LCOV - code coverage report
Current view: top level - idl/inc - bastype.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 52 0.0 %
Date: 2014-04-14 Functions: 0 44 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             : 
      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           0 :                 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           0 :     operator    int ()const { return nVal; }
      63           0 :     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           0 :                 SvBOOL() { bSet = nVal = sal_False; }
      78             :                 SvBOOL( sal_Bool n ) : nVal( n ), bSet( sal_True ) {}
      79           0 :                 SvBOOL( sal_Bool n, sal_Bool bSetP ) : nVal( n ), bSet( bSetP ) {}
      80           0 :     SvBOOL &    operator = ( sal_Bool n ) { nVal = n; bSet = sal_True; return *this; }
      81             : 
      82           0 :     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           0 :     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           0 : class SvIdentifier
      99             : {
     100             : private:
     101             :     OString m_aStr;
     102             : public:
     103           0 :     SvIdentifier()
     104           0 :     {
     105           0 :     }
     106           0 :     void setString(const OString& rStr)
     107             :     {
     108           0 :         m_aStr = rStr;
     109           0 :     }
     110           0 :     const OString& getString() const
     111             :     {
     112           0 :         return m_aStr;
     113             :     }
     114             :     friend SvStream& WriteSvIdentifier(SvStream &, const SvIdentifier &);
     115             :     friend SvStream& operator >> (SvStream &, SvIdentifier &);
     116             : 
     117           0 :     sal_Bool IsSet() const
     118             :     {
     119           0 :         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           0 : 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           0 :                 SvNumberIdentifier() : nValue( 0 ) {};
     134           0 :     sal_Bool        IsSet() const
     135             :                 {
     136           0 :                     return SvIdentifier::IsSet() || nValue != 0;
     137             :                 }
     138           0 :     sal_uInt32      GetValue() const { return nValue; }
     139           0 :     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           0 : class SvString
     150             : {
     151             : private:
     152             :     OString m_aStr;
     153             : public:
     154           0 :     SvString() {}
     155           0 :     void setString(const OString& rStr)
     156             :     {
     157           0 :         m_aStr = rStr;
     158           0 :     }
     159           0 :     const OString& getString() const
     160             :     {
     161           0 :         return m_aStr;
     162             :     }
     163           0 :     sal_Bool IsSet() const
     164             :     {
     165           0 :         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           0 : class SvHelpText : public SvString
     177             : {
     178             : public:
     179           0 :                 SvHelpText() {}
     180             :     sal_Bool        ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
     181             :     sal_Bool        WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
     182             :                             sal_uInt16 nTab );
     183             : };
     184             : 
     185             : 
     186           0 : class SvHelpContext : public SvNumberIdentifier
     187             : {
     188             : };
     189             : 
     190           0 : class SvUUId : public SvGlobalName
     191             : {
     192             : public:
     193           0 :                 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           0 :                 SvVersion() : nMajorVersion( 1 ), nMinorVersion( 0 ) {}
     205           0 :     sal_Bool        operator == ( const SvVersion & r )
     206             :                 {
     207           0 :                     return (r.nMajorVersion == nMajorVersion)
     208           0 :                              && (r.nMinorVersion == nMinorVersion);
     209             :                 }
     210           0 :     sal_Bool        operator != ( const SvVersion & r )
     211             :                 {
     212           0 :                     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