[Libreoffice-commits] .: vcl/inc

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 27 07:45:24 PST 2012


 vcl/inc/vcl/builder.hxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 6e1fba8a7262325eb7adf8f90c0f53359ae3e555
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Nov 27 15:42:12 2012 +0000

    try and make error message a little more useful
    
    Change-Id: I20070965dbf2632461fc74cc8a9795c7ddded269

diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index cbda844..82bd805 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -10,6 +10,7 @@
 #ifndef _VCLBUILDER_HXX
 #define _VCLBUILDER_HXX
 
+#include <typeinfo>
 #include <vcl/dllapi.h>
 #include <vcl/window.hxx>
 #include <xmlreader/xmlreader.hxx>
@@ -150,6 +151,9 @@ public:
     template <typename T> T* get(T*& ret, OString sID)
     {
         Window *w = get_by_name(sID);
+        SAL_WARN_IF(!w, "vcl.layout", "widget " << sID.getStr() << " not found in .ui");
+        SAL_WARN_IF(!dynamic_cast<T*>(w),
+            "vcl.layout", "widget " << sID.getStr() << " needs to have type " << typeid(T).name());
         assert(w && dynamic_cast<T*>(w));
         ret = static_cast<T*>(w);
         return ret;
@@ -158,6 +162,8 @@ public:
     template <typename T /*=Window if we had c++11*/> T* get(OString sID)
     {
         Window *w = get_by_name(sID);
+        SAL_WARN_IF(w && !dynamic_cast<T*>(w),
+            "vcl.layout", "widget " << sID.getStr() << " needs to have type " << typeid(T).name());
         assert(!w || dynamic_cast<T*>(w));
         return static_cast<T*>(w);
     }


More information about the Libreoffice-commits mailing list