diff options
Diffstat (limited to 'lexlib')
| -rw-r--r-- | lexlib/OptionSet.h | 15 | 
1 files changed, 14 insertions, 1 deletions
| diff --git a/lexlib/OptionSet.h b/lexlib/OptionSet.h index b6fc07049..918eaba4f 100644 --- a/lexlib/OptionSet.h +++ b/lexlib/OptionSet.h @@ -25,6 +25,7 @@ class OptionSet {  			plcoi pi;  			plcos ps;  		}; +		std::string value;  		std::string description;  		Option() :  			opType(SC_TYPE_BOOLEAN), pb(0), description("") { @@ -38,7 +39,8 @@ class OptionSet {  		Option(plcos ps_, std::string description_) :  			opType(SC_TYPE_STRING), ps(ps_), description(description_) {  		} -		bool Set(T *base, const char *val) const { +		bool Set(T *base, const char *val) { +			value = val;  			switch (opType) {  			case SC_TYPE_BOOLEAN: {  					bool option = atoi(val) != 0; @@ -66,6 +68,9 @@ class OptionSet {  			}  			return false;  		} +		const char *Get() const { +			return value.c_str(); +		}  	};  	typedef std::map<std::string, Option> OptionMap;  	OptionMap nameToDef; @@ -118,6 +123,14 @@ public:  		return false;  	} +	const char *PropertyGet(const char *name) { +		typename OptionMap::iterator it = nameToDef.find(name); +		if (it != nameToDef.end()) { +			return it->second.Get(); +		} +		return nullptr; +	} +  	void DefineWordListSets(const char * const wordListDescriptions[]) {  		if (wordListDescriptions) {  			for (size_t wl = 0; wordListDescriptions[wl]; wl++) { | 
