summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-02-04 11:28:44 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-02-04 11:31:55 -0500
commit71ca001ae1621a0a48fb7377c2afd3697e2a2203 (patch)
tree10a5b77012d9289ba88a64380643030e1a3a5867 /filter
parentaf823deeeedc42de3ddf11be3518622e6acdbdd2 (diff)
Add some debug bits for type detection code.
The code is used only during debugging and needs to be explicitly enabled by setting DEBUG_TYPE_DETECTION to 1 and inserting the function that prints debug outputs. Change-Id: I72f31eb86f7fcc99030e3bb6c2a869d076b066fd
Diffstat (limited to 'filter')
-rw-r--r--filter/source/config/cache/cacheitem.cxx3
-rw-r--r--filter/source/config/cache/cacheitem.hxx17
-rw-r--r--filter/source/config/cache/typedetection.cxx23
3 files changed, 32 insertions, 11 deletions
diff --git a/filter/source/config/cache/cacheitem.cxx b/filter/source/config/cache/cacheitem.cxx
index 005285d1524c..d33c3fb9e364 100644
--- a/filter/source/config/cache/cacheitem.cxx
+++ b/filter/source/config/cache/cacheitem.cxx
@@ -389,6 +389,9 @@ sal_Bool CacheItem::dontHaveProps(const CacheItem& lProps) const
return sal_True;
}
+FlatDetectionInfo::FlatDetectionInfo() :
+ bMatchByExtension(false), bMatchByPattern(false), bPreselectedByDocumentService(false) {}
+
} // namespace config
} // namespace filter
diff --git a/filter/source/config/cache/cacheitem.hxx b/filter/source/config/cache/cacheitem.hxx
index 33e7272d4df8..5e018905aa4b 100644
--- a/filter/source/config/cache/cacheitem.hxx
+++ b/filter/source/config/cache/cacheitem.hxx
@@ -206,26 +206,21 @@ typedef ::boost::unordered_map< ::rtl::OUString ,
structure can decide then, if a deep detection should be
suppressed e.g. if an URLPattern was used.
*/
-struct FlatDetectionInfo
+struct FlatDetectionInfo
{
// the internal type name
::rtl::OUString sType;
// this type was found by a matching the URL extension
- sal_Bool bMatchByExtension;
+ bool bMatchByExtension;
// this type was found by a matching URL Pattern
- sal_Bool bMatchByPattern;
+ bool bMatchByPattern;
// the user selected this type implicit by selecting a corresponding office module
- sal_Bool bPreselectedByDocumentService;
-
- FlatDetectionInfo()
- : sType (::rtl::OUString())
- , bMatchByExtension (sal_False )
- , bMatchByPattern (sal_False )
- , bPreselectedByDocumentService(sal_False )
- {}
+ bool bPreselectedByDocumentService;
+
+ FlatDetectionInfo();
};
typedef ::std::list< FlatDetectionInfo > FlatDetection;
diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
index f3772e524101..e7c0bc048e17 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -34,6 +34,13 @@
#include <unotools/localfilehelper.hxx>
#include <comphelper/processfactory.hxx>
+#define DEBUG_TYPE_DETECTION 0
+
+#if DEBUG_TYPE_DETECTION
+#include <iostream>
+using std::cout;
+using std::endl;
+#endif
namespace filter{
namespace config{
@@ -226,6 +233,22 @@ struct EqualByName : public std::binary_function<FlatDetectionInfo, FlatDetectio
}
};
+#if DEBUG_TYPE_DETECTION
+void printFlatDetectionList(const char* caption, const FlatDetection& types)
+{
+ cout << "-- " << caption << endl;
+ FlatDetection::const_iterator it = types.begin(), itEnd = types.end();
+ for (; it != itEnd; ++it)
+ {
+ const FlatDetectionInfo& item = *it;
+ cout << " type='" << item.sType << "'; match by extension (" << item.bMatchByExtension
+ << "); match by pattern (" << item.bMatchByPattern << "); pre-selected by doc service ("
+ << item.bPreselectedByDocumentService << ")" << endl;
+ }
+ cout << "--" << endl;
+}
+#endif
+
}
::rtl::OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css::beans::PropertyValue >& lDescriptor,