latin1validator.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                      latin1validator.cpp  -  description
00003                              -------------------
00004     begin                : Fri Dec 01 2005
00005     copyright            : (C) 2005-2006 by Ben Swerts
00006     email                : bswerts@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00019 
00027 
00028 
00029 
00031 
00032 // Xbrabo header files
00033 #include "latin1validator.h"
00034 
00038 
00040 Latin1Validator::Latin1Validator(QObject* parent, const char* name) : QValidator(parent, name)
00042 {
00043 }
00044 
00046 Latin1Validator::~Latin1Validator()
00048 {
00049 }
00050 
00052 void Latin1Validator::fixup(QString& input) const
00054 {
00055   //qDebug("called fixup");
00056   for(unsigned int i = input.length(); i != 0; i--)
00057   {
00058     if(!input.at(i - 1).latin1() || input.at(i-1).isSpace())
00059       input.remove(i - 1,1);
00060   }
00061 }
00062 
00064 QValidator::State Latin1Validator::validate(QString& input, int& pos) const
00066 {
00067   //qDebug("called validate");
00068   for(unsigned int i = 0; i < input.length(); i++)
00069   {
00070     if(!input.at(i).latin1() || input.at(i).isSpace())
00071     {
00072       pos = i;
00073       return QValidator::Invalid;
00074     }
00075   }
00076   return QValidator::Acceptable;
00077 }
00078 

Generated on Fri May 19 14:31:55 2006 for Brabosphere by  doxygen 1.4.6-NO