xref: /aoo41x/main/svl/unx/inc/convert.hxx (revision 39a19a47)
1*39a19a47SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*39a19a47SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*39a19a47SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*39a19a47SAndrew Rist  * distributed with this work for additional information
6*39a19a47SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*39a19a47SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*39a19a47SAndrew Rist  * "License"); you may not use this file except in compliance
9*39a19a47SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*39a19a47SAndrew Rist  *
11*39a19a47SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*39a19a47SAndrew Rist  *
13*39a19a47SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*39a19a47SAndrew Rist  * software distributed under the License is distributed on an
15*39a19a47SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*39a19a47SAndrew Rist  * KIND, either express or implied.  See the License for the
17*39a19a47SAndrew Rist  * specific language governing permissions and limitations
18*39a19a47SAndrew Rist  * under the License.
19*39a19a47SAndrew Rist  *
20*39a19a47SAndrew Rist  *************************************************************/
21*39a19a47SAndrew Rist 
22*39a19a47SAndrew Rist 
23cdf0e10cSrcweir #ifndef _CONVERT_HXX
24cdf0e10cSrcweir #define _CONVERT_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir /*
27cdf0e10cSrcweir #define _SWAPSHORT(x) ((((x) & 0xFF00)>>8) | (((x) & 0x00FF)<<8))
28cdf0e10cSrcweir #define _SWAPLONG(x)  ((((x) & 0xFF000000)>>24) | (((x) & 0x00FF0000)>>8) |  \
29cdf0e10cSrcweir 					  (((x) & 0x0000FF00)<<8) | (((x) & 0x000000FF)<<24))
30cdf0e10cSrcweir */
31cdf0e10cSrcweir class Convert
32cdf0e10cSrcweir {
33cdf0e10cSrcweir public:
Swap(long & nValue)34cdf0e10cSrcweir 	static void		Swap( long & nValue )
35cdf0e10cSrcweir 					{ nValue = SWAPLONG( nValue ); }
Swap(ULONG & nValue)36cdf0e10cSrcweir 	static void		Swap( ULONG & nValue )
37cdf0e10cSrcweir 					{ nValue = SWAPLONG( nValue ); }
Swap(short & nValue)38cdf0e10cSrcweir 	static void		Swap( short & nValue )
39cdf0e10cSrcweir 					{ nValue = SWAPSHORT( nValue ); }
Swap(USHORT & nValue)40cdf0e10cSrcweir 	static void		Swap( USHORT & nValue )
41cdf0e10cSrcweir 					{ nValue = SWAPSHORT( nValue ); }
Swap(Point & aPtr)42cdf0e10cSrcweir 	static void		Swap( Point & aPtr )
43cdf0e10cSrcweir 					{ Swap( aPtr.X() ); Swap( aPtr.Y() ); }
Swap(Size & aSize)44cdf0e10cSrcweir 	static void		Swap( Size & aSize )
45cdf0e10cSrcweir 					{ Swap( aSize.Width() ); Swap( aSize.Height() ); }
Swap(Rectangle & rRect)46cdf0e10cSrcweir 	static void		Swap( Rectangle & rRect )
47cdf0e10cSrcweir 					{ Swap( rRect.Top() ); Swap( rRect.Bottom() );
48cdf0e10cSrcweir 					  Swap( rRect.Left() ); Swap( rRect.Right() ); }
49cdf0e10cSrcweir /*
50cdf0e10cSrcweir 	static USHORT	AnsiFloatSize() const { return 6; }
51cdf0e10cSrcweir 	static float	AnsiToFloat( void * pAnsiFloat )
52cdf0e10cSrcweir 					{ return 0; }
53cdf0e10cSrcweir 	static USHORT	AnsiDoubleSize() const { return 12; }
54cdf0e10cSrcweir 	static double	AnsiToDouble( void * pAnsiDouble )
55cdf0e10cSrcweir 					{ return 0; }
56cdf0e10cSrcweir */
57cdf0e10cSrcweir };
58cdf0e10cSrcweir 
59cdf0e10cSrcweir #endif // _CONVERT_HXX
60