X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fcounters.h;h=1f98e89adc3f06a38c7b1e56dfc3859b45193290;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=4aee7f93aeef550a3badd498df352ad7196cd5f8;hpb=6c3d48c0c6d38bd20392ae5b4e69d60b676256c7;p=lyx.git diff --git a/src/counters.h b/src/counters.h index 4aee7f93ae..1f98e89adc 100644 --- a/src/counters.h +++ b/src/counters.h @@ -15,10 +15,12 @@ #ifndef COUNTERS_H #define COUNTERS_H +#include "support/docstring.h" + #include -#include -#include "buffer.h" + +namespace lyx { /// This represents a single counter. class Counter { @@ -36,16 +38,16 @@ public: /// void reset(); /// Returns the master counter of this counter - std::string master() const; + lyx::docstring master() const; /// sets the master counter for this counter - void setMaster(std::string const & m); + void setMaster(lyx::docstring const & m); private: /// int value_; /// contains master counter name; master counter is the counter /// that, if stepped (incremented) zeroes this counter. E.g. /// "subparagraph"'s master is "paragraph". - std::string master_; + lyx::docstring master_; }; @@ -54,41 +56,45 @@ private: class Counters { public: /// Add a new counter to array. - void newCounter(std::string const & newc); + void newCounter(lyx::docstring const & newc); /// Add new counter having oldc as its master. - void newCounter(std::string const & newc, std::string const & oldc); + void newCounter(lyx::docstring const & newc, + lyx::docstring const & oldc); /// - void set(std::string const & ctr, int val); + void set(lyx::docstring const & ctr, int val); /// - void addto(std::string const & ctr, int val); + void addto(lyx::docstring const & ctr, int val); /// - int value(std::string const & ctr) const; + int value(lyx::docstring const & ctr) const; /// Step (increment by one) counter named by arg, and /// zeroes slave counter(s) for which it is the master. /// NOTE sub-slaves not zeroed! That happens at slave's /// first step 0->1. Seems to be sufficient. - void step(std::string const & ctr); + void step(lyx::docstring const & ctr); /// Reset all counters. void reset(); /// Reset counters matched by match string. - void reset(std::string const & match); + void reset(lyx::docstring const & match); /// Copy counters whose name matches match from the &from to /// the &to array of counters. Empty string matches all. - void copy(Counters & from, Counters & to, std::string const & match = std::string()); + void copy(Counters & from, Counters & to, + lyx::docstring const & match = lyx::docstring()); /// A complete expanded label, like 2.1.4 for a subsubsection /// according to the given format - std::string counterLabel(std::string const & format); - /// A complete label, like 1.a for enumerations - std::string enumLabel(std::string const & ctr, Buffer const & buf); + lyx::docstring counterLabel(lyx::docstring const & format); private: /// A counter label's single item, 1 for subsection number in /// the 2.1.4 subsubsection number label. - std::string labelItem(std::string const & ctr, std::string const & numbertype); + lyx::docstring labelItem(lyx::docstring const & ctr, + lyx::docstring const & numbertype); /// Maps counter (layout) names to actual counters. - typedef std::map CounterList; + typedef std::map CounterList; /// Instantiate. CounterList counterList; }; + +} // namespace lyx + #endif