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,2009 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (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                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: FXStringDict.h,v 1.23 2009/01/06 13:07:27 fox Exp $                      *
00022 ********************************************************************************/
00023 #ifndef FXSTRINGDICT_H
00024 #define FXSTRINGDICT_H
00025 
00026 #ifndef FXDICT_H
00027 #include "FXDict.h"
00028 #endif
00029 
00030 namespace FX {
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(void*);
00040   virtual void deleteData(void*);
00041 public:
00042 
00043   /// Construct a string dictionary
00044   FXStringDict();
00045 
00046   /// Copy constructor
00047   FXStringDict(const FXStringDict& orig);
00048 
00049   /// Assignment operator
00050   FXStringDict &operator=(const FXStringDict& orig);
00051 
00052   /// Insert a new string indexed by key, with given mark flag
00053   const FXchar* insert(const FXchar* ky,const FXchar* str,FXbool mrk=false){ return (const FXchar*)FXDict::insert(ky,(void*)str,mrk); }
00054 
00055   /// Replace or insert a new string indexed by key, unless given mark is lower that the existing mark
00056   const FXchar* replace(const FXchar* ky,const FXchar* str,FXbool mrk=false){ return (const FXchar*)FXDict::replace(ky,(void*)str,mrk); }
00057 
00058   /// Remove entry indexed by key
00059   const FXchar* remove(const FXchar* ky){ return (const FXchar*)FXDict::remove(ky); }
00060 
00061   /// Return the entry indexed by key, or return NULL if the key does not exist
00062   const FXchar* find(const FXchar* ky) const { return (const FXchar*)FXDict::find(ky); }
00063 
00064   /// Return the string at position pos
00065   const FXchar* data(FXint pos) const { return (const FXchar*)FXDict::data(pos); }
00066 
00067   /// Destructor
00068   virtual ~FXStringDict();
00069   };
00070 
00071 }
00072 
00073 #endif

Copyright © 1997-2009 Jeroen van der Zijp