1*f3ea6674SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f3ea6674SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f3ea6674SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f3ea6674SAndrew Rist * distributed with this work for additional information 6*f3ea6674SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f3ea6674SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f3ea6674SAndrew Rist * "License"); you may not use this file except in compliance 9*f3ea6674SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*f3ea6674SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*f3ea6674SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f3ea6674SAndrew Rist * software distributed under the License is distributed on an 15*f3ea6674SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f3ea6674SAndrew Rist * KIND, either express or implied. See the License for the 17*f3ea6674SAndrew Rist * specific language governing permissions and limitations 18*f3ea6674SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*f3ea6674SAndrew Rist *************************************************************/ 21*f3ea6674SAndrew Rist 22*f3ea6674SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _BASTYPE_HXX 25cdf0e10cSrcweir #define _BASTYPE_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <tools/globname.hxx> 29cdf0e10cSrcweir #include <tools/gen.hxx> 30cdf0e10cSrcweir #include <tools/stream.hxx> 31cdf0e10cSrcweir #include <tools/unqid.hxx> 32cdf0e10cSrcweir #include <tools/string.hxx> 33cdf0e10cSrcweir 34cdf0e10cSrcweir class SvStringHashEntry; 35cdf0e10cSrcweir class SvIdlDataBase; 36cdf0e10cSrcweir class SvTokenStream; 37cdf0e10cSrcweir 38cdf0e10cSrcweir /******************** class SvUINT32 **********************************/ 39cdf0e10cSrcweir class SvUINT32 40cdf0e10cSrcweir { 41cdf0e10cSrcweir sal_uInt32 nVal; 42cdf0e10cSrcweir public: SvUINT32()43cdf0e10cSrcweir SvUINT32() { nVal = 0; } SvUINT32(sal_uInt32 n)44cdf0e10cSrcweir SvUINT32( sal_uInt32 n ) : nVal( n ) {} operator =(sal_uInt32 n)45cdf0e10cSrcweir SvUINT32 & operator = ( sal_uInt32 n ) { nVal = n; return *this; } 46cdf0e10cSrcweir operator sal_uInt32&()47cdf0e10cSrcweir operator sal_uInt32 &() { return nVal; } 48cdf0e10cSrcweir 49cdf0e10cSrcweir static sal_uInt32 Read( SvStream & rStm ); 50cdf0e10cSrcweir static void Write( SvStream & rStm, sal_uInt32 nVal ); 51cdf0e10cSrcweir operator <<(SvStream & rStm,const SvUINT32 & r)52cdf0e10cSrcweir friend SvStream& operator << (SvStream & rStm, const SvUINT32 & r ) 53cdf0e10cSrcweir { SvUINT32::Write( rStm, r.nVal ); return rStm; } operator >>(SvStream & rStm,SvUINT32 & r)54cdf0e10cSrcweir friend SvStream& operator >> (SvStream & rStm, SvUINT32 & r ) 55cdf0e10cSrcweir { r.nVal = SvUINT32::Read( rStm ); return rStm; } 56cdf0e10cSrcweir }; 57cdf0e10cSrcweir 58cdf0e10cSrcweir 59cdf0e10cSrcweir /******************** class SvINT16 **********************************/ 60cdf0e10cSrcweir class SvINT16 61cdf0e10cSrcweir { 62cdf0e10cSrcweir short nVal; 63cdf0e10cSrcweir public: SvINT16()64cdf0e10cSrcweir SvINT16() { nVal = 0; } SvINT16(short n)65cdf0e10cSrcweir SvINT16( short n ) : nVal( n ) {} operator =(short n)66cdf0e10cSrcweir SvINT16 & operator = ( short n ) { nVal = n; return *this; } 67cdf0e10cSrcweir operator short&()68cdf0e10cSrcweir operator short &() { return nVal; } 69cdf0e10cSrcweir operator <<(SvStream & rStm,const SvINT16 & r)70cdf0e10cSrcweir friend SvStream& operator << (SvStream & rStm, const SvINT16 & r ) 71cdf0e10cSrcweir { SvUINT32::Write( rStm, (sal_uInt32)r.nVal ); return rStm; } operator >>(SvStream & rStm,SvINT16 & r)72cdf0e10cSrcweir friend SvStream& operator >> (SvStream & rStm, SvINT16 & r ) 73cdf0e10cSrcweir { r.nVal = (short)SvUINT32::Read( rStm ); return rStm; } 74cdf0e10cSrcweir }; 75cdf0e10cSrcweir 76cdf0e10cSrcweir 77cdf0e10cSrcweir /******************** class SvUINT16 **********************************/ 78cdf0e10cSrcweir class SvUINT16 79cdf0e10cSrcweir { 80cdf0e10cSrcweir sal_uInt16 nVal; 81cdf0e10cSrcweir public: SvUINT16()82cdf0e10cSrcweir SvUINT16() { nVal = 0; } SvUINT16(sal_uInt16 n)83cdf0e10cSrcweir SvUINT16( sal_uInt16 n ) : nVal( n ) {} operator =(sal_uInt16 n)84cdf0e10cSrcweir SvUINT16 & operator = ( sal_uInt16 n ) { nVal = n; return *this; } 85cdf0e10cSrcweir operator sal_uInt16&()86cdf0e10cSrcweir operator sal_uInt16 &() { return nVal; } 87cdf0e10cSrcweir operator <<(SvStream & rStm,const SvUINT16 & r)88cdf0e10cSrcweir friend SvStream& operator << (SvStream & rStm, const SvUINT16 & r ) 89cdf0e10cSrcweir { SvUINT32::Write( rStm, (sal_uInt32)r.nVal ); return rStm; } operator >>(SvStream & rStm,SvUINT16 & r)90cdf0e10cSrcweir friend SvStream& operator >> (SvStream & rStm, SvUINT16 & r ) 91cdf0e10cSrcweir { r.nVal = (sal_uInt16)SvUINT32::Read( rStm ); return rStm; } 92cdf0e10cSrcweir }; 93cdf0e10cSrcweir 94cdf0e10cSrcweir 95cdf0e10cSrcweir /******************** class SvINT32 **********************************/ 96cdf0e10cSrcweir class SvINT32 97cdf0e10cSrcweir { 98cdf0e10cSrcweir sal_Int32 nVal; 99cdf0e10cSrcweir public: SvINT32()100cdf0e10cSrcweir SvINT32() { nVal = 0; } SvINT32(sal_Int32 n)101cdf0e10cSrcweir SvINT32( sal_Int32 n ) : nVal( n ) {} operator =(sal_Int32 n)102cdf0e10cSrcweir SvINT32 & operator = ( sal_Int32 n ) { nVal = n; return *this; } 103cdf0e10cSrcweir operator sal_Int32&()104cdf0e10cSrcweir operator sal_Int32 &() { return nVal; } 105cdf0e10cSrcweir operator <<(SvStream & rStm,const SvINT32 & r)106cdf0e10cSrcweir friend SvStream& operator << (SvStream & rStm, const SvINT32 & r ) 107cdf0e10cSrcweir { SvUINT32::Write( rStm, (sal_uInt32)r.nVal ); return rStm; } operator >>(SvStream & rStm,SvINT32 & r)108cdf0e10cSrcweir friend SvStream& operator >> (SvStream & rStm, SvINT32 & r ) 109cdf0e10cSrcweir { r.nVal = (sal_Int32)SvUINT32::Read( rStm ); return rStm; } 110cdf0e10cSrcweir }; 111cdf0e10cSrcweir 112cdf0e10cSrcweir 113cdf0e10cSrcweir /******************** class Svint **********************************/ 114cdf0e10cSrcweir class Svint 115cdf0e10cSrcweir { 116cdf0e10cSrcweir int nVal; 117cdf0e10cSrcweir sal_Bool bSet; 118cdf0e10cSrcweir public: Svint()119cdf0e10cSrcweir Svint() { nVal = bSet = 0; } Svint(int n)120cdf0e10cSrcweir Svint( int n ) : nVal( n ), bSet( sal_True ) {} Svint(int n,sal_Bool bSetP)121cdf0e10cSrcweir Svint( int n, sal_Bool bSetP ) : nVal( n ), bSet( bSetP ) {} operator =(int n)122cdf0e10cSrcweir Svint & operator = ( int n ) { nVal = n; bSet = sal_True; return *this; } 123cdf0e10cSrcweir operator int() const124cdf0e10cSrcweir operator int ()const { return nVal; } IsSet() const125cdf0e10cSrcweir sal_Bool IsSet() const { return bSet; } 126cdf0e10cSrcweir operator <<(SvStream & rStm,const Svint & r)127cdf0e10cSrcweir friend SvStream& operator << (SvStream & rStm, const Svint & r ) 128cdf0e10cSrcweir { SvUINT32::Write( rStm, (sal_uInt32)r.nVal ); rStm << r.bSet; return rStm; } operator >>(SvStream & rStm,Svint & r)129cdf0e10cSrcweir friend SvStream& operator >> (SvStream & rStm, Svint & r ) 130cdf0e10cSrcweir { r.nVal = (int)SvUINT32::Read( rStm ); rStm >> r.bSet ; return rStm; } 131cdf0e10cSrcweir }; 132cdf0e10cSrcweir 133cdf0e10cSrcweir 134cdf0e10cSrcweir /******************** class SvBOOL **********************************/ 135cdf0e10cSrcweir class SvBOOL 136cdf0e10cSrcweir { 137cdf0e10cSrcweir sal_Bool nVal:1, 138cdf0e10cSrcweir bSet:1; 139cdf0e10cSrcweir public: SvBOOL()140cdf0e10cSrcweir SvBOOL() { bSet = nVal = sal_False; } SvBOOL(sal_Bool n)141cdf0e10cSrcweir SvBOOL( sal_Bool n ) : nVal( n ), bSet( sal_True ) {} SvBOOL(sal_Bool n,sal_Bool bSetP)142cdf0e10cSrcweir SvBOOL( sal_Bool n, sal_Bool bSetP ) : nVal( n ), bSet( bSetP ) {} operator =(sal_Bool n)143cdf0e10cSrcweir SvBOOL & operator = ( sal_Bool n ) { nVal = n; bSet = sal_True; return *this; } 144cdf0e10cSrcweir operator sal_Bool() const145cdf0e10cSrcweir operator sal_Bool() const { return nVal; } 146cdf0e10cSrcweir #ifdef STC operator int() const147cdf0e10cSrcweir operator int() const { return nVal; } 148cdf0e10cSrcweir #endif Is() const149cdf0e10cSrcweir sal_Bool Is() const { return nVal; } IsSet() const150cdf0e10cSrcweir sal_Bool IsSet() const { return bSet; } 151cdf0e10cSrcweir 152cdf0e10cSrcweir friend SvStream& operator << (SvStream &, const SvBOOL &); 153cdf0e10cSrcweir friend SvStream& operator >> (SvStream &, SvBOOL &); 154cdf0e10cSrcweir 155cdf0e10cSrcweir #ifdef IDL_COMPILER 156cdf0e10cSrcweir sal_Bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ); 157cdf0e10cSrcweir sal_Bool WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm ); 158cdf0e10cSrcweir ByteString GetSvIdlString( SvStringHashEntry * pName ); 159cdf0e10cSrcweir #endif 160cdf0e10cSrcweir }; 161cdf0e10cSrcweir 162cdf0e10cSrcweir 163cdf0e10cSrcweir /******************** class SvIdentifier **********************************/ 164cdf0e10cSrcweir class SvIdentifier : public ByteString 165cdf0e10cSrcweir { 166cdf0e10cSrcweir public: SvIdentifier()167cdf0e10cSrcweir SvIdentifier(){}; operator =(const ByteString & rStr)168cdf0e10cSrcweir SvIdentifier & operator = ( const ByteString & rStr ) 169cdf0e10cSrcweir { ByteString::operator =( rStr ); return *this; } 170cdf0e10cSrcweir friend SvStream& operator << (SvStream &, const SvIdentifier &); 171cdf0e10cSrcweir friend SvStream& operator >> (SvStream &, SvIdentifier &); 172cdf0e10cSrcweir IsSet() const173cdf0e10cSrcweir sal_Bool IsSet() const { return Len() != 0; } 174cdf0e10cSrcweir #ifdef IDL_COMPILER 175cdf0e10cSrcweir sal_Bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ); 176cdf0e10cSrcweir sal_Bool WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm, 177cdf0e10cSrcweir sal_uInt16 nTab ); 178cdf0e10cSrcweir #endif 179cdf0e10cSrcweir }; 180cdf0e10cSrcweir 181cdf0e10cSrcweir 182cdf0e10cSrcweir /******************** class SvIdentifier **********************************/ 183cdf0e10cSrcweir class SvNumberIdentifier : public SvIdentifier 184cdf0e10cSrcweir { 185cdf0e10cSrcweir sal_uInt32 nValue; 186cdf0e10cSrcweir // darf nicht benutzt werden 187cdf0e10cSrcweir sal_Bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ); 188cdf0e10cSrcweir public: SvNumberIdentifier()189cdf0e10cSrcweir SvNumberIdentifier() : nValue( 0 ) {}; IsSet() const190cdf0e10cSrcweir sal_Bool IsSet() const 191cdf0e10cSrcweir { 192cdf0e10cSrcweir return SvIdentifier::IsSet() || nValue != 0; 193cdf0e10cSrcweir } GetValue() const194cdf0e10cSrcweir sal_uInt32 GetValue() const { return nValue; } SetValue(sal_uInt32 nVal)195cdf0e10cSrcweir void SetValue( sal_uInt32 nVal ) { nValue = nVal; } 196cdf0e10cSrcweir 197cdf0e10cSrcweir friend SvStream& operator << (SvStream &, const SvNumberIdentifier &); 198cdf0e10cSrcweir friend SvStream& operator >> (SvStream &, SvNumberIdentifier &); 199cdf0e10cSrcweir #ifdef IDL_COMPILER 200cdf0e10cSrcweir sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); 201cdf0e10cSrcweir sal_Bool ReadSvIdl( SvIdlDataBase &, SvStringHashEntry * pName, 202cdf0e10cSrcweir SvTokenStream & rInStm ); 203cdf0e10cSrcweir #endif 204cdf0e10cSrcweir }; 205cdf0e10cSrcweir 206cdf0e10cSrcweir 207cdf0e10cSrcweir /******************** class SvString **********************************/ 208cdf0e10cSrcweir class SvString : public ByteString 209cdf0e10cSrcweir { 210cdf0e10cSrcweir public: SvString()211cdf0e10cSrcweir SvString(){}; operator =(const ByteString & rStr)212cdf0e10cSrcweir SvString & operator = ( const ByteString & rStr ) 213cdf0e10cSrcweir { ByteString::operator =( rStr ); return *this; } IsSet() const214cdf0e10cSrcweir sal_Bool IsSet() const { return Len() != 0; } 215cdf0e10cSrcweir friend SvStream& operator << (SvStream &, const SvString &); 216cdf0e10cSrcweir friend SvStream& operator >> (SvStream &, SvString &); 217cdf0e10cSrcweir 218cdf0e10cSrcweir #ifdef IDL_COMPILER 219cdf0e10cSrcweir sal_Bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ); 220cdf0e10cSrcweir sal_Bool WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm, 221cdf0e10cSrcweir sal_uInt16 nTab ); 222cdf0e10cSrcweir #endif 223cdf0e10cSrcweir }; 224cdf0e10cSrcweir 225cdf0e10cSrcweir 226cdf0e10cSrcweir /******************** class SvHelpText **********************************/ 227cdf0e10cSrcweir class SvHelpText : public SvString 228cdf0e10cSrcweir { 229cdf0e10cSrcweir public: SvHelpText()230cdf0e10cSrcweir SvHelpText() {} 231cdf0e10cSrcweir #ifdef IDL_COMPILER 232cdf0e10cSrcweir sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); 233cdf0e10cSrcweir sal_Bool WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, 234cdf0e10cSrcweir sal_uInt16 nTab ); 235cdf0e10cSrcweir #endif 236cdf0e10cSrcweir }; 237cdf0e10cSrcweir 238cdf0e10cSrcweir 239cdf0e10cSrcweir /******************** class SvHelpContext *******************************/ 240cdf0e10cSrcweir class SvHelpContext : public SvNumberIdentifier 241cdf0e10cSrcweir { 242cdf0e10cSrcweir }; 243cdf0e10cSrcweir 244cdf0e10cSrcweir /******************** class SvUUId *************************************/ 245cdf0e10cSrcweir class SvUUId : public SvGlobalName 246cdf0e10cSrcweir { 247cdf0e10cSrcweir public: SvUUId()248cdf0e10cSrcweir SvUUId() {} 249cdf0e10cSrcweir #ifdef IDL_COMPILER 250cdf0e10cSrcweir sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); 251cdf0e10cSrcweir sal_Bool WriteSvIdl( SvStream & rOutStm ); 252cdf0e10cSrcweir #endif 253cdf0e10cSrcweir }; 254cdf0e10cSrcweir 255cdf0e10cSrcweir 256cdf0e10cSrcweir /******************** class SvVersion **********************************/ 257cdf0e10cSrcweir class SvVersion 258cdf0e10cSrcweir { 259cdf0e10cSrcweir sal_uInt16 nMajorVersion; 260cdf0e10cSrcweir sal_uInt16 nMinorVersion; 261cdf0e10cSrcweir public: SvVersion()262cdf0e10cSrcweir SvVersion() : nMajorVersion( 1 ), nMinorVersion( 0 ) {} operator ==(const SvVersion & r)263cdf0e10cSrcweir sal_Bool operator == ( const SvVersion & r ) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir return (r.nMajorVersion == nMajorVersion) 266cdf0e10cSrcweir && (r.nMinorVersion == nMinorVersion); 267cdf0e10cSrcweir } operator !=(const SvVersion & r)268cdf0e10cSrcweir sal_Bool operator != ( const SvVersion & r ) 269cdf0e10cSrcweir { 270cdf0e10cSrcweir return !(*this == r); 271cdf0e10cSrcweir } 272cdf0e10cSrcweir GetMajorVersion() const273cdf0e10cSrcweir sal_uInt16 GetMajorVersion() const { return nMajorVersion; } GetMinorVersion() const274cdf0e10cSrcweir sal_uInt16 GetMinorVersion() const { return nMinorVersion; } 275cdf0e10cSrcweir 276cdf0e10cSrcweir friend SvStream& operator << (SvStream &, const SvVersion &); 277cdf0e10cSrcweir friend SvStream& operator >> (SvStream &, SvVersion &); 278cdf0e10cSrcweir #ifdef IDL_COMPILER 279cdf0e10cSrcweir sal_Bool ReadSvIdl( SvTokenStream & rInStm ); 280cdf0e10cSrcweir sal_Bool WriteSvIdl( SvStream & rOutStm ); 281cdf0e10cSrcweir #endif 282cdf0e10cSrcweir }; 283cdf0e10cSrcweir 284cdf0e10cSrcweir 285cdf0e10cSrcweir #endif // _BASTYPE_HXX 286cdf0e10cSrcweir 287