LCOV - code coverage report
Current view: top level - idl/inc - basobj.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 49 0.0 %
Date: 2014-04-14 Functions: 0 35 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 _BASOBJ_HXX
      21             : #define _BASOBJ_HXX
      22             : 
      23             : #include <tools/ref.hxx>
      24             : #include <bastype.hxx>
      25             : #include <tools/pstm.hxx>
      26             : 
      27             : class SvTokenStream;
      28             : class SvMetaObject;
      29             : class SvIdlDataBase;
      30             : 
      31             : typedef SvMetaObject * (*CreateMetaObjectType)();
      32             : #define IDL_WRITE_COMPILER  0x8000
      33             : #define IDL_WRITE_BROWSER   0x4000
      34             : #define IDL_WRITE_CALLING   0x2000
      35             : #define IDL_WRITE_MASK      0xE000
      36             : 
      37             : #define C_PREF  "C_"
      38             : 
      39             : enum WriteType
      40             : {
      41             :     WRITE_IDL, WRITE_ODL, WRITE_SLOTMAP, WRITE_C_HEADER, WRITE_C_SOURCE,
      42             :     WRITE_CXX_HEADER, WRITE_CXX_SOURCE, WRITE_DOCU
      43             : };
      44             : 
      45             : enum
      46             : {
      47             :     WA_METHOD = 0x1,    WA_VARIABLE = 0x2,  WA_ARGUMENT = 0x4,
      48             :     WA_STRUCT = 0x8,    WA_READONLY = 0x10
      49             : };
      50             : typedef int WriteAttribute;
      51             : 
      52             : #define SV_DECL_META_FACTORY1( Class, Super1, CLASS_ID )                \
      53             :     SV_DECL_PERSIST1( Class, Super1, CLASS_ID )
      54             : 
      55             : #define SV_IMPL_META_FACTORY1( Class, Super1 )                          \
      56             :     SV_IMPL_PERSIST1( Class, Super1 )
      57             : 
      58           0 : class SvMetaObject : public SvPersistBase
      59             : {
      60             : public:
      61           0 :             SV_DECL_META_FACTORY1( SvMetaObject, SvPersistBase, 14 )
      62             :             SvMetaObject();
      63             : 
      64             :     static void         WriteTab( SvStream & rOutStm, sal_uInt16 nTab );
      65             :     static sal_Bool         TestAndSeekSpaceOnly( SvStream &, sal_uLong nBegPos );
      66             :     static void         Back2Delemitter( SvStream & );
      67             :     static void         WriteStars( SvStream & );
      68             : 
      69             :     virtual sal_Bool        ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
      70             :     virtual void        WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
      71             : 
      72             :     virtual void        Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
      73             :                                 WriteType, WriteAttribute = 0 );
      74             : };
      75             : typedef tools::SvRef<SvMetaObject> SvMetaObjectRef;
      76             : 
      77           0 : class SvMetaObjectMemberList : public SvDeclPersistList<SvMetaObject *> {};
      78             : 
      79           0 : class SvMetaObjectMemberStack
      80             : {
      81             :     SvMetaObjectMemberList aList;
      82             : public:
      83           0 :             SvMetaObjectMemberStack() {;}
      84             : 
      85           0 :     void            Push( SvMetaObject * pObj )
      86           0 :                     { aList.push_back( pObj ); }
      87           0 :     SvMetaObject *  Pop() { return aList.pop_back(); }
      88             :     SvMetaObject *  Top() const { return aList.back(); }
      89             :     void            Clear() { aList.clear(); }
      90             :     sal_uLong     Count() const { return aList.size(); }
      91             : 
      92           0 :     SvMetaObject *  Get( TypeId nType )
      93             :                     {
      94           0 :                         for( SvMetaObjectMemberList::reverse_iterator it = aList.rbegin(); it != aList.rend(); ++it )
      95           0 :                             if( (*it)->IsA( nType ) )
      96           0 :                                 return *it;
      97           0 :                         return NULL;
      98             :                     }
      99             : };
     100             : 
     101           0 : class SvMetaName : public SvMetaObject
     102             : {
     103             :     SvString      aName;
     104             :     SvHelpContext aHelpContext;
     105             :     SvHelpText    aHelpText;
     106             :     SvString      aConfigName;
     107             :     SvString      aDescription;
     108             : 
     109             : protected:
     110             :     virtual sal_Bool ReadNameSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
     111             :             void DoReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm,
     112             :                                      char c = '\0' );
     113             :     virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
     114             :     virtual void WriteContextSvIdl( SvIdlDataBase & rBase,
     115             :                                     SvStream & rOutStm, sal_uInt16 nTab );
     116             :     virtual void ReadAttributesSvIdl( SvIdlDataBase & rBase,
     117             :                                       SvTokenStream & rInStm );
     118             :     virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase,
     119             :                                        SvStream & rOutStm, sal_uInt16 nTab );
     120             :     virtual void WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
     121             :                                         WriteType, WriteAttribute = 0);
     122             :     virtual void WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
     123             :                                         WriteType, WriteAttribute = 0);
     124             : public:
     125           0 :             SV_DECL_META_FACTORY1( SvMetaName, SvMetaObject, 15 )
     126             :             SvMetaName();
     127             : 
     128             :     virtual sal_Bool            SetName( const OString& rName, SvIdlDataBase * = NULL  );
     129           0 :     void                        SetDescription( const OString& rText )
     130           0 :                                 { aDescription.setString(rText); }
     131           0 :     const SvHelpContext&        GetHelpContext() const { return aHelpContext; }
     132           0 :     virtual const SvString &    GetName() const { return aName; }
     133           0 :     virtual const SvString &    GetHelpText() const { return aHelpText; }
     134           0 :     virtual const SvString &    GetConfigName() const{ return aConfigName; }
     135           0 :     virtual const SvString&     GetDescription() const{ return aDescription; }
     136             : 
     137             :     virtual sal_Bool        Test( SvIdlDataBase &, SvTokenStream & rInStm );
     138             :     virtual sal_Bool        ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
     139             :     virtual void        WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab ) SAL_OVERRIDE;
     140             :     virtual void        Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
     141             :                                        WriteType, WriteAttribute = 0) SAL_OVERRIDE;
     142             :     void                WriteDescription( SvStream& rOutStm );
     143             : };
     144             : typedef tools::SvRef<SvMetaName> SvMetaNameRef;
     145             : 
     146             : class SvMetaNameMemberList : public SvDeclPersistList<SvMetaName *> {};
     147             : 
     148             : class SvMetaReference;
     149             : typedef tools::SvRef<SvMetaReference> SvMetaReferenceRef;
     150           0 : class SvMetaReference : public SvMetaName
     151             : {
     152             : protected:
     153             :     SvMetaReferenceRef  aRef;
     154             : public:
     155           0 :             SV_DECL_META_FACTORY1( SvMetaReference, SvMetaName, 17 )
     156             :             SvMetaReference();
     157             : 
     158           0 :     const SvString &    GetName() const SAL_OVERRIDE
     159             :                         {
     160           0 :                             return ( !aRef.Is()
     161           0 :                                     || !SvMetaName::GetName().getString().isEmpty() )
     162           0 :                                 ? SvMetaName::GetName()
     163           0 :                                 : aRef->GetName();
     164             :                         }
     165             : 
     166           0 :     const SvString &    GetHelpText() const SAL_OVERRIDE
     167             :                         {
     168           0 :                             return ( !aRef.Is()
     169           0 :                                     || !SvMetaName::GetHelpText().getString().isEmpty() )
     170           0 :                                 ? SvMetaName::GetHelpText()
     171           0 :                                 : aRef->GetHelpText();
     172             :                         }
     173             : 
     174           0 :     const SvString &    GetConfigName() const SAL_OVERRIDE
     175             :                         {
     176           0 :                             return ( !aRef.Is()
     177           0 :                                     || !SvMetaName::GetConfigName().getString().isEmpty() )
     178           0 :                                 ? SvMetaName::GetConfigName()
     179           0 :                                 : aRef->GetConfigName();
     180             :                         }
     181             : 
     182           0 :     const SvString &    GetDescription() const SAL_OVERRIDE
     183             :                         {
     184           0 :                             return ( !aRef.Is()
     185           0 :                                     || !SvMetaName::GetDescription().getString().isEmpty() )
     186           0 :                                 ? SvMetaName::GetDescription()
     187           0 :                                 : aRef->GetDescription();
     188             :                         }
     189           0 :     SvMetaReference *   GetRef() const { return aRef; }
     190           0 :     void                SetRef( SvMetaReference * pRef  )
     191           0 :                         { aRef = pRef; }
     192             : };
     193             : 
     194             : class SvMetaReferenceMemberList : public SvDeclPersistList<SvMetaReference *> {};
     195             : 
     196             : 
     197             : class SvMetaModule;
     198           0 : class SvMetaExtern : public SvMetaReference
     199             : {
     200             :     SvMetaModule *          pModule;    // included in which module
     201             : 
     202             :     SvUUId                  aUUId;
     203             :     SvVersion               aVersion;
     204             :     sal_Bool                    bReadUUId;
     205             :     sal_Bool                    bReadVersion;
     206             : public:
     207           0 :                         SV_DECL_META_FACTORY1( SvMetaExtern, SvMetaName, 16 )
     208             :                         SvMetaExtern();
     209             : 
     210             :     SvMetaModule *      GetModule() const;
     211             : 
     212             :     const SvGlobalName &GetUUId() const;
     213             :     const SvVersion &   GetVersion() const { return aVersion; }
     214             :     void                SetModule( SvIdlDataBase & rBase );
     215             :     virtual sal_Bool        ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
     216             :     virtual void        WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab ) SAL_OVERRIDE;
     217             : 
     218             :     virtual void        Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
     219             :                                   WriteType, WriteAttribute = 0) SAL_OVERRIDE;
     220             : protected:
     221             :     virtual void        ReadAttributesSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
     222             :     virtual void        WriteAttributesSvIdl( SvIdlDataBase & rBase,
     223             :                                               SvStream & rOutStm, sal_uInt16 nTab ) SAL_OVERRIDE;
     224             :     virtual void        WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
     225             :                                           WriteType, WriteAttribute = 0) SAL_OVERRIDE;
     226             : };
     227             : typedef tools::SvRef<SvMetaExtern> SvMetaExternRef;
     228             : 
     229             : class SvMetaExternMemberList : public SvDeclPersistList<SvMetaExtern *> {};
     230             : 
     231             : #endif // _BASOBJ_HXX
     232             : 
     233             : 
     234             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10