Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXStringDict.h

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,2005 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.12 2005/01/16 16:06:06 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXSTRINGDICT_H 00025 #define FXSTRINGDICT_H 00026 00027 #ifndef FXDICT_H 00028 #include "FXDict.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 /** 00034 * String dictionary maps a character string to a character string. 00035 * The inserted strings are copied when they're inserted. 00036 */ 00037 class FXAPI FXStringDict : public FXDict { 00038 FXDECLARE(FXStringDict) 00039 protected: 00040 virtual void *createData(const void*); 00041 virtual void deleteData(void*); 00042 private: 00043 FXStringDict(const FXStringDict&); 00044 FXStringDict &operator=(const FXStringDict&); 00045 public: 00046 00047 /// Construct a string dictionary 00048 FXStringDict(); 00049 00050 /// Insert a new string indexed by key, with given mark flag 00051 const FXchar* insert(const FXchar* ky,const FXchar* str,FXbool mrk=FALSE){ return (const FXchar*)FXDict::insert(ky,str,mrk); } 00052 00053 /// Replace or insert a new string indexed by key, unless given mark is lower that the existing mark 00054 const FXchar* replace(const FXchar* ky,const FXchar* str,FXbool mrk=FALSE){ return (const FXchar*)FXDict::replace(ky,str,mrk); } 00055 00056 /// Remove entry indexed by key 00057 const FXchar* remove(const FXchar* ky){ return (const FXchar*)FXDict::remove(ky); } 00058 00059 /// Return the entry indexed by key, or return NULL if the key does not exist 00060 const FXchar* find(const FXchar* ky) const { return (const FXchar*)FXDict::find(ky); } 00061 00062 /// Return the string at position pos 00063 const FXchar* data(FXuint pos) const { return (const FXchar*)dict[pos].data; } 00064 00065 /// Destructor 00066 virtual ~FXStringDict(); 00067 }; 00068 00069 } 00070 00071 #endif

Copyright © 1997-2005 Jeroen van der Zijp