diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-06-03 14:05:06 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-06-03 14:05:14 (GMT) |
commit | d513bcc4c33d23faaf2e48a82007ae2803d17acb (patch) | |
tree | ab84a09c99ec6b53e38e3662bc9ee15272624447 /Swiften/Base | |
parent | 00200cfc0df5b616eb2eb48e5bb252f970808d15 (diff) | |
download | swift-contrib-d513bcc4c33d23faaf2e48a82007ae2803d17acb.zip swift-contrib-d513bcc4c33d23faaf2e48a82007ae2803d17acb.tar.bz2 |
Added missing SafeString
Diffstat (limited to 'Swiften/Base')
-rw-r--r-- | Swiften/Base/SafeString.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Swiften/Base/SafeString.h b/Swiften/Base/SafeString.h new file mode 100644 index 0000000..ef9c7cc --- /dev/null +++ b/Swiften/Base/SafeString.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2011 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/SafeByteArray.h> + +namespace Swift { + class SafeString { + public: + SafeString(const SafeByteArray& data) : data(data) { + } + + SafeString(const std::string& s) { + data = createSafeByteArray(s); + } + + SafeString(const char* s) { + data = createSafeByteArray(s); + } + + operator SafeByteArray () const { + return data; + } + + private: + SafeByteArray data; + }; +} |