1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
30 #include <tools/solar.h>
31 #include <rtl/ustring.hxx>
33 /******************* T y p e s *******************************************/
35 enum COMPARE
{ LESS
= -1, EQUAL
= 0, GREATER
= 1 };
37 enum RSCBYTEORDER_TYPE
{ RSC_BIGENDIAN
, RSC_LITTLEENDIAN
, RSC_SYSTEMENDIAN
};
39 /******************* M A K R O S *****************************************/
40 #define ALIGNED_SIZE( nSize ) \
41 (nSize + sizeof( void * ) -1) / sizeof( void * ) * sizeof( void * )
42 /******************* F u n c t i o n F o r w a r d s *******************/
43 OString
GetTmpFileName();
44 sal_Bool
Append(const OString
&rDestFile
, const OString
&rSourceFile
);
45 sal_Bool
Append(FILE * fDest
, OString
&raSourceFile
);
46 OString
OutputFile(const OString
&rInput
, const char * ext
);
47 char * ResponseFile( RscPtrPtr
* ppCmd
, char ** ppArgv
,
49 void RscExit( sal_uInt32 nExit
);
51 /********* A n s i - F u n c t i o n F o r w a r d s *******************/
52 int rsc_strnicmp( const char *string1
, const char *string2
, size_t count
);
53 int rsc_stricmp( const char *string1
, const char *string2
);
54 char* rsc_strdup( const char* );
56 /****************** C L A S S E S ****************************************/
58 typedef ::std::vector
< OString
* > RscStrList
;
60 /*********** R s c C h a r ***********************************************/
64 static char * MakeUTF8( char * pStr
, sal_uInt16 nTextEncoding
);
67 /****************** R s c P t r P t r ************************************/
76 sal_uInt32
Append( void * );
77 sal_uInt32
Append( char * pStr
){
78 return( Append( (void *)pStr
) );
80 sal_uInt32
GetCount(){ return( nCount
); };
81 void * GetEntry( sal_uInt32 nEle
);
82 void ** GetBlock(){ return( pMem
); };
85 /****************** R s c W r i t e R c **********************************/
90 RSCBYTEORDER_TYPE nByteOrder
;
92 char * GetPointer( sal_uInt32 nSize
);
94 RscWriteRc( RSCBYTEORDER_TYPE nOrder
= RSC_SYSTEMENDIAN
);
96 sal_uInt32
IncSize( sal_uInt32 nSize
);// gibt die vorherige Groesse
99 return GetPointer( 0 );
101 sal_uInt16
GetShort( sal_uInt32 nPos
)
104 char* pFrom
= GetPointer(nPos
);
105 char* pTo
= (char*)&nVal
;
108 return bSwap
? OSL_SWAPWORD( nVal
) : nVal
;
110 sal_uInt32
GetLong( sal_uInt32 nPos
)
113 char* pFrom
= GetPointer(nPos
);
114 char* pTo
= (char*)&nVal
;
119 return bSwap
? OSL_SWAPDWORD( nVal
) : nVal
;
121 char * GetUTF8( sal_uInt32 nPos
)
123 return GetPointer( nPos
);
127 RSCBYTEORDER_TYPE
GetByteOrder() const { return nByteOrder
; }
128 sal_uInt32
Size(){ return( nLen
); };
129 void Put( sal_uInt64 lVal
)
134 sal_uInt32 aVal32
[2];
148 void Put( sal_Int32 lVal
)
153 sal_uInt16 aVal16
[2];
168 void Put( sal_uInt32 nValue
)
169 { Put( (sal_Int32
)nValue
); }
170 void Put( sal_uInt16 nValue
);
171 void Put( sal_Int16 nValue
)
172 { Put( (sal_uInt16
)nValue
); }
173 void PutUTF8( char * pData
);
175 void PutAt( sal_uInt32 nPos
, sal_Int32 lVal
)
180 sal_uInt16 aVal16
[2];
186 PutAt( nPos
, aVal16
[1] );
187 PutAt( nPos
+ 2, aVal16
[0] );
191 PutAt( nPos
, aVal16
[0] );
192 PutAt( nPos
+ 2, aVal16
[1] );
195 void PutAt( sal_uInt32 nPos
, sal_uInt32 lVal
)
197 PutAt( nPos
, (sal_Int32
)lVal
);
199 void PutAt( sal_uInt32 nPos
, short nVal
)
201 PutAt( nPos
, (sal_uInt16
)nVal
);
203 void PutAt( sal_uInt32 nPos
, sal_uInt16 nVal
)
206 nVal
= OSL_SWAPWORD( nVal
);
207 char* pTo
= GetPointer( nPos
);
208 char* pFrom
= (char*)&nVal
;
214 #endif // _RSCTOOLS_HXX
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */