From ee2a5c3986a8069859a8d6bd0625f14eaf7fe3cf Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Mon, 12 Dec 2011 17:50:50 +0100
Subject: [PATCH] debugger: add primitive dumper for boost::gregorian::date

Change-Id: Ie276457dc965a9b971382fd927e3049103397f0d
Reviewed-by: hjk <qthjk@ovi.com>
---
 share/qtcreator/dumper/qttypes.py             |  5 +++
 .../debugger/simple/simple_test_app.cpp       | 42 +++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/share/qtcreator/dumper/qttypes.py b/share/qtcreator/dumper/qttypes.py
index a2236d803ab..6fd9e7a6d3a 100644
--- a/share/qtcreator/dumper/qttypes.py
+++ b/share/qtcreator/dumper/qttypes.py
@@ -2052,6 +2052,11 @@ def qdump__boost__shared_ptr(d, value):
             d.putIntItem("usecount", usecount)
 
 
+def qdump__boost__gregorian__date(d, value):
+    d.putValue(value["days_"], JulianDate)
+    d.putNumChild(0)
+
+
 #######################################################################
 #
 # Symbian
diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp
index 47804d1eb0e..48473b7e10d 100644
--- a/tests/manual/debugger/simple/simple_test_app.cpp
+++ b/tests/manual/debugger/simple/simple_test_app.cpp
@@ -159,6 +159,7 @@ void dummyStatement(...) {}
 #if USE_BOOST
 #include <boost/optional.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/date_time/gregorian/gregorian.hpp>
 #endif
 
 #if USE_EIGEN
@@ -5068,11 +5069,52 @@ namespace boost {
         dummyStatement(&s, &j, &sl);
     }
 
+    void testBoostGregorianDate()
+    {
+        using namespace boost;
+        using namespace gregorian;
+        date d(2005, Nov, 29);
+        BREAK_HERE;
+        // Check d Tue Nov 29 2005 boost::gregorian::date.
+        // Continue
+
+        d += months(1);
+        BREAK_HERE;
+        // Check d Thu Dec 29 2005 boost::gregorian::date.
+        // Continue
+
+        d += months(1);
+        BREAK_HERE;
+        // Check d Sun Jan 29 2006 boost::gregorian::date.
+        // Continue
+
+        // snap-to-end-of-month behavior kicks in:
+        d += months(1);
+        BREAK_HERE;
+        // Check d Tue Feb 28 2006 boost::gregorian::date6.
+        // Continue.
+
+        // Also end of the month (expected in boost)
+        d += months(1);
+        BREAK_HERE;
+        // Check d Fri Mar 31 2006 boost::gregorian::date.
+        // Continue.
+
+        // Not where we started (expected in boost)
+        d -= months(4);
+        BREAK_HERE;
+        // Check d Tue Nov 30 2005 boost::gregorian::date.
+        // Continue.
+
+        dummyStatement(&d);
+    }
+
     void testBoost()
     {
         testBoostOptional1();
         testBoostOptional2();
         testBoostSharedPtr();
+        testBoostGregorianDate();
     }
 
     #else
-- 
GitLab