summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-01-23 11:51:53 (GMT)
committerRichard Maudsley <richard.maudsley@isode.com>2014-01-23 11:51:53 (GMT)
commit3a41fca4c1c2423c1f13cc3c77f9a70f767ae2dc (patch)
tree471bb5460ac2f23647282a7e6d37846953ea994d /Swift/Controllers/HighlightManager.h
parentd773cc196eb63618fe0c426d4eafd7fe8ec69873 (diff)
downloadswift-3a41fca4c1c2423c1f13cc3c77f9a70f767ae2dc.zip
swift-3a41fca4c1c2423c1f13cc3c77f9a70f767ae2dc.tar.bz2
Preventing stale highlight rules by creating list encapsulation.
Change-Id: I8f95d6bfd769fb104d972bd1cabfeb3ad79d308b
Diffstat (limited to 'Swift/Controllers/HighlightManager.h')
-rw-r--r--Swift/Controllers/HighlightManager.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/Swift/Controllers/HighlightManager.h b/Swift/Controllers/HighlightManager.h
index e91d8ce..4f4fe6e 100644
--- a/Swift/Controllers/HighlightManager.h
+++ b/Swift/Controllers/HighlightManager.h
@@ -19,11 +19,26 @@ namespace Swift {
class HighlightManager {
public:
+
+ class HighlightRulesList {
+ public:
+ friend class HighlightManager;
+ size_t getSize() const { return list_.size(); }
+ const HighlightRule& getRule(const size_t index) const { return list_[index]; }
+ void addRule(const HighlightRule &rule) { list_.push_back(rule); }
+ void combineRules(const HighlightRulesList &rhs) {
+ list_.insert(list_.end(), rhs.list_.begin(), rhs.list_.end());
+ }
+ private:
+ std::vector<HighlightRule> list_;
+ };
+
HighlightManager(SettingsProvider* settings);
Highlighter* createHighlighter();
- const std::vector<HighlightRule>& getRules() const { return rules_; }
+ boost::shared_ptr<const HighlightManager::HighlightRulesList> getRules() const { return rules_; }
+
HighlightRule getRule(int index) const;
void setRule(int index, const HighlightRule& rule);
void insertRule(int index, const HighlightRule& rule);
@@ -37,13 +52,14 @@ namespace Swift {
void handleSettingChanged(const std::string& settingPath);
std::string rulesToString() const;
- static std::vector<HighlightRule> rulesFromString(const std::string&);
static std::vector<HighlightRule> getDefaultRules();
SettingsProvider* settings_;
bool storingSettings_;
- std::vector<HighlightRule> rules_;
+ boost::shared_ptr<HighlightManager::HighlightRulesList> rules_;
};
+ typedef boost::shared_ptr<const HighlightManager::HighlightRulesList> HighlightRulesListPtr;
+
}