*
* ====================================================== */
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
#include <config.h>
#include "counters.h"
#include "debug.h"
+
#include "support/lstrings.h"
#include "support/LAssert.h"
value_ = 0;
}
+
string Counter::master() const
{
return master_;
}
+
void Counter::setMaster(string const & m)
{
master_ = m;
}
-Counters::Counters()
-{
- // Ehh, should this take a textclass arg?
-
- // Sectioning counters:
- newCounter("part");
- newCounter("chapter");
- newCounter("section", "chapter");
- newCounter("subsection", "section");
- newCounter("subsubsection", "subsection");
- newCounter("paragraph", "subsubsection");
- newCounter("subparagraph", "paragraph");
-
- // Enumeration counters:
- newCounter("enumi");
- newCounter("enumii", "enumi");
- newCounter("enumiii", "enumii");
- newCounter("enumiv", "enumiii");
-
- // Biblio:
- newCounter("bibitem");
-
- // Float counters:
- newCounter("figure");
- newCounter("table");
-}
-
void Counters::newCounter(string const & newc)
{
return;
}
counterList[newc];
- cit = counterList.find(newc);
- cit->second.setMaster("");
}
return;
}
- counterList[newc];
- cit = counterList.find(newc);
- cit->second.setMaster(masterc);
+ counterList[newc].setMaster(masterc);
}
CounterList::iterator it = counterList.find(ctr);
if (it == counterList.end()) {
lyxerr << "Counter does not exist." << endl;
- return "";
+ return string();
}
if (!first) {
- s << "." << value(ctr);
+ s << '.' << value(ctr);
} else {
if (numbertype == "sectioning" || numbertype == "appendix") {
if (numbertype == "appendix") {
}
s << o.str();
}
- return s.str();
+
+ return STRCONV(s.str());
}
string const & langtype,
int head)
{
- ostringstream s, o;
+ ostringstream s;
+
if (numbertype == "sectioning" || numbertype == "appendix") {
if (ctr == "chapter" && head == 0) {
s << labelItem("chapter", numbertype, langtype, true);
}
} else if (numbertype == "enumeration") {
- ostringstream ei, eii, eiii, eiv;
- //string ei, eiii, eiv;
- //char eii;
+ ostringstream ei;
+ ostringstream eii;
+ ostringstream eiii;
+ ostringstream eiv;
+
if (langtype == "hebrew") {
ei << '.' << value("enumi");
eii << '(' << hebrewCounter(value("enumii")) << ')';
s << eiv.str();
}
}
- return s.str();
+
+ return STRCONV(s.str());
}