xref: /aoo41x/main/framework/inc/macros/generic.hxx (revision f8e07b45)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef __FRAMEWORK_MACROS_GENERIC_HXX_
25 #define __FRAMEWORK_MACROS_GENERIC_HXX_
26 
27 //_________________________________________________________________________________________________________________
28 //	includes
29 //_________________________________________________________________________________________________________________
30 
31 #include <rtl/ustring.hxx>
32 #include <rtl/textenc.h>
33 
34 //*****************************************************************************************************************
35 //	generic macros
36 //*****************************************************************************************************************
37 
38 /*_________________________________________________________________________________________________________________
39 	DECLARE_ASCII( SASCIIVALUE )
40 
41 	Use it to declare a constant ascii value at compile time in code.
42 	zB. OUSting sTest = DECLARE_ASCII( "Test" )
43 _________________________________________________________________________________________________________________*/
44 
45 #define	DECLARE_ASCII( SASCIIVALUE )																			\
46 	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) )
47 
48 /*_________________________________________________________________________________________________________________
49 	U2B( SUNICODEVALUE )
50 	B2U( SASCIIVALUE )
51 	U2B_ENC( SUNICODEVALUE, AENCODING )
52 	B2U_ENC( SASCIIVALUE, AENCODING )
53 
54 	Use it to convert unicode strings to ascii values and reverse ...
55 	We use UTF8 as default textencoding. If you will change this use U2B_ENC and B2U_ENC!
56 _________________________________________________________________________________________________________________*/
57 
58 #define	U2B( SUNICODEVALUE )																					\
59 	::rtl::OUStringToOString( SUNICODEVALUE, RTL_TEXTENCODING_UTF8 )
60 
61 #define	B2U( SASCIIVALUE )																						\
62 	::rtl::OStringToOUString( SASCIIVALUE, RTL_TEXTENCODING_UTF8 )
63 
64 #define	U2B_ENC( SUNICODEVALUE, AENCODING )																		\
65 	::rtl::OUStringToOString( SUNICODEVALUE, AENCODING )
66 
67 #define	B2U_ENC( SASCIIVALUE, AENCODING )																		\
68 	::rtl::OStringToOUString( SASCIIVALUE, AENCODING )
69 
70 //*****************************************************************************************************************
71 //	end of file
72 //*****************************************************************************************************************
73 
74 #endif	//	#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_
75