00001 /* 00002 File : gadget_w_allowable.h 00003 Date : 19-Sep-02 00004 Description : Class to represent a toolbox gadget that has an associated 00005 allowable range of characters. 00006 00007 Copyright © 1995-2002 Alexander Thoukydides 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License 00011 as published by the Free Software Foundation; either version 2 00012 of the License, or (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00022 */ 00023 00024 // Only include header file once 00025 #ifndef gadget_w_allowable_h 00026 #define gadget_w_allowable_h 00027 00028 // Include cpplib header files 00029 #include "string.h" 00030 00031 // A class to represent a gadget with an allowable range of characters 00032 class gadget_w_allowable 00033 { 00034 public: 00035 00036 /* 00037 Parameters : allowed - The new set of allowable characters, or NULL 00038 to allow all characters. 00039 Returns : void 00040 Description : Define the set of allowable characters for this gadget. 00041 */ 00042 void set_allowable(const char *allowed = NULL); 00043 00044 /* 00045 Parameters : allowed - The new set of allowable characters. 00046 Returns : void 00047 Description : Define the set of allowable characters for this gadget. 00048 */ 00049 void set_allowable(const string &allowed); 00050 00051 protected: 00052 00053 /* 00054 Parameters : allowed - The new set of allowable characters, or NULL 00055 to allow all characters. 00056 Returns : void 00057 Description : Gadget specific function to define the set of allowable 00058 characters. 00059 */ 00060 virtual void _set_allowable(const char *allowed) = 0; 00061 }; 00062 00063 /* 00064 Parameters : allowed - The new set of allowable characters, or NULL 00065 to allow all characters. 00066 Returns : void 00067 Description : Define the set of allowable characters for this gadget. 00068 */ 00069 inline void gadget_w_allowable::set_allowable(const char *allowed) 00070 { 00071 _set_allowable(allowed); 00072 } 00073 00074 /* 00075 Parameters : allowed - The new set of allowable characters. 00076 Returns : void 00077 Description : Define the set of allowable characters for this gadget. 00078 */ 00079 inline void gadget_w_allowable::set_allowable(const string &allowed) 00080 { 00081 _set_allowable(allowed.c_str()); 00082 } 00083 00084 #endif
1.3.3