Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index



 Hello,

 would somebody see a problem with this?

sal/inc/rtl/ustring.hxx :
+#ifdef RTL_AUTOMATIC_USING
+using ::rtl::OUString;
+using ::rtl::OStringToOUString;
+using ::rtl::OUStringToOString;
+#endif

 I seriously doubt there will ever be any O(U)String anywhere in LO build that 
will not be the rtl one, so the need to explicitly qualify it with the rtl 
namespace (or go with using, which is what many files do) seem to be just an 
unnecessary hassle. So I'd like to do this change for those few commonly used 
rtl types which are in practice namespaced by the name itself (i.e. not the 
problematic rtl::Reference), and then build all of LO 
with -DRTL_AUTOMATIC_USING.

-- 
 Lubos Lunak
 l.lunak@suse.cz
diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk
index 0b6e30f..eaacf07 100644
--- a/sal/Library_sal.mk
+++ b/sal/Library_sal.mk
@@ -54,6 +54,11 @@ $(eval $(call gb_Library_add_defs,sal,\
        -DSAL_DLLIMPLEMENTATION \
 ))
 
+# ensure that public headers build without this feature
+$(eval $(call gb_Library_add_defs,sal,\
+       -URTL_AUTOMATIC_USING \
+))
+
 $(eval $(call gb_Library_use_libraries,sal,\
        $(if $(filter $(GUI),UNX), \
                $(if $(filter $(OS),ANDROID),, \
diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
index 7711308..ec48088 100644
--- a/sal/inc/rtl/strbuf.hxx
+++ b/sal/inc/rtl/strbuf.hxx
@@ -849,6 +849,10 @@ typedef rtlunittest::OStringBuffer OStringBuffer;
 #undef RTL_STRING_CONST_FUNCTION
 #endif
 
+#ifdef RTL_AUTOMATIC_USING
+using ::rtl::OStringBuffer;
+#endif
+
 #endif  /* __cplusplus */
 #endif  /* _RTL_STRBUF_HXX_ */
 
diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx
index 9791a8c..84d9eba 100644
--- a/sal/inc/rtl/string.hxx
+++ b/sal/inc/rtl/string.hxx
@@ -1467,6 +1467,11 @@ struct OStringHash
 
 } /* Namespace */
 
+#ifdef RTL_AUTOMATIC_USING
+using ::rtl::OString;
+using ::rtl::OStringHash;
+#endif
+
 #endif /* _RTL_STRING_HXX_ */
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index a887107..cbfcb5c 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -962,6 +962,10 @@ typedef rtlunittest::OUStringBuffer OUStringBuffer;
 }
 #endif
 
+#ifdef RTL_AUTOMATIC_USING
+using ::rtl::OUStringBuffer;
+#endif
+
 #endif  /* _RTL_USTRBUF_HXX_ */
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index 883fb93..1c9d34a 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -2083,6 +2083,13 @@ inline OString OUStringToOString( const OUString & rUnicode,
 
 } /* Namespace */
 
+#ifdef RTL_AUTOMATIC_USING
+using ::rtl::OUString;
+using ::rtl::OUStringHash;
+using ::rtl::OStringToOUString;
+using ::rtl::OUStringToOString;
+#endif
+
 #endif /* _RTL_USTRING_HXX */
 
 // Include the ostream << operator directly here, so that it's always available
diff --git a/solenv/gbuild/platform/WNT_INTEL_MSC.mk b/solenv/gbuild/platform/WNT_INTEL_MSC.mk
index 0df48c4..1f492fb 100644
--- a/solenv/gbuild/platform/WNT_INTEL_MSC.mk
+++ b/solenv/gbuild/platform/WNT_INTEL_MSC.mk
@@ -59,6 +59,7 @@ gb_COMPILERDEFS := \
        -DBOOST_MEM_FN_ENABLE_CDECL \
        -DCPPU_ENV=msci \
        -DM1500 \
+       -DRTL_AUTOMATIC_USING \
 
 gb_CPUDEFS := -D_X86_=1
 
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 36b2cc7..435030a 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -85,6 +85,7 @@ gb_COMPILERDEFS := \
        -D$(COM) \
        -DCPPU_ENV=gcc3 \
        -DGXX_INCLUDE_PATH=$(GXX_INCLUDE_PATH) \
+       -DRTL_AUTOMATIC_USING \
 
 gb_CFLAGS_COMMON := \
        -Wall \

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.