+class ParamInfo {
+public:
+ /// Types of parameters
+ enum ParamType {
+ LATEX_OPTIONAL, /// normal optional argument
+ LATEX_REQUIRED, /// normal required argument
+ LYX_INTERNAL /// a parameter used internally by LyX
+ };
+ /// Special handling on output
+ enum ParamHandling {
+ HANDLING_NONE, /// no special handling
+ HANDLING_ESCAPE, /// escape special characters
+ HANDLING_LATEXIFY /// transform special characters to LaTeX macros
+ };
+ ///
+ class ParamData {
+ // No parameter may be named "preview", because that is a required
+ // flag for all commands.
+ public:
+ ///
+ ParamData(std::string const &, ParamType, ParamHandling = HANDLING_NONE);
+ ///
+ std::string name() const { return name_; }
+ ///
+ ParamType type() const { return type_; }
+ ///
+ ParamHandling handling() const { return handling_; }
+ /// whether this is an optional LaTeX argument
+ bool isOptional() const;
+ ///
+ bool operator==(ParamData const &) const;
+ ///
+ bool operator!=(ParamData const & rhs) const
+ { return !(*this == rhs); }
+ private:
+ ///
+ std::string name_;
+ ///
+ ParamType type_;
+ /// do we need special handling on latex output?
+ ParamHandling handling_;
+ };
+
+ /// adds a new parameter
+ void add(std::string const & name, ParamType type,
+ ParamHandling = HANDLING_NONE);
+ ///
+ bool empty() const { return info_.empty(); }
+ ///
+ size_t size() const { return info_.size(); }
+ ///
+ typedef std::vector<ParamData>::const_iterator const_iterator;
+ ///
+ const_iterator const begin() const { return info_.begin(); }
+ ///
+ const_iterator const end() const { return info_.end(); }
+ /// \return true if name corresponds to a parameter of some sort.
+ /// \return false if the parameter does not exist at all of it it
+ bool hasParam(std::string const & name) const;
+ ///
+ ParamData const & operator[](std::string const & name) const;
+ ///
+ bool operator==(ParamInfo const &) const;
+private:
+ ///
+ std::vector<ParamData> info_;
+};
+
+