summaryrefslogtreecommitdiff
path: root/dbaccess/source/inc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-05-17 14:00:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-05-17 14:03:26 +0100
commit5dcf536b69848b56f1199b81e4b7ed87a0a3864d (patch)
tree86f28d6db1963680549b6111ca99f95ca580f763 /dbaccess/source/inc
parentacd9cda35457f0a839bf9713c261022c39cd8269 (diff)
merge the 5 ConstAsciiString duplicate classes together
a) merge them together and move it into comphelper b) turn it into a POD rather than having vast amounts of destructors registered into the cxa_atexit chain Change-Id: I04d3b9d7804f8e233013c916df9d617a0f84f96a
Diffstat (limited to 'dbaccess/source/inc')
-rw-r--r--dbaccess/source/inc/constasciistring.hxx48
-rw-r--r--dbaccess/source/inc/dbastrings.hrc4
-rw-r--r--dbaccess/source/inc/dbustrings.hrc4
-rw-r--r--dbaccess/source/inc/sdbtstrings.hrc4
-rw-r--r--dbaccess/source/inc/xmlstrings.hrc4
5 files changed, 10 insertions, 54 deletions
diff --git a/dbaccess/source/inc/constasciistring.hxx b/dbaccess/source/inc/constasciistring.hxx
index 2179e2d7ffdd..80ead8e75597 100644
--- a/dbaccess/source/inc/constasciistring.hxx
+++ b/dbaccess/source/inc/constasciistring.hxx
@@ -6,58 +6,14 @@
#error "don't include this file directly! use stringconstants.hrc instead!"
#endif
-// no namespaces. This file is included from several other files _within_ a namespace.
-
-//============================================================
-//= a helper for static ascii pseudo-unicode strings
-//============================================================
-// string constants
-struct ConstAsciiString
-{
- const sal_Char* ascii;
- sal_Int32 length;
-
- inline operator const ::rtl::OUString& () const;
- inline operator const sal_Char* () const { return ascii; }
-
- inline ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength);
- inline ~ConstAsciiString();
-
-private:
- mutable ::rtl::OUString* ustring;
-};
-//------------------------------------------------------------
-inline ConstAsciiString::ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength)
- :ascii(_pAsciiZeroTerminated)
- ,length(_nLength)
- ,ustring(NULL)
-{
-}
-
-//------------------------------------------------------------
-inline ConstAsciiString::~ConstAsciiString()
-{
- delete ustring;
- ustring = NULL;
-}
-
-//------------------------------------------------------------
-inline ConstAsciiString::operator const ::rtl::OUString& () const
-{
- if (!ustring)
- ustring = new ::rtl::OUString(ascii, length, RTL_TEXTENCODING_ASCII_US);
- return *ustring;
-}
-
-//============================================================
+// no namespaces. This file is included from several other files _within_ a namespace.
#define DECLARE_CONSTASCII_USTRING( name ) \
extern const ConstAsciiString name
#define IMPLEMENT_CONSTASCII_USTRING( name, string ) \
- const ConstAsciiString name(string, sizeof(string)-1)
-
+ const ConstAsciiString name = {RTL_CONSTASCII_STRINGPARAM(string)}
#endif // _DBASHARED_CONSTASCIISTRING_HXX_
diff --git a/dbaccess/source/inc/dbastrings.hrc b/dbaccess/source/inc/dbastrings.hrc
index eb6b98d5bd8b..9a98721777df 100644
--- a/dbaccess/source/inc/dbastrings.hrc
+++ b/dbaccess/source/inc/dbastrings.hrc
@@ -27,9 +27,9 @@
#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
#define DBACCESS_SHARED_DBASTRINGS_HRC
-#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
-#endif
+#include <comphelper/string.hxx>
+using comphelper::string::ConstAsciiString;
namespace dbaccess
{
diff --git a/dbaccess/source/inc/dbustrings.hrc b/dbaccess/source/inc/dbustrings.hrc
index aeef19d752dd..84e8c3021a4a 100644
--- a/dbaccess/source/inc/dbustrings.hrc
+++ b/dbaccess/source/inc/dbustrings.hrc
@@ -27,9 +27,9 @@
#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
#define DBACCESS_SHARED_DBUSTRINGS_HRC
-#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
-#endif
+#include <comphelper/string.hxx>
+using comphelper::string::ConstAsciiString;
namespace dbaui
{
diff --git a/dbaccess/source/inc/sdbtstrings.hrc b/dbaccess/source/inc/sdbtstrings.hrc
index c4837f52bce1..f14854a7f596 100644
--- a/dbaccess/source/inc/sdbtstrings.hrc
+++ b/dbaccess/source/inc/sdbtstrings.hrc
@@ -27,9 +27,9 @@
#ifndef DBACCESS_SHARED_SDBTSTRINGS_HRC
#define DBACCESS_SHARED_SDBTSTRINGS_HRC
-#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
-#endif
+#include <comphelper/string.hxx>
+using comphelper::string::ConstAsciiString;
namespace sdbtools
{
diff --git a/dbaccess/source/inc/xmlstrings.hrc b/dbaccess/source/inc/xmlstrings.hrc
index db5a729e2ea6..e1e891e31f7d 100644
--- a/dbaccess/source/inc/xmlstrings.hrc
+++ b/dbaccess/source/inc/xmlstrings.hrc
@@ -27,9 +27,9 @@
#ifndef DBACCESS_SHARED_XMLSTRINGS_HRC
#define DBACCESS_SHARED_XMLSTRINGS_HRC
-#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
-#endif
+#include <comphelper/string.hxx>
+using comphelper::string::ConstAsciiString;
namespace dbaxml
{