1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- #ifndef cmDefinitions_h
- #define cmDefinitions_h
- #include "cmConfigure.h"
- #include <string>
- #include <unordered_map>
- #include <vector>
- #include "cmLinkedTree.h"
- class cmDefinitions
- {
- typedef cmLinkedTree<cmDefinitions>::iterator StackIter;
- public:
- static const char* Get(const std::string& key, StackIter begin,
- StackIter end);
- static void Raise(const std::string& key, StackIter begin, StackIter end);
- static bool HasKey(const std::string& key, StackIter begin, StackIter end);
-
- void Set(const std::string& key, const char* value);
- std::vector<std::string> UnusedKeys() const;
- static std::vector<std::string> ClosureKeys(StackIter begin, StackIter end);
- static cmDefinitions MakeClosure(StackIter begin, StackIter end);
- private:
-
- struct Def : public std::string
- {
- private:
- typedef std::string std_string;
- public:
- Def()
- : std_string()
- , Exists(false)
- , Used(false)
- {
- }
- Def(const char* v)
- : std_string(v ? v : "")
- , Exists(v ? true : false)
- , Used(false)
- {
- }
- Def(const std_string& v)
- : std_string(v)
- , Exists(true)
- , Used(false)
- {
- }
- bool Exists;
- bool Used;
- };
- static Def NoDef;
- typedef std::unordered_map<std::string, Def> MapType;
- MapType Map;
- static Def const& GetInternal(const std::string& key, StackIter begin,
- StackIter end, bool raise);
- };
- #endif
|