diff options
author | Neil <nyamatongwe@gmail.com> | 2017-04-09 16:51:46 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2017-04-09 16:51:46 +1000 |
commit | 1b763e30f00b6f03d506bf1e1fa0c6cb5264205e (patch) | |
tree | 0366173a7fa48aef3c77734e10b7c972b4adef9f /src/ViewStyle.h | |
parent | 3fd9e81391a32f703b42f096d4d7e4195c37ade7 (diff) | |
download | scintilla-mirror-1b763e30f00b6f03d506bf1e1fa0c6cb5264205e.tar.gz |
Modernise ViewStyle with vector, unique_ptr, any_of, and method deletion.
Diffstat (limited to 'src/ViewStyle.h')
-rw-r--r-- | src/ViewStyle.h | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/ViewStyle.h b/src/ViewStyle.h index db415344b..f08fb777a 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -22,17 +22,18 @@ public: int mask; bool sensitive; int cursor; - MarginStyle(); + MarginStyle(int style_= SC_MARGIN_SYMBOL, int width_=0, int mask_=0); }; /** */ class FontNames { private: - std::vector<char *> names; + std::vector<const char *> names; - // Private so FontNames objects can not be copied - FontNames(const FontNames &); + // FontNames objects can not be copied + FontNames(const FontNames &) = delete; + FontNames &operator=(const FontNames &) = delete; public: FontNames(); ~FontNames(); @@ -41,9 +42,9 @@ public: }; class FontRealised : public FontMeasurements { - // Private so FontRealised objects can not be copied - FontRealised(const FontRealised &); - FontRealised &operator=(const FontRealised &); + // FontRealised objects can not be copied + FontRealised(const FontRealised &) = delete; + FontRealised &operator=(const FontRealised &) = delete; public: Font font; FontRealised(); @@ -57,7 +58,7 @@ enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterInden enum TabDrawMode {tdLongArrow=0, tdStrikeOut=1}; -typedef std::map<FontSpecification, FontRealised *> FontMap; +typedef std::map<FontSpecification, std::unique_ptr<FontRealised>> FontMap; enum WrapMode { eWrapNone, eWrapWord, eWrapChar, eWrapWhitespace }; @@ -94,11 +95,11 @@ class ViewStyle { public: std::vector<Style> styles; size_t nextExtendedStyle; - LineMarker markers[MARKER_MAX + 1]; + std::vector<LineMarker> markers; int largestMarkerHeight; - Indicator indicators[INDIC_MAX + 1]; - unsigned int indicatorsDynamic; - unsigned int indicatorsSetFore; + std::vector<Indicator> indicators; + bool indicatorsDynamic; + bool indicatorsSetFore; int technology; int lineHeight; int lineOverlap; @@ -211,8 +212,8 @@ private: void CreateAndAddFont(const FontSpecification &fs); FontRealised *Find(const FontSpecification &fs); void FindMaxAscentDescent(); - // Private so can only be copied through copy constructor which ensures font names initialised correctly - ViewStyle &operator=(const ViewStyle &); + // Can only be copied through copy constructor which ensures font names initialised correctly + ViewStyle &operator=(const ViewStyle &) = delete; }; #ifdef SCI_NAMESPACE |