![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * S t r i n g D i c t i o n a r y C l a s s * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,2002 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXStringDict.h,v 1.6 2002/01/24 14:27:36 jeroen Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXSTRINGDICT_H 00025 #define FXSTRINGDICT_H 00026 00027 #ifndef FXDICT_H 00028 #include "FXDict.h" 00029 #endif 00030 00031 00032 /** 00033 * String dictionary maps a character string to a character string. 00034 * The inserted strings are copied when they're inserted. 00035 */ 00036 class FXAPI FXStringDict : public FXDict { 00037 FXDECLARE(FXStringDict) 00038 protected: 00039 virtual void *createData(const void*); 00040 virtual void deleteData(void*); 00041 private: 00042 FXStringDict(const FXStringDict&); 00043 FXStringDict &operator=(const FXStringDict&); 00044 public: 00045 00046 /// Construct a string dictionary 00047 FXStringDict(); 00048 00049 /// Insert a new string indexed by key, with given mark flag 00050 const FXchar* insert(const FXchar* ky,const FXchar* str,FXbool mrk=FALSE){ return (const FXchar*)FXDict::insert(ky,str,mrk); } 00051 00052 /// Replace or insert a new string indexed by key, unless given mark is lower that the existing mark 00053 const FXchar* replace(const FXchar* ky,const FXchar* str,FXbool mrk=FALSE){ return (const FXchar*)FXDict::replace(ky,str,mrk); } 00054 00055 /// Remove entry indexed by key 00056 const FXchar* remove(const FXchar* ky){ return (const FXchar*)FXDict::remove(ky); } 00057 00058 /// Return the entry indexed by key, or return NULL if the key does not exist 00059 const FXchar* find(const FXchar* ky) const { return (const FXchar*)FXDict::find(ky); } 00060 00061 /// Return the string at position pos 00062 const FXchar* data(FXuint pos) const { return (const FXchar*)dict[pos].data; } 00063 00064 /// Destructor 00065 virtual ~FXStringDict(); 00066 }; 00067 00068 00069 #endif