Vidalia
0.2.17
|
00001 /* 00002 ** This file is part of Vidalia, and is subject to the license terms in the 00003 ** LICENSE file, found in the top level directory of this distribution. If you 00004 ** did not receive the LICENSE file with this file, you may obtain it from the 00005 ** Vidalia source package distributed by the Vidalia Project at 00006 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 00007 ** including this file, may be copied, modified, propagated, or distributed 00008 ** except according to the terms described in the LICENSE file. 00009 */ 00010 00011 /* 00012 ** \file Local8BitStringValidator.h 00013 ** \brief Validates that a given string contains only characters capable of 00014 ** being represented in the current local 8-bit character encoding. 00015 */ 00016 00017 #ifndef _LOCAL8BITSTRINGVALIDATOR_H 00018 #define _LOCAL8BITSTRINGVALIDATOR_H 00019 00020 #include <QValidator> 00021 #include <QTextCodec> 00022 00023 00024 class Local8BitStringValidator : public QValidator 00025 { 00026 Q_OBJECT 00027 00028 public: 00029 /** Constructor. */ 00030 Local8BitStringValidator(QObject *parent); 00031 /** Validates the given input at the specified position. */ 00032 QValidator::State validate(QString &input, int &pos) const; 00033 00034 /** Returns true if <b>input</b> can be encoded with the current local 00035 * 8-bit character encoding. */ 00036 static bool canEncode(const QString &input); 00037 00038 private: 00039 QTextCodec* _codec; 00040 }; 00041 00042 #endif 00043