36 #define DATRW_FORMATMODIFIER_CC_VERSION \ 37 "DATRW_FORMATMODIFIER_CC V1.1" 47 namespace formatmodifiers {
52 const std::string& delimiter,
53 const std::string& assign)
55 std::string parameters=p;
57 while (parameters.length()>0)
62 if (value.length()==0)
64 retval[key]=
Value(
"true");
68 retval[key]=
Value(value);
78 os <<
"format modifiers" << std::endl;
79 os <<
"----------------" << std::endl;
81 "Some I/O streams support format modifiers. These can be used to\n" 82 "control the behaviour of the specific I/O stream. The modifiers\n" 83 "are passed through a string to the I/O stream. Each modifier\n" 84 "consists of a keyword and an optional parameter string. Several\n" 85 "modifiers can be concatenated being separated by a colon (:).\n" 86 "Keyword and parameter are separated by an equal sign (=).\n" 87 "If the program takes format identifiers as string values,\n" 88 "format modifiers usually can be appended to the format ID with\n" 89 "a separating colon in between.\n" 91 "Example: To read a seife format file, using 4.7.2011 as the day\n" 92 "of recording and \"BFO\" as recording station, you could use\n" 94 " seife:date=2011/7/4:station=BFO\n" 96 "to specify the input format.";
107 const std::string& def)
const 120 const std::string& def)
const 123 formatmodifiers::Tparamap::const_iterator P=
Mparamap.find(k);
126 retval=P->second.value;
127 P->second.checked=
true;
143 formatmodifiers::Tparamap::const_iterator P=
Mparamap.find(k);
147 P->second.checked=
true;
157 formatmodifiers::Tparamap::const_iterator I=
Mparamap.begin();
160 if (!I->second.checked) { retval=
false; }
172 formatmodifiers::Tparamap::const_iterator I=
Mparamap.begin();
173 os <<
"Format modifiers which were not recognized:" << std::endl;
176 if (!I->second.checked)
178 os <<
" " << I->first <<
"=" << I->second.value << std::endl;
187 namespace formatmodifiers {
192 Mos << std::left << std::setfill(
' ') <<
" " <<
" ";
201 std::string keyval=key;
203 Mos << std::left << std::setfill(
'.') << keyval <<
" ";
210 const std::string& val)
213 std::string keyval=key;
214 keyval +=
"=" + val +
": ";
215 Mos << std::left << std::setfill(
'.') << keyval <<
" ";
std::string commatospace(std::string s)
std::string trimws(std::string s)
remove leading and trailing whitespace
Root namespace of library.
utilities used by more than one type of data reader (prototypes)
std::string clipstring(std::string &s, const std::string &delim)
strip substringStrips off first substring up to given delimiter. The string is passed as a reference ...