X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetCommandParams.cpp;h=90fe6cca8ad813cd38ac067f29b1e13ee25610ff;hb=06254d11dfdf670fab3548dc2a2674e7a261262c;hp=b29c8ee9cb5166a623c84397af634dc40a8a086e;hpb=07b6198f4c3aa6dfe3245394b660966fd3e85c99;p=lyx.git diff --git a/src/insets/InsetCommandParams.cpp b/src/insets/InsetCommandParams.cpp index b29c8ee9cb..90fe6cca8a 100644 --- a/src/insets/InsetCommandParams.cpp +++ b/src/insets/InsetCommandParams.cpp @@ -27,47 +27,21 @@ #include "InsetRef.h" #include "InsetTOC.h" -#include "debug.h" -#include "gettext.h" +#include "support/debug.h" +#include "support/gettext.h" #include "Lexer.h" #include "support/ExceptionMessage.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; - -ICPInfo::ICPInfo(std::string const & s, bool b) - : paramName(s), optional(b) -{} - - -void ICPList::addParam(std::string const & s, bool b) { - plist_.push_back(ICPInfo(s, b)); -} - - -bool ICPList::hasParam(std::string const & s) { - PList::const_iterator it = begin(); - PList::const_iterator et = end(); - for (; it != et; ++it) { - if (it->paramName == s) - return true; - } - return false; -} - InsetCommandParams::InsetCommandParams(InsetCode code) : insetCode_(code), preview_(false) @@ -90,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: @@ -107,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: @@ -128,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(); @@ -144,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: @@ -166,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: @@ -183,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: @@ -207,8 +175,8 @@ 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.")); } @@ -216,8 +184,8 @@ void InsetCommandParams::setCmdName(string const & 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); @@ -228,7 +196,7 @@ void InsetCommandParams::setCmdName(string const & name) params[j] = params_[i]; } info_ = info; - std::swap(params, params_); + swap(params, params_); }