Skip to content

Commit

Permalink
reorganization of some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Iximiel committed Jan 10, 2025
1 parent 2ef0986 commit 843d019
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions src/tools/Keywords.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::monostate,std::string,bool> defaultValue;
/// Do we allow stuff like key1, key2 etc
bool allowmultiple;
keyInfo();
keyInfo& setType(KeyType t);
Expand All @@ -99,39 +103,30 @@ class Keywords {
keyInfo& setAllowMultiple(bool a);
keyInfo& setDefaultFlag(bool a);
};
//std::less<void> make some magic and makes find and [] work with string_view
/// Stores the keywords along with their settings
std::map<std::string,keyInfo,std::less<void>> keywords;
/// The names of the allowed keywords, in order of declaration
std::vector<std::string> keys;
/// The names of the reserved keywords, in order of declaration
std::vector<std::string> reserved_keys;
//std::less<void> make some magic and makes find and [] work with string_view
/// Whether the keyword is compulsory, optional...
// std::map<std::string,KeyType,std::less<void>> types;
/// Do we allow stuff like key1, key2 etc
// std::map<std::string,bool> allowmultiple;
/// The documentation for the keywords
// std::map<std::string,std::string> documentation;
/// The type for the arguments in this action
std::map<std::string,argType> argument_types;
/// The default values for the flags (are they on or of)
// std::map<std::string,bool> booldefs;
/// The default values (if there are default values) for compulsory keywords
// std::map<std::string,std::string> numdefs;
std::map<std::string,argType,std::less<void>> argument_types;
/// The tags for atoms - we use this so the manual can differentiate between different ways of specifying atoms
std::map<std::string,std::string> atomtags;
std::map<std::string,std::string,std::less<void>> 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<std::string,component,std::less<void>> components;
/// The string that should be printed out to describe how the components work for this particular action
std::string cstring;
Expand All @@ -141,7 +136,7 @@ class Keywords {
std::vector<std::string> neededActions;
/// List of suffixes that can be used with this action
std::vector<std::string> 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
Expand Down Expand Up @@ -280,6 +275,8 @@ class Keywords {
const std::vector<std::string>& 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;
Expand Down

0 comments on commit 843d019

Please sign in to comment.