Vidalia
0.3.1
Main Page
Namespaces
Classes
Files
File List
File Members
src
vidalia
config
PortValidator.cpp
Go to the documentation of this file.
1
/*
2
** This file is part of Vidalia, and is subject to the license terms in the
3
** LICENSE file, found in the top level directory of this distribution. If you
4
** did not receive the LICENSE file with this file, you may obtain it from the
5
** Vidalia source package distributed by the Vidalia Project at
6
** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7
** including this file, may be copied, modified, propagated, or distributed
8
** except according to the terms described in the LICENSE file.
9
*/
10
11
/*
12
** \file PortValidator.cpp
13
** \brief Validates that a number is a valid port number
14
*/
15
16
#include "
PortValidator.h
"
17
18
#define MIN_PORT 1
/**< Minimum valid port. */
19
#define MAX_PORT 65535
/**< Maximum valid port. */
20
#define MATCH_ALL "*"
/**< Matches all ports. */
21
22
23
/** Constructor. */
24
PortValidator::PortValidator
(QObject *parent)
25
: QIntValidator(
MIN_PORT
,
MAX_PORT
, parent)
26
{
27
}
28
29
/** Validates that the given port is either a valid port or a "*". */
30
QValidator::State
31
PortValidator::validate
(QString &input,
int
&pos)
const
32
{
33
if
(input ==
MATCH_ALL
) {
34
return
QValidator::Acceptable;
35
}
36
return
QIntValidator::validate(input, pos);
37
}
38
PortValidator::validate
QValidator::State validate(QString &input, int &pos) const
Definition:
PortValidator.cpp:31
PortValidator.h
PortValidator::PortValidator
PortValidator(QObject *parent)
Definition:
PortValidator.cpp:24
MATCH_ALL
#define MATCH_ALL
Definition:
PortValidator.cpp:20
MAX_PORT
#define MAX_PORT
Definition:
PortValidator.cpp:19
MIN_PORT
#define MIN_PORT
Definition:
PortValidator.cpp:18
Generated on Mon Oct 27 2014 19:40:11 for Vidalia by
1.8.8