LCOV - code coverage report
Current view: top level - rsc/inc - rsctools.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 64 0.0 %
Date: 2014-04-14 Functions: 0 15 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : struct RSHEADER_TYPE;
      20             : class  RscPtrPtr;
      21             : 
      22             : #ifndef _RSCTOOLS_HXX
      23             : #define _RSCTOOLS_HXX
      24             : 
      25             : #ifdef UNX
      26             : #include <stdlib.h>
      27             : #endif
      28             : #include <stdio.h>
      29             : #include <vector>
      30             : #include <rtl/ustring.hxx>
      31             : #include <osl/endian.h>
      32             : 
      33             : // Zeichensatz
      34             : enum COMPARE { LESS = -1, EQUAL = 0, GREATER = 1 };
      35             : 
      36             : enum RSCBYTEORDER_TYPE { RSC_BIGENDIAN, RSC_LITTLEENDIAN, RSC_SYSTEMENDIAN };
      37             : 
      38             : #define ALIGNED_SIZE( nSize )                               \
      39             :             (nSize + sizeof( void * ) -1) / sizeof( void * ) * sizeof( void * )
      40             : 
      41             : // Function Forwards
      42             : OString GetTmpFileName();
      43             : 
      44             : bool Append(const OString &rDestFile, const OString &rSourceFile);
      45             : 
      46             : bool Append(FILE * fDest, OString &raSourceFile);
      47             : 
      48             : OString OutputFile(const OString &rInput, const char * ext);
      49             : 
      50             : char * ResponseFile( RscPtrPtr * ppCmd, char ** ppArgv,
      51             :                      sal_uInt32 nArgc );
      52             : 
      53             : void RscExit( sal_uInt32 nExit );
      54             : 
      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* );
      59             : 
      60             : typedef ::std::vector< OString* > RscStrList;
      61             : 
      62             : class RscChar
      63             : {
      64             : public:
      65             :     static char * MakeUTF8( char * pStr, sal_uInt16 nTextEncoding );
      66             : };
      67             : 
      68             : class RscPtrPtr
      69             : {
      70             :     sal_uInt32  nCount;
      71             :     void **         pMem;
      72             : public:
      73             :                     RscPtrPtr();
      74             :                     ~RscPtrPtr();
      75             :     void            Reset();
      76             :     sal_uInt32  Append( void * );
      77           0 :     sal_uInt32  Append( char * pStr ){
      78           0 :                         return( Append( (void *)pStr ) );
      79             :                     };
      80           0 :     sal_uInt32  GetCount(){ return( nCount ); };
      81             :     void *          GetEntry( sal_uInt32 nEle );
      82           0 :     void **         GetBlock(){ return( pMem ); };
      83             : };
      84             : 
      85             : class RscWriteRc
      86             : {
      87             :     sal_uInt32          nLen;
      88             :     bool                bSwap;
      89             :     RSCBYTEORDER_TYPE   nByteOrder;
      90             :     char *              pMem;
      91             :     char *              GetPointer( sal_uInt32 nSize );
      92             : public:
      93             :                 RscWriteRc( RSCBYTEORDER_TYPE nOrder = RSC_SYSTEMENDIAN );
      94             :                 ~RscWriteRc();
      95             :     sal_uInt32      IncSize( sal_uInt32 nSize );// gibt die vorherige Groesse
      96           0 :     void *      GetBuffer()
      97             :                 {
      98           0 :                     return GetPointer( 0 );
      99             :                 }
     100           0 :     sal_uInt16  GetShort( sal_uInt32 nPos )
     101             :                 {
     102           0 :                     sal_uInt16 nVal = 0;
     103           0 :                     char* pFrom = GetPointer(nPos);
     104           0 :                     char* pTo = (char*)&nVal;
     105           0 :                     *pTo++ = *pFrom++;
     106           0 :                     *pTo++ = *pFrom++;
     107           0 :                     return bSwap ? OSL_SWAPWORD( nVal ) : nVal;
     108             :                 }
     109           0 :     sal_uInt32  GetLong( sal_uInt32 nPos )
     110             :                 {
     111           0 :                     sal_uInt32 nVal = 0;
     112           0 :                     char* pFrom = GetPointer(nPos);
     113           0 :                     char* pTo = (char*)&nVal;
     114           0 :                     *pTo++ = *pFrom++;
     115           0 :                     *pTo++ = *pFrom++;
     116           0 :                     *pTo++ = *pFrom++;
     117           0 :                     *pTo++ = *pFrom++;
     118           0 :                     return bSwap ? OSL_SWAPDWORD( nVal ) : nVal;
     119             :                 }
     120           0 :     char *      GetUTF8( sal_uInt32 nPos )
     121             :                 {
     122           0 :                     return GetPointer( nPos );
     123             :                 }
     124             : 
     125             : 
     126             :     RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; }
     127           0 :     sal_uInt32      Size(){ return( nLen ); };
     128           0 :     void        Put( sal_uInt64 lVal )
     129             :                 {
     130             :                     union
     131             :                     {
     132             :                         sal_uInt64 lVal64;
     133             :                         sal_uInt32 aVal32[2];
     134             :                     };
     135           0 :                     lVal64 = lVal;
     136           0 :                     if( bSwap )
     137             :                     {
     138           0 :                         Put( aVal32[1] );
     139           0 :                         Put( aVal32[0] );
     140             :                     }
     141             :                     else
     142             :                     {
     143           0 :                         Put( aVal32[0] );
     144           0 :                         Put( aVal32[1] );
     145             :                     }
     146           0 :                 }
     147           0 :     void        Put( sal_Int32 lVal )
     148             :                 {
     149             :                     union
     150             :                     {
     151             :                         sal_uInt32 lVal32;
     152             :                         sal_uInt16 aVal16[2];
     153             :                     };
     154           0 :                     lVal32 = lVal;
     155             : 
     156           0 :                     if( bSwap )
     157             :                     {
     158           0 :                         Put( aVal16[1] );
     159           0 :                         Put( aVal16[0] );
     160             :                     }
     161             :                     else
     162             :                     {
     163           0 :                         Put( aVal16[0] );
     164           0 :                         Put( aVal16[1] );
     165             :                     }
     166           0 :                 }
     167           0 :     void        Put( sal_uInt32 nValue )
     168           0 :                 { Put( (sal_Int32)nValue ); }
     169             :     void        Put( sal_uInt16 nValue );
     170           0 :     void        Put( sal_Int16 nValue )
     171           0 :                 { Put( (sal_uInt16)nValue ); }
     172             :     void        PutUTF8( char * pData );
     173             : 
     174           0 :     void        PutAt( sal_uInt32 nPos, sal_Int32 lVal )
     175             :                 {
     176             :                     union
     177             :                     {
     178             :                         sal_uInt32 lVal32;
     179             :                         sal_uInt16 aVal16[2];
     180             :                     };
     181           0 :                     lVal32 = lVal;
     182             : 
     183           0 :                     if( bSwap )
     184             :                     {
     185           0 :                         PutAt( nPos, aVal16[1] );
     186           0 :                         PutAt( nPos + 2, aVal16[0] );
     187             :                     }
     188             :                     else
     189             :                     {
     190           0 :                         PutAt( nPos, aVal16[0] );
     191           0 :                         PutAt( nPos + 2, aVal16[1] );
     192             :                     }
     193           0 :                 }
     194           0 :     void        PutAt( sal_uInt32 nPos, sal_uInt32 lVal )
     195             :                 {
     196           0 :                     PutAt( nPos, (sal_Int32)lVal);
     197           0 :                 }
     198             :     void        PutAt( sal_uInt32 nPos, short nVal )
     199             :                 {
     200             :                     PutAt( nPos, (sal_uInt16)nVal );
     201             :                 }
     202           0 :     void        PutAt( sal_uInt32 nPos, sal_uInt16 nVal )
     203             :                 {
     204           0 :                     if( bSwap )
     205           0 :                         nVal = OSL_SWAPWORD( nVal );
     206           0 :                     char* pTo = GetPointer( nPos );
     207           0 :                     char* pFrom = (char*)&nVal;
     208           0 :                     *pTo++ = *pFrom++;
     209           0 :                     *pTo++ = *pFrom++;
     210           0 :                 }
     211             : };
     212             : 
     213             : #endif // _RSCTOOLS_HXX
     214             : 
     215             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10