diff --git a/src/tools/Keywords.h b/src/tools/Keywords.h index 4d056cd943..f48e6b2fda 100644 --- a/src/tools/Keywords.h +++ b/src/tools/Keywords.h @@ -88,9 +88,13 @@ class Keywords { std::string thisactname; struct keyInfo { + /// Whether the keyword is compulsory, optional... KeyType type; + /// The documentation for the keyword std::string docstring; + /// The default values (if there are default values) for compulsory keywords or flags std::variant defaultValue; + /// Do we allow stuff like key1, key2 etc bool allowmultiple; keyInfo(); keyInfo& setType(KeyType t); @@ -99,39 +103,30 @@ class Keywords { keyInfo& setAllowMultiple(bool a); keyInfo& setDefaultFlag(bool a); }; + //std::less make some magic and makes find and [] work with string_view +/// Stores the keywords along with their settings std::map> keywords; /// The names of the allowed keywords, in order of declaration std::vector keys; /// The names of the reserved keywords, in order of declaration std::vector reserved_keys; - //std::less make some magic and makes find and [] work with string_view -/// Whether the keyword is compulsory, optional... - // std::map> types; -/// Do we allow stuff like key1, key2 etc - // std::map allowmultiple; -/// The documentation for the keywords - // std::map documentation; /// The type for the arguments in this action - std::map argument_types; -/// The default values for the flags (are they on or of) - // std::map booldefs; -/// The default values (if there are default values) for compulsory keywords - // std::map numdefs; + std::map> argument_types; /// The tags for atoms - we use this so the manual can differentiate between different ways of specifying atoms - std::map atomtags; + std::map> atomtags; struct component { - /// The keyword that turns on a particular component + /// The keyword that turns on this component std::string key; - /// The documentation for a particular component + /// The documentation for the component std::string docstring; - /// The type of a particular component + /// The type of the component componentType type; component(); component& setKey(std::string k); component& setDocstring(std::string d); component& setType(componentType t); }; - //the "exists component" is stored here + //the "exists component" is stored in the map keys std::map> components; /// The string that should be printed out to describe how the components work for this particular action std::string cstring; @@ -141,7 +136,7 @@ class Keywords { std::vector neededActions; /// List of suffixes that can be used with this action std::vector actionNameSuffixes; -/// Print the documentation for the jth keyword in html +/// Print the documentation for the named keyword in html void print_html_item( const std::string& ) const; public: /// Constructor @@ -280,6 +275,8 @@ class Keywords { const std::vector& componentNames() const ; }; +//the follwoing templates psecializations make the bitmask enum work with the +// bitwise operators | & and the "valid" function (valid converts to bool a result of a "mask operation") template<> struct BitmaskEnum< Keywords::componentType > { static constexpr bool has_valid = true;