aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Document.h
diff options
context:
space:
mode:
authornyamatongwe <unknown>2010-03-25 12:10:59 +0000
committernyamatongwe <unknown>2010-03-25 12:10:59 +0000
commit295013083c4e9454656c0e94ab977057ee55ea11 (patch)
tree661dd867b477a189c846fada99399ba9a61bc191 /src/Document.h
parent9f6eff4d795ec5cef078a432b89744f5542a1ade (diff)
downloadscintilla-mirror-295013083c4e9454656c0e94ab977057ee55ea11.tar.gz
New case insensitive searching implementation uses objects implementing
the CaseFolder interface to fold both search text and document text so they can be compared with a simple strcmp. A simple table based folder CaseFolderTable is used for 8 bit encodings and maps input bytes to folded bytes. For multi-byte encodings except for UTF-8 a null (output same as input) CaseFolderTable is used. For UTF-8, more complex subclasses are used which call platform APIs to perform the folding. Folding is approximately to lower case although this differs between platforms.
Diffstat (limited to 'src/Document.h')
-rw-r--r--src/Document.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/Document.h b/src/Document.h
index c61c56892..73571cbdd 100644
--- a/src/Document.h
+++ b/src/Document.h
@@ -115,6 +115,24 @@ struct StyledText {
}
};
+class CaseFolder {
+public:
+ virtual ~CaseFolder() {
+ };
+ virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) = 0;
+};
+
+class CaseFolderTable : public CaseFolder {
+protected:
+ char mapping[256];
+public:
+ CaseFolderTable();
+ virtual ~CaseFolderTable();
+ virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed);
+ void SetTranslation(char ch, char chTranslation);
+ void StandardASCII();
+};
+
/**
*/
class Document : PerLine {
@@ -254,9 +272,9 @@ public:
int NextWordEnd(int pos, int delta);
int Length() const { return cb.Length(); }
void Allocate(int newSize) { cb.Allocate(newSize); }
- long FindText(int minPos, int maxPos, const char *s,
- bool caseSensitive, bool word, bool wordStart, bool regExp, int flags, int *length);
- long FindText(int iMessage, unsigned long wParam, long lParam);
+ size_t ExtractChar(int pos, char *bytes);
+ long FindText(int minPos, int maxPos, const char *s, bool caseSensitive, bool word,
+ bool wordStart, bool regExp, int flags, int *length, CaseFolder *pcf);
const char *SubstituteByPosition(const char *text, int *length);
int LinesTotal() const;