added valueSplitAttributes() method
This commit is contained in:
parent
1cd62ace41
commit
360b2271da
@ -493,6 +493,32 @@ string RclConfig::getMimeHandlerDef(const std::string &mtype, bool filtertypes)
|
|||||||
return hs;
|
return hs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param whole is like "base value ; attr1 = somthing; attr2 = somethelse"
|
||||||
|
* There is no way to escape a semi-colon inside whole
|
||||||
|
*/
|
||||||
|
bool RclConfig::valueSplitAttributes(const string& whole, string& value,
|
||||||
|
ConfSimple& attrs)
|
||||||
|
{
|
||||||
|
string::size_type semicol0 = whole.find_first_of(";");
|
||||||
|
value = whole.substr(0, semicol0);
|
||||||
|
string attrstr;
|
||||||
|
if (semicol0 != string::npos && semicol0 < whole.size() - 1) {
|
||||||
|
attrstr = whole.substr(semicol0+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle additional attributes. We substitute the semi-colons
|
||||||
|
// with newlines and use a ConfSimple
|
||||||
|
if (!attrstr.empty()) {
|
||||||
|
for (string::size_type i = 0; i < attrstr.size(); i++)
|
||||||
|
if (attrstr[i] == ';')
|
||||||
|
attrstr[i] = '\n';
|
||||||
|
attrs = ConfSimple(attrstr);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
string RclConfig::getMissingHelperDesc()
|
string RclConfig::getMissingHelperDesc()
|
||||||
{
|
{
|
||||||
string fmiss = path_cat(getConfDir(), "missing");
|
string fmiss = path_cat(getConfDir(), "missing");
|
||||||
|
|||||||
@ -167,6 +167,10 @@ class RclConfig {
|
|||||||
|
|
||||||
/** mimeconf: get input filter for mimetype */
|
/** mimeconf: get input filter for mimetype */
|
||||||
string getMimeHandlerDef(const string &mimetype, bool filtertypes=false);
|
string getMimeHandlerDef(const string &mimetype, bool filtertypes=false);
|
||||||
|
/** For lines like: "name = some value; and additional; attributes"
|
||||||
|
* Split the value and store the attributes in a ConfSimple */
|
||||||
|
bool valueSplitAttributes(const string& whole, string& value,
|
||||||
|
ConfSimple& attrs);
|
||||||
|
|
||||||
/** mimeconf: get icon name for mimetype */
|
/** mimeconf: get icon name for mimetype */
|
||||||
string getMimeIconName(const string &mtype, string *path = 0);
|
string getMimeIconName(const string &mtype, string *path = 0);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user