Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:09:54

0001 #ifndef ATOOLS_Org_SettingsKeys_H
0002 #define ATOOLS_Org_SettingsKeys_H
0003 
0004 #include <string>
0005 #include <vector>
0006 #include <limits>
0007 
0008 namespace ATOOLS {
0009 
0010   class Setting_Key {
0011 
0012   public:
0013 
0014     Setting_Key(size_t _index) :
0015       name{ "" },
0016       index{ _index }
0017     {};
0018 
0019     Setting_Key(const char* _name) : Setting_Key{ std::string{_name} } {}
0020 
0021     Setting_Key(const std::string& _name) :
0022       name{ _name },
0023       index{ std::numeric_limits<size_t>::max() }
0024     {};
0025 
0026     bool IsIndex() const;
0027     std::string GetName() const;
0028     size_t GetIndex() const;
0029 
0030     bool operator==(const Setting_Key&) const;
0031     bool operator!=(const Setting_Key &rhs) const { return !(*this == rhs); }
0032     bool operator<(const Setting_Key&) const;
0033     bool operator>(const Setting_Key&) const;
0034 
0035     friend std::ostream& operator<<(std::ostream&, const Setting_Key&);
0036 
0037   private:
0038 
0039     std::string name;
0040     size_t index;
0041 
0042   };
0043 
0044   class Settings_Keys : public std::vector<Setting_Key> {
0045 
0046   public:
0047 
0048     Settings_Keys() {}
0049 
0050     using std::vector<Setting_Key>::vector;
0051 
0052     Settings_Keys(const std::vector<std::string>&);
0053 
0054     std::string Name() const;
0055 
0056     std::vector<std::string> IndicesRemoved() const;
0057     bool ContainsNoIndices() const;
0058 
0059     bool IsBeginningOf(const Settings_Keys&) const;
0060     bool IsParentScopeOfItem(const Settings_Keys&) const;
0061 
0062     friend std::ostream& operator<<(std::ostream&, const Settings_Keys&);
0063 
0064   };
0065 
0066   std::ostream& operator<<(std::ostream&, const Setting_Key&);
0067   std::ostream& operator<<(std::ostream&, const Settings_Keys&);
0068 }
0069 
0070 #endif