Lars Gullik Bjønnes wrote:
 | +    ListingsParam(string v, bool o, param_type t, string i, docstring h)
| +             : value_(v), onoff_(o), type_(t), info_(i), hint_(h)

const ref strings please.

I've done that and added/fixed some more Doxygen comments.

Abdel.

Author: younes
Date: Mon May 28 00:46:09 2007
New Revision: 18536

URL: http://www.lyx.org/trac/changeset/18536
Log:
* ListingsParam::ListingsParam(): use const ref.

* add some doxygen comments and FIXME.

* white space.

Modified:
    lyx-devel/trunk/src/insets/InsetListingsParams.cpp

Modified: lyx-devel/trunk/src/insets/InsetListingsParams.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/insets/InsetListingsParams.cpp?rev=18536
==============================================================================
--- lyx-devel/trunk/src/insets/InsetListingsParams.cpp (original)
+++ lyx-devel/trunk/src/insets/InsetListingsParams.cpp Mon May 28 00:46:09 2007
@@ -53,48 +53,55 @@
 };


-/** Information about each parameter
- */
+/// Listings package parameter information.
+// FIXME: make this class visible outside of this file so that
+// FIXME: it can be used directly in the frontend and in the LyX format
+// FIXME: parsing.
 class ListingsParam {
 public:
-       ///
-       ListingsParam(): onoff_(false), type_(ALL) {}
-       ///
-       ListingsParam(string v, bool o, param_type t, string i, docstring h)
+       /// Default ctor for STL containers.
+       ListingsParam(): onoff_(false), type_(ALL)
+       {}
+       /// Main ctor.
+       ListingsParam(string const & v, bool o, param_type t,
+               string const & i, docstring const & h)
                : value_(v), onoff_(o), type_(t), info_(i), hint_(h)
        {}
-       ///
+       /// Validate a paramater.
+       /// \retval an empty string if \c par is valid.
+       /// \retval otherwise an explanation WRT to \c par invalidity.
        docstring validate(string const & par) const;
 private:
        /// default value
        string value_;
 public:
-       // for option with value "true", "false",
-       // if onoff is true,
-       //   "true":  option
-       //   "false":
-       //   "other": option="other"
-       // onoff is false,
-       //   "true":  option=true
-       //   "false": option=false
-       // this is public because of InsetListingParam::addParam()
+       /// for option with value "true", "false".
+       /// if onoff is true,
+       ///   "true":  option
+       ///   "false":
+       ///   "other": option="other"
+       /// onoff is false,
+       ///   "true":  option=true
+       ///   "false": option=false
+       // FIXME: this is public because of InsetListingParam::addParam()
        bool onoff_;
 private:
-       /// validator type
-       // ALL:
-       // TRUEFALSE:
-       // INTEGER:
-       // LENGTH:
-       //     info is ignored.
-       // ONEOF
-       //     info is a \n separated string with allowed values
-       // SUBSETOF
-       //     info is a string from which par is composed of
-       //     (e.g. floatplacement can be one or more of *tbph)
+       /// validator type.
+       /// ALL:
+       /// TRUEFALSE:
+       /// INTEGER:
+       /// LENGTH:
+       ///     info is ignored.
+       /// ONEOF
+       ///     info is a \n separated string with allowed values
+       /// SUBSETOF
+       ///     info is a string from which par is composed of
+       ///     (e.g. floatplacement can be one or more of *tbph)
        param_type type_;
-       /// parameter info, meaning depending on parameter type
+       /// information which meaning depends on parameter type.
+       /// \sa type_
        string info_;
-       /// a help message that is displayed in the gui
+       /// a help message that is displayed in the gui.
        docstring hint_;
 };

@@ -251,17 +258,24 @@
        "[97]VRML\nXML\nXSLT";


+/// ListingsParam Validator.
+/// This class is aimed to be a singleton which is instantiated in
+/// \c InsetListingsParams::addParam().
+// FIXME: transfer this validator to the frontend.
+// FIXME: avoid the use of exception.
 class ParValidator
 {
 public:
        ParValidator();

-       ///
+       /// \return the associated \c ListingsParam.
+       /// \warning an \c invalidParamexception will be thrown
+       ///          if the key is not found.
        ListingsParam const & param(string const & key) const;

-       /// validate given parameter
-       /// invalidParam will be thrown if invalid
-       /// parameter is found.
+       /// validate a parameter for a given key.
+       /// \warning an \c invalidParam exception will be thrown if
+       /// \c par is an invalid parameter.
ListingsParam const & validate(string const & key, string const & par) const;

 private:
@@ -618,13 +632,14 @@

 } // namespace anon.

-InsetListingsParams::InsetListingsParams() :
-       inline_(false), params_(), status_(InsetCollapsable::Open)
-{
-}
-
-
-InsetListingsParams::InsetListingsParams(string const & par, bool in, InsetCollapsable::CollapseStatus s)
+InsetListingsParams::InsetListingsParams()
+       : inline_(false), params_(), status_(InsetCollapsable::Open)
+{
+}
+
+
+InsetListingsParams::InsetListingsParams(string const & par, bool in,
+               InsetCollapsable::CollapseStatus s)
        : inline_(in), params_(), status_(s)
 {
        // this will activate parameter validation.
@@ -733,7 +748,8 @@
                        continue;
                } else if (par[i] == '{' && par[i - 1] == '=')
                        braces ++;
- else if (par[i] == '}' && (i == par.size() - 1 || par[i + 1] == ',' || par[i + 1] == '\n'))
+               else if (par[i] == '}'
+                       && (i == par.size() - 1 || par[i + 1] == ',' || par[i + 
1] == '\n'))
                        braces --;
                
                if (isValue)




Reply via email to