]> git.lyx.org Git - lyx.git/blobdiff - src/TextClass.cpp
Typo.
[lyx.git] / src / TextClass.cpp
index f26f8153e094d9b44989e0c5d89e4f8398ce1f05..b3ac4898513fe72ffcfd1455e8147e1e1733fe6a 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "frontends/alert.h"
 
+#include "support/lassert.h"
 #include "support/debug.h"
 #include "support/ExceptionMessage.h"
 #include "support/FileName.h"
@@ -39,8 +40,6 @@
 #include <fstream>
 #include <sstream>
 
-#include "boost/assert.hpp"
-
 using namespace std;
 using namespace lyx::support;
 
@@ -110,12 +109,20 @@ std::string translateRT(TextClass::ReadType rt)
 } // namespace anon
 
 
-docstring const TextClass::emptylayout_ = from_ascii(N_("Plain Layout"));
+// This string should not be translated here, 
+// because it is a layout identifier.
+docstring const TextClass::emptylayout_ = from_ascii("Plain Layout");
 
 
 InsetLayout DocumentClass::empty_insetlayout_;
 
 
+/////////////////////////////////////////////////////////////////////////
+//
+// TextClass
+//
+/////////////////////////////////////////////////////////////////////////
+
 TextClass::TextClass()
 {
        outputType_ = LATEX;
@@ -130,6 +137,7 @@ TextClass::TextClass()
        titletype_ = TITLE_COMMAND_AFTER;
        titlename_ = "maketitle";
        loaded_ = false;
+       _("Plain Layout"); // a hack to make this translatable
 }
 
 
@@ -254,7 +262,7 @@ bool TextClass::read(FileName const & filename, ReadType rt)
                if (!readStyle(lex, lay)) {
                        // The only way this happens is because the hardcoded layout above
                        // is wrong.
-                       BOOST_ASSERT(false);
+                       LASSERT(false, /**/);
                };
                layoutlist_.push_back(lay);
        }
@@ -921,7 +929,7 @@ bool TextClass::hasLayout(docstring const & n) const
 
 Layout const & TextClass::operator[](docstring const & name) const
 {
-       BOOST_ASSERT(!name.empty());
+       LASSERT(!name.empty(), /**/);
 
        const_iterator it = 
                find_if(begin(), end(), LayoutNamesEqual(name));
@@ -934,7 +942,7 @@ Layout const & TextClass::operator[](docstring const & name) const
                        lyxerr  << " " << to_utf8(cit->name()) << endl;
 
                // we require the name to exist
-               BOOST_ASSERT(false);
+               LASSERT(false, /**/);
        }
 
        return *it;
@@ -943,7 +951,7 @@ Layout const & TextClass::operator[](docstring const & name) const
 
 Layout & TextClass::operator[](docstring const & name)
 {
-       BOOST_ASSERT(!name.empty());
+       LASSERT(!name.empty(), /**/);
 
        iterator it = find_if(begin(), end(), LayoutNamesEqual(name));
 
@@ -954,7 +962,7 @@ Layout & TextClass::operator[](docstring const & name)
                        LYXERR0(" " << to_utf8(cit->name()));
 
                // we require the name to exist
-               BOOST_ASSERT(false);
+               LASSERT(false, /**/);
        }
 
        return *it;
@@ -1033,23 +1041,36 @@ Layout const & TextClass::defaultLayout() const
 }
 
 
-bool TextClass::isDefaultLayout(Layout const & lay) const 
+bool TextClass::isDefaultLayout(Layout const & layout) const 
 {
-       return lay.name() == defaultLayoutName();
+       return layout.name() == defaultLayoutName();
 }
 
 
-bool TextClass::isEmptyLayout(Layout const & lay) const 
+bool TextClass::isEmptyLayout(Layout const & layout) const 
 {
-       return lay.name() == emptyLayoutName();
+       return layout.name() == emptyLayoutName();
 }
 
 
+/////////////////////////////////////////////////////////////////////////
+//
+// DocumentClassBundle
+//
+/////////////////////////////////////////////////////////////////////////
+
+DocumentClassBundle::~DocumentClassBundle()
+{
+       for (size_t i = 0; i != documentClasses_.size(); ++i)
+               delete documentClasses_[i];
+       documentClasses_.clear();
+}
+
 DocumentClass & DocumentClassBundle::newClass(LayoutFile const & baseClass)
 {
        DocumentClass * dc = new DocumentClass(baseClass);
-       tc_list_.push_back(dc);
-       return *tc_list_.back();
+       documentClasses_.push_back(dc);
+       return *documentClasses_.back();
 }
 
 
@@ -1060,6 +1081,12 @@ DocumentClassBundle & DocumentClassBundle::get()
 }
 
 
+/////////////////////////////////////////////////////////////////////////
+//
+// DocumentClass
+//
+/////////////////////////////////////////////////////////////////////////
+
 DocumentClass::DocumentClass(LayoutFile const & tc)
        : TextClass(tc)
 {}
@@ -1088,6 +1115,12 @@ bool DocumentClass::hasTocLevels() const
 }
 
 
+/////////////////////////////////////////////////////////////////////////
+//
+// PageSides
+//
+/////////////////////////////////////////////////////////////////////////
+
 ostream & operator<<(ostream & os, PageSides p)
 {
        switch (p) {