summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-21 00:59:21 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-21 01:01:05 (GMT)
commit2c8bfd7c49bd16bebbf0b89c01fce7817afab74f (patch)
tree1a7c73d4aaf81a1e243ee6f50de0385e9e6a081f /Swiften/Base/String.h
parentfe007f1afdaf29c7ce0302da2984b5611503a822 (diff)
downloadswift-2c8bfd7c49bd16bebbf0b89c01fce7817afab74f.zip
swift-2c8bfd7c49bd16bebbf0b89c01fce7817afab74f.tar.bz2
Implemented SCRAM-SHA-1 for real now.
Still need to do some cleanup and polishing.
Diffstat (limited to 'Swiften/Base/String.h')
-rw-r--r--Swiften/Base/String.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/Swiften/Base/String.h b/Swiften/Base/String.h
index c4a44a3..0a5530c 100644
--- a/Swiften/Base/String.h
+++ b/Swiften/Base/String.h
@@ -49,75 +49,79 @@ namespace Swift {
bool beginsWith(char c) const {
return data_.size() > 0 && data_[0] == c;
}
bool beginsWith(const String& s) const {
return data_.substr(0, s.data_.size()) == s;
}
bool endsWith(char c) const {
return data_.size() > 0 && data_[data_.size()-1] == c;
}
String getSubstring(size_t begin, size_t end) const {
return String(data_.substr(begin, end));
}
size_t find(char c) const {
assert((c & 0x80) == 0);
return data_.find(c);
}
size_t npos() const {
return data_.npos;
}
friend String operator+(const String& a, const String& b) {
return String(a.data_ + b.data_);
}
friend String operator+(const String& a, char b) {
return String(a.data_ + b);
}
String& operator+=(const String& o) {
data_ += o.data_;
return *this;
}
String& operator+=(char c) {
data_ += c;
return *this;
}
String& operator=(const String& o) {
data_ = o.data_;
return *this;
}
+ char operator[](size_t i) const {
+ return data_[i];
+ }
+
friend bool operator>(const String& a, const String& b) {
return a.data_ > b.data_;
}
friend bool operator<(const String& a, const String& b) {
return a.data_ < b.data_;
}
friend bool operator!=(const String& a, const String& b) {
return a.data_ != b.data_;
}
friend bool operator==(const String& a, const String& b) {
return a.data_ == b.data_;
}
friend std::ostream& operator<<(std::ostream& os, const String& s) {
os << s.data_;
return os;
}
private:
std::string data_;
};
}
#endif