diff options
author | Neil <nyamatongwe@gmail.com> | 2021-04-27 10:04:57 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-04-27 10:04:57 +1000 |
commit | 13b6f88d9b4710e1c51b36a97c3b45a6441a7820 (patch) | |
tree | a8f7b3fa0e91986f4d0a8125a705df771ddb5f83 /src | |
parent | dd48a3b8b049ab42ac16108b428e947135f82877 (diff) | |
download | scintilla-mirror-13b6f88d9b4710e1c51b36a97c3b45a6441a7820.tar.gz |
Rename CharacterSet and CharacterCategory modules in Scintilla to CharacterType
and CharacterCategoryMap to avoid clashes with Lexilla when building an
executable that includes both.
Diffstat (limited to 'src')
-rw-r--r-- | src/AutoComplete.cxx | 2 | ||||
-rw-r--r-- | src/CharClassify.cxx | 2 | ||||
-rw-r--r-- | src/CharacterCategoryMap.cxx (renamed from src/CharacterCategory.cxx) | 6 | ||||
-rw-r--r-- | src/CharacterCategoryMap.h (renamed from src/CharacterCategory.h) | 8 | ||||
-rw-r--r-- | src/CharacterType.cxx (renamed from src/CharacterSet.cxx) | 7 | ||||
-rw-r--r-- | src/CharacterType.h (renamed from src/CharacterSet.h) | 104 | ||||
-rw-r--r-- | src/Document.cxx | 4 | ||||
-rw-r--r-- | src/EditModel.cxx | 2 | ||||
-rw-r--r-- | src/EditView.cxx | 4 | ||||
-rw-r--r-- | src/Editor.cxx | 4 | ||||
-rw-r--r-- | src/MarginView.cxx | 2 | ||||
-rw-r--r-- | src/PositionCache.cxx | 2 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 2 |
13 files changed, 28 insertions, 121 deletions
diff --git a/src/AutoComplete.cxx b/src/AutoComplete.cxx index 779d34965..3de456371 100644 --- a/src/AutoComplete.cxx +++ b/src/AutoComplete.cxx @@ -24,7 +24,7 @@ #include "Platform.h" #include "Scintilla.h" -#include "CharacterSet.h" +#include "CharacterType.h" #include "Position.h" #include "AutoComplete.h" diff --git a/src/CharClassify.cxx b/src/CharClassify.cxx index f82fe75a6..64d720740 100644 --- a/src/CharClassify.cxx +++ b/src/CharClassify.cxx @@ -10,7 +10,7 @@ #include <stdexcept> -#include "CharacterSet.h" +#include "CharacterType.h" #include "CharClassify.h" using namespace Scintilla; diff --git a/src/CharacterCategory.cxx b/src/CharacterCategoryMap.cxx index fdd6c15e7..e9bfecb6a 100644 --- a/src/CharacterCategory.cxx +++ b/src/CharacterCategoryMap.cxx @@ -1,8 +1,10 @@ // Scintilla source code edit control -/** @file CharacterCategory.cxx +/** @file CharacterCategoryMap.cxx ** Returns the Unicode general category of a character. ** Table automatically regenerated by scripts/GenerateCharacterCategory.py ** Should only be rarely regenerated for new versions of Unicode. + ** Similar code to Lexilla's lexilla/lexlib/CharacterCategory.cxx but renamed + ** to avoid problems with builds that statically include both Scintilla and Lexilla. **/ // Copyright 2013 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. @@ -11,7 +13,7 @@ #include <algorithm> #include <iterator> -#include "CharacterCategory.h" +#include "CharacterCategoryMap.h" namespace Scintilla { diff --git a/src/CharacterCategory.h b/src/CharacterCategoryMap.h index cd3320dd9..35706eda7 100644 --- a/src/CharacterCategory.h +++ b/src/CharacterCategoryMap.h @@ -1,12 +1,14 @@ // Scintilla source code edit control -/** @file CharacterCategory.h +/** @file CharacterCategoryMap.h ** Returns the Unicode general category of a character. + ** Similar code to Lexilla's lexilla/lexlib/CharacterCategory.h but renamed + ** to avoid problems with builds that statically include both Scintilla and Lexilla. **/ // Copyright 2013 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. -#ifndef CHARACTERCATEGORY_H -#define CHARACTERCATEGORY_H +#ifndef CHARACTERCATEGORYMAP_H +#define CHARACTERCATEGORYMAP_H namespace Scintilla { diff --git a/src/CharacterSet.cxx b/src/CharacterType.cxx index b934c2dd4..04d6a2abe 100644 --- a/src/CharacterSet.cxx +++ b/src/CharacterType.cxx @@ -1,7 +1,6 @@ // Scintilla source code edit control -/** @file CharacterSet.cxx - ** Simple case functions for ASCII. - ** Lexer infrastructure. +/** @file CharacterType.cxx + ** Tests for character type and case-insensitive comparisons. **/ // Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. @@ -9,7 +8,7 @@ #include <cstdlib> #include <cassert> -#include "CharacterSet.h" +#include "CharacterType.h" using namespace Scintilla; diff --git a/src/CharacterSet.h b/src/CharacterType.h index a518c27fc..1a478cbe4 100644 --- a/src/CharacterSet.h +++ b/src/CharacterType.h @@ -1,111 +1,15 @@ // Scintilla source code edit control -/** @file CharacterSet.h - ** Encapsulates a set of characters. Used to test if a character is within a set. +/** @file CharacterType.h + ** Tests for character type and case-insensitive comparisons. **/ // Copyright 2007 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. -#ifndef CHARACTERSET_H -#define CHARACTERSET_H +#ifndef CHARACTERTYPE_H +#define CHARACTERTYPE_H namespace Scintilla { -class CharacterSet { - int size; - bool valueAfter; - bool *bset; -public: - enum setBase { - setNone=0, - setLower=1, - setUpper=2, - setDigits=4, - setAlpha=setLower|setUpper, - setAlphaNum=setAlpha|setDigits - }; - CharacterSet(setBase base=setNone, const char *initialSet="", int size_=0x80, bool valueAfter_=false) { - size = size_; - valueAfter = valueAfter_; - bset = new bool[size]; - for (int i=0; i < size; i++) { - bset[i] = false; - } - AddString(initialSet); - if (base & setLower) - AddString("abcdefghijklmnopqrstuvwxyz"); - if (base & setUpper) - AddString("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); - if (base & setDigits) - AddString("0123456789"); - } - CharacterSet(const CharacterSet &other) { - size = other.size; - valueAfter = other.valueAfter; - bset = new bool[size]; - for (int i=0; i < size; i++) { - bset[i] = other.bset[i]; - } - } - CharacterSet(CharacterSet &&other) noexcept { - size = other.size; - valueAfter = other.valueAfter; - bset = other.bset; - other.size = 0; - other.bset = nullptr; - } - CharacterSet &operator=(const CharacterSet &other) { - if (this != &other) { - bool *bsetNew = new bool[other.size]; - for (int i = 0; i < other.size; i++) { - bsetNew[i] = other.bset[i]; - } - delete[]bset; - size = other.size; - valueAfter = other.valueAfter; - bset = bsetNew; - } - return *this; - } - CharacterSet &operator=(CharacterSet &&other) noexcept { - if (this != &other) { - delete []bset; - size = other.size; - valueAfter = other.valueAfter; - bset = other.bset; - other.size = 0; - other.bset = nullptr; - } - return *this; - } - ~CharacterSet() { - delete []bset; - bset = nullptr; - size = 0; - } - void Add(int val) { - assert(val >= 0); - assert(val < size); - bset[val] = true; - } - void AddString(const char *setToAdd) { - for (const char *cp=setToAdd; *cp; cp++) { - const unsigned char uch = *cp; - assert(uch < size); - bset[uch] = true; - } - } - bool Contains(int val) const noexcept { - assert(val >= 0); - if (val < 0) return false; - return (val < size) ? bset[val] : valueAfter; - } - bool Contains(char ch) const noexcept { - // Overload char as char may be signed - const unsigned char uch = ch; - return Contains(uch); - } -}; - // Functions for classifying characters constexpr bool IsASpace(int ch) noexcept { diff --git a/src/Document.cxx b/src/Document.cxx index 0a4c8ca0b..ffbf8f557 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -32,8 +32,8 @@ #include "ILexer.h" #include "Scintilla.h" -#include "CharacterSet.h" -#include "CharacterCategory.h" +#include "CharacterType.h" +#include "CharacterCategoryMap.h" #include "Position.h" #include "SplitVector.h" #include "Partitioning.h" diff --git a/src/EditModel.cxx b/src/EditModel.cxx index 013f848ba..c7fe1c710 100644 --- a/src/EditModel.cxx +++ b/src/EditModel.cxx @@ -29,7 +29,7 @@ #include "ILexer.h" #include "Scintilla.h" -#include "CharacterCategory.h" +#include "CharacterCategoryMap.h" #include "Position.h" #include "UniqueString.h" diff --git a/src/EditView.cxx b/src/EditView.cxx index 08bdfb55c..1061d28fc 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -33,8 +33,8 @@ #include "ILexer.h" #include "Scintilla.h" -#include "CharacterSet.h" -#include "CharacterCategory.h" +#include "CharacterType.h" +#include "CharacterCategoryMap.h" #include "Position.h" #include "UniqueString.h" #include "SplitVector.h" diff --git a/src/Editor.cxx b/src/Editor.cxx index 66b8fe47d..adc9f3492 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -33,8 +33,8 @@ #include "ILexer.h" #include "Scintilla.h" -#include "CharacterSet.h" -#include "CharacterCategory.h" +#include "CharacterType.h" +#include "CharacterCategoryMap.h" #include "Position.h" #include "UniqueString.h" #include "SplitVector.h" diff --git a/src/MarginView.cxx b/src/MarginView.cxx index 308923ad8..c2dcbf32d 100644 --- a/src/MarginView.cxx +++ b/src/MarginView.cxx @@ -30,7 +30,7 @@ #include "ILexer.h" #include "Scintilla.h" -#include "CharacterCategory.h" +#include "CharacterCategoryMap.h" #include "Position.h" #include "UniqueString.h" #include "SplitVector.h" diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 7516c82ec..0a9ef259a 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -29,7 +29,7 @@ #include "ILexer.h" #include "Scintilla.h" -#include "CharacterCategory.h" +#include "CharacterCategoryMap.h" #include "Position.h" #include "UniqueString.h" #include "SplitVector.h" diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 0b9e8e41c..62c3fa658 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -28,7 +28,7 @@ #include "ILexer.h" #include "Scintilla.h" -#include "CharacterCategory.h" +#include "CharacterCategoryMap.h" #include "Position.h" #include "UniqueString.h" |