]> git.lyx.org Git - lyx.git/blobdiff - src/counters.C
Move #includes out of header files.
[lyx.git] / src / counters.C
index 8203a98ceaec6583467fdeae9b4404d1c6af576a..b0d99cbe154b673788dc09b0fd5726fde23018f3 100644 (file)
@@ -1,26 +1,25 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file counters.C
+ * 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 Martin Vermeer
  *
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team.
- *
- *
- * ====================================================== */
-
-#ifdef __GNUG__
-#pragma implementation
-#endif
+ * Full author contact details are available in file CREDITS.
+ */
 
 #include <config.h>
 
 #include "counters.h"
 #include "debug.h"
+#include "Lsstream.h"
 
 #include "support/lstrings.h"
 #include "support/LAssert.h"
 
+using namespace lyx::support;
+
 using std::endl;
 using std::vector;
 
@@ -172,7 +171,7 @@ void Counters::reset()
 
 void Counters::reset(string const & match)
 {
-       lyx::Assert(!match.empty());
+       Assert(!match.empty());
 
        CounterList::iterator it = counterList.begin();
        CounterList::iterator end = counterList.end();
@@ -261,11 +260,11 @@ string Counters::labelItem(string const & ctr,
        CounterList::iterator it = counterList.find(ctr);
        if (it == counterList.end()) {
                lyxerr << "Counter does not exist." << endl;
-               return "";
+               return string();
        }
 
        if (!first) {
-               s << "." << value(ctr);
+               s << '.' << value(ctr);
        } else {
                if (numbertype == "sectioning" || numbertype == "appendix") {
                        if (numbertype == "appendix") {
@@ -278,7 +277,8 @@ string Counters::labelItem(string const & ctr,
                }
                s << o.str();
        }
-       return s.str();
+
+       return STRCONV(s.str());
 }
 
 
@@ -287,7 +287,8 @@ string Counters::numberLabel(string const & ctr,
                             string const & langtype,
                             int head)
 {
-       ostringstream s, o;
+       ostringstream s;
+
        if (numbertype == "sectioning" || numbertype == "appendix") {
                if (ctr == "chapter" && head == 0) {
                        s << labelItem("chapter", numbertype, langtype, true);
@@ -340,5 +341,6 @@ string Counters::numberLabel(string const & ctr,
                        s << eiv.str();
                }
        }
-       return s.str();
+
+       return STRCONV(s.str());
 }