summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-02-26 12:07:46 -0500
committerEliot Horowitz <eliot@10gen.com>2010-02-26 12:07:46 -0500
commitc3f07f3be05934d8dae18c83d6c1bad57eaff739 (patch)
tree2418089fb2d6084a82c4bf7b2f1d08e0d200f39d /util
parent27e94db45caa61293da51898c3df72e538f18805 (diff)
downloadmongo-c3f07f3be05934d8dae18c83d6c1bad57eaff739.tar.gz
some missing operators
Diffstat (limited to 'util')
-rw-r--r--util/goodies.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/util/goodies.h b/util/goodies.h
index 6577b9db7e6..d2678f5fa9c 100644
--- a/util/goodies.h
+++ b/util/goodies.h
@@ -510,13 +510,19 @@ namespace mongo {
memset( _buf , 0 , _size );
}
+ ThreadSafeString( const ThreadSafeString& other )
+ : _size( other._size ) , _buf( new char[_size] ){
+ strncpy( _buf , other._buf , _size );
+ }
+
~ThreadSafeString(){
- delete _buf;
+ delete[] _buf;
_buf = 0;
}
operator string() const {
- return (string)_buf;
+ string s = _buf;
+ return s;
}
ThreadSafeString& operator=( const char * str ){
@@ -527,6 +533,18 @@ namespace mongo {
_buf[s] = 0;
return *this;
}
+
+ bool operator==( const ThreadSafeString& other ) const {
+ return strcmp( _buf , other._buf ) == 0;
+ }
+
+ bool operator==( const char * str ) const {
+ return strcmp( _buf , str ) == 0;
+ }
+
+ bool operator!=( const char * str ) const {
+ return strcmp( _buf , str );
+ }
bool empty() const {
return _buf[0] == 0;