25 const size_t l = strlen(str);
32 char *current = &data[start];
44 char *data = string_area_write();
46 while(data[count+
offset]) {
62 const char* str = string_area_read();
80 if (
offset==0)
return add(str);
82 size_t available = clear(
offset);
83 if (available>=strlen(str)) {
84 char *data = string_area_write();
85 char *dest = &data[
offset];
112 const char *str = get_string(
offset);
116 const std::string text(str);
118 std::string::size_type start_p = 0;
119 std::string::size_type end_p = 0;
121 while(start_p < text.size()) {
122 end_p = text.find(STRING_SEPARATOR,start_p);
123 if (end_p == std::string::npos) {
124 end_p = text.length();
126 std::string extract = text.substr(start_p, end_p - start_p);
127 if(extract.size() > 0) {
128 vector.push_back(extract);
147 str_vector::const_iterator pos;
148 std::ostringstream stream;
149 for(pos=vect.begin();pos!=vect.end();pos++) {
150 if (vect.begin()!=pos) {
151 stream << STRING_SEPARATOR;
155 return insert(
offset,stream.str().c_str());
180 const char* str = get_string(
offset);
184 const std::string text(str);
185 std::string::size_type start_p = 0;
186 std::string::size_type end_p = 0;
188 while(start_p < text.size()) {
189 end_p = text.find(MAP_ENTRY_SEPARATOR,start_p);
190 if (end_p == std::string::npos) {
191 end_p = text.length();
193 const std::string entry(text.substr(start_p, end_p - start_p));
194 const std::string::size_type entrySize = entry.size();
196 const std::string::size_type separator_p = entry.find(STRING_SEPARATOR);
197 if(separator_p != std::string::npos) {
198 if((separator_p + 1) < entrySize) {
199 map[entry.substr(0, separator_p)] = entry.substr(separator_p + 1);
201 map[entry.substr(0, separator_p)] =
"";
223 str_map::const_iterator pos;
224 std::ostringstream stream;
225 for(pos=map.begin();pos!=map.end();pos++) {
226 if (map.begin()!=pos) {
227 stream << MAP_ENTRY_SEPARATOR;
229 stream << (pos->first);
230 stream << STRING_SEPARATOR;
231 stream << (pos->second);
233 return insert(
offset,stream.str().c_str());
#define ERS_RANGE_CHECK(min, val, max)
#define ERS_PRECONDITION(expression)
virtual char * string_area_write()=0
write pointer for the string area
virtual size_t string_area_size() const =0
size of the string area
size_t clear(offset_t offset)
const char * get_string(offset_t offset) const
std::vector< std::string > str_vector
virtual offset_t last_string() const =0
offset of the end of the last string
static const char STRING_SEPARATOR
character used to separate strings (i.e., to tokenize strings in vectors)
static const char MAP_ENTRY_SEPARATOR
character used to separate map entries
str_vector get_vector(offset_t offset) const
std::map< std::string, std::string > str_map
offset_t insert(offset_t offset, const char *str)
str_map get_map(offset_t offset) const
offset_t add(const char *str)