X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fcounters.h;h=1f98e89adc3f06a38c7b1e56dfc3859b45193290;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=69c4983be810e318b611d813671966d9e2bae068;hpb=83f4b0018ebf8a7566d11d74ad2eb84add5b7984;p=lyx.git diff --git a/src/counters.h b/src/counters.h index 69c4983be8..1f98e89adc 100644 --- a/src/counters.h +++ b/src/counters.h @@ -1,26 +1,26 @@ // -*- C++ -*- -/* This file is part of - * ====================================================== +/** + * \file counters.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * LyX, The Document Processor + * \author Lars Gullik Bjønnes + * \author Jean-Marc Lasgouttes + * \author John Levon + * \author Martin Vermeer * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. - * - * - * ====================================================== */ - + * Full author contact details are available in file CREDITS. + */ #ifndef COUNTERS_H #define COUNTERS_H -#ifdef __GNUG__ -#pragma interface -#endif +#include "support/docstring.h" -#include "LString.h" #include -#include + + +namespace lyx { /// This represents a single counter. class Counter { @@ -38,17 +38,16 @@ public: /// void reset(); /// Returns the master counter of this counter - string master() const; + lyx::docstring master() const; /// sets the master counter for this counter - void setMaster(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". - string master_; + lyx::docstring master_; }; @@ -56,56 +55,46 @@ private: /// Every instantiation is an array of counters of type Counter. class Counters { public: - /// - Counters(); - /// - //~Counters(); /// Add a new counter to array. - void newCounter(string const & newc); + void newCounter(lyx::docstring const & newc); /// Add new counter having oldc as its master. - void newCounter(string const & newc, string const & oldc); + void newCounter(lyx::docstring const & newc, + lyx::docstring const & oldc); /// - void set(string const & ctr, int val); + void set(lyx::docstring const & ctr, int val); /// - void addto(string const & ctr, int val); + void addto(lyx::docstring const & ctr, int val); /// - int value(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(string const & ctr); + void step(lyx::docstring const & ctr); /// Reset all counters. void reset(); /// Reset counters matched by match string. - void reset(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, 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); - /// Maps numbers to enumeration of sectioning counter name strings. - std::vector enums; - std::vector sects; - + 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 + 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. + 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