X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fcounters.h;h=df9a0a6149b00255e3867142478684fc314a2609;hb=d9e6e32961860821ecc047039ae6c1a9dcc6e35d;hp=d7bf25654f164bc87e40e82696d7ef754677f64e;hpb=0be0fcfd5907d448cd51addf83ed7032719a0692;p=lyx.git diff --git a/src/counters.h b/src/counters.h index d7bf25654f..df9a0a6149 100644 --- a/src/counters.h +++ b/src/counters.h @@ -15,9 +15,8 @@ #ifndef COUNTERS_H #define COUNTERS_H -#include "LString.h" #include - +#include /// This represents a single counter. class Counter { @@ -35,16 +34,16 @@ public: /// void reset(); /// Returns the master counter of this counter - string master() const; + std::string master() const; /// sets the master counter for this counter - void setMaster(string const & m); + void setMaster(std::string 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". - string master_; + std::string master_; }; @@ -53,44 +52,36 @@ private: class Counters { public: /// Add a new counter to array. - void newCounter(string const & newc); + void newCounter(std::string const & newc); /// Add new counter having oldc as its master. - void newCounter(string const & newc, string const & oldc); + void newCounter(std::string const & newc, std::string const & oldc); /// - void set(string const & ctr, int val); + void set(std::string const & ctr, int val); /// - void addto(string const & ctr, int val); + void addto(std::string const & ctr, int val); /// - int value(string const & ctr) const; + int value(std::string 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(string const & ctr); + void step(std::string const & ctr); /// Reset all counters. void reset(); /// Reset counters matched by match string. - void reset(string const & match); + void reset(std::string 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, string const & match = string()); - /// A numeric label's single item, like .1 for subsection number in - /// the 2.1.4 subsubsection number label. "first" indicates if this - /// is the first item to be displayed, usually chapter or section. - string labelItem(string const & ctr, - string const & labeltype, - string const & langtype = "latin", - bool first = false); - /// A complete numeric label, like 2.1.4 for a subsubsection. - /// "head" indicates sequence number of first item to be - /// displayed, e.g. 0 for chapter, 1 for section. - string numberLabel(string const & ctr, - string const & labeltype, - string const & langtype = "latin", - int head = 0); + void copy(Counters & from, Counters & to, std::string const & match = std::string()); + /// A complete expanded label, like 2.1.4 for a subsubsection + /// according to the given format + std::string counterLabel(std::string 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); /// Maps counter (layout) names to actual counters. - typedef std::map CounterList; + typedef std::map CounterList; /// Instantiate. CounterList counterList;