diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-07-03 00:28:59 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-07-03 00:28:59 +0000 |
commit | ac517a2b7625e0aa0862679e961c6349f859ea3b (patch) | |
tree | e3e27a6b9bd5e2be6150088495c91fc91786ad9d /src/old/staticstring.h | |
parent | f8d4301e9fa4f3709258505941e37fab2eadadc6 (diff) | |
parent | bd865cee5f89116c1f054cd0e5c275e97c2d0a9b (diff) | |
download | libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.gz libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.bz2 libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.xz libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.zip |
The reorg is being put in trunk, I think it's ready. Now we just get to find
out how many applications won't work anymore :)
Diffstat (limited to 'src/old/staticstring.h')
-rw-r--r-- | src/old/staticstring.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/old/staticstring.h b/src/old/staticstring.h new file mode 100644 index 0000000..4c3f7b8 --- /dev/null +++ b/src/old/staticstring.h | |||
@@ -0,0 +1,63 @@ | |||
1 | #ifndef STATIC_STRING_H | ||
2 | #define STATIC_STRING_H | ||
3 | |||
4 | #include <string> | ||
5 | #include "serializable.h" | ||
6 | //#include "hashable.h" | ||
7 | |||
8 | /** | ||
9 | * Simple string managing class. Allows for dynamically allocated string data | ||
10 | * along with some minor caching to speed things up when accessing your | ||
11 | * string data. Really designed for making copies of strings easy and safe, | ||
12 | * and making accessing meta-info like length fast and reliable as well. | ||
13 | *@author Mike Buland | ||
14 | */ | ||
15 | class StaticString : public Serializable/*, public Hashable*/ | ||
16 | { | ||
17 | public: | ||
18 | StaticString(); | ||
19 | StaticString( const char *lpNewStr, int nNewLen ); | ||
20 | StaticString( const char *lpNewStr ); | ||
21 | StaticString( StaticString &xSrcStr, int nNewLen ); | ||
22 | StaticString( StaticString &xSrcStr ); | ||
23 | StaticString( const StaticString &xSrcStr ); | ||
24 | StaticString( int nLength ); | ||
25 | virtual ~StaticString(); | ||
26 | |||
27 | char *getString(); | ||
28 | const char *getString() const; | ||
29 | int getLength() const; | ||
30 | void setLength( int nNewLength ); | ||
31 | |||
32 | void setString( const char *lpNewStr, int nNewLen=-1 ); | ||
33 | void setString( StaticString &sNewStr, int nNewLen=-1 ); | ||
34 | |||
35 | char getAt( unsigned int nIndex ); | ||
36 | void setAt( unsigned int nIndex, char cVal ); | ||
37 | |||
38 | class StaticString &operator=( class StaticString &lpOtherStr ); | ||
39 | class StaticString &operator=( std::string &lpOtherStr ); | ||
40 | class StaticString &operator=( const char *lpNewStr ); | ||
41 | operator const char *(); | ||
42 | char &operator[]( unsigned int nIndex ); | ||
43 | operator int(); | ||
44 | char *operator+( int nAmnt ); | ||
45 | char *operator-( int nAmnt ); | ||
46 | bool operator==( const char *str ); | ||
47 | bool operator==( StaticString &str ); | ||
48 | bool operator!=( const char *str ); | ||
49 | bool operator!=( StaticString &str ); | ||
50 | |||
51 | void clear(); | ||
52 | |||
53 | virtual void serialize( class Serializer &ar ); | ||
54 | |||
55 | //virtual unsigned long int getHashCode(); | ||
56 | //virtual bool compareForHash( Hashable &other ); | ||
57 | |||
58 | private: | ||
59 | char *lpStr; | ||
60 | uint32_t nLen; | ||
61 | }; | ||
62 | |||
63 | #endif | ||