1 #ifndef _RPTSHARED_CONSTASCIISTRING_HXX_
2 #define _RPTSHARED_CONSTASCIISTRING_HXX_
4 #ifndef CONSTASCII_INCLUDED_INDIRECT
5 #error "don't include this file directly! use stringconstants.hrc instead!"
8 // no namespaces. This file is included from several other files _within_ a namespace.
10 //============================================================
11 //= a helper for static ascii pseudo-unicode strings
12 //============================================================
14 struct ConstAsciiString
16 const sal_Char
* ascii
;
19 inline operator const ::rtl::OUString
& () const;
20 inline operator const sal_Char
* () const { return ascii
; }
22 inline ConstAsciiString(const sal_Char
* _pAsciiZeroTerminated
, const sal_Int32 _nLength
);
23 inline ~ConstAsciiString();
26 mutable ::rtl::OUString
* ustring
;
29 //------------------------------------------------------------
30 inline ConstAsciiString::ConstAsciiString(const sal_Char
* _pAsciiZeroTerminated
, const sal_Int32 _nLength
)
31 :ascii(_pAsciiZeroTerminated
)
37 //------------------------------------------------------------
38 inline ConstAsciiString::~ConstAsciiString()
44 //------------------------------------------------------------
45 inline ConstAsciiString::operator const ::rtl::OUString
& () const
48 ustring
= new ::rtl::OUString(ascii
, length
, RTL_TEXTENCODING_ASCII_US
);
52 //============================================================
54 #define DECLARE_CONSTASCII_USTRING( name ) \
55 extern const ConstAsciiString name
57 #define IMPLEMENT_CONSTASCII_USTRING( name, string ) \
58 const ConstAsciiString name(string, sizeof(string)-1)
61 #endif // _RPTSHARED_CONSTASCIISTRING_HXX_