diff --git a/src/CmdDef.cpp b/src/CmdDef.cpp index 2a3158c3dd..2055ed5949 100644 --- a/src/CmdDef.cpp +++ b/src/CmdDef.cpp @@ -28,23 +28,18 @@ using namespace lyx::support; namespace lyx { -namespace { - -enum CmdDefTags { - BN_DEFFILE, - BN_DEFINE -}; - -LexerKeyword cmdDefTags[] = { - { "\\def_file", BN_DEFFILE }, - { "\\define", BN_DEFINE } -}; - -} - - bool CmdDef::read(string const & def_file) { + enum { + BN_DEFFILE, + BN_DEFINE + }; + + LexerKeyword cmdDefTags[] = { + { "\\def_file", BN_DEFFILE }, + { "\\define", BN_DEFINE } + }; + Lexer lexrc(cmdDefTags); if (lyxerr.debugging(Debug::PARSER)) lexrc.printTable(lyxerr); @@ -108,7 +103,7 @@ bool CmdDef::read(string const & def_file) } case BN_DEFFILE: if (lexrc.next()) { - string const tmp(lexrc.getString()); + string const tmp = lexrc.getString(); error |= !read(tmp); } else { lexrc.printError("BN_DEFFILE: Missing file name"); @@ -157,10 +152,10 @@ bool CmdDef::lock(string const & name, FuncRequest & func) void CmdDef::release(string const & name) { string const name2 = trim(name); - lockSet.erase(name2); } + CmdDef::newCmdDefResult CmdDef::newCmdDef(string const & name, string const & def) { @@ -173,8 +168,8 @@ CmdDef::newCmdDefResult CmdDef::newCmdDef(string const & name, return CmdDefExists; FuncRequest func = lyxaction.lookupFunc(def); - if (func.action == LFUN_NOACTION || - func.action == LFUN_UNKNOWN_ACTION) { + if (func.action == LFUN_NOACTION + || func.action == LFUN_UNKNOWN_ACTION) { return CmdDefInvalid; } diff --git a/src/Encoding.cpp b/src/Encoding.cpp index 5812410357..5e8cbb156e 100644 --- a/src/Encoding.cpp +++ b/src/Encoding.cpp @@ -522,12 +522,12 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile) } // Now read the encodings - enum Encodingtags { + enum { et_encoding = 1, et_end, }; - struct LexerKeyword encodingtags[] = { + LexerKeyword encodingtags[] = { { "encoding", et_encoding }, { "end", et_end } }; diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp index f8c8d683b7..324127cdb9 100644 --- a/src/KeyMap.cpp +++ b/src/KeyMap.cpp @@ -117,25 +117,20 @@ void KeyMap::clear() } -namespace { - -enum BindTags { - BN_BIND, - BN_BINDFILE, - BN_UNBIND, -}; - -LexerKeyword bindTags[] = { - { "\\bind", BN_BIND }, - { "\\bind_file", BN_BINDFILE }, - { "\\unbind", BN_UNBIND }, -}; - -} - - bool KeyMap::read(string const & bind_file, KeyMap * unbind_map) { + enum { + BN_BIND, + BN_BINDFILE, + BN_UNBIND, + }; + + LexerKeyword bindTags[] = { + { "\\bind", BN_BIND }, + { "\\bind_file", BN_BINDFILE }, + { "\\unbind", BN_UNBIND }, + }; + Lexer lexrc(bindTags); if (lyxerr.debugging(Debug::PARSER)) lexrc.printTable(lyxerr); diff --git a/src/Layout.cpp b/src/Layout.cpp index 05efa9c387..c3889fd2c4 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -504,7 +504,7 @@ bool Layout::read(Lexer & lexrc, TextClass const & tclass) } -enum AlignTags { +enum { AT_BLOCK = 1, AT_LEFT, AT_RIGHT, @@ -512,7 +512,6 @@ enum AlignTags { AT_LAYOUT }; - void Layout::readAlign(Lexer & lexrc) { LexerKeyword alignTags[] = { @@ -523,7 +522,7 @@ void Layout::readAlign(Lexer & lexrc) { "right", AT_RIGHT } }; - PushPopHelper pph(lexrc, alignTags, AT_LAYOUT); + PushPopHelper pph(lexrc, alignTags); int le = lexrc.lex(); switch (le) { case Lexer::LEX_UNDEF: @@ -531,7 +530,7 @@ void Layout::readAlign(Lexer & lexrc) return; default: break; }; - switch (static_cast(le)) { + switch (le) { case AT_BLOCK: align = LYX_ALIGN_BLOCK; break; @@ -572,7 +571,7 @@ void Layout::readAlignPossible(Lexer & lexrc) continue; default: break; }; - switch (static_cast(le)) { + switch (le) { case AT_BLOCK: alignpossible |= LYX_ALIGN_BLOCK; break; @@ -594,36 +593,36 @@ void Layout::readAlignPossible(Lexer & lexrc) } -enum LabelTypeTags { - LA_NO_LABEL = 1, - LA_MANUAL, - LA_TOP_ENVIRONMENT, - LA_CENTERED_TOP_ENVIRONMENT, - LA_STATIC, - LA_SENSITIVE, - LA_COUNTER, - LA_ENUMERATE, - LA_ITEMIZE, - LA_BIBLIO -}; - - void Layout::readLabelType(Lexer & lexrc) { - LexerKeyword labelTypeTags[] = { - { "bibliography", LA_BIBLIO }, - { "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT }, - { "counter", LA_COUNTER }, - { "enumerate", LA_ENUMERATE }, - { "itemize", LA_ITEMIZE }, - { "manual", LA_MANUAL }, - { "no_label", LA_NO_LABEL }, - { "sensitive", LA_SENSITIVE }, - { "static", LA_STATIC }, - { "top_environment", LA_TOP_ENVIRONMENT } + enum { + LA_NO_LABEL = 1, + LA_MANUAL, + LA_TOP_ENVIRONMENT, + LA_CENTERED_TOP_ENVIRONMENT, + LA_STATIC, + LA_SENSITIVE, + LA_COUNTER, + LA_ENUMERATE, + LA_ITEMIZE, + LA_BIBLIO }; - PushPopHelper pph(lexrc, labelTypeTags, LA_BIBLIO); + + LexerKeyword labelTypeTags[] = { + { "bibliography", LA_BIBLIO }, + { "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT }, + { "counter", LA_COUNTER }, + { "enumerate", LA_ENUMERATE }, + { "itemize", LA_ITEMIZE }, + { "manual", LA_MANUAL }, + { "no_label", LA_NO_LABEL }, + { "sensitive", LA_SENSITIVE }, + { "static", LA_STATIC }, + { "top_environment", LA_TOP_ENVIRONMENT } + }; + + PushPopHelper pph(lexrc, labelTypeTags); int le = lexrc.lex(); switch (le) { case Lexer::LEX_UNDEF: @@ -631,7 +630,7 @@ void Layout::readLabelType(Lexer & lexrc) return; default: break; } - switch (static_cast(le)) { + switch (le) { case LA_NO_LABEL: labeltype = LABEL_NO_LABEL; break; @@ -666,19 +665,16 @@ void Layout::readLabelType(Lexer & lexrc) } -static LexerKeyword endlabelTypeTags[] = -{ - { "box", END_LABEL_BOX }, - { "filled_box", END_LABEL_FILLED_BOX }, - { "no_label", END_LABEL_NO_LABEL }, - { "static", END_LABEL_STATIC } -}; - - void Layout::readEndLabelType(Lexer & lexrc) { - PushPopHelper pph(lexrc, endlabelTypeTags, - END_LABEL_ENUM_LAST-END_LABEL_ENUM_FIRST+1); + static LexerKeyword endlabelTypeTags[] = { + { "box", END_LABEL_BOX }, + { "filled_box", END_LABEL_FILLED_BOX }, + { "no_label", END_LABEL_NO_LABEL }, + { "static", END_LABEL_STATIC } + }; + + PushPopHelper pph(lexrc, endlabelTypeTags); int le = lexrc.lex(); switch (le) { case Lexer::LEX_UNDEF: @@ -708,7 +704,7 @@ void Layout::readMargin(Lexer & lexrc) { "static", MARGIN_STATIC } }; - PushPopHelper pph(lexrc, marginTags, MARGIN_RIGHT_ADDRESS_BOX); + PushPopHelper pph(lexrc, marginTags); int le = lexrc.lex(); switch (le) { @@ -741,7 +737,7 @@ void Layout::readLatexType(Lexer & lexrc) { "paragraph", LATEX_PARAGRAPH } }; - PushPopHelper pph(lexrc, latexTypeTags, LATEX_LIST_ENVIRONMENT); + PushPopHelper pph(lexrc, latexTypeTags); int le = lexrc.lex(); switch (le) { case Lexer::LEX_UNDEF: @@ -763,16 +759,15 @@ void Layout::readLatexType(Lexer & lexrc) } -enum SpacingTags { - ST_SPACING_SINGLE = 1, - ST_SPACING_ONEHALF, - ST_SPACING_DOUBLE, - ST_OTHER -}; - - void Layout::readSpacing(Lexer & lexrc) { + enum { + ST_SPACING_SINGLE = 1, + ST_SPACING_ONEHALF, + ST_SPACING_DOUBLE, + ST_OTHER + }; + LexerKeyword spacingTags[] = { {"double", ST_SPACING_DOUBLE }, {"onehalf", ST_SPACING_ONEHALF }, @@ -780,7 +775,7 @@ void Layout::readSpacing(Lexer & lexrc) {"single", ST_SPACING_SINGLE } }; - PushPopHelper pph(lexrc, spacingTags, ST_OTHER); + PushPopHelper pph(lexrc, spacingTags); int le = lexrc.lex(); switch (le) { case Lexer::LEX_UNDEF: @@ -788,7 +783,7 @@ void Layout::readSpacing(Lexer & lexrc) return; default: break; } - switch (static_cast(le)) { + switch (le) { case ST_SPACING_SINGLE: spacing.set(Spacing::Single); break; diff --git a/src/Lexer.cpp b/src/Lexer.cpp index a069c93e47..b5f72e51a2 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -67,7 +67,7 @@ public: /// bool next(bool esc = false); /// - int search_kw(char const * const tag) const; + int searchKeyword(char const * const tag) const; /// int lex(); /// @@ -424,7 +424,7 @@ bool Lexer::Pimpl::next(bool esc /* = false */) } -int Lexer::Pimpl::search_kw(char const * const tag) const +int Lexer::Pimpl::searchKeyword(char const * const tag) const { LexerKeyword search_tag = { tag, 0 }; LexerKeyword * res = @@ -444,7 +444,7 @@ int Lexer::Pimpl::lex() { //NOTE: possible bug. if (next() && status == LEX_TOKEN) - return search_kw(getString().c_str()); + return searchKeyword(getString().c_str()); return status; } @@ -721,7 +721,7 @@ string const Lexer::getLongString(string const & endtoken) LYXERR(Debug::PARSER, "LongString: `" << getString() << '\''); - // We do a case independent comparison, like search_kw does. + // We do a case independent comparison, like searchKeyword does. if (compare_ascii_no_case(token, endtoken) == 0) break; diff --git a/src/Lexer.h b/src/Lexer.h index c537eabfec..5419fab778 100644 --- a/src/Lexer.h +++ b/src/Lexer.h @@ -216,10 +216,11 @@ class PushPopHelper { public: /// - PushPopHelper(Lexer & lexrc, LexerKeyword * i, int s) - : lex(lexrc) + template + PushPopHelper(Lexer & l, LexerKeyword (&table)[N]) + : lex(l) { - lex.pushTable(i, s); + lex.pushTable(table, N); } /// ~PushPopHelper() diff --git a/src/LyX.cpp b/src/LyX.cpp index 7dc438a5c8..30cb397700 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -987,7 +987,7 @@ bool LyX::readUIFile(string const & name, bool include) ui_last }; - struct LexerKeyword uitags[] = { + LexerKeyword uitags[] = { { "include", ui_include }, { "menuset", ui_menuset }, { "toolbars", ui_toolbars }, diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 3d6e67ad69..b2db456122 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -195,7 +195,8 @@ LyXRC::LyXRC() } -void LyXRC::setDefaults() { +void LyXRC::setDefaults() +{ bind_file = "cua"; def_file = "default"; ui_file = "default"; diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 2d79a2b755..f7da2d11f2 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -622,10 +622,10 @@ void TextClass::readTitleType(Lexer & lexrc) { LexerKeyword titleTypeTags[] = { { "commandafter", TITLE_COMMAND_AFTER }, - { "environment", TITLE_ENVIRONMENT } + { "environment", TITLE_ENVIRONMENT } }; - PushPopHelper pph(lexrc, titleTypeTags, TITLE_ENVIRONMENT); + PushPopHelper pph(lexrc, titleTypeTags); int le = lexrc.lex(); switch (le) { @@ -648,12 +648,12 @@ void TextClass::readTitleType(Lexer & lexrc) void TextClass::readOutputType(Lexer & lexrc) { LexerKeyword outputTypeTags[] = { - { "docbook", DOCBOOK }, - { "latex", LATEX }, + { "docbook", DOCBOOK }, + { "latex", LATEX }, { "literate", LITERATE } }; - PushPopHelper pph(lexrc, outputTypeTags, LITERATE); + PushPopHelper pph(lexrc, outputTypeTags); int le = lexrc.lex(); switch (le) { @@ -674,22 +674,21 @@ void TextClass::readOutputType(Lexer & lexrc) } -enum ClassOptionsTags { - CO_FONTSIZE = 1, - CO_PAGESTYLE, - CO_OTHER, - CO_HEADER, - CO_END -}; - - void TextClass::readClassOptions(Lexer & lexrc) { + enum { + CO_FONTSIZE = 1, + CO_PAGESTYLE, + CO_OTHER, + CO_HEADER, + CO_END + }; + LexerKeyword classOptionsTags[] = { - {"end", CO_END }, - {"fontsize", CO_FONTSIZE }, - {"header", CO_HEADER }, - {"other", CO_OTHER }, + {"end", CO_END }, + {"fontsize", CO_FONTSIZE }, + {"header", CO_HEADER }, + {"other", CO_OTHER }, {"pagestyle", CO_PAGESTYLE } }; @@ -703,7 +702,7 @@ void TextClass::readClassOptions(Lexer & lexrc) continue; default: break; } - switch (static_cast(le)) { + switch (le) { case CO_FONTSIZE: lexrc.next(); opt_fontsize_ = rtrim(lexrc.getString()); @@ -729,21 +728,20 @@ void TextClass::readClassOptions(Lexer & lexrc) } -enum FloatTags { - FT_TYPE = 1, - FT_NAME, - FT_PLACEMENT, - FT_EXT, - FT_WITHIN, - FT_STYLE, - FT_LISTNAME, - FT_BUILTIN, - FT_END -}; - - void TextClass::readFloat(Lexer & lexrc) { + enum { + FT_TYPE = 1, + FT_NAME, + FT_PLACEMENT, + FT_EXT, + FT_WITHIN, + FT_STYLE, + FT_LISTNAME, + FT_BUILTIN, + FT_END + }; + LexerKeyword floatTags[] = { { "end", FT_END }, { "extension", FT_EXT }, @@ -776,7 +774,7 @@ void TextClass::readFloat(Lexer & lexrc) continue; default: break; } - switch (static_cast(le)) { + switch (le) { case FT_TYPE: lexrc.next(); type = lexrc.getString(); @@ -845,17 +843,16 @@ void TextClass::readFloat(Lexer & lexrc) } -enum CounterTags { - CT_NAME = 1, - CT_WITHIN, - CT_LABELSTRING, - CT_LABELSTRING_APPENDIX, - CT_END -}; - - void TextClass::readCounter(Lexer & lexrc) { + enum { + CT_NAME = 1, + CT_WITHIN, + CT_LABELSTRING, + CT_LABELSTRING_APPENDIX, + CT_END + }; + LexerKeyword counterTags[] = { { "end", CT_END }, { "labelstring", CT_LABELSTRING }, @@ -880,7 +877,7 @@ void TextClass::readCounter(Lexer & lexrc) continue; default: break; } - switch (static_cast(le)) { + switch (le) { case CT_NAME: lexrc.next(); name = lexrc.getDocString(); diff --git a/src/Trans.cpp b/src/Trans.cpp index 2c25db7039..57db85f540 100644 --- a/src/Trans.cpp +++ b/src/Trans.cpp @@ -378,7 +378,7 @@ docstring const Trans::process(char_type c, TransManager & k) int Trans::load(string const & language) { - struct LexerKeyword kmapTags[] = { + LexerKeyword kmapTags[] = { {"\\kcomb", KCOMB }, { "\\kmap", KMAP }, { "\\kmod", KMOD }, diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp index 7867d4a1e9..c22f49a761 100644 --- a/src/frontends/qt4/Menus.cpp +++ b/src/frontends/qt4/Menus.cpp @@ -357,7 +357,7 @@ void MenuDefinition::addWithStatusCheck(MenuItem const & i) void MenuDefinition::read(Lexer & lex) { - enum Menutags { + enum { md_item = 1, md_branches, md_documents, @@ -382,7 +382,7 @@ void MenuDefinition::read(Lexer & lex) md_toolbars }; - struct LexerKeyword menutags[] = { + LexerKeyword menutags[] = { { "bookmarks", md_bookmarks }, { "branches", md_branches }, { "charstyles", md_charstyles }, @@ -1404,13 +1404,13 @@ Menus::Menus() : d(new Impl) {} void Menus::read(Lexer & lex) { - enum Menutags { + enum { md_menu, md_menubar, md_endmenuset, }; - struct LexerKeyword menutags[] = { + LexerKeyword menutags[] = { { "end", md_endmenuset }, { "menu", md_menu }, { "menubar", md_menubar } diff --git a/src/insets/ExternalTemplate.cpp b/src/insets/ExternalTemplate.cpp index 73a115484d..7b47955aa2 100644 --- a/src/insets/ExternalTemplate.cpp +++ b/src/insets/ExternalTemplate.cpp @@ -73,16 +73,16 @@ class DumpPreambleDef { public: typedef TemplateManager::PreambleDefs::value_type value_type; - DumpPreambleDef(ostream & o) : ost(o) {} + DumpPreambleDef(ostream & os) : os_(os) {} void operator()(value_type const & vt) { - ost << "PreambleDef " << vt.first << '\n' + os_ << "PreambleDef " << vt.first << '\n' << vt.second << "PreambleDefEnd" << endl; } private: - ostream & ost; + ostream & os_; }; @@ -90,12 +90,12 @@ class DumpTemplate { public: typedef TemplateManager::Templates::value_type value_type; - DumpTemplate(ostream & o) : ost(o) {} + DumpTemplate(ostream & os) : os_(os) {} void operator()(value_type const & vt) { Template const & et = vt.second; - ost << "Template " << et.lyxName << '\n' + os_ << "Template " << et.lyxName << '\n' << "\tGuiName " << et.guiName << '\n' << "\tHelpText\n" << et.helpText @@ -108,28 +108,28 @@ public: IDs::const_iterator it = et.transformIds.begin(); IDs::const_iterator end = et.transformIds.end(); for (; it != end; ++it) { - ost << "\tTransform " + os_ << "\tTransform " << transformIDTranslator().find(*it) << '\n'; } - et.dumpFormats(ost); - ost << "TemplateEnd" << endl; + et.dumpFormats(os_); + os_ << "TemplateEnd" << endl; } private: - ostream & ost; + ostream & os_; }; class DumpFormat { public: typedef Template::Formats::value_type value_type; - DumpFormat(ostream & o) : ost(o) {} + DumpFormat(ostream & o) : os_(o) {} void operator()(value_type const & vt) const { Template::Format const & ft = vt.second; - ost << "\tFormat " << vt.first << '\n' + os_ << "\tFormat " << vt.first << '\n' << "\t\tProduct " << ft.product << '\n' << "\t\tUpdateFormat " << ft.updateFormat << '\n' << "\t\tUpdateResult " << ft.updateResult << '\n'; @@ -138,14 +138,14 @@ public: vector::const_iterator qend = ft.requirements.end(); for (; qit != qend; ++qit) { lyxerr << "req:" << *qit << endl; - ost << "\t\tRequirement " << *qit << '\n'; + os_ << "\t\tRequirement " << *qit << '\n'; } typedef vector Options; Options::const_iterator oit = ft.options.begin(); Options::const_iterator oend = ft.options.end(); for (; oit != oend; ++oit) { - ost << "\t\tOption " + os_ << "\t\tOption " << oit->name << ": " << oit->option @@ -155,7 +155,7 @@ public: vector::const_iterator pit = ft.preambleNames.begin(); vector::const_iterator pend = ft.preambleNames.end(); for (; pit != pend; ++pit) { - ost << "\t\tPreamble " << *pit << '\n'; + os_ << "\t\tPreamble " << *pit << '\n'; } typedef Template::Format::FileMap FileMap; @@ -165,15 +165,15 @@ public: vector::const_iterator fit = rit->second.begin(); vector::const_iterator fend = rit->second.end(); for (; fit != fend; ++fit) { - ost << "\t\tReferencedFile " << rit->first + os_ << "\t\tReferencedFile " << rit->first << " \"" << *fit << "\"\n"; } } - ost << "\tFormatEnd\n"; + os_ << "\tFormatEnd\n"; } private: - ostream & ost; + ostream & os_; }; @@ -333,7 +333,7 @@ void Template::readTemplate(Lexer & lex) { "transform", TO_TRANSFORM } }; - PushPopHelper pph(lex, templateoptiontags, TO_END); + PushPopHelper pph(lex, templateoptiontags); while (lex.isOK()) { switch (lex.lex()) { @@ -467,7 +467,7 @@ void setOptionFactory(Template::Format & format, string const & transform, void Template::Format::readFormat(Lexer & lex) { - enum FormatTags { + enum { FO_PRODUCT = 1, FO_UPDATEFORMAT, FO_UPDATERESULT, @@ -493,7 +493,7 @@ void Template::Format::readFormat(Lexer & lex) { "updateresult", FO_UPDATERESULT } }; - PushPopHelper pph(lex, formattags, FO_END); + PushPopHelper pph(lex, formattags); while (lex.isOK()) { switch (lex.lex()) { @@ -564,6 +564,3 @@ void Template::Format::readFormat(Lexer & lex) } // namespace external } // namespace lyx - - - diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index 1d52515746..b8e89d9509 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -245,7 +245,7 @@ void InsetExternalParams::write(Buffer const & buf, ostream & os) const bool InsetExternalParams::read(Buffer const & buffer, Lexer & lex) { - enum ExternalTags { + enum { EX_TEMPLATE = 1, EX_FILENAME, EX_EMBED, @@ -283,7 +283,7 @@ bool InsetExternalParams::read(Buffer const & buffer, Lexer & lex) { "width", EX_WIDTH } }; - PushPopHelper pph(lex, external_tags, EX_END); + PushPopHelper pph(lex, external_tags); bool found_end = false; bool read_error = false; diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp index 4a0c35d02c..16051dc71a 100644 --- a/src/insets/InsetLayout.cpp +++ b/src/insets/InsetLayout.cpp @@ -38,39 +38,19 @@ InsetLayout::InsetLayout() : } -enum InsetLayoutTags { - IL_FONT, - IL_BGCOLOR, - IL_DECORATION, - IL_FREESPACING, - IL_FORCELTR, - IL_LABELFONT, - IL_LABELSTRING, - IL_LATEXNAME, - IL_LATEXPARAM, - IL_LATEXTYPE, - IL_LYXTYPE, - IL_KEEPEMPTY, - IL_MULTIPAR, - IL_NEEDPROTECT, - IL_PASSTHRU, - IL_PREAMBLE, - IL_REQUIRES, - IL_END -}; - - namespace { - InsetLayout::InsetDecoration translateDecoration(std::string const & str) - { - if (str == "classic") - return InsetLayout::Classic; - if (str == "minimalistic") - return InsetLayout::Minimalistic; - if (str == "conglomerate") - return InsetLayout::Conglomerate; - return InsetLayout::Default; - } + +InsetLayout::InsetDecoration translateDecoration(std::string const & str) +{ + if (str == "classic") + return InsetLayout::Classic; + if (str == "minimalistic") + return InsetLayout::Minimalistic; + if (str == "conglomerate") + return InsetLayout::Conglomerate; + return InsetLayout::Default; +} + } @@ -78,6 +58,28 @@ bool InsetLayout::read(Lexer & lexrc) { name_ = support::subst(lexrc.getDocString(), '_', ' '); + enum { + IL_FONT, + IL_BGCOLOR, + IL_DECORATION, + IL_FREESPACING, + IL_FORCELTR, + IL_LABELFONT, + IL_LABELSTRING, + IL_LATEXNAME, + IL_LATEXPARAM, + IL_LATEXTYPE, + IL_LYXTYPE, + IL_KEEPEMPTY, + IL_MULTIPAR, + IL_NEEDPROTECT, + IL_PASSTHRU, + IL_PREAMBLE, + IL_REQUIRES, + IL_END + }; + + LexerKeyword elementTags[] = { { "bgcolor", IL_BGCOLOR }, { "decoration", IL_DECORATION }, @@ -114,7 +116,7 @@ bool InsetLayout::read(Lexer & lexrc) continue; default: break; } - switch (static_cast(le)) { + switch (le) { case IL_LYXTYPE: lexrc.next(); lyxtype_ = lexrc.getString();