X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetCommandParams.cpp;h=f93f83552eaabad7e06ebd48e047604209eb991e;hb=2c357c1d23b7b83839a9beb8225d4f1ae4f793b4;hp=125f5de943af036768014a32881592a78f2cdccc;hpb=8f2a8c72672ae933227e072c006e512aaad7c409;p=lyx.git diff --git a/src/insets/InsetCommandParams.cpp b/src/insets/InsetCommandParams.cpp index 125f5de943..f93f83552e 100644 --- a/src/insets/InsetCommandParams.cpp +++ b/src/insets/InsetCommandParams.cpp @@ -27,26 +27,21 @@ #include "InsetRef.h" #include "InsetTOC.h" -#include "debug.h" -#include "gettext.h" #include "Lexer.h" +#include "support/debug.h" #include "support/ExceptionMessage.h" +#include "support/gettext.h" #include "support/lstrings.h" +#include "support/docstream.h" #include +using namespace std; +using namespace lyx::support; namespace lyx { -using support::findToken; - -using std::string; -using std::endl; -using std::ostream; - -using support::ExceptionMessage; -using support::WarningException; InsetCommandParams::InsetCommandParams(InsetCode code) : insetCode_(code), preview_(false) @@ -69,7 +64,7 @@ InsetCommandParams::InsetCommandParams(InsetCode code, CommandInfo const * InsetCommandParams::findInfo( - InsetCode code, std::string const & cmdName) + InsetCode code, string const & cmdName) { switch (code) { case BIBITEM_CODE: @@ -86,8 +81,6 @@ CommandInfo const * InsetCommandParams::findInfo( return InsetHyperlink::findInfo(cmdName); case INCLUDE_CODE: return InsetInclude::findInfo(cmdName); - case INDEX_CODE: - return InsetIndex::findInfo(cmdName); case INDEX_PRINT_CODE: return InsetPrintIndex::findInfo(cmdName); case LABEL_CODE: @@ -107,7 +100,7 @@ CommandInfo const * InsetCommandParams::findInfo( } -std::string InsetCommandParams::getDefaultCmd(InsetCode code) { +string InsetCommandParams::getDefaultCmd(InsetCode code) { switch (code) { case BIBITEM_CODE: return InsetBibitem::defaultCommand(); @@ -123,8 +116,6 @@ std::string InsetCommandParams::getDefaultCmd(InsetCode code) { return InsetHyperlink::defaultCommand(); case INCLUDE_CODE: return InsetInclude::defaultCommand(); - case INDEX_CODE: - return InsetIndex::defaultCommand(); case INDEX_PRINT_CODE: return InsetPrintIndex::defaultCommand(); case LABEL_CODE: @@ -145,7 +136,7 @@ std::string InsetCommandParams::getDefaultCmd(InsetCode code) { bool InsetCommandParams::isCompatibleCommand( - InsetCode code, std::string const & s) + InsetCode code, string const & s) { switch (code) { case BIBITEM_CODE: @@ -162,8 +153,6 @@ bool InsetCommandParams::isCompatibleCommand( return InsetHyperlink::isCompatibleCommand(s); case INCLUDE_CODE: return InsetInclude::isCompatibleCommand(s); - case INDEX_CODE: - return InsetIndex::isCompatibleCommand(s); case INDEX_PRINT_CODE: return InsetPrintIndex::isCompatibleCommand(s); case LABEL_CODE: @@ -186,17 +175,17 @@ bool InsetCommandParams::isCompatibleCommand( void InsetCommandParams::setCmdName(string const & name) { if (!isCompatibleCommand(insetCode_, cmdName_)){ - lyxerr << "InsetCommand: Incompatible command name " << - name << "." << std::endl; + LYXERR0("InsetCommand: Incompatible command name " << + name << "."); throw ExceptionMessage(WarningException, _("InsetCommand Error: "), - from_utf8("Incompatible command name.")); + _("Incompatible command name.")); } cmdName_ = name; CommandInfo const * const info = findInfo(insetCode_, cmdName_); if (!info) { - lyxerr << "Command '" << name << "' is not compatible with a '" << - insetType() << "' inset." << std::endl; + LYXERR0("Command '" << name << "' is not compatible with a '" << + insetType() << "' inset."); return; } ParamVector params(info->n); @@ -207,7 +196,7 @@ void InsetCommandParams::setCmdName(string const & name) params[j] = params_[i]; } info_ = info; - std::swap(params, params_); + swap(params, params_); } @@ -218,9 +207,9 @@ void InsetCommandParams::read(Lexer & lex) string const insetType = lex.getString(); InsetCode const code = insetCode(insetType); if (code != insetCode_) { - lex.printError("InsetCommand: Attempt to change type of parameters."); - throw ExceptionMessage(WarningException, _("InsetCommand Error: "), - from_utf8("Attempt to change type of parameters.")); + lex.printError("InsetCommandParams: Attempt to change type of inset."); + throw ExceptionMessage(WarningException, _("InsetCommandParams Error: "), + _("Attempt to change type of parameters.")); } } @@ -228,24 +217,24 @@ void InsetCommandParams::read(Lexer & lex) lex.next(); string const test = lex.getString(); if (test != "LatexCommand") { - lex.printError("InsetCommand: no LatexCommand line found."); - throw ExceptionMessage(WarningException, _("InsetCommand error:"), - from_utf8("Can't find LatexCommand line.")); + lex.printError("InsetCommandParams: No LatexCommand line found."); + throw ExceptionMessage(WarningException, _("InsetCommandParams error:"), + _("Can't find LatexCommand line.")); } } lex.next(); cmdName_ = lex.getString(); if (!isCompatibleCommand(insetCode_, cmdName_)){ - lex.printError("InsetCommand: Incompatible command name " + cmdName_ + "."); - throw ExceptionMessage(WarningException, _("InsetCommand Error: "), - from_utf8("Incompatible command name.")); + lex.printError("InsetCommandParams: Incompatible command name " + cmdName_ + "."); + throw ExceptionMessage(WarningException, _("InsetCommandParams Error: "), + _("Incompatible command name.")); } info_ = findInfo(insetCode_, cmdName_); if (!info_) { - lex.printError("InsetCommand: Unknown inset name `$$Token'"); + lex.printError("InsetCommandParams: Unknown inset name `$$Token'"); throw ExceptionMessage(WarningException, - _("Unknown inset name: "), from_utf8(insetType())); + _("Unknown inset name: "), from_utf8(insetType())); } string token; @@ -266,7 +255,7 @@ void InsetCommandParams::read(Lexer & lex) } else { lex.printError("Unknown parameter name `$$Token' for command " + cmdName_); throw ExceptionMessage(WarningException, - _("Inset Command: ") + from_ascii(cmdName_), + _("InsetCommandParams: ") + from_ascii(cmdName_), _("Unknown parameter name: ") + from_utf8(token)); } }