8 #ifndef CPPCMS_STRING_KEY_H 9 #define CPPCMS_STRING_KEY_H 41 static const size_t npos = -1;
103 size_t find(
char c,
size_t pos = 0)
const 108 char const *p=
begin() + pos;
109 while(pos <= s && *p!=c) {
135 char const *p=
begin() + pos;
137 if(n >
size_t(e-p)) {
150 return *(
begin() + n);
155 char const &
at(
size_t n)
const 158 throw std::out_of_range(
"cppcms::string_key::at() range error");
159 return *(
begin() + n);
168 return string_key(v.c_str(),v.c_str()+v.size());
206 return key_.c_str() + key_.size();
213 return std::lexicographical_compare(
begin(),
end(),
215 std::char_traits<char>::lt);
222 return other < *
this;
229 return !(*
this < other);
236 return !(*
this > other);
251 return !(*
this==other);
268 return std::string(begin_,end_-begin_);
275 operator std::string()
const static const size_t npos
Definition: string_key.h:41
string_key()
Definition: string_key.h:46
static string_key unowned(std::string const &v)
Definition: string_key.h:166
string_key(char const *key)
Definition: string_key.h:55
bool operator<(string_key const &other) const
Definition: string_key.h:211
char const & at(size_t n) const
Definition: string_key.h:155
std::string str() const
Definition: string_key.h:265
string_key(std::string const &key)
Definition: string_key.h:64
This is the namespace where all CppCMS functionality is placed.
Definition: application.h:19
static string_key unowned(char const *begin, char const *end)
Definition: string_key.h:185
bool operator!=(string_key const &other) const
Definition: string_key.h:249
size_t size() const
Definition: string_key.h:73
char const * const_iterator
Definition: string_key.h:36
char const * end() const
Definition: string_key.h:202
bool operator>(string_key const &other) const
Definition: string_key.h:220
static string_key unowned(char const *str)
Definition: string_key.h:174
string_key unowned_substr(size_t pos=0, size_t n=npos) const
Definition: string_key.h:130
This is a special object that may hold an std::string or alternatively reference to external (unowned...
Definition: string_key.h:30
char const * begin() const
Definition: string_key.h:193
char const * data() const
Definition: string_key.h:257
char const & operator[](size_t n) const
Definition: string_key.h:148
bool operator==(string_key const &other) const
Definition: string_key.h:241
void clear()
Definition: string_key.h:87
bool operator>=(string_key const &other) const
Definition: string_key.h:227
bool empty() const
Definition: string_key.h:95
size_t find(char c, size_t pos=0) const
Definition: string_key.h:103
archive & operator<<(archive &a, Archivable const &object)
Definition: serialization_classes.h:176
string_key substr(size_t pos=0, size_t n=npos) const
Definition: string_key.h:121
bool operator<=(string_key const &other) const
Definition: string_key.h:234
size_t length() const
Definition: string_key.h:80