diff options
Diffstat (limited to 'tdecore/tdestringmatcher.h')
-rw-r--r-- | tdecore/tdestringmatcher.h | 95 |
1 files changed, 45 insertions, 50 deletions
diff --git a/tdecore/tdestringmatcher.h b/tdecore/tdestringmatcher.h index 504ccfa8c..24adeb665 100644 --- a/tdecore/tdestringmatcher.h +++ b/tdecore/tdestringmatcher.h @@ -8,55 +8,8 @@ #define TSMTRACE kdWarning() << "<TSMTRACE> " -namespace TSM -{ -/** - * Enumeration used by the TDEStringMatcher class - * defining types of patterns to be matched - */ -enum class PatternType: uchar -{ - REGEX, - WILDCARD, - SUBSTRING, - //OTHER, - DEFAULT = REGEX -}; - -/** - * Enumeration used by the TDEStringMatcher class - * defining special handling of alphanumeric characters - */ -enum class ANCHandling: uchar -{ - CASE_SENSITIVE = 0, // No handling, each character distinct - CASE_INSENSITIVE = 1, // Alphabetic case variants are same - EQUIVALENCE = 2, // Alphanumeric equivalents are same - DEFAULT = CASE_SENSITIVE -}; - -/** - * Structure used by the TDEStringMatcher class - * representing properties of a single match specification. - */ -struct MatchSpec -{ - PatternType patternType; - ANCHandling ancHandling; - bool expectMatch; // "matching" vs. "not matching" - TQString pattern; -}; - -/** - * Container used in a TDEStringMatcher object - * representing multiple match specifications. - */ -typedef TQValueVector<MatchSpec> MatchSpecList; - // Use horizontal tab as m_patternString separator -inline constexpr char PatterStringDivider { '\t' }; - -} // End of namespace TSM +inline constexpr char PatternStringDivider = '\t' ; /** @@ -67,13 +20,53 @@ class TDECORE_EXPORT TDEStringMatcher : public TQObject Q_OBJECT public: + /** + * Enumeration defining types of patterns to be matched + */ + enum class PatternType: uchar + { + REGEX, + WILDCARD, + SUBSTRING, + //OTHER, + DEFAULT = REGEX + }; + + /** + * Enumeration defining special handling of alphanumeric characters + */ + enum class ANCHandling: uchar + { + CASE_SENSITIVE = 0, // No handling, each character distinct + CASE_INSENSITIVE = 1, // Alphabetic case variants are same + EQUIVALENCE = 2, // Alphanumeric equivalents are same + DEFAULT = CASE_SENSITIVE + }; + + /** + * Structure representing properties of a single match specification. + */ + struct MatchSpec + { + PatternType patternType; + ANCHandling ancHandling; + bool expectMatch; // "matching" vs. "not matching" + TQString pattern; + }; + + /** + * Container representing multiple match specifications. + */ + typedef TQValueVector<MatchSpec> MatchSpecList; + + TDEStringMatcher(); ~TDEStringMatcher(); /** @return list of currently defined match specifications. */ - const TSM::MatchSpecList getMatchSpecs() const; + const MatchSpecList getMatchSpecs() const; /** @return string encoding list of currently defined match specifications. @@ -84,7 +77,7 @@ public: Use @param newMatchSpecList to generate the internal list of match specifications to be used for pattern matching. */ - bool setMatchSpecs( TSM::MatchSpecList newMatchSpecList ); + bool setMatchSpecs( MatchSpecList newMatchSpecList ); /** Use specially encoded @param newPatternString to generate the internal @@ -106,6 +99,8 @@ public: */ bool matchAll( const TQString& stringToMatch ) const; +protected: + /** @return a basic regular expression formed by converting the basic wildcard expression in @param wildcardPattern. |