Vidalia 0.3.1
Local8BitStringValidator.h
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 Local8BitStringValidator.h
13** \brief Validates that a given string contains only characters capable of
14** being represented in the current local 8-bit character encoding.
15*/
16
17#ifndef _LOCAL8BITSTRINGVALIDATOR_H
18#define _LOCAL8BITSTRINGVALIDATOR_H
19
20#include <QValidator>
21#include <QTextCodec>
22
23
24class Local8BitStringValidator : public QValidator
25{
26 Q_OBJECT
27
28public:
29 /** Constructor. */
30 Local8BitStringValidator(QObject *parent);
31 /** Validates the given input at the specified position. */
32 QValidator::State validate(QString &input, int &pos) const;
33
34 /** Returns true if <b>input</b> can be encoded with the current local
35 * 8-bit character encoding. */
36 static bool canEncode(const QString &input);
37
38private:
39 QTextCodec* _codec;
40};
41
42#endif
43
static bool canEncode(const QString &input)
QValidator::State validate(QString &input, int &pos) const