diff options
author | Frank Schönheit <fs@openoffice.org> | 2002-10-25 07:03:17 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2002-10-25 07:03:17 +0000 |
commit | fba65599ed4de5c6ea607f88004405080df5f2e9 (patch) | |
tree | 0e564474473b7d317866609966cec414e6146e96 /xmloff/source/forms/strings.hxx | |
parent | e159b46a38e00a2e1fe25186cf77974a1fa31d22 (diff) |
during #104402#: changed the ConstAsciiString no able to return a reference to an OUString (which is cheaper than a complete new copy)
Diffstat (limited to 'xmloff/source/forms/strings.hxx')
-rw-r--r-- | xmloff/source/forms/strings.hxx | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/xmloff/source/forms/strings.hxx b/xmloff/source/forms/strings.hxx index 9103bf6848d3..45b0c4b34db2 100644 --- a/xmloff/source/forms/strings.hxx +++ b/xmloff/source/forms/strings.hxx @@ -2,9 +2,9 @@ * * $RCSfile: strings.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: fs $ $Date: 2002-05-30 08:38:35 $ + * last change: $Author: fs $ $Date: 2002-10-25 08:03:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -82,14 +82,15 @@ namespace xmloff const sal_Char* ascii; sal_Int32 length; - inline operator ::rtl::OUString () const; + 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_uString* ustring; + mutable ::rtl::OUString* m_pString; private: ConstAsciiString(); // never implemented @@ -97,28 +98,28 @@ namespace xmloff //------------------------------------------------------------ inline ConstAsciiString::ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength) - :ascii(_pAsciiZeroTerminated) - ,length(_nLength) - ,ustring(NULL) + :ascii( _pAsciiZeroTerminated ) + ,length( _nLength ) + ,m_pString( NULL ) { } //------------------------------------------------------------ inline ConstAsciiString::~ConstAsciiString() { - if (ustring) + if ( m_pString ) { - rtl_uString_release(ustring); - ustring = NULL; + delete m_pString; + m_pString = NULL; } } //------------------------------------------------------------ - inline ConstAsciiString::operator ::rtl::OUString () const + inline const ::rtl::OUString* ConstAsciiString::operator& () const { - if (!ustring) - rtl_uString_newFromAscii( &ustring, ascii ); - return ustring; + if ( !m_pString ) + m_pString = new ::rtl::OUString( ascii, length, RTL_TEXTENCODING_ASCII_US ); + return m_pString; } #ifndef XMLFORM_IMPLEMENT_STRINGS @@ -286,6 +287,9 @@ namespace xmloff /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.8 2002/05/30 08:38:35 fs + * #99693# +PROPERTY_HIDDEN_VALUE + * * Revision 1.7 2001/09/04 10:18:40 fs * #91865# some script related strings * |