]> git.lyx.org Git - features.git/commitdiff
* Counter.cpp (hasCounter): new method.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 11 Aug 2007 18:23:30 +0000 (18:23 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 11 Aug 2007 18:23:30 +0000 (18:23 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19429 a592a061-630c-0410-9148-cb99ea01b6c8

src/Counters.cpp
src/Counters.h

index ac7c68394dd842cdf8cf1dbb412164988fec6aae..d59d17f1548fce2c25083a1820f8a398b6c38d72 100644 (file)
@@ -120,6 +120,12 @@ void Counters::newCounter(docstring const & newc,
 }
 
 
+bool Counters::hasCounter(docstring const & c) const
+{
+       return counterList.find(c) != counterList.end();
+}
+
+
 void Counters::set(docstring const & ctr, int const val)
 {
        CounterList::iterator const it = counterList.find(ctr);
index 7177dfc7a86594915d4acd6181a32e853c283d53..0020a7bb5a8f29ce6f55077ead1b410c92bcacc2 100644 (file)
@@ -38,16 +38,16 @@ public:
        ///
        void reset();
        /// Returns the master counter of this counter
-       lyx::docstring const & master() const;
+       docstring const & master() const;
        /// sets the master counter for this counter
-       void setMaster(lyx::docstring const & m);
+       void setMaster(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".
-       lyx::docstring master_;
+       docstring master_;
 };
 
 
@@ -56,48 +56,55 @@ private:
 class Counters {
 public:
        /// Add a new counter to array.
-       void newCounter(lyx::docstring const & newc);
+       void newCounter(docstring const & newc);
        /// Add new counter having oldc as its master.
-       void newCounter(lyx::docstring const & newc,
-                       lyx::docstring const & oldc);
+       void newCounter(docstring const & newc,
+                       docstring const & oldc);
        ///
-       void set(lyx::docstring const & ctr, int val);
+       bool hasCounter(docstring const & c) const;
        ///
-       void addto(lyx::docstring const & ctr, int val);
+       void set(docstring const & ctr, int val);
        ///
-       int value(lyx::docstring const & ctr) const;
+       void addto(docstring const & ctr, int val);
+       ///
+       int value(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(lyx::docstring const & ctr);
+       void step(docstring const & ctr);
        /// Reset all counters.
        void reset();
        /// Reset counters matched by match string.
-       void reset(lyx::docstring const & match);
+       void reset(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,
-                 lyx::docstring const & match = lyx::docstring());
+                 docstring const & match = docstring());
        /// A complete expanded label, like 2.1.4 for a subsubsection
        /// according to the given format
-       lyx::docstring counterLabel(lyx::docstring const & format);
+       docstring counterLabel(docstring const & format);
        ///
        bool appendix() const { return appendix_; };
        ///
        void appendix(bool a) { appendix_ = a; };
+       ///
+       std::string const & current_float() const { return current_float_; }
+       ///
+       void current_float(std::string const & f) { current_float_ = f; }
 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);
+       docstring labelItem(docstring const & ctr,
+                                docstring const & numbertype);
        /// Maps counter (layout) names to actual counters.
-       typedef std::map<lyx::docstring, Counter> CounterList;
+       typedef std::map<docstring, Counter> CounterList;
        /// Instantiate.
        CounterList counterList;
        ///
        bool appendix_;
-
+       ///
+       std::string current_float_;
 };