LCOV - code coverage report
Current view: top level - idl/inc - bastype.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 45 52 86.5 %
Date: 2014-04-11 Functions: 39 44 88.6 %
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             : 
      20             : #ifndef _BASTYPE_HXX
      21             : #define _BASTYPE_HXX
      22             : 
      23             : 
      24             : #include <sal/types.h>
      25             : #include <tools/globname.hxx>
      26             : #include <tools/stream.hxx>
      27             : 
      28             : class SvStringHashEntry;
      29             : class SvIdlDataBase;
      30             : class SvTokenStream;
      31             : 
      32             : class SvUINT32
      33             : {
      34             :     sal_uInt32  nVal;
      35             : public:
      36             :                 SvUINT32() { nVal = 0; }
      37             :                 SvUINT32( sal_uInt32 n ) : nVal( n ) {}
      38             :     SvUINT32 &  operator = ( sal_uInt32 n ) { nVal = n; return *this; }
      39             : 
      40             :     operator    sal_uInt32 &() { return nVal; }
      41             : 
      42             :     static sal_uInt32  Read( SvStream & rStm );
      43             :     static void    Write( SvStream & rStm, sal_uInt32 nVal );
      44             : 
      45             :     friend SvStream& WriteSvUINT32(SvStream & rStm, const SvUINT32 & r )
      46             :                 { SvUINT32::Write( rStm, r.nVal ); return rStm; }
      47             :     friend SvStream& operator >> (SvStream & rStm, SvUINT32 & r )
      48             :                 { r.nVal = SvUINT32::Read( rStm ); return rStm; }
      49             : };
      50             : 
      51             : 
      52             : class Svint
      53             : {
      54             :     int     nVal;
      55             :     sal_Bool    bSet;
      56             : public:
      57             :                 Svint() { nVal = bSet = 0; }
      58             :                 Svint( int n ) : nVal( n ), bSet( sal_True ) {}
      59       19302 :                 Svint( int n, sal_Bool bSetP ) : nVal( n ), bSet( bSetP ) {}
      60           0 :     Svint    &  operator = ( int n ) { nVal = n; bSet = sal_True; return *this; }
      61             : 
      62       82752 :     operator    int ()const { return nVal; }
      63       19302 :     sal_Bool        IsSet() const { return bSet; }
      64             : 
      65           0 :     friend SvStream& WriteSvint(SvStream & rStm, const Svint & r )
      66           0 :                 { SvUINT32::Write( rStm, (sal_uInt32)r.nVal ); rStm.WriteUInt8( r.bSet ); return rStm; }
      67           0 :     friend SvStream& operator >> (SvStream & rStm, Svint & r )
      68           0 :                 { r.nVal = (int)SvUINT32::Read( rStm ); rStm.ReadUChar( r.bSet ); return rStm; }
      69             : };
      70             : 
      71             : 
      72             : class SvBOOL
      73             : {
      74             :     sal_Bool  nVal:1,
      75             :           bSet:1;
      76             : public:
      77      454604 :                 SvBOOL() { bSet = nVal = sal_False; }
      78             :                 SvBOOL( sal_Bool n ) : nVal( n ), bSet( sal_True ) {}
      79      162098 :                 SvBOOL( sal_Bool n, sal_Bool bSetP ) : nVal( n ), bSet( bSetP ) {}
      80      218860 :     SvBOOL &    operator = ( sal_Bool n ) { nVal = n; bSet = sal_True; return *this; }
      81             : 
      82      818143 :     operator    sal_Bool() const { return nVal; }
      83             : #ifdef STC
      84             :     operator    int() const { return nVal; }
      85             : #endif
      86             :     sal_Bool        Is() const { return nVal; }
      87      926729 :     sal_Bool        IsSet() const { return bSet; }
      88             : 
      89             :     friend SvStream& WriteSvBOOL(SvStream &, const SvBOOL &);
      90             :     friend SvStream& operator >> (SvStream &, SvBOOL &);
      91             : 
      92             :     sal_Bool        ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
      93             :     sal_Bool        WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm );
      94             :     OString    GetSvIdlString( SvStringHashEntry * pName );
      95             : };
      96             : 
      97             : 
      98      154982 : class SvIdentifier
      99             : {
     100             : private:
     101             :     OString m_aStr;
     102             : public:
     103      167256 :     SvIdentifier()
     104      167256 :     {
     105      167256 :     }
     106       37630 :     void setString(const OString& rStr)
     107             :     {
     108       37630 :         m_aStr = rStr;
     109       37630 :     }
     110    12924175 :     const OString& getString() const
     111             :     {
     112    12924175 :         return m_aStr;
     113             :     }
     114             :     friend SvStream& WriteSvIdentifier(SvStream &, const SvIdentifier &);
     115             :     friend SvStream& operator >> (SvStream &, SvIdentifier &);
     116             : 
     117     9751324 :     sal_Bool IsSet() const
     118             :     {
     119     9751324 :         return !m_aStr.isEmpty();
     120             :     }
     121             :     sal_Bool        ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
     122             :     sal_Bool        WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm,
     123             :                             sal_uInt16 nTab );
     124             : };
     125             : 
     126             : 
     127       42476 : class SvNumberIdentifier : public SvIdentifier
     128             : {
     129             :     sal_uInt32  nValue;
     130             :     // must not be used
     131             :     sal_Bool    ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
     132             : public:
     133       52650 :                 SvNumberIdentifier() : nValue( 0 ) {};
     134     9685262 :     sal_Bool        IsSet() const
     135             :                 {
     136     9685262 :                     return SvIdentifier::IsSet() || nValue != 0;
     137             :                 }
     138      943908 :     sal_uInt32      GetValue() const { return nValue; }
     139           5 :     void        SetValue( sal_uInt32 nVal ) { nValue = nVal; }
     140             : 
     141             :     friend SvStream& WriteSvNumberIdentifier(SvStream &, const SvNumberIdentifier &);
     142             :     friend SvStream& operator >> (SvStream &, SvNumberIdentifier &);
     143             :     sal_Bool        ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
     144             :     sal_Bool        ReadSvIdl( SvIdlDataBase &, SvStringHashEntry * pName,
     145             :                            SvTokenStream & rInStm );
     146             : };
     147             : 
     148             : 
     149      125070 : class SvString
     150             : {
     151             : private:
     152             :     OString m_aStr;
     153             : public:
     154      146922 :     SvString() {}
     155       21339 :     void setString(const OString& rStr)
     156             :     {
     157       21339 :         m_aStr = rStr;
     158       21339 :     }
     159     6179092 :     const OString& getString() const
     160             :     {
     161     6179092 :         return m_aStr;
     162             :     }
     163      207400 :     sal_Bool IsSet() const
     164             :     {
     165      207400 :         return !m_aStr.isEmpty();
     166             :     }
     167             :     friend SvStream& WriteSvString(SvStream &, const SvString &);
     168             :     friend SvStream& operator >> (SvStream &, SvString &);
     169             : 
     170             :     sal_Bool        ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
     171             :     sal_Bool        WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm,
     172             :                             sal_uInt16 nTab );
     173             : };
     174             : 
     175             : 
     176       24858 : class SvHelpText : public SvString
     177             : {
     178             : public:
     179       30389 :                 SvHelpText() {}
     180             :     sal_Bool        ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
     181             :     sal_Bool        WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
     182             :                             sal_uInt16 nTab );
     183             : };
     184             : 
     185             : 
     186       55247 : class SvHelpContext : public SvNumberIdentifier
     187             : {
     188             : };
     189             : 
     190        5956 : class SvUUId : public SvGlobalName
     191             : {
     192             : public:
     193        6442 :                 SvUUId() {}
     194             :     sal_Bool        ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
     195             :     sal_Bool        WriteSvIdl( SvStream & rOutStm );
     196             : };
     197             : 
     198             : 
     199             : class SvVersion
     200             : {
     201             :     sal_uInt16  nMajorVersion;
     202             :     sal_uInt16  nMinorVersion;
     203             : public:
     204       12884 :                 SvVersion() : nMajorVersion( 1 ), nMinorVersion( 0 ) {}
     205        6442 :     sal_Bool        operator == ( const SvVersion & r )
     206             :                 {
     207        6442 :                     return (r.nMajorVersion == nMajorVersion)
     208        6442 :                              && (r.nMinorVersion == nMinorVersion);
     209             :                 }
     210        6442 :     sal_Bool        operator != ( const SvVersion & r )
     211             :                 {
     212        6442 :                     return !(*this == r);
     213             :                 }
     214             : 
     215           0 :     sal_uInt16      GetMajorVersion() const { return nMajorVersion; }
     216           0 :     sal_uInt16      GetMinorVersion() const { return nMinorVersion; }
     217             : 
     218             :     friend SvStream& WriteSvVersion(SvStream &, const SvVersion &);
     219             :     friend SvStream& operator >> (SvStream &, SvVersion &);
     220             :     sal_Bool        ReadSvIdl( SvTokenStream & rInStm );
     221             :     sal_Bool        WriteSvIdl( SvStream & rOutStm );
     222             : };
     223             : 
     224             : 
     225             : #endif // _BASTYPE_HXX
     226             : 
     227             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10