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