From: Jean-Marc Lasgouttes Date: Thu, 16 Aug 2007 15:26:00 +0000 (+0000) Subject: rename TextClass::ctrs_ to counters_ X-Git-Tag: 1.6.10~8837 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=06c43ec975c690a1e4cd3f22bba8e953c2fe50f9;p=features.git rename TextClass::ctrs_ to counters_ git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19607 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/TextClass.cpp b/src/TextClass.cpp index d83f273e9c..9143bf2ca2 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -104,7 +104,7 @@ bool layout2layout(FileName const & filename, FileName const & tempfile) TextClass::TextClass(string const & fn, string const & cln, string const & desc, bool texClassAvail ) : name_(fn), latexname_(cln), description_(desc), - floatlist_(new FloatList), ctrs_(new Counters), + floatlist_(new FloatList), counters_(new Counters), texClassAvail_(texClassAvail) { outputType_ = LATEX; @@ -894,8 +894,8 @@ void TextClass::readFloat(Lexer & lexrc) style, name, listName, builtin); floatlist_->newFloat(fl); // each float has its own counter - ctrs_->newCounter(from_ascii(type), from_ascii(within), - docstring(), docstring()); + counters_->newCounter(from_ascii(type), from_ascii(within), + docstring(), docstring()); } lexrc.popTable(); @@ -940,7 +940,7 @@ void TextClass::readCounter(Lexer & lexrc) case CT_NAME: lexrc.next(); name = lexrc.getDocString(); - if (ctrs_->hasCounter(name)) + if (counters_->hasCounter(name)) LYXERR(Debug::TCLASS) << "Reading existing counter " << to_utf8(name) << endl; @@ -972,8 +972,8 @@ void TextClass::readCounter(Lexer & lexrc) // Here if have a full counter if getout == true if (getout) - ctrs_->newCounter(name, within, - labelstring, labelstring_appendix); + counters_->newCounter(name, within, + labelstring, labelstring_appendix); lexrc.popTable(); } @@ -1090,12 +1090,23 @@ FloatList const & TextClass::floats() const Counters & TextClass::counters() const { - return *ctrs_.get(); + return *counters_.get(); } InsetLayout const & TextClass::insetlayout(docstring const & name) const { - return insetlayoutlist_[name]; + docstring n = name; + while (!n.empty()) { + if (insetlayoutlist_.count(n) > 0) + return insetlayoutlist_[n]; + docstring::size_type i = n.rfind(':'); + if (i != string::npos) // delimiter was found + n = n.substr(i + 1); + else + break; + } + static const InsetLayout empty; + return empty; } diff --git a/src/TextClass.h b/src/TextClass.h index 8f0c8cf1cb..64716c1741 100644 --- a/src/TextClass.h +++ b/src/TextClass.h @@ -257,7 +257,7 @@ private: boost::shared_ptr floatlist_; /// Types of counters, eg. sections, eqns, figures, avail. in document class. - boost::shared_ptr ctrs_; + boost::shared_ptr counters_; /// Has this layout file been loaded yet? mutable bool loaded_;