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 .
22 #ifndef INCLUDED_RSC_INC_RSCTOOLS_HXX
23 #define INCLUDED_RSC_INC_RSCTOOLS_HXX
30 #include <rtl/ustring.hxx>
31 #include <osl/endian.h>
34 enum COMPARE
{ LESS
= -1, EQUAL
= 0, GREATER
= 1 };
36 enum RSCBYTEORDER_TYPE
{ RSC_BIGENDIAN
, RSC_LITTLEENDIAN
, RSC_SYSTEMENDIAN
};
38 #define ALIGNED_SIZE( nSize ) \
39 (nSize + sizeof( void * ) -1) / sizeof( void * ) * sizeof( void * )
42 OString
GetTmpFileName();
44 bool Append(const OString
&rDestFile
, const OString
&rSourceFile
);
46 bool Append(FILE * fDest
, OString
&raSourceFile
);
48 OString
OutputFile(const OString
&rInput
, const char * ext
);
50 char * ResponseFile( RscPtrPtr
* ppCmd
, char ** ppArgv
,
53 void RscExit( sal_uInt32 nExit
);
55 // Ansi-Function Forwards
56 int rsc_strnicmp( const char *string1
, const char *string2
, size_t count
);
57 int rsc_stricmp( const char *string1
, const char *string2
);
58 char* rsc_strdup( const char* );
60 typedef ::std::vector
< OString
* > RscStrList
;
65 static char * MakeUTF8( char * pStr
, sal_uInt16 nTextEncoding
);
76 sal_uInt32
Append( void * );
77 sal_uInt32
Append( char * pStr
) { return Append( (void *)pStr
); }
78 sal_uInt32
GetCount() { return nCount
; }
79 void * GetEntry( sal_uInt32 nEle
);
80 void ** GetBlock() { return pMem
; }
87 RSCBYTEORDER_TYPE nByteOrder
;
89 char * GetPointer( sal_uInt32 nSize
);
91 RscWriteRc( RSCBYTEORDER_TYPE nOrder
= RSC_SYSTEMENDIAN
);
93 sal_uInt32
IncSize( sal_uInt32 nSize
);// gibt die vorherige Groesse
96 return GetPointer( 0 );
98 sal_uInt16
GetShort( sal_uInt32 nPos
)
101 char* pFrom
= GetPointer(nPos
);
102 char* pTo
= reinterpret_cast<char*>(&nVal
);
105 return bSwap
? OSL_SWAPWORD( nVal
) : nVal
;
107 sal_uInt32
GetLong( sal_uInt32 nPos
)
110 char* pFrom
= GetPointer(nPos
);
111 char* pTo
= reinterpret_cast<char*>(&nVal
);
116 return bSwap
? OSL_SWAPDWORD( nVal
) : nVal
;
118 char * GetUTF8( sal_uInt32 nPos
)
120 return GetPointer( nPos
);
124 RSCBYTEORDER_TYPE
GetByteOrder() const { return nByteOrder
; }
125 sal_uInt32
Size(){ return nLen
; }
126 void Put( sal_uInt64 lVal
)
131 sal_uInt32 aVal32
[2];
145 void Put( sal_Int32 lVal
)
150 sal_uInt16 aVal16
[2];
165 void Put( sal_uInt32 nValue
)
166 { Put( (sal_Int32
)nValue
); }
167 void Put( sal_uInt16 nValue
);
168 void Put( sal_Int16 nValue
)
169 { Put( (sal_uInt16
)nValue
); }
170 void PutUTF8( char * pData
);
172 void PutAt( sal_uInt32 nPos
, sal_Int32 lVal
)
177 sal_uInt16 aVal16
[2];
183 PutAt( nPos
, aVal16
[1] );
184 PutAt( nPos
+ 2, aVal16
[0] );
188 PutAt( nPos
, aVal16
[0] );
189 PutAt( nPos
+ 2, aVal16
[1] );
192 void PutAt( sal_uInt32 nPos
, sal_uInt32 lVal
)
194 PutAt( nPos
, (sal_Int32
)lVal
);
196 void PutAt( sal_uInt32 nPos
, short nVal
)
198 PutAt( nPos
, (sal_uInt16
)nVal
);
200 void PutAt( sal_uInt32 nPos
, sal_uInt16 nVal
)
203 nVal
= OSL_SWAPWORD( nVal
);
204 char* pTo
= GetPointer( nPos
);
205 char* pFrom
= reinterpret_cast<char*>(&nVal
);
211 #endif // INCLUDED_RSC_INC_RSCTOOLS_HXX
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */