X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLayout.cpp;h=e368f23bbda0e821d3928b0f58538e5290a9e577;hb=51ac7d895cc7a9c4ad91131d0b4734395366d04b;hp=2efe9edf9f7cf937ca098ce35bdf8a17107b004e;hpb=61e10d5c85585f120c2d4f397e61e41620543fcc;p=lyx.git diff --git a/src/Layout.cpp b/src/Layout.cpp index 2efe9edf9f..e368f23bbd 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -223,16 +223,17 @@ bool Layout::read(Lexer & lexrc, TextClass const & tclass) if (tclass.hasLayout(style)) { docstring const tmpname = name_; - this->operator=(*tclass[style]); + this->operator=(tclass[style]); name_ = tmpname; } else { lyxerr << "Cannot copy unknown style `" << to_utf8(style) << "'\n" << "All layouts so far:" << endl; - for (size_t i = 0; i != tclass.layoutCount(); ++i) - lyxerr << to_utf8(tclass.layout(i)->name()) - << endl; + DocumentClass::const_iterator lit = tclass.begin(); + DocumentClass::const_iterator len = tclass.end(); + for (; lit != len; ++lit) + lyxerr << to_utf8(lit->name()) << endl; //lexrc.printError("Cannot copy known " // "style `$$Token'"); @@ -247,7 +248,7 @@ bool Layout::read(Lexer & lexrc, TextClass const & tclass) if (tclass.hasLayout(style)) { docstring const tmpname = name_; - this->operator=(*tclass[style]); + this->operator=(tclass[style]); name_ = tmpname; if (obsoleted_by().empty()) obsoleted_by_ = style; @@ -829,6 +830,16 @@ docstring const & Layout::depends_on() const } +bool Layout::operator==(Layout const & rhs) const +{ + // This is enough for the applications we actually make, + // at least at the moment. But we could check more. + return name() == rhs.name() + && latexname() == rhs.latexname() + && latextype == rhs.latextype; +} + + Layout * Layout::forCaption() { Layout * lay = new Layout();