mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-14 08:01:49 +01:00
Added find(str, what, from) to the default_string_adaptor
This commit is contained in:
parent
dbfcf1c41b
commit
2e1f279786
3 changed files with 21 additions and 4 deletions
|
@ -57,6 +57,8 @@ public:
|
||||||
static bool empty(const string_type& str) { return str.empty(); }
|
static bool empty(const string_type& str) { return str.empty(); }
|
||||||
static size_type find(const string_type& str, value_type what) { return str.find(what); }
|
static size_type find(const string_type& str, value_type what) { return str.find(what); }
|
||||||
static size_type find(const string_type& str, const string_type& what) { return str.find(what); }
|
static size_type find(const string_type& str, const string_type& what) { return str.find(what); }
|
||||||
|
static size_type find(const string_type& str, value_type what, size_type from) { return str.find(what, from); }
|
||||||
|
static size_type find(const string_type& str, const string_type& what, size_type from) { return str.find(what, from); }
|
||||||
static string_type substr(const string_type& str, const size_type& offset) { return str.substr(offset); }
|
static string_type substr(const string_type& str, const size_type& offset) { return str.substr(offset); }
|
||||||
static string_type substr(const string_type& str, const size_type& offset, const size_type& count) { return str.substr(offset, count); }
|
static string_type substr(const string_type& str, const size_type& offset, const size_type& count) { return str.substr(offset, count); }
|
||||||
static void append(string_type& str, const string_type& a) { str.append(a); }
|
static void append(string_type& str, const string_type& a) { str.append(a); }
|
||||||
|
|
|
@ -95,6 +95,16 @@ silly_string_adaptor::size_type silly_string_adaptor::find(const silly_string& s
|
||||||
return str.s_.find(c);
|
return str.s_.find(c);
|
||||||
} // find
|
} // find
|
||||||
|
|
||||||
|
silly_string_adaptor::size_type silly_string_adaptor::find(const silly_string& str, const silly_string& what, silly_string_adaptor::size_type from)
|
||||||
|
{
|
||||||
|
return str.s_.find(what.s_, from);
|
||||||
|
} // find
|
||||||
|
|
||||||
|
silly_string_adaptor::size_type silly_string_adaptor::find(const silly_string& str, value_type c, silly_string_adaptor::size_type from)
|
||||||
|
{
|
||||||
|
return str.s_.find(c, from);
|
||||||
|
} // find
|
||||||
|
|
||||||
silly_string silly_string_adaptor::substr(const silly_string& str, const size_type& offset)
|
silly_string silly_string_adaptor::substr(const silly_string& str, const size_type& offset)
|
||||||
{
|
{
|
||||||
return silly_string_adaptor::construct_from_utf8(str.s_.substr(offset).c_str());
|
return silly_string_adaptor::construct_from_utf8(str.s_.substr(offset).c_str());
|
||||||
|
|
|
@ -72,6 +72,8 @@ public:
|
||||||
static bool empty(const silly_string& s);
|
static bool empty(const silly_string& s);
|
||||||
static size_type find(const silly_string& str, const silly_string& what);
|
static size_type find(const silly_string& str, const silly_string& what);
|
||||||
static size_type find(const silly_string& str, value_type c);
|
static size_type find(const silly_string& str, value_type c);
|
||||||
|
static size_type find(const silly_string& str, const silly_string& what, size_type from);
|
||||||
|
static size_type find(const silly_string& str, value_type c, size_type from);
|
||||||
static silly_string substr(const silly_string& str, const size_type& offset);
|
static silly_string substr(const silly_string& str, const size_type& offset);
|
||||||
static silly_string substr(const silly_string& str, const size_type& offset, const size_type& count);
|
static silly_string substr(const silly_string& str, const size_type& offset, const size_type& count);
|
||||||
static size_type length(const silly_string& str);
|
static size_type length(const silly_string& str);
|
||||||
|
@ -101,12 +103,15 @@ namespace std {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct less<silly_string> : public binary_function<silly_string, silly_string, bool>
|
struct less<silly_string> : public binary_function<silly_string, silly_string, bool>
|
||||||
{ // functor for operator<
|
{
|
||||||
bool operator()(const silly_string& lhs, const silly_string& rhs) const
|
// functor for operator<
|
||||||
{ // apply operator< to operands
|
bool operator()(const silly_string& lhs, const silly_string& rhs) const
|
||||||
|
{
|
||||||
|
// apply operator< to operands
|
||||||
return (silly_string_adaptor::asStdString(lhs) < silly_string_adaptor::asStdString(rhs));
|
return (silly_string_adaptor::asStdString(lhs) < silly_string_adaptor::asStdString(rhs));
|
||||||
}
|
} // operator()
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue