From bf234dc9cd0481c241bbb0f755264562ee89d568 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 4 Aug 2017 12:58:33 +0300 Subject: Add debug output operator<< for SearchParam::SearchType --- include/unotools/textsearch.hxx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'include') diff --git a/include/unotools/textsearch.hxx b/include/unotools/textsearch.hxx index 46cc358584df..dfe563d831d0 100644 --- a/include/unotools/textsearch.hxx +++ b/include/unotools/textsearch.hxx @@ -27,6 +27,8 @@ #include #include +#include + class CharClass; namespace com { @@ -133,6 +135,32 @@ public: TransliterationFlags GetTransliterationFlags() const { return nTransliterationFlags; } }; +// For use in SAL_DEBUG etc. Output format not guaranteed to be stable. +template +inline std::basic_ostream & operator <<(std::basic_ostream & stream, const SearchParam::SearchType& eType) +{ + switch (eType) + { + case SearchParam::SearchType::Normal: + stream << "N"; + break; + case SearchParam::SearchType::Regexp: + stream << "RE"; + break; + case SearchParam::SearchType::Wildcard: + stream << "WC"; + break; + case SearchParam::SearchType::Unknown: + stream << "UNK"; + break; + default: + stream << static_cast(eType) << '?'; + break; + } + + return stream; +} + // Utility class for searching a substring in a string. // The following metrics are supported // - ordinary text (Bayer/Moore) -- cgit