diff options
| author | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
| commit | be933ef2241d79558f91796cc5b3a161f72ebf9c (patch) | |
| tree | fe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/utils/TextSearch.h | |
| parent | 5f8335c1e49ce108ef3481863833c98efa00411b (diff) | |
| download | kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2 kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip | |
sync with upstream
Diffstat (limited to 'xbmc/utils/TextSearch.h')
| -rw-r--r-- | xbmc/utils/TextSearch.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/xbmc/utils/TextSearch.h b/xbmc/utils/TextSearch.h new file mode 100644 index 0000000..f2d1fdb --- /dev/null +++ b/xbmc/utils/TextSearch.h | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2018 Team Kodi | ||
| 3 | * This file is part of Kodi - https://kodi.tv | ||
| 4 | * | ||
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later | ||
| 6 | * See LICENSES/README.md for more information. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #pragma once | ||
| 10 | |||
| 11 | #include <string> | ||
| 12 | #include <vector> | ||
| 13 | |||
| 14 | typedef enum TextSearchDefault | ||
| 15 | { | ||
| 16 | SEARCH_DEFAULT_AND = 0, | ||
| 17 | SEARCH_DEFAULT_OR, | ||
| 18 | SEARCH_DEFAULT_NOT | ||
| 19 | } TextSearchDefault; | ||
| 20 | |||
| 21 | class CTextSearch final | ||
| 22 | { | ||
| 23 | public: | ||
| 24 | CTextSearch(const std::string &strSearchTerms, bool bCaseSensitive = false, TextSearchDefault defaultSearchMode = SEARCH_DEFAULT_OR); | ||
| 25 | |||
| 26 | bool Search(const std::string &strHaystack) const; | ||
| 27 | bool IsValid(void) const; | ||
| 28 | |||
| 29 | private: | ||
| 30 | static void GetAndCutNextTerm(std::string &strSearchTerm, std::string &strNextTerm); | ||
| 31 | void ExtractSearchTerms(const std::string &strSearchTerm, TextSearchDefault defaultSearchMode); | ||
| 32 | |||
| 33 | bool m_bCaseSensitive; | ||
| 34 | std::vector<std::string> m_AND; | ||
| 35 | std::vector<std::string> m_OR; | ||
| 36 | std::vector<std::string> m_NOT; | ||
| 37 | }; | ||
