X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/65ec6247df6af7b6489257b1ac04ca2242dc14ec..d1a6e2b7a103d761fbc15e0e9c1c20ab53a849d9:/contrib/src/stc/scintilla/include/PropSet.h diff --git a/contrib/src/stc/scintilla/include/PropSet.h b/contrib/src/stc/scintilla/include/PropSet.h index 6f6bf410f1..20ac5f774a 100644 --- a/contrib/src/stc/scintilla/include/PropSet.h +++ b/contrib/src/stc/scintilla/include/PropSet.h @@ -2,7 +2,7 @@ /** @file PropSet.h ** A Java style properties file module. **/ -// Copyright 1998-2001 by Neil Hodgson +// Copyright 1998-2002 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef PROPSET_H @@ -24,11 +24,21 @@ struct Property { /** */ class PropSet { -private: +protected: enum { hashRoots=31 }; Property *props[hashRoots]; Property *enumnext; int enumhash; + static unsigned int HashString(const char *s, size_t len) { + unsigned int ret = 0; + while (len--) { + ret <<= 4; + ret ^= *s; + s++; + } + return ret; + } + static bool IncludesVar(const char *value, const char *key); public: PropSet *superPS; PropSet(); @@ -38,10 +48,10 @@ public: void SetMultiple(const char *s); SString Get(const char *key); SString GetExpanded(const char *key); - SString Expand(const char *withVars); + SString Expand(const char *withVars, int maxExpands=100); int GetInt(const char *key, int defaultValue=0); SString GetWild(const char *keybase, const char *filename); - SString GetNewExpand(const char *keybase, const char *filename); + SString GetNewExpand(const char *keybase, const char *filename=""); void Clear(); char *ToString(); // Caller must delete[] the return value bool GetFirst(char **key, char **val); @@ -60,7 +70,7 @@ public: bool onlyLineEnds; ///< Delimited by any white space or only line ends bool sorted; int starts[256]; - WordList(bool onlyLineEnds_ = false) : + WordList(bool onlyLineEnds_ = false) : words(0), wordsNoCase(0), list(0), len(0), onlyLineEnds(onlyLineEnds_), sorted(false) {} ~WordList() { Clear(); } operator bool() { return len ? true : false; } @@ -70,15 +80,12 @@ public: char *Allocate(int size); void SetFromAllocated(); bool InList(const char *s); - const char *GetNearestWord(const char *wordStart, int searchLen = -1, bool ignoreCase = false); - char *GetNearestWords(const char *wordStart, int searchLen=-1, + const char *GetNearestWord(const char *wordStart, int searchLen = -1, + bool ignoreCase = false, SString wordCharacters=""); + char *GetNearestWords(const char *wordStart, int searchLen=-1, bool ignoreCase=false, char otherSeparator='\0'); }; -inline bool nonFuncChar(char ch) { - return strchr("\t\n\r !\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~", ch) != NULL; -} - inline bool IsAlphabetic(unsigned int ch) { return ((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z')); }