1 : //=============================================================================
2 : // File <$/src/cpp/prod/tool/String.h>
3 : // This file is part of YaOrb : Yet Another Object Request Broker,
4 : // Copyright (c) 2000-2003, Marc Alff.
5 : //
6 : // This program is free software; you can redistribute it and/or
7 : // modify it under the terms of the GNU General Public License
8 : // as published by the Free Software Foundation; either version 2
9 : // of the License, or (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License
17 : // along with this program; if not, write to the Free Software
18 : // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 : //
20 : //=============================================================================
21 :
22 : #ifndef STRING_H
23 : #define STRING_H
24 :
25 : class String
26 : {
27 : public :
28 : String() ;
29 : String(const int aSize) ;
30 : String(char c) ;
31 : String(const char* aCharString) ;
32 : String(const String& aString) ;
33 : virtual ~String() ;
34 :
35 : int length() const ;
36 :
37 : String & operator =(const char* aCharString) ;
38 : String & operator =(const String& aString) ;
39 :
40 : void operator +=(const char* aCharString) ;
41 : void operator +=(const String& aCharString) ;
42 :
43 : int operator ==(const char* aCharString) const ;
44 : int operator ==(const String& aString) const ;
45 :
46 : int operator !=(const char* aCharString) const ;
47 : int operator !=(const String& aString) const ;
48 :
49 : operator const char*() const ;
50 :
51 : int compare(const char* aCharString) const ;
52 : int compare(const String& aString) const ;
53 :
54 : static int Hash(const char* str) ;
55 : int Hash(void) const ;
56 :
57 : // To be completed ...
58 :
59 : private :
60 :
61 : int _len ;
62 : char *_str ;
63 : } ;
64 :
65 : inline int String::operator !=(const char* aCharString) const
66 : {
67 445 : return !(*this == aCharString) ;
68 : }
69 :
70 : inline int String::operator !=(const String& aString) const
71 : {
72 : return !(*this == aString) ;
73 : }
74 :
75 : #endif
76 :
|