summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/staticstring.cpp14
-rw-r--r--src/staticstring.h4
2 files changed, 16 insertions, 2 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
49StaticString::StaticString( const StaticString &xSrcStr )
50{
51 nLen = xSrcStr.getLength();
52 lpStr = new char[nLen];
53 memcpy( lpStr, xSrcStr.getString(), nLen );
54}
55
49StaticString::~StaticString() 56StaticString::~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
59int StaticString::getLength() 66const char *StaticString::getString() const
67{
68 return lpStr;
69}
70
71int StaticString::getLength() const
60{ 72{
61 return nLen; 73 return nLen;
62} 74}
diff --git a/src/staticstring.h b/src/staticstring.h
index 0d155c4..4c3f7b8 100644
--- a/src/staticstring.h
+++ b/src/staticstring.h
@@ -20,11 +20,13 @@ public:
20 StaticString( const char *lpNewStr ); 20 StaticString( const char *lpNewStr );
21 StaticString( StaticString &xSrcStr, int nNewLen ); 21 StaticString( StaticString &xSrcStr, int nNewLen );
22 StaticString( StaticString &xSrcStr ); 22 StaticString( StaticString &xSrcStr );
23 StaticString( const StaticString &xSrcStr );
23 StaticString( int nLength ); 24 StaticString( int nLength );
24 virtual ~StaticString(); 25 virtual ~StaticString();
25 26
26 char *getString(); 27 char *getString();
27 int getLength(); 28 const char *getString() const;
29 int getLength() const;
28 void setLength( int nNewLength ); 30 void setLength( int nNewLength );
29 31
30 void setString( const char *lpNewStr, int nNewLen=-1 ); 32 void setString( const char *lpNewStr, int nNewLen=-1 );