Applets
clocknumber.cpp
Go to the documentation of this file.00001 /*************************************************************************** 00002 * Copyright (C) 2007 by Riccardo Iaconelli <riccardo@kde.org> * 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License as published by * 00006 * the Free Software Foundation; either version 2 of the License, or * 00007 * (at your option) any later version. * 00008 * * 00009 * This program is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU General Public License * 00015 * along with this program; if not, write to the * 00016 * Free Software Foundation, Inc., * 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 00018 ***************************************************************************/ 00019 00020 #include "clocknumber.h" 00021 00022 class Number::Private 00023 { 00024 public: 00025 char data; 00026 }; 00027 00028 Number::Number(QChar value) 00029 : d(new Private) 00030 { 00031 d->data = value.toAscii(); 00032 } 00033 00034 Number::~Number() 00035 { 00036 delete d; 00037 } 00038 00039 void Number::operator--() 00040 { 00041 if (d->data == '0') { 00042 d->data = '9'; 00043 } else { 00044 d->data--; 00045 } 00046 } 00047 00048 void Number::operator++() 00049 { 00050 if (d->data == '9') { 00051 d->data = '0'; 00052 } else { 00053 d->data++; 00054 } 00055 } 00056 00057 void Number::operator=(QChar value) 00058 { 00059 d->data = value.toAscii(); 00060 } 00061 00062 bool Number::operator==(char value) 00063 { 00064 return d->data == value; 00065 } 00066 00067 Number::operator char() 00068 { 00069 return d->data; 00070 } 00071