#include <sstream>
-using lyx::docstring;
+
+namespace lyx {
using std::endl;
using std::ostringstream;
}
-docstring Counter::master() const
+docstring const & Counter::master() const
{
return master_;
}
// if already exist give warning and return
if (cit != counterList.end()) {
lyxerr << "New counter already exists: "
- << lyx::to_utf8(newc)
+ << to_utf8(newc)
<< endl;
return;
}
// if already existant give warning and return
if (cit != counterList.end()) {
lyxerr << "New counter already exists: "
- << lyx::to_utf8(newc)
+ << to_utf8(newc)
<< endl;
return;
}
// if not give warning and return
if (it == counterList.end()) {
lyxerr << "Master counter does not exist: "
- << lyx::to_utf8(masterc)
+ << to_utf8(masterc)
<< endl;
return;
}
CounterList::iterator const it = counterList.find(ctr);
if (it == counterList.end()) {
lyxerr << "set: Counter does not exist: "
- << lyx::to_utf8(ctr) << endl;
+ << to_utf8(ctr) << endl;
return;
}
it->second.set(val);
CounterList::iterator const it = counterList.find(ctr);
if (it == counterList.end()) {
lyxerr << "addto: Counter does not exist: "
- << lyx::to_utf8(ctr) << endl;
+ << to_utf8(ctr) << endl;
return;
}
it->second.addto(val);
CounterList::const_iterator const cit = counterList.find(ctr);
if (cit == counterList.end()) {
lyxerr << "value: Counter does not exist: "
- << lyx::to_utf8(ctr) << endl;
+ << to_utf8(ctr) << endl;
return 0;
}
return cit->second.value();
CounterList::iterator it = counterList.find(ctr);
if (it == counterList.end()) {
lyxerr << "step: Counter does not exist: "
- << lyx::to_utf8(ctr) << endl;
+ << to_utf8(ctr) << endl;
return;
}
};
if (n < 1 || n > 20)
- return lyx::from_ascii("??");
- return lyx::from_ascii(roman[n - 1]);
+ return from_ascii("??");
+ return from_ascii(roman[n - 1]);
}
};
if (n < 1 || n > 20)
- return lyx::from_ascii("??");
- return lyx::from_ascii(roman[n - 1]);
+ return from_ascii("??");
+ return from_ascii(roman[n - 1]);
}
} // namespace anon
docstring Counters::labelItem(docstring const & ctr,
docstring const & numbertype)
{
- if (counterList.find(ctr) == counterList.end()) {
+ CounterList::const_iterator const cit = counterList.find(ctr);
+ if (cit == counterList.end()) {
lyxerr << "Counter "
- << lyx::to_utf8(ctr)
+ << to_utf8(ctr)
<< " does not exist." << endl;
return docstring();
}
+ int val = cit->second.value();
+
if (numbertype == "hebrew")
- return docstring(1, hebrewCounter(value(ctr)));
+ return docstring(1, hebrewCounter(val));
if (numbertype == "alph")
- return docstring(1, loweralphaCounter(value(ctr)));
+ return docstring(1, loweralphaCounter(val));
if (numbertype == "Alph")
- return docstring(1, alphaCounter(value(ctr)));
+ return docstring(1, alphaCounter(val));
if (numbertype == "roman")
- return lowerromanCounter(value(ctr));
+ return lowerromanCounter(val);
if (numbertype == "Roman")
- return romanCounter(value(ctr));
+ return romanCounter(val);
- return convert<docstring>(value(ctr));
+ return convert<docstring>(val);
}
if (j == docstring::npos)
break;
size_t const k = label.find('}', j + 1);
- if (k == string::npos)
+ if (k == docstring::npos)
break;
docstring const numbertype(label, i + 1, j - i - 1);
docstring const counter(label, j + 1, k - j - 1);
docstring const rep = labelItem(counter, numbertype);
- label = docstring(label, 0, i) + rep + docstring(label, k + 1, string::npos);
+ label = docstring(label, 0, i) + rep
+ + docstring(label, k + 1, docstring::npos);
//lyxerr << " : " << " (" << counter << ","
// << numbertype << ") -> " << label << endl;
}
//lyxerr << "counterLabel: " << format << " -> " << label << endl;
return label;
}
+
+
+} // namespace lyx