summaryrefslogtreecommitdiff
path: root/xmloff/source/forms/strings.hxx
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 /xmloff/source/forms/strings.hxx
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 'xmloff/source/forms/strings.hxx')
-rw-r--r--xmloff/source/forms/strings.hxx55
1 files changed, 3 insertions, 52 deletions
diff --git a/xmloff/source/forms/strings.hxx b/xmloff/source/forms/strings.hxx
index b98cd42f43c7..ea5d8951cb65 100644
--- a/xmloff/source/forms/strings.hxx
+++ b/xmloff/source/forms/strings.hxx
@@ -29,67 +29,18 @@
#ifndef _XMLOFF_FORMS_STRINGS_HXX_
#define _XMLOFF_FORMS_STRINGS_HXX_
-#include <sal/types.h>
-#include <rtl/ustring.hxx>
+#include <comphelper/string.hxx>
//.........................................................................
namespace xmloff
{
+ using comphelper::string::ConstAsciiString;
//.........................................................................
- //============================================================
- //= a helper for static ascii pseudo-unicode strings
- //============================================================
- struct ConstAsciiString
- {
- const sal_Char* ascii;
- sal_Int32 length;
-
- inline operator const ConstAsciiString* () const { return this; }
- inline const ::rtl::OUString* operator& () const;
- inline operator const ::rtl::OUString& () const { return *(&(*this)); }
- inline operator const sal_Char* () const { return ascii; }
-
- inline ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength);
- inline ~ConstAsciiString();
-
- private:
- mutable ::rtl::OUString* m_pString;
-
- private:
- ConstAsciiString(); // never implemented
- };
-
- //------------------------------------------------------------
- inline ConstAsciiString::ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength)
- :ascii( _pAsciiZeroTerminated )
- ,length( _nLength )
- ,m_pString( NULL )
- {
- }
-
- //------------------------------------------------------------
- inline ConstAsciiString::~ConstAsciiString()
- {
- if ( m_pString )
- {
- delete m_pString;
- m_pString = NULL;
- }
- }
-
- //------------------------------------------------------------
- inline const ::rtl::OUString* ConstAsciiString::operator& () const
- {
- if ( !m_pString )
- m_pString = new ::rtl::OUString( ascii, length, RTL_TEXTENCODING_ASCII_US );
- return m_pString;
- }
-
#ifndef XMLFORM_IMPLEMENT_STRINGS
#define XMLFORM_CONSTASCII_STRING(ident, string) extern const ConstAsciiString ident
#else
- #define XMLFORM_CONSTASCII_STRING(ident, string) extern const ConstAsciiString ident(string, sizeof(string)-1)
+ #define XMLFORM_CONSTASCII_STRING(ident, string) extern const ConstAsciiString ident = {RTL_CONSTASCII_STRINGPARAM(string)}
#endif
//============================================================