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 | a64428dc77747caba268e25e4ec9d7d1db10eefa (patch) | |
| tree | 81013dfb7b2d2601eed138efa9a4cdfe97bcc719 | |
| parent | b9b5cf4cb81c03c1871a40becbe9b4d7807ad600 (diff) | |
| download | scintilla-mirror-a64428dc77747caba268e25e4ec9d7d1db10eefa.tar.gz | |
Backport: Remember string values in OptionSet so can be easily retrieved.
Backport of changeset 7869:7dac229bc696.
| -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++) { |
