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

FXStringDict.h

Go to the documentation of this file.
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,2006 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.16 2006/01/22 17:58:10 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 public:
00043 
00044   /// Construct a string dictionary
00045   FXStringDict();
00046 
00047   /// Copy constructor
00048   FXStringDict(const FXStringDict& orig);
00049 
00050   /// Assignment operator
00051   FXStringDict &operator=(const FXStringDict& orig);
00052 
00053   /// Insert a new string indexed by key, with given mark flag
00054   const FXchar* insert(const FXchar* ky,const FXchar* str,bool mrk=false){ return (const FXchar*)FXDict::insert(ky,str,mrk); }
00055 
00056   /// Replace or insert a new string indexed by key, unless given mark is lower that the existing mark
00057   const FXchar* replace(const FXchar* ky,const FXchar* str,bool mrk=false){ return (const FXchar*)FXDict::replace(ky,str,mrk); }
00058 
00059   /// Remove entry indexed by key
00060   const FXchar* remove(const FXchar* ky){ return (const FXchar*)FXDict::remove(ky); }
00061 
00062   /// Return the entry indexed by key, or return NULL if the key does not exist
00063   const FXchar* find(const FXchar* ky) const { return (const FXchar*)FXDict::find(ky); }
00064 
00065   /// Return the string at position pos
00066   const FXchar* data(FXuint pos) const { return (const FXchar*)dict[pos].data; }
00067 
00068   /// Destructor
00069   virtual ~FXStringDict();
00070   };
00071 
00072 }
00073 
00074 #endif

Copyright © 1997-2005 Jeroen van der Zijp