]> git.lyx.org Git - lyx.git/blobdiff - src/counters.C
partial framebox support
[lyx.git] / src / counters.C
index c6d5745ad1a62bab49ea9d1211d64fdd970374f3..27fbc7ae3a556159b01c8e7c5a03691214d46bc7 100644 (file)
@@ -18,6 +18,7 @@
 #include "counters.h"
 #include "debug.h"
 #include "support/lstrings.h"
+#include "support/LAssert.h"
 
 using std::endl;
 using std::vector;
@@ -198,16 +199,30 @@ void Counters::step(string const & ctr)
        }
 }
 
+
+void Counters::reset()
+{
+       CounterList::iterator it = counterList.begin();
+       CounterList::iterator end = counterList.end();
+       for (; it != end; ++it) {
+               it->second.reset();
+       }
+}
+
+
 void Counters::reset(string const & match)
 {
+       lyx::Assert(!match.empty());
+
        CounterList::iterator it = counterList.begin();
        CounterList::iterator end = counterList.end();
        for (; it != end; ++it) {
-               if (it->first.find(match) != string::npos || match == "")
+               if (it->first.find(match) != string::npos)
                        it->second.reset();
        }
 }
 
+
 void Counters::copy(Counters & from, Counters & to, string const & match)
 {
        CounterList::iterator it = counterList.begin();
@@ -231,6 +246,7 @@ char loweralphaCounter(int n)
                return 'a' + n - 1;
 }
 
+
 inline
 char alphaCounter(int n)
 {
@@ -240,6 +256,7 @@ char alphaCounter(int n)
                return 'A' + n - 1;
 }
 
+
 inline
 char hebrewCounter(int n)
 {
@@ -254,6 +271,7 @@ char hebrewCounter(int n)
                return hebrew[n-1];
 }
 
+
 inline
 string const romanCounter(int n)
 {
@@ -271,10 +289,11 @@ string const romanCounter(int n)
 
 } // namespace anon
 
+
 string Counters::labelItem(string const & ctr,
-               string const & numbertype,
-               string const & langtype,
-               bool first)
+                          string const & numbertype,
+                          string const & langtype,
+                          bool first)
 {
        ostringstream s, o;
        CounterList::iterator it = counterList.find(ctr);
@@ -300,10 +319,11 @@ string Counters::labelItem(string const & ctr,
        return s.str();
 }
 
+
 string Counters::numberLabel(string const & ctr,
-               string const & numbertype,
-               string const & langtype,
-               int head)
+                            string const & numbertype,
+                            string const & langtype,
+                            int head)
 {
        ostringstream s, o;
        if (numbertype == "sectioning" || numbertype == "appendix") {