diff options
| author | Neil <nyamatongwe@gmail.com> | 2019-11-09 15:31:48 +1100 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2019-11-09 15:31:48 +1100 | 
| commit | a4bd72249722211f08ffa3e65c664a9ccbbc7f84 (patch) | |
| tree | 659e253f1801879d6a53af85e3ebaa729b48a8f4 | |
| parent | 38e4d3cbc591f06a6663d6c0962bc17ea73d61ad (diff) | |
| download | scintilla-mirror-a4bd72249722211f08ffa3e65c664a9ccbbc7f84.tar.gz | |
Remember string values in OptionSet so can be easily retrieved.
| -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++) { | 
