aboutsummaryrefslogtreecommitdiff
path: root/src/old/staticstring.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-04-03 03:49:53 +0000
committerMike Buland <eichlan@xagasoft.com>2007-04-03 03:49:53 +0000
commitf4c20290509d7ed3a8fd5304577e7a4cc0b9d974 (patch)
tree13cdf64f7cf134f397a7165b7a3fe0807e37026b /src/old/staticstring.h
parent74d4c8cd27334fc7204d5a8773deb3d424565778 (diff)
downloadlibbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.gz
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.bz2
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.xz
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.zip
Ok, no code is left in src, it's all in src/old. We'll gradually move code back
into src as it's fixed and re-org'd. This includes tests, which, I may write a unit test system into libbu++ just to make my life easier.
Diffstat (limited to 'src/old/staticstring.h')
-rw-r--r--src/old/staticstring.h63
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 */
15class StaticString : public Serializable/*, public Hashable*/
16{
17public:
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
58private:
59 char *lpStr;
60 uint32_t nLen;
61};
62
63#endif