summaryrefslogtreecommitdiff
path: root/include/unotools
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2017-08-04 12:58:33 +0300
committerTor Lillqvist <tml@collabora.com>2017-08-04 12:59:12 +0300
commitbf234dc9cd0481c241bbb0f755264562ee89d568 (patch)
treeb168828fe1c97075416457a791f93a558d934810 /include/unotools
parent902d87147d779c84b4ea84ef7779897d89b1fab2 (diff)
Add debug output operator<< for SearchParam::SearchType
Diffstat (limited to 'include/unotools')
-rw-r--r--include/unotools/textsearch.hxx28
1 files changed, 28 insertions, 0 deletions
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 <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/util/XTextSearch2.hpp>
+#include <ostream>
+
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<typename charT, typename traits>
+inline std::basic_ostream<charT, traits> & operator <<(std::basic_ostream<charT, traits> & 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<int>(eType) << '?';
+ break;
+ }
+
+ return stream;
+}
+
// Utility class for searching a substring in a string.
// The following metrics are supported
// - ordinary text (Bayer/Moore)