Vidalia 0.2.10

Local8BitStringValidator.h

Go to the documentation of this file.
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.vidalia-project.net/. No part of Vidalia, including this file,
00007 **  may be copied, modified, propagated, or distributed except according to the
00008 **  terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file Local8BitStringValidator.h
00013 ** \version $Id: Local8BitStringValidator.h 4353 2010-07-14 15:50:50Z edmanm $
00014 ** \brief Validates that a given string contains only characters capable of
00015 ** being represented in the current local 8-bit character encoding.
00016 */
00017 
00018 #ifndef _LOCAL8BITSTRINGVALIDATOR_H
00019 #define _LOCAL8BITSTRINGVALIDATOR_H
00020 
00021 #include <QValidator>
00022 #include <QTextCodec>
00023 
00024 
00025 class Local8BitStringValidator : public QValidator
00026 {
00027   Q_OBJECT
00028 
00029 public:
00030   /** Constructor. */
00031   Local8BitStringValidator(QObject *parent);
00032   /** Validates the given input at the specified position. */
00033   QValidator::State validate(QString &input, int &pos) const;
00034 
00035   /** Returns true if <b>input</b> can be encoded with the current local
00036    * 8-bit character encoding. */
00037   static bool canEncode(const QString &input);
00038 
00039 private:
00040   QTextCodec* _codec;
00041 };
00042 
00043 #endif
00044