41 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| // Copyright (c) 2023 Dominic Masters
 | |
| // 
 | |
| // This software is released under the MIT License.
 | |
| // https://opensource.org/licenses/MIT
 | |
| 
 | |
| #pragma once
 | |
| #include "dawnlibs.hpp"
 | |
| 
 | |
| namespace Dawn {
 | |
|   class Environment {
 | |
|     private:
 | |
|       std::map<std::string, std::string> variables;
 | |
| 
 | |
|     public:
 | |
|       /**
 | |
|        * Checks if the environment has a variable.
 | |
|        * 
 | |
|        * @param key Variable key to check.
 | |
|        * @return True if the variable exists, false otherwise.
 | |
|        */
 | |
|       bool_t hasVariable(const std::string &key);
 | |
| 
 | |
|       /**
 | |
|        * Sets a variable in the environment.
 | |
|        * 
 | |
|        * @param key Variable key to set.
 | |
|        * @param value Variable value to set.
 | |
|        */
 | |
|       void setVariable(const std::string &key, const std::string &value);
 | |
| 
 | |
|       /**
 | |
|        * Gets a variable from the environment.
 | |
|        * 
 | |
|        * @param key Variable key to get.
 | |
|        * @return Variable value, or empty string if not found.
 | |
|        */
 | |
|       std::string getVariable(const std::string &key);
 | |
|   };
 | |
| }
 | |
| 
 | |
| extern Dawn::Environment environment; |