NEURON
ustring.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1991 Stanford University
3  * Copyright (c) 1991 Silicon Graphics, Inc.
4  *
5  * Permission to use, copy, modify, distribute, and sell this software and
6  * its documentation for any purpose is hereby granted without fee, provided
7  * that (i) the above copyright notices and this permission notice appear in
8  * all copies of the software and related documentation, and (ii) the names of
9  * Stanford and Silicon Graphics may not be used in any advertising or
10  * publicity relating to the software without the specific, prior written
11  * permission of Stanford and Silicon Graphics.
12  *
13  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
14  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
15  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR
18  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
19  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
21  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
22  * OF THIS SOFTWARE.
23  */
24 
25 #ifndef os_ustring_h
26 #define os_ustring_h
27 
28 /*
29  * UniqueString - unique string using hash table
30  */
31 
32 #include <OS/string.h>
33 
34 class UniqueStringPool;
35 class UniqueStringTable;
36 
37 class UniqueString : public String {
38 public:
39 #ifdef _DELTA_EXTENSIONS
40 #pragma __static_class
41 #endif
42  UniqueString();
43  UniqueString(const char*);
44  UniqueString(const char*, int length);
45  UniqueString(const String&);
46  UniqueString(const UniqueString&);
47  virtual ~UniqueString();
48 
49  virtual unsigned long hash() const;
50  virtual bool operator ==(const String&) const;
51  virtual bool operator ==(const char*) const;
52 
53  virtual bool null_terminated() const;
54 private:
57 
58  void init(const String&);
59 };
60 
61 #endif
void init(const String &)
Definition: ustring.cpp:70
int length() const
Definition: string.h:140
static UniqueStringPool * pool_
Definition: ustring.h:56
static UniqueStringTable * table_
Definition: ustring.h:55
virtual bool null_terminated() const
Definition: ustring.cpp:99
virtual unsigned long hash() const
Definition: ustring.cpp:89
virtual bool operator==(const String &) const
Definition: ustring.cpp:91
virtual ~UniqueString()
Definition: ustring.cpp:68
Definition: string.h:34
#define UniqueStringTable
Definition: _defines.h:22