make doc.meta an unordered_map

This commit is contained in:
Jean-Francois Dockes
2019-04-20 15:04:19 +02:00
parent 44cd3fd633
commit 54f0eda990
12 changed files with 44 additions and 45 deletions
+4 -5
View File
@@ -61,8 +61,8 @@ void output_fields(vector<string> fields, Rcl::Doc& doc,
{
if (fields.empty()) {
map<string,string>::const_iterator it;
for (it = doc.meta.begin();it != doc.meta.end(); it++) {
fields.push_back(it->first);
for (const auto& entry : doc.meta) {
fields.push_back(entry.first);
}
}
for (vector<string>::const_iterator it = fields.begin();
@@ -406,9 +406,8 @@ endopts:
<< doc.fbytes << "\tbytes" << "\t"
<< endl;
if (op_flags & OPT_m) {
for (map<string,string>::const_iterator it = doc.meta.begin();
it != doc.meta.end(); it++) {
cout << it->first << " = " << it->second << endl;
for (const auto ent : doc.meta) {
cout << ent.first << " = " << ent.second << endl;
}
}
if (op_flags & OPT_A) {
+3 -4
View File
@@ -313,10 +313,9 @@ void ResListPager::displayDoc(RclConfig *config, int i, Rcl::Doc& doc,
subs["x"] = xdocidbuf;
// Let %(xx) access all metadata. HTML-neuter everything:
for (map<string,string>::iterator it = doc.meta.begin();
it != doc.meta.end(); it++) {
if (!it->first.empty())
subs[it->first] = maybeEscapeHtml(it->second);
for (const auto& entry : doc.meta) {
if (!entry.first.empty())
subs[entry.first] = maybeEscapeHtml(entry.second);
}
string formatted;
+2 -3
View File
@@ -32,9 +32,8 @@ public:
{
LOGDEB1("Comparing .. \n" );
map<string,string>::const_iterator xit, yit;
xit = x->meta.find(ss.field);
yit = y->meta.find(ss.field);
const auto xit = x->meta.find(ss.field);
const auto yit = y->meta.find(ss.field);
if (xit == x->meta.end() || yit == y->meta.end())
return 0;
return ss.desc ? yit->second < xit->second : xit->second < yit->second;