]> git.lyx.org Git - features.git/commitdiff
Some minor cleanup of new InsetArguments stuff that I did while
authorRichard Heck <rgheck@lyx.org>
Sat, 24 Nov 2012 01:40:38 +0000 (20:40 -0500)
committerRichard Heck <rgheck@lyx.org>
Sat, 24 Nov 2012 01:40:38 +0000 (20:40 -0500)
reading the patch....

src/Paragraph.cpp
src/Text3.cpp
src/insets/InsetArgument.cpp
src/insets/InsetLayout.cpp
src/insets/InsetLayout.h
src/output_latex.cpp
src/output_latex.h

index 8429b015d6eacd1d621de6239f2c207ce5ab0738..ee80b94454351d0cc4aedee3d20b4c3b398fba79 100644 (file)
@@ -1461,7 +1461,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
                        // we have to provide all the optional arguments here, even though
                        // the last one is the only one we care about.
                        // Separate handling of optional argument inset.
-                       if (layout_->latexargs().size() != 0)
+                       if (!layout_->latexargs().empty())
                                latexArgInsets(*owner_, os, features.runparams(),
                                               layout_->latexargs());
                        else
index 7a7269668fe87cd43c724f909d66b53fdbaf5a53..9cace0df53822176dcb873b498035eb62c2c6712 100644 (file)
@@ -2531,7 +2531,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                if (lait != args.end()) {
                        enable = true;
                        InsetList::const_iterator it = cur.paragraph().insetList().begin();
-                       InsetList::const_iterator end = cur.paragraph().insetList().end();
+                       InsetList::const_iterator const end = cur.paragraph().insetList().end();
                        for (; it != end; ++it) {
                                if (it->inset->lyxCode() == ARG_CODE) {
                                        InsetArgument const * ins =
index 91ae4aa5a64e92e647e568bc6cb533708ab896df..80b69e03692e15c7916337897be6697bb39ac773 100644 (file)
@@ -59,12 +59,12 @@ void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype)
 
        // Handle pre 2.1 ArgInsets (lyx2lyx cannot classify them)
        if (name_ == "999") {
-               int req = insetlayout ? it.inset().getLayout().requiredArgs()
+               unsigned int const req = insetlayout ? it.inset().getLayout().numRequiredArgs()
                                      : it.paragraph().layout().requiredArgs();
-               int opts = insetlayout ? it.inset().getLayout().optArgs()
+               unsigned int const opts = insetlayout ? it.inset().getLayout().numOptArgs()
                                      : it.paragraph().layout().optArgs();
-               int nr = 0;
-               int ours = 0;
+               unsigned int nr = 0;
+               unsigned int ours = 0;
                InsetList::const_iterator parit = it.paragraph().insetList().begin();
                InsetList::const_iterator parend = it.paragraph().insetList().end();
                for (; parit != parend; ++parit) {
@@ -75,7 +75,7 @@ void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype)
                        }
                }
                bool done = false;
-               int realopts = 0;
+               unsigned int realopts = 0;
                if (nr > req) {
                        // We have optional arguments
                        realopts = nr - req;
index 87be22cc81b38848e3ffff6b605371a7f520fe48..53f56aea6099307376e0c257a31c27be03903cec 100644 (file)
@@ -525,9 +525,9 @@ void InsetLayout::readArgument(Lexer & lex)
                latexargs_[nr] = arg;
 }
 
-int InsetLayout::optArgs() const
+unsigned int InsetLayout::numOptArgs() const
 {
-       int nr = 0;
+       unsigned int nr = 0;
        Layout::LaTeXArgMap::const_iterator it = latexargs_.begin();
        for (; it != latexargs_.end(); ++it) {
                if (!(*it).second.mandatory)
@@ -537,9 +537,9 @@ int InsetLayout::optArgs() const
 }
 
 
-int InsetLayout::requiredArgs() const
+unsigned int InsetLayout::numRequiredArgs() const
 {
-       int nr = 0;
+       unsigned int nr = 0;
        Layout::LaTeXArgMap::const_iterator it = latexargs_.begin();
        for (; it != latexargs_.end(); ++it) {
                if ((*it).second.mandatory)
index 33fcffaddd980d5e56a4c6402b30d5797db221d5..3ddee169ce9eb1d2dad30c7dcf72fb2a8465c66d 100644 (file)
@@ -84,9 +84,9 @@ public:
        ///
        Layout::LaTeXArgMap latexargs() const { return latexargs_; }
        ///
-       int optArgs() const;
+       unsigned int numOptArgs() const;
        ///
-       int requiredArgs() const;
+       unsigned int numRequiredArgs() const;
        ///
        docstring preamble() const { return preamble_; }
        /// Get language dependent macro definitions needed for this inset
index 2112b80e7065b202fb1baf3c50d801e32737a903..e680cc7aeb1bfee54a0510ca5a98a52485050981 100644 (file)
@@ -162,7 +162,7 @@ static TeXEnvironmentData prepareEnvironment(Buffer const & buf,
 
        if (style.isEnvironment()) {
                os << "\\begin{" << from_ascii(style.latexname()) << '}';
-               if (style.latexargs().size() != 0)
+               if (!style.latexargs().empty())
                    latexArgInsets(*pit, os, runparams, style.latexargs());
                if (style.latextype == LATEX_LIST_ENVIRONMENT) {
                        os << '{'
@@ -313,7 +313,7 @@ void TeXEnvironment(Buffer const & buf, Text const & text,
 
 
 void latexArgInsets(Paragraph const & par, otexstream & os,
-       OutputParams const & runparams, Layout::LaTeXArgMap latexargs)
+       OutputParams const & runparams, Layout::LaTeXArgMap const & latexargs)
 {
        map<int, InsetArgument const *> ilist;
        vector<string> required;
@@ -332,7 +332,7 @@ void latexArgInsets(Paragraph const & par, otexstream & os,
                                Layout::LaTeXArgMap::const_iterator const lit =
                                                latexargs.find(nr);
                                if (lit != latexargs.end()) {
-                                       Layout::latexarg arg = (*lit).second;
+                                       Layout::latexarg const & arg = (*lit).second;
                                        if (!arg.requires.empty()) {
                                                vector<string> req = getVectorFromString(arg.requires);
                                                required.insert(required.end(), req.begin(), req.end());
@@ -407,7 +407,7 @@ void parStartCommand(Paragraph const & par, otexstream & os,
                os << '\\' << from_ascii(style.latexname());
 
                // Separate handling of optional argument inset.
-               if (style.latexargs().size() != 0)
+               if (!style.latexargs().empty())
                        latexArgInsets(par, os, runparams, style.latexargs());
                else
                        os << from_ascii(style.latexparam());
index ee0419b2319e73447914c57b211001269a6f9a38..fa07ca6ce79627f67927ed164f172fe1576d6080 100644 (file)
@@ -38,7 +38,7 @@ class Text;
 /// must all come first.
 void latexArgInsets(Paragraph const & par,
                otexstream & os, OutputParams const & runparams,
-               Layout::LaTeXArgMap latexargs);
+               Layout::LaTeXArgMap const & latexargs);
 
 /** Export \p paragraphs of buffer \p buf to LaTeX.
     Don't use a temporary stringstream for \p os if the final output is