LCOV - code coverage report
Current view: top level - idl/inc - bastype.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 44 51 86.3 %
Date: 2012-08-25 Functions: 39 44 88.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 8 75.0 %

           Branch data     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                 :            : 
      20                 :            : #ifndef _BASTYPE_HXX
      21                 :            : #define _BASTYPE_HXX
      22                 :            : 
      23                 :            : 
      24                 :            : #include <tools/globname.hxx>
      25                 :            : #include <tools/gen.hxx>
      26                 :            : #include <tools/stream.hxx>
      27                 :            : #include <tools/string.hxx>
      28                 :            : 
      29                 :            : class SvStringHashEntry;
      30                 :            : class SvIdlDataBase;
      31                 :            : class SvTokenStream;
      32                 :            : 
      33                 :            : class SvUINT32
      34                 :            : {
      35                 :            :     sal_uInt32  nVal;
      36                 :            : public:
      37                 :            :                 SvUINT32() { nVal = 0; }
      38                 :            :                 SvUINT32( sal_uInt32 n ) : nVal( n ) {}
      39                 :            :     SvUINT32 &  operator = ( sal_uInt32 n ) { nVal = n; return *this; }
      40                 :            : 
      41                 :            :     operator    sal_uInt32 &() { return nVal; }
      42                 :            : 
      43                 :            :     static sal_uInt32  Read( SvStream & rStm );
      44                 :            :     static void    Write( SvStream & rStm, sal_uInt32 nVal );
      45                 :            : 
      46                 :            :     friend SvStream& operator << (SvStream & rStm, const SvUINT32 & r )
      47                 :            :                 { SvUINT32::Write( rStm, r.nVal ); return rStm; }
      48                 :            :     friend SvStream& operator >> (SvStream & rStm, SvUINT32 & r )
      49                 :            :                 { r.nVal = SvUINT32::Read( rStm ); return rStm; }
      50                 :            : };
      51                 :            : 
      52                 :            : 
      53                 :            : class Svint
      54                 :            : {
      55                 :            :     int     nVal;
      56                 :            :     sal_Bool    bSet;
      57                 :            : public:
      58                 :            :                 Svint() { nVal = bSet = 0; }
      59                 :            :                 Svint( int n ) : nVal( n ), bSet( sal_True ) {}
      60                 :      37998 :                 Svint( int n, sal_Bool bSetP ) : nVal( n ), bSet( bSetP ) {}
      61                 :          0 :     Svint    &  operator = ( int n ) { nVal = n; bSet = sal_True; return *this; }
      62                 :            : 
      63                 :     159712 :     operator    int ()const { return nVal; }
      64                 :      37998 :     sal_Bool        IsSet() const { return bSet; }
      65                 :            : 
      66                 :          0 :     friend SvStream& operator << (SvStream & rStm, const Svint & r )
      67                 :          0 :                 { SvUINT32::Write( rStm, (sal_uInt32)r.nVal ); rStm << r.bSet; return rStm; }
      68                 :          0 :     friend SvStream& operator >> (SvStream & rStm, Svint & r )
      69                 :          0 :                 { r.nVal = (int)SvUINT32::Read( rStm ); rStm >> r.bSet ; return rStm; }
      70                 :            : };
      71                 :            : 
      72                 :            : 
      73                 :            : class SvBOOL
      74                 :            : {
      75                 :            :     sal_Bool  nVal:1,
      76                 :            :           bSet:1;
      77                 :            : public:
      78                 :     875620 :                 SvBOOL() { bSet = nVal = sal_False; }
      79                 :            :                 SvBOOL( sal_Bool n ) : nVal( n ), bSet( sal_True ) {}
      80                 :     313254 :                 SvBOOL( sal_Bool n, sal_Bool bSetP ) : nVal( n ), bSet( bSetP ) {}
      81                 :     423362 :     SvBOOL &    operator = ( sal_Bool n ) { nVal = n; bSet = sal_True; return *this; }
      82                 :            : 
      83                 :    1237624 :     operator    sal_Bool() const { return nVal; }
      84                 :            : #ifdef STC
      85                 :            :     operator    int() const { return nVal; }
      86                 :            : #endif
      87                 :            :     sal_Bool        Is() const { return nVal; }
      88                 :    1760024 :     sal_Bool        IsSet() const { return bSet; }
      89                 :            : 
      90                 :            :     friend SvStream& operator << (SvStream &, const SvBOOL &);
      91                 :            :     friend SvStream& operator >> (SvStream &, SvBOOL &);
      92                 :            : 
      93                 :            :     sal_Bool        ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
      94                 :            :     sal_Bool        WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm );
      95                 :            :     rtl::OString    GetSvIdlString( SvStringHashEntry * pName );
      96                 :            : };
      97                 :            : 
      98                 :            : 
      99                 :     300332 : class SvIdentifier
     100                 :            : {
     101                 :            : private:
     102                 :            :     rtl::OString m_aStr;
     103                 :            : public:
     104                 :     324126 :     SvIdentifier()
     105                 :     324126 :     {
     106                 :     324126 :     }
     107                 :      72762 :     void setString(const rtl::OString& rStr)
     108                 :            :     {
     109                 :      72762 :         m_aStr = rStr;
     110                 :      72762 :     }
     111                 :   24023034 :     const rtl::OString& getString() const
     112                 :            :     {
     113                 :   24023034 :         return m_aStr;
     114                 :            :     }
     115                 :            :     friend SvStream& operator << (SvStream &, const SvIdentifier &);
     116                 :            :     friend SvStream& operator >> (SvStream &, SvIdentifier &);
     117                 :            : 
     118                 :   17776412 :     sal_Bool IsSet() const
     119                 :            :     {
     120                 :   17776412 :         return !m_aStr.isEmpty();
     121                 :            :     }
     122                 :            :     sal_Bool        ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
     123                 :            :     sal_Bool        WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm,
     124                 :            :                             sal_uInt16 nTab );
     125                 :            : };
     126                 :            : 
     127                 :            : 
     128                 :      82352 : class SvNumberIdentifier : public SvIdentifier
     129                 :            : {
     130                 :            :     sal_uInt32  nValue;
     131                 :            :     // must not be used
     132                 :            :     sal_Bool    ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
     133                 :            : public:
     134                 :     102198 :                 SvNumberIdentifier() : nValue( 0 ) {};
     135                 :   17647232 :     sal_Bool        IsSet() const
     136                 :            :                 {
     137 [ +  + ][ +  + ]:   17647232 :                     return SvIdentifier::IsSet() || nValue != 0;
     138                 :            :                 }
     139                 :    1587100 :     sal_uInt32      GetValue() const { return nValue; }
     140                 :         10 :     void        SetValue( sal_uInt32 nVal ) { nValue = nVal; }
     141                 :            : 
     142                 :            :     friend SvStream& operator << (SvStream &, const SvNumberIdentifier &);
     143                 :            :     friend SvStream& operator >> (SvStream &, SvNumberIdentifier &);
     144                 :            :     sal_Bool        ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
     145                 :            :     sal_Bool        ReadSvIdl( SvIdlDataBase &, SvStringHashEntry * pName,
     146                 :            :                            SvTokenStream & rInStm );
     147                 :            : };
     148                 :            : 
     149                 :            : 
     150                 :     242316 : class SvString
     151                 :            : {
     152                 :            : private:
     153                 :            :     rtl::OString m_aStr;
     154                 :            : public:
     155                 :     284932 :     SvString() {}
     156                 :      41186 :     void setString(const rtl::OString& rStr)
     157                 :            :     {
     158                 :      41186 :         m_aStr = rStr;
     159                 :      41186 :     }
     160                 :   11119312 :     const rtl::OString& getString() const
     161                 :            :     {
     162                 :   11119312 :         return m_aStr;
     163                 :            :     }
     164                 :     400748 :     sal_Bool IsSet() const
     165                 :            :     {
     166                 :     400748 :         return !m_aStr.isEmpty();
     167                 :            :     }
     168                 :            :     friend SvStream& operator << (SvStream &, const SvString &);
     169                 :            :     friend SvStream& operator >> (SvStream &, SvString &);
     170                 :            : 
     171                 :            :     sal_Bool        ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
     172                 :            :     sal_Bool        WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm,
     173                 :            :                             sal_uInt16 nTab );
     174                 :            : };
     175                 :            : 
     176                 :            : 
     177                 :      48266 : class SvHelpText : public SvString
     178                 :            : {
     179                 :            : public:
     180                 :      59056 :                 SvHelpText() {}
     181                 :            :     sal_Bool        ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
     182                 :            :     sal_Bool        WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
     183                 :            :                             sal_uInt16 nTab );
     184                 :            : };
     185                 :            : 
     186                 :            : 
     187                 :     107322 : class SvHelpContext : public SvNumberIdentifier
     188                 :            : {
     189                 :            : };
     190                 :            : 
     191                 :      11752 : class SvUUId : public SvGlobalName
     192                 :            : {
     193                 :            : public:
     194                 :      12682 :                 SvUUId() {}
     195                 :            :     sal_Bool        ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
     196                 :            :     sal_Bool        WriteSvIdl( SvStream & rOutStm );
     197                 :            : };
     198                 :            : 
     199                 :            : 
     200                 :            : class SvVersion
     201                 :            : {
     202                 :            :     sal_uInt16  nMajorVersion;
     203                 :            :     sal_uInt16  nMinorVersion;
     204                 :            : public:
     205                 :      25364 :                 SvVersion() : nMajorVersion( 1 ), nMinorVersion( 0 ) {}
     206                 :      12682 :     sal_Bool        operator == ( const SvVersion & r )
     207                 :            :                 {
     208                 :            :                     return (r.nMajorVersion == nMajorVersion)
     209 [ +  - ][ +  - ]:      12682 :                              && (r.nMinorVersion == nMinorVersion);
     210                 :            :                 }
     211                 :      12682 :     sal_Bool        operator != ( const SvVersion & r )
     212                 :            :                 {
     213                 :      12682 :                     return !(*this == r);
     214                 :            :                 }
     215                 :            : 
     216                 :          0 :     sal_uInt16      GetMajorVersion() const { return nMajorVersion; }
     217                 :          0 :     sal_uInt16      GetMinorVersion() const { return nMinorVersion; }
     218                 :            : 
     219                 :            :     friend SvStream& operator << (SvStream &, const SvVersion &);
     220                 :            :     friend SvStream& operator >> (SvStream &, SvVersion &);
     221                 :            :     sal_Bool        ReadSvIdl( SvTokenStream & rInStm );
     222                 :            :     sal_Bool        WriteSvIdl( SvStream & rOutStm );
     223                 :            : };
     224                 :            : 
     225                 :            : 
     226                 :            : #endif // _BASTYPE_HXX
     227                 :            : 
     228                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10