[Libreoffice-commits] core.git: filter/source
Kohei Yoshida
kohei.yoshida at gmail.com
Mon Feb 4 08:30:37 PST 2013
filter/source/config/cache/cacheitem.cxx | 3 +++
filter/source/config/cache/cacheitem.hxx | 17 ++++++-----------
filter/source/config/cache/typedetection.cxx | 23 +++++++++++++++++++++++
3 files changed, 32 insertions(+), 11 deletions(-)
New commits:
commit 71ca001ae1621a0a48fb7377c2afd3697e2a2203
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Feb 4 11:28:44 2013 -0500
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
diff --git a/filter/source/config/cache/cacheitem.cxx b/filter/source/config/cache/cacheitem.cxx
index 005285d..d33c3fb 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 33e7272..5e01890 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 f3772e5..e7c0bc0 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,
More information about the Libreoffice-commits
mailing list