Changeset View
Changeset View
Standalone View
Standalone View
src/services/ktraderparsetree_p.h
Show First 20 Lines • Show All 217 Lines • ▼ Show 20 Line(s) | |||||
218 | protected: | 218 | protected: | ||
219 | ParseTreeBase::Ptr m_pLeft; | 219 | ParseTreeBase::Ptr m_pLeft; | ||
220 | ParseTreeBase::Ptr m_pRight; | 220 | ParseTreeBase::Ptr m_pRight; | ||
221 | Qt::CaseSensitivity m_cs; | 221 | Qt::CaseSensitivity m_cs; | ||
222 | }; | 222 | }; | ||
223 | 223 | | |||
224 | /** | 224 | /** | ||
225 | * @internal | 225 | * @internal | ||
226 | * | ||||
227 | * A sub-sequence match is like a sub-string match except the characters | ||||
228 | * do not have to be contiguous. For example 'ct' is a sub-sequence of 'cat' | ||||
229 | * but not a sub-string. 'at' is both a sub-string and sub-sequence of 'cat'. | ||||
230 | * All sub-strings are sub-sequences. | ||||
231 | * | ||||
232 | * This is useful if you want to support a fuzzier search, say for instance | ||||
233 | * you are searching for `LibreOffice 6.0 Writer`, after typing `libre` you | ||||
234 | * see a list of all the LibreOffice apps, to narrow down that list you only | ||||
235 | * need to add `write` (so the search term is `librewrite`) instead of typing | ||||
236 | * out the entire app name until a distinguishing letter is reached. | ||||
237 | * It's also useful to allow the user to forget to type some characters. | ||||
238 | */ | ||||
239 | class ParseTreeSubsequenceMATCH : public ParseTreeBase | ||||
240 | { | ||||
241 | public: | ||||
242 | ParseTreeSubsequenceMATCH(ParseTreeBase *_ptr1, ParseTreeBase *_ptr2, Qt::CaseSensitivity cs) | ||||
243 | { | ||||
244 | m_pLeft = _ptr1; | ||||
245 | m_pRight = _ptr2; | ||||
246 | m_cs = cs; | ||||
247 | } | ||||
248 | | ||||
249 | bool eval(ParseContext *_context) const override; | ||||
250 | | ||||
251 | static bool isSubseq(const QString& pattern, const QString& text, Qt::CaseSensitivity cs); | ||||
252 | | ||||
253 | protected: | ||||
254 | ParseTreeBase::Ptr m_pLeft; | ||||
255 | ParseTreeBase::Ptr m_pRight; | ||||
256 | Qt::CaseSensitivity m_cs; | ||||
257 | }; | ||||
258 | | ||||
259 | /** | ||||
260 | * @internal | ||||
226 | */ | 261 | */ | ||
227 | class ParseTreeCALC : public ParseTreeBase | 262 | class ParseTreeCALC : public ParseTreeBase | ||
228 | { | 263 | { | ||
229 | public: | 264 | public: | ||
230 | ParseTreeCALC(ParseTreeBase *_ptr1, ParseTreeBase *_ptr2, int _i) | 265 | ParseTreeCALC(ParseTreeBase *_ptr1, ParseTreeBase *_ptr2, int _i) | ||
231 | { | 266 | { | ||
232 | m_pLeft = _ptr1; | 267 | m_pLeft = _ptr1; | ||
233 | m_pRight = _ptr2; | 268 | m_pRight = _ptr2; | ||
▲ Show 20 Lines • Show All 184 Lines • Show Last 20 Lines |