Commit Graph

7 Commits

Author SHA1 Message Date
Avi Kivity
a28f0efd9a sstring: add iterator range constructor 2015-04-30 15:03:27 +03:00
Amnon Heiman
04b5bad2b7 Adding insert replace and erase to sstring
The boost::replace_all uses insert and erase to perform a change, those
method are missing from sstring.

Following the std:string implemntation the implementation of both
functionalities is based on the replace method, either as c string
replace or with templated iterators.

Not all the variation of insert, replace and erase where added, but it
will be possible to add them in the future if needed by calling the
existing functionality.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-04-05 09:51:28 +03:00
Amnon Heiman
0faf9cbb56 Adding back, find_last_of and append to sstring
This adds the back method that return a reference or const reference to
the last char in an sstring.

find_last_of, which return the index of the last occurance of a char in
the string.

And append with append C string to a string.

The logic and definition are similiar to the std::string.

Note that following the std::string definition, calling back on an empty
string is forbiden and the results are undefined.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-03-30 15:38:41 +03:00
Amnon Heiman
29391d9a9b Extending sstring
This patch adds some of the common functionalities from std:string to
sstring.

It adds length (implement by size() )
It define the constant npos to indicate no possition.
It adds the at (reference and const reference)
It define the find char and find sstring methods
and the substr method

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>

need merge sstring
2015-03-08 21:55:57 +02:00
Avi Kivity
7f8d88371a Add LICENSE, NOTICE, and copyright headers to all source files.
The two files imported from the OSv project retain their original licenses.
2015-02-19 16:52:34 +02:00
Avi Kivity
4c46f4db8c tests: test literal + sstring concatenation 2015-01-13 10:13:05 +02:00
Tomasz Grabiec
da10ab6443 tests: add sstring tests 2014-10-15 15:50:46 +02:00