diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-02-28 07:40:56 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-02-28 07:40:56 +0000 |
commit | 9e85e4d8f31fcfa97cc95e43fa8c3b51434dcb7b (patch) | |
tree | 1a3ce94eec484c06427d89e8e30a38c7f90d306c /src/staticstring.cpp | |
parent | 8a51dd0db9176a56c482ca5cecb5051d2b6848ba (diff) | |
download | libbu++-9e85e4d8f31fcfa97cc95e43fa8c3b51434dcb7b.tar.gz libbu++-9e85e4d8f31fcfa97cc95e43fa8c3b51434dcb7b.tar.bz2 libbu++-9e85e4d8f31fcfa97cc95e43fa8c3b51434dcb7b.tar.xz libbu++-9e85e4d8f31fcfa97cc95e43fa8c3b51434dcb7b.zip |
Made updates to the staticstring, it works better with const situations now...
Diffstat (limited to 'src/staticstring.cpp')
-rw-r--r-- | src/staticstring.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/staticstring.cpp b/src/staticstring.cpp index 4d60b8d..60f130f 100644 --- a/src/staticstring.cpp +++ b/src/staticstring.cpp | |||
@@ -46,6 +46,13 @@ StaticString::StaticString( StaticString &xSrcStr ) | |||
46 | setString( xSrcStr, -1 ); | 46 | setString( xSrcStr, -1 ); |
47 | } | 47 | } |
48 | 48 | ||
49 | StaticString::StaticString( const StaticString &xSrcStr ) | ||
50 | { | ||
51 | nLen = xSrcStr.getLength(); | ||
52 | lpStr = new char[nLen]; | ||
53 | memcpy( lpStr, xSrcStr.getString(), nLen ); | ||
54 | } | ||
55 | |||
49 | StaticString::~StaticString() | 56 | StaticString::~StaticString() |
50 | { | 57 | { |
51 | if( lpStr != NULL ) delete[] lpStr; | 58 | if( lpStr != NULL ) delete[] lpStr; |
@@ -56,7 +63,12 @@ char *StaticString::getString() | |||
56 | return lpStr; | 63 | return lpStr; |
57 | } | 64 | } |
58 | 65 | ||
59 | int StaticString::getLength() | 66 | const char *StaticString::getString() const |
67 | { | ||
68 | return lpStr; | ||
69 | } | ||
70 | |||
71 | int StaticString::getLength() const | ||
60 | { | 72 | { |
61 | return nLen; | 73 | return nLen; |
62 | } | 74 | } |