csutil/strhashr.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

csutil/strhashr.h

    00001 /*
    00002     Copyright (C) 2008 by Jorrit Tyberghein and Michael Gist
    00003
    00004     This library is free software; you can redistribute it and/or
    00005     modify it under the terms of the GNU Library General Public
    00006     License as published by the Free Software Foundation; either
    00007     version 2 of the License, or (at your option) any later version.
    00008
    00009     This library is distributed in the hope that it will be useful,
    00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012     Library General Public License for more details.
    00013
    00014     You should have received a copy of the GNU Library General Public
    00015     License along with this library; if not, write to the Free
    00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00017 */
    00018
    00019
    00020 #ifndef __CS_UTIL_STRHASHR_H__
    00021 #define __CS_UTIL_STRHASHR_H__
    00022
    00023 #include "csutil/strhash.h"
    00024
    00029 class CS_CRYSTALSPACE_EXPORT csStringHashReversible : public csStringHash
    00030 {
    00031 private:
    00032   csHash<const char*, csStringID> reverse;
    00033   void Copy(csStringHashReversible const& h);
    00034
    00035 public:
    00037   csStringHashReversible (size_t size = 23);
    00039   csStringHashReversible (csStringHashReversible const& h) { Copy(h); }
    00041   ~csStringHashReversible ();
    00043   csStringHashReversible& operator=(csStringHashReversible const& h) { Copy(h); return *this; }
    00044
    00064   const char* Register (const char* s, csStringID id = 0);
    00065
    00071   csStringID Request (const char* s) const { return csStringHash::Request(s); }
    00072
    00080   const char* Request (csStringID id) const;
    00081
    00086   csArray<const char*> RequestAll (csStringID id) const
    00087   {
    00088     return reverse.GetAll(id);
    00089   }
    00090
    00095   bool Delete(char const* s);
    00096
    00103   bool Delete(csStringID id);
    00104
    00108   void Empty ();
    00109 };
    00110
    00111 #endif // __CS_UTIL_STRHASHR_H__