After a hiatus, I'm returning to the rewrite of InsetCommandParams, the purpose of all of this being to make things more flexible, with the ultimate goal being biblatex support and a kind of InsetCommandFlex that will allow user-definable such things. The next step, really, is to fix up CiteEngine so that we can have different sets of parameters for InsetCitation depending upon what engine is in use. (Something like this also needs doing with InsetInclude.)

This patch reworks the machinery that holds information about what parameters there are and what their values are. There's enough flexibility here that true keyval support ought to be fairly easy at this point. I'll have a peek at that shortly.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23168 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-02-23 22:01:02 +00:00
parent c207a8fe0b
commit 8e9410b3d0
27 changed files with 294 additions and 179 deletions

View File

@ -38,8 +38,6 @@ namespace lyx {
int InsetBibitem::key_counter = 0;
docstring const key_prefix = from_ascii("key-");
@ -51,12 +49,14 @@ InsetBibitem::InsetBibitem(InsetCommandParams const & p)
}
CommandInfo const * InsetBibitem::findInfo(string const & /* cmdName */)
ParamInfo const & InsetBibitem::findInfo(string const & /* cmdName */)
{
static const char * const paramnames[] = {"label", "key", ""};
static const bool isoptional[] = {true, false};
static const CommandInfo info = {2, paramnames, isoptional};
return &info;
static ParamInfo param_info_;
if (param_info_.empty()) {
param_info_.add("label", true);
param_info_.add("key", false);
}
return param_info_;
}

View File

@ -46,7 +46,7 @@ public:
/// Update the counter of this inset
virtual void updateLabels(Buffer const &, ParIterator const &);
///
static CommandInfo const * findInfo(std::string const &);
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "bibitem"; };
///
@ -56,8 +56,8 @@ protected:
///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
///
virtual Inset * clone() const;
/// The label that is set by updateLabels
docstring autolabel_;
///

View File

@ -53,13 +53,16 @@ InsetBibtex::InsetBibtex(InsetCommandParams const & p)
{}
CommandInfo const * InsetBibtex::findInfo(string const & /* cmdName */)
ParamInfo const & InsetBibtex::findInfo(string const & /* cmdName */)
{
static const char * const paramnames[] =
{"options", "btprint", "bibfiles", "embed", ""};
static const bool isoptional[] = {true, true, false, false};
static const CommandInfo info = {4, paramnames, isoptional};
return &info;
static ParamInfo param_info_;
if (param_info_.empty()) {
param_info_.add("options", true);
param_info_.add("btprint", true);
param_info_.add("bibfiles", false);
param_info_.add("embed", false);
}
return param_info_;
}

View File

@ -49,7 +49,7 @@ public:
///
void validate(LaTeXFeatures &) const;
///
static CommandInfo const * findInfo(std::string const &);
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "bibtex"; };
///
@ -61,8 +61,10 @@ public:
void updateEmbeddedFile(Buffer const & buf, EmbeddedFile const & file);
protected:
///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
///
virtual Inset * clone() const;
};

View File

@ -375,22 +375,26 @@ docstring const getBasicLabel(docstring const & keyList, docstring const & after
} // anon namespace
ParamInfo InsetCitation::param_info_;
InsetCitation::InsetCitation(InsetCommandParams const & p)
: InsetCommand(p, "citation")
{}
CommandInfo const * InsetCitation::findInfo(string const & /* cmdName */)
ParamInfo const & InsetCitation::findInfo(string const & /* cmdName */)
{
// standard cite does only take one argument if jurabib is
// not used, but jurabib extends this to two arguments, so
// we have to allow both here. InsetCitation takes care that
// LaTeX output is nevertheless correct.
static const char * const paramnames[] =
{"after", "before", "key", ""};
static const bool isoptional[] = {true, true, false};
static const CommandInfo info = {3, paramnames, isoptional};
return &info;
if (param_info_.empty()) {
param_info_.add("after", true);
param_info_.add("before", true);
param_info_.add("key", false);
}
return param_info_;
}

View File

@ -49,7 +49,7 @@ public:
///
void validate(LaTeXFeatures &) const;
///
static CommandInfo const * findInfo(std::string const &);
static ParamInfo const & findInfo(std::string const &);
//FIXME This is the locus of the design problem we have.
//It really ought to do what default_cite_command() does,
//but to do that it needs to know what CiteEngine we are
@ -59,14 +59,16 @@ public:
///
static bool isCompatibleCommand(std::string const & cmd);
private:
///
virtual Inset * clone() const
{
return new InsetCitation(params());
}
{ return new InsetCitation(params()); }
/// we'll eventually want to be able to get info on this from the
/// various CiteEngines
static ParamInfo param_info_;
/// This function does the donkey work of creating the pretty label
docstring const generateLabel(Buffer const &) const;
///
class Cache {
public:
///

View File

@ -80,7 +80,7 @@ public:
bool setMouseHover(bool mouse_hover);
/// Return parameter information for command cmdName.
/// Not implemented here. Must be implemented in derived class.
static CommandInfo const * findInfo(std::string const & cmdName);
static ParamInfo const & findInfo(std::string const & cmdName);
/// Return default command for this inset.
/// Not implemented here. Must be implemented in derived class.
static std::string defaultCommand();

View File

@ -42,14 +42,63 @@ using namespace lyx::support;
namespace lyx {
ParamInfo::ParamData::ParamData(std::string const & s, bool b) :
name_(s), optional_(b)
{}
bool ParamInfo::ParamData::operator==(ParamInfo::ParamData const & rhs) const
{
return name() == rhs.name() && isOptional() == rhs.isOptional();
}
bool ParamInfo::hasParam(std::string const & name) const
{
const_iterator it = begin();
for (; it != end(); ++it) {
if (it->name() == name)
return true;
}
return false;
}
void ParamInfo::add(std::string const & name, bool opt)
{
info_.push_back(ParamData(name, opt));
}
bool ParamInfo::operator==(ParamInfo const & rhs) const
{
// the idea here is to check each ParamData for equality
const_iterator itL = begin();
const_iterator itR = rhs.begin();
const_iterator endL = end();
const_iterator endR = rhs.end();
while (true) {
// if they both end together, return true
if (itL == endL && itR == endR)
return true;
// but if one ends before the other, return false
if (itL == endL || itR == endR)
return false;
//check this one for equality
if (*itL != *itR)
return false;
// equal, so check the next one
++itL;
++itR;
}
}
InsetCommandParams::InsetCommandParams(InsetCode code)
: insetCode_(code), preview_(false)
{
cmdName_ = getDefaultCmd(code);
info_ = findInfo(code, cmdName_);
BOOST_ASSERT(info_);
params_.resize(info_->n);
}
@ -58,12 +107,10 @@ InsetCommandParams::InsetCommandParams(InsetCode code,
: insetCode_(code), cmdName_(cmdName), preview_(false)
{
info_ = findInfo(code, cmdName);
BOOST_ASSERT(info_);
params_.resize(info_->n);
}
CommandInfo const * InsetCommandParams::findInfo(
ParamInfo const & InsetCommandParams::findInfo(
InsetCode code, string const & cmdName)
{
switch (code) {
@ -96,7 +143,8 @@ CommandInfo const * InsetCommandParams::findInfo(
default:
BOOST_ASSERT(false);
}
return 0;
static const ParamInfo pi;
return pi; // to silence the warning
}
@ -131,7 +179,7 @@ string InsetCommandParams::getDefaultCmd(InsetCode code) {
default:
BOOST_ASSERT(false);
}
return string(); //silence the warning
return string(); // silence the warning
}
@ -168,7 +216,7 @@ bool InsetCommandParams::isCompatibleCommand(
default:
BOOST_ASSERT(false);
}
return false; //silence the warning
return false; // silence the warning
}
@ -182,21 +230,7 @@ void InsetCommandParams::setCmdName(string const & name)
}
cmdName_ = name;
CommandInfo const * const info = findInfo(insetCode_, cmdName_);
if (!info) {
LYXERR0("Command '" << name << "' is not compatible with a '" <<
insetType() << "' inset.");
return;
}
ParamVector params(info->n);
// Overtake parameters with the same name
for (size_t i = 0; i < info_->n; ++i) {
int j = findToken(info->paramnames, info_->paramnames[i]);
if (j >= 0)
params[j] = params_[i];
}
info_ = info;
swap(params, params_);
info_ = findInfo(insetCode_, cmdName_);
}
@ -231,11 +265,6 @@ void InsetCommandParams::read(Lexer & lex)
}
info_ = findInfo(insetCode_, cmdName_);
if (!info_) {
lex.printError("InsetCommandParams: Unknown inset name `$$Token'");
throw ExceptionMessage(WarningException,
_("Unknown inset name: "), from_utf8(insetType()));
}
string token;
while (lex.isOK()) {
@ -248,10 +277,9 @@ void InsetCommandParams::read(Lexer & lex)
preview_ = lex.getBool();
continue;
}
int const i = findToken(info_->paramnames, token);
if (i >= 0) {
if (info_.hasParam(token)) {
lex.next(true);
params_[i] = lex.getDocString();
params_[token] = lex.getDocString();
} else {
lex.printError("Unknown parameter name `$$Token' for command " + cmdName_);
throw ExceptionMessage(WarningException,
@ -275,12 +303,18 @@ void InsetCommandParams::write(ostream & os) const
os << "LatexCommand " << cmdName_ << '\n';
if (preview_)
os << "preview true\n";
for (size_t i = 0; i < info_->n; ++i)
if (!params_[i].empty())
ParamInfo::const_iterator it = info_.begin();
ParamInfo::const_iterator end = info_.end();
for (; it != end; ++it) {
std::string const & name = it->name();
docstring const & data = (*this)[name];
if (!data.empty()) {
// FIXME UNICODE
os << info_->paramnames[i] << ' '
<< Lexer::quoteString(to_utf8(params_[i]))
os << name << ' '
<< Lexer::quoteString(to_utf8(data))
<< '\n';
}
}
}
@ -288,28 +322,36 @@ docstring const InsetCommandParams::getCommand() const
{
docstring s = '\\' + from_ascii(cmdName_);
bool noparam = true;
for (size_t i = 0; i < info_->n; ++i) {
if (info_->optional[i]) {
if (params_[i].empty()) {
// We need to write this parameter even if
// it is empty if nonempty optional parameters
// follow before the next required parameter.
for (size_t j = i + 1; j < info_->n; ++j) {
if (!info_->optional[j])
break;
if (!params_[j].empty()) {
s += "[]";
noparam = false;
break;
}
}
} else {
s += '[' + params_[i] + ']';
noparam = false;
}
} else {
s += '{' + params_[i] + '}';
ParamInfo::const_iterator it = info_.begin();
ParamInfo::const_iterator end = info_.end();
for (; it != end; ++it) {
std::string const & name = it->name();
docstring const & data = (*this)[name];
if (!it->isOptional()) {
s += '{' + data + '}';
noparam = false;
continue;
}
if (!data.empty()) {
s += '[' + data + ']';
noparam = false;
continue;
}
// This param is therefore optional but empty.
// But we need to write it anyway if nonempty
// optional parameters follow before the next
// required parameter.
ParamInfo::const_iterator it2 = it;
for (++it2; it2 != end; ++it2) {
if (!it2->isOptional())
break;
std::string const & name2 = it2->name();
docstring const & data2 = (*this)[name2];
if (!data2.empty()) {
s += "[]";
noparam = false;
break;
}
}
}
if (noparam)
@ -320,36 +362,47 @@ docstring const InsetCommandParams::getCommand() const
}
namespace {
//predicate for what follows
bool paramIsNonOptional(ParamInfo::ParamData pi)
{
return !pi.isOptional();
}
}
docstring const InsetCommandParams::getFirstNonOptParam() const
{
for (size_t i = 0; i < info_->n; ++i)
if (!info_->optional[i])
return params_[i];
BOOST_ASSERT(false);
return docstring();
ParamInfo::const_iterator it =
find_if(info_.begin(), info_.end(), paramIsNonOptional);
if (it == info_.end())
BOOST_ASSERT(false);
return (*this)[it->name()];
}
docstring const & InsetCommandParams::operator[](string const & name) const
{
int const i = findToken(info_->paramnames, name);
BOOST_ASSERT(i >= 0);
return params_[i];
static const docstring dummy; //so we don't return a ref to temporary
if (!info_.hasParam(name))
BOOST_ASSERT(false);
ParamMap::const_iterator data = params_.find(name);
if (data == params_.end() || data->second.empty())
return dummy;
return data->second;
}
docstring & InsetCommandParams::operator[](string const & name)
{
int const i = findToken(info_->paramnames, name);
BOOST_ASSERT(i >= 0);
return params_[i];
if (!info_.hasParam(name))
BOOST_ASSERT(false);
return params_[name];
}
void InsetCommandParams::clear()
{
for (size_t i = 0; i < info_->n; ++i)
params_[i].clear();
params_.clear();
}

View File

@ -20,21 +20,57 @@
#include <iosfwd>
#include <string>
#include <vector>
#include <map>
namespace lyx {
class Lexer;
// No parameter may be named "preview", because that is a required
// flag for all commands.
struct CommandInfo {
/// Number of parameters
size_t n;
/// Parameter names. paramnames[n] must be "".
char const * const * paramnames;
/// Tells whether a parameter is optional
bool const * optional;
class ParamInfo {
public:
///
class ParamData {
// No parameter may be named "preview", because that is a required
// flag for all commands.
public:
///
ParamData(std::string const &, bool);
///
std::string name() const { return name_; }
///
bool isOptional() const { return optional_; }
///
bool operator==(ParamData const &) const;
///
bool operator!=(ParamData const & rhs) const
{ return !(*this == rhs); }
private:
///
std::string name_;
///
bool optional_;
};
/// adds a new parameter
void add(std::string const & name, bool optional);
///
bool empty() const { return info_.empty(); }
///
size_t size() const { return info_.size(); }
///
typedef std::vector<ParamData>::const_iterator const_iterator;
///
const_iterator begin() const { return info_.begin(); }
///
const_iterator end() const { return info_.end(); }
///
bool hasParam(std::string const & name) const;
///
bool operator==(ParamInfo const &) const;
private:
///
std::vector<ParamData> info_;
};
@ -81,29 +117,27 @@ private:
///
/// Get information for inset type \p code.
/// Returns 0 if the inset is not known.
static CommandInfo const * findInfo(InsetCode code);
static ParamInfo const & findInfo(InsetCode code);
/// Get information for \p code and command \p cmdName.
/// Returns 0 if the combination is not known.
/// Don't call this without first making sure the command name is
/// acceptable to the inset.
static CommandInfo const * findInfo(InsetCode code,
static ParamInfo const & findInfo(InsetCode code,
std::string const & cmdName);
///
static bool isCompatibleCommand(InsetCode code, std::string const & s);
///
std::string getDefaultCmd(InsetCode);
/// Description of all command properties
CommandInfo const * info_;
ParamInfo info_;
/// what kind of inset we're the parameters for
InsetCode insetCode_;
/// The name of this command as it appears in .lyx and .tex files
std::string cmdName_;
///
typedef std::vector<docstring> ParamVector;
/// The parameters (both optional and required ones). The order is
/// the same that is required for LaTeX output. The size of params_
/// is always info_->n.
ParamVector params_;
typedef std::map<std::string, docstring> ParamMap;
/// The parameters, by name.
ParamMap params_;
///
bool preview_;
///
@ -111,10 +145,8 @@ private:
InsetCommandParams const &);
};
///
bool operator==(InsetCommandParams const &, InsetCommandParams const &);
///
bool operator!=(InsetCommandParams const &, InsetCommandParams const &);

View File

@ -48,12 +48,13 @@ InsetFloatList::InsetFloatList(string const & type)
}
CommandInfo const * InsetFloatList::findInfo(string const & /* cmdName */)
ParamInfo const & InsetFloatList::findInfo(string const & /* cmdName */)
{
static const char * const paramnames[] = {"type", ""};
static const bool isoptional[] = {false};
static const CommandInfo info = {1, paramnames, isoptional};
return &info;
static ParamInfo param_info_;
if (param_info_.empty()) {
param_info_.add("type", false);
}
return param_info_;
}

View File

@ -50,16 +50,17 @@ public:
///
void validate(LaTeXFeatures & features) const;
///
static CommandInfo const * findInfo(std::string const & cmdName = "");
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "listoftables"; };
///
static bool isCompatibleCommand(std::string const & s);
private:
///
virtual Inset * clone() const
{
return new InsetFloatList(to_ascii(getParam("type")));
}
{ return new InsetFloatList(to_ascii(getParam("type"))); }
///
static ParamInfo param_info_;
};

View File

@ -30,11 +30,10 @@ InsetHFill::InsetHFill()
{}
CommandInfo const * InsetHFill::findInfo(string const & /* cmdName */)
ParamInfo const & InsetHFill::findInfo(string const & /* cmdName */)
{
static const char * const paramnames[] = {""};
static const CommandInfo info = {0, paramnames, 0};
return &info;
static ParamInfo param_info_;
return param_info_;
}

View File

@ -44,13 +44,14 @@ public:
// a line separator)?
bool isSpace() const;
///
static CommandInfo const * findInfo(std::string const &);
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "hfill"; };
///
static bool isCompatibleCommand(std::string const & s)
{ return s == "hfill"; }
private:
///
virtual Inset * clone() const;
};

View File

@ -33,13 +33,15 @@ InsetHyperlink::InsetHyperlink(InsetCommandParams const & p)
{}
CommandInfo const * InsetHyperlink::findInfo(string const & /* cmdName */)
ParamInfo const & InsetHyperlink::findInfo(string const & /* cmdName */)
{
static const char * const paramnames[] =
{"name", "target", "type", ""};
static const bool isoptional[] = {true, false};
static const CommandInfo info = {3, paramnames, isoptional};
return &info;
static ParamInfo param_info_;
if (param_info_.empty()) {
param_info_.add("name", true);
param_info_.add("target", false);
param_info_.add("type", false);
}
return param_info_;
}

View File

@ -49,7 +49,7 @@ public:
/// the string that is passed to the TOC
void textString(Buffer const &, odocstream &) const;
///
static CommandInfo const * findInfo(std::string const &);
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "href"; };
///

View File

@ -5,6 +5,7 @@
*
* \author Lars Gullik Bjønnes
* \author Richard Heck (conversion to InsetCommand)
* \author Bo Peng (embedding stuff)
*
* Full author contact details are available in file CREDITS.
*/
@ -164,15 +165,18 @@ InsetInclude::InsetInclude(InsetInclude const & other)
}
CommandInfo const * InsetInclude::findInfo(string const & /* cmdName */)
ParamInfo const & InsetInclude::findInfo(string const & /* cmdName */)
{
// FIXME
// This is only correct for the case of listings, but it'll do for now.
// In the other cases, this second parameter should just be empty.
static const char * const paramnames[] = {"filename", "embed", "lstparams", ""};
static const bool isoptional[] = {false, false, true};
static const CommandInfo info = {3, paramnames, isoptional};
return &info;
static ParamInfo param_info_;
if (param_info_.empty()) {
param_info_.add("filename", false);
param_info_.add("embed", false);
param_info_.add("lstparams", true);
}
return param_info_;
}

View File

@ -96,7 +96,7 @@ public:
///
void updateEmbeddedFile(Buffer const & buf, EmbeddedFile const & file);
///
static CommandInfo const * findInfo(std::string const &);
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "include"; };
///

View File

@ -80,12 +80,13 @@ InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
{}
CommandInfo const * InsetPrintIndex::findInfo(string const & /* cmdName */)
ParamInfo const & InsetPrintIndex::findInfo(string const & /* cmdName */)
{
static const char * const paramnames[] = {"name", ""};
static const bool isoptional[] = {false};
static const CommandInfo info = {1, paramnames, isoptional};
return &info;
static ParamInfo param_info_;
if (param_info_.empty()) {
param_info_.add("name", false);
}
return param_info_;
}

View File

@ -65,7 +65,7 @@ public:
///
docstring const getScreenLabel(Buffer const &) const;
///
static CommandInfo const * findInfo(std::string const & cmdName = "");
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "printindex"; };
///

View File

@ -33,12 +33,13 @@ InsetLabel::InsetLabel(InsetCommandParams const & p)
{}
CommandInfo const * InsetLabel::findInfo(string const & /* cmdName */)
ParamInfo const & InsetLabel::findInfo(string const & /* cmdName */)
{
static const char * const paramnames[] = {"name", ""};
static const bool isoptional[] = {false};
static const CommandInfo info = {1, paramnames, isoptional};
return &info;
static ParamInfo param_info_;
if (param_info_.empty()) {
param_info_.add("name", false);
}
return param_info_;
}

View File

@ -36,15 +36,17 @@ public:
///
int docbook(Buffer const &, odocstream &, OutputParams const &) const;
///
static CommandInfo const * findInfo(std::string const &);
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "label"; };
///
static bool isCompatibleCommand(std::string const & s)
{ return s == "label"; }
protected:
///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
///
virtual Inset * clone() const;
};

View File

@ -35,12 +35,15 @@ InsetNomencl::InsetNomencl(InsetCommandParams const & p)
{}
CommandInfo const * InsetNomencl::findInfo(string const & /* cmdName */)
ParamInfo const & InsetNomencl::findInfo(string const & /* cmdName */)
{
static const char * const paramnames[] = {"prefix", "symbol", "description", ""};
static const bool isoptional[] = {true, false, false};
static const CommandInfo info = {3, paramnames, isoptional};
return &info;
static ParamInfo param_info_;
if (param_info_.empty()) {
param_info_.add("prefix", true);
param_info_.add("symbol", false);
param_info_.add("description", false);
}
return param_info_;
}
@ -85,12 +88,13 @@ InsetPrintNomencl::InsetPrintNomencl(InsetCommandParams const & p)
{}
CommandInfo const * InsetPrintNomencl::findInfo(string const & /* cmdName */)
ParamInfo const & InsetPrintNomencl::findInfo(string const & /* cmdName */)
{
static const char * const paramnames[] = {"labelwidth", ""};
static const bool isoptional[] = {true};
static const CommandInfo info = {1, paramnames, isoptional};
return &info;
static ParamInfo param_info_;
if (param_info_.empty()) {
param_info_.add("labelwidth", true);
}
return param_info_;
}

View File

@ -41,7 +41,7 @@ public:
///
int docbookGlossary(odocstream &) const;
///
static CommandInfo const * findInfo(std::string const &);
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "nomenclature"; };
///
@ -78,7 +78,7 @@ public:
///
docstring const getScreenLabel(Buffer const &) const;
///
static CommandInfo const * findInfo(std::string const &);
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "printnomenclature"; };
///

View File

@ -52,12 +52,14 @@ bool InsetRef::isCompatibleCommand(string const & s) {
}
CommandInfo const * InsetRef::findInfo(string const & /* cmdName */)
ParamInfo const & InsetRef::findInfo(string const & /* cmdName */)
{
static const char * const paramnames[] = {"name", "reference", ""};
static const bool isoptional[] = {true, false};
static const CommandInfo info = {2, paramnames, isoptional};
return &info;
static ParamInfo param_info_;
if (param_info_.empty()) {
param_info_.add("name", true);
param_info_.add("reference", false);
}
return param_info_;
}

View File

@ -57,7 +57,7 @@ public:
///
void validate(LaTeXFeatures & features) const;
///
static CommandInfo const * findInfo(std::string const &);
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "ref"; };
///

View File

@ -32,12 +32,13 @@ InsetTOC::InsetTOC(InsetCommandParams const & p)
{}
CommandInfo const * InsetTOC::findInfo(string const & /* cmdName */)
ParamInfo const & InsetTOC::findInfo(string const & /* cmdName */)
{
static const char * const paramnames[] = {"type", ""};
static const bool isoptional[] = {false};
static const CommandInfo info = {1, paramnames, isoptional};
return &info;
static ParamInfo param_info_;
if (param_info_.empty()) {
param_info_.add("type", false);
}
return param_info_;
}

View File

@ -38,7 +38,7 @@ public:
int docbook(Buffer const &, odocstream &,
OutputParams const &) const;
///
static CommandInfo const * findInfo(std::string const &);
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "tableofcontents"; };
///