|
|
@ -76,13 +76,10 @@ public: |
|
|
|
inline |
|
|
|
inline |
|
|
|
String::String(const std::string& str) |
|
|
|
String::String(const std::string& str) |
|
|
|
: cstr_(0), len_(0) |
|
|
|
: cstr_(0), len_(0) |
|
|
|
{ |
|
|
|
|
|
|
|
if (!str.empty()) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
size_t len = str.size(); |
|
|
|
size_t len = str.size(); |
|
|
|
if (len) memcpy(allocate(len), str.c_str(), len); |
|
|
|
if (len) memcpy(allocate(len), str.c_str(), len); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline |
|
|
|
inline |
|
|
|
String::String(const std::string& str, size_t pos, size_t len) |
|
|
|
String::String(const std::string& str, size_t pos, size_t len) |
|
|
@ -99,11 +96,8 @@ inline |
|
|
|
String& String::operator = (const std::string& str) |
|
|
|
String& String::operator = (const std::string& str) |
|
|
|
{ |
|
|
|
{ |
|
|
|
deallocate(); |
|
|
|
deallocate(); |
|
|
|
if (!str.empty()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
size_t len = str.size(); |
|
|
|
size_t len = str.size(); |
|
|
|
if (len) memcpy(allocate(len), str.c_str(), len); |
|
|
|
if (len) memcpy(allocate(len), str.c_str(), len); |
|
|
|
} |
|
|
|
|
|
|
|
return *this; |
|
|
|
return *this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|