#include "TextClass.h"
-#include "BaseClassList.h"
+#include "LayoutFile.h"
#include "Color.h"
#include "Counters.h"
#include "Floating.h"
#include "support/lstrings.h"
#include "support/os.h"
+#include <algorithm>
#include <sstream>
+#include "boost/assert.hpp"
+
using namespace std;
using namespace lyx::support;
TextClass::TextClass()
{
- floatlist_ = boost::shared_ptr<FloatList>(new FloatList);
- counters_ = boost::shared_ptr<Counters>(new Counters);
outputType_ = LATEX;
columns_ = 1;
sides_ = OneSide;
case TC_NOFLOAT:
if (lexrc.next()) {
string const nofloat = lexrc.getString();
- floatlist_->erase(nofloat);
+ floatlist_.erase(nofloat);
}
break;
}
case FT_TYPE:
lexrc.next();
type = lexrc.getString();
- if (floatlist_->typeExist(type)) {
- Floating const & fl = floatlist_->getType(type);
+ if (floatlist_.typeExist(type)) {
+ Floating const & fl = floatlist_.getType(type);
placement = fl.placement();
ext = fl.ext();
within = fl.within();
if (getout) {
Floating fl(type, placement, ext, within,
style, name, listName, builtin);
- floatlist_->newFloat(fl);
+ floatlist_.newFloat(fl);
// each float has its own counter
- counters_->newCounter(from_ascii(type), from_ascii(within),
+ counters_.newCounter(from_ascii(type), from_ascii(within),
docstring(), docstring());
// also define sub-float counters
docstring const subtype = "sub-" + from_ascii(type);
- counters_->newCounter(subtype, from_ascii(type),
+ counters_.newCounter(subtype, from_ascii(type),
"\\alph{" + subtype + "}", docstring());
}
case CT_NAME:
lexrc.next();
name = lexrc.getDocString();
- if (counters_->hasCounter(name))
+ if (counters_.hasCounter(name))
LYXERR(Debug::TCLASS, "Reading existing counter " << to_utf8(name));
else
LYXERR(Debug::TCLASS, "Reading new counter " << to_utf8(name));
// Here if have a full counter if getout == true
if (getout)
- counters_->newCounter(name, within,
+ counters_.newCounter(name, within,
labelstring, labelstring_appendix);
lexrc.popTable();
InsetLayout const & DocumentClass::insetLayout(docstring const & name) const
{
docstring n = name;
+ InsetLayouts::const_iterator cen = insetlayoutlist_.end();
while (!n.empty()) {
- if (insetlayoutlist_.count(n) > 0)
- return insetlayoutlist_[n];
+ InsetLayouts::const_iterator cit = insetlayoutlist_.lower_bound(n);
+ if (cit != cen && cit->first == n)
+ return cit->second;
size_t i = n.find(':');
if (i == string::npos)
break;
DocumentClass & DocumentClassBundle::newClass(LayoutFile const & baseClass)
{
- DocumentClass dc(baseClass);
+ DocumentClass * dc = new DocumentClass(baseClass);
tc_list_.push_back(dc);
- return tc_list_.back();
+ return *tc_list_.back();
}