LCOV - code coverage report
Current view: top level - idl/inc - database.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 27 29 93.1 %
Date: 2014-04-11 Functions: 18 20 90.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 _DATABASE_HXX
      21             : #define _DATABASE_HXX
      22             : 
      23             : #include <module.hxx>
      24             : #include <hash.hxx>
      25             : #include <lex.hxx>
      26             : #include <rtl/string.hxx>
      27             : #include <tools/pstm.hxx>
      28             : 
      29             : #include <rtl/ustring.hxx>
      30             : #include <set>
      31             : 
      32             : class SvCommand;
      33             : 
      34        5458 : class SvIdlError
      35             : {
      36             :     OString aText;
      37             : public:
      38             :     sal_uInt32  nLine, nColumn;
      39             : 
      40         141 :             SvIdlError() : nLine(0), nColumn(0) {}
      41        5051 :             SvIdlError( sal_uInt32 nL, sal_uInt32 nC )
      42        5051 :                 : nLine(nL), nColumn(nC) {}
      43             : 
      44           0 :     const OString&  GetText() const { return aText; }
      45        5829 :     void SetText( const OString& rT ) { aText = rT; }
      46           0 :     sal_Bool            IsError() const { return nLine != 0; }
      47             :     void            Clear() { nLine = nColumn = 0; }
      48        5317 :     SvIdlError &    operator = ( const SvIdlError & rRef )
      49        5317 :     { aText   = rRef.aText;
      50        5317 :       nLine   = rRef.nLine;
      51        5317 :       nColumn = rRef.nColumn;
      52        5317 :       return *this;
      53             :     }
      54             : };
      55             : 
      56             : class SvIdlDataBase
      57             : {
      58             :     sal_Bool                        bExport;
      59             :     OUString                    aExportFile;
      60             :     sal_uInt32                  nUniqueId;
      61             :     sal_uInt32                  nVerbosity;
      62             :     OUString                    aDataBaseFile;
      63             :     SvPersistStream             aPersStream;
      64             :     StringList                  aIdFileList;
      65             :     SvStringHashTable *         pIdTable;
      66             : 
      67             :     SvMetaTypeMemberList        aTypeList;
      68             :     SvMetaClassMemberList       aClassList;
      69             :     SvMetaModuleMemberList      aModuleList;
      70             :     SvMetaAttributeMemberList   aAttrList;
      71             :     SvMetaTypeMemberList        aTmpTypeList; // not persistent
      72             : 
      73             : protected:
      74             :     ::std::set< OUString > m_DepFiles;
      75             :     SvMetaObjectMemberStack     aContextStack;
      76             :     OUString                    aPath;
      77             :     SvIdlError                  aError;
      78           8 :     void WriteReset()
      79             :     {
      80           8 :         aUsedTypes.clear();
      81           8 :         aIFaceName = OString();
      82           8 :     }
      83             : public:
      84             :     OUString sSlotMapFile;
      85             : 
      86             :                 explicit SvIdlDataBase( const SvCommand& rCmd );
      87             :                 ~SvIdlDataBase();
      88             :     static sal_Bool IsBinaryFormat( SvStream & rInStm );
      89             : 
      90             :     void        Load( SvStream & rInStm );
      91             :     void        Save( SvStream & rInStm, sal_uInt32 nContextFlags );
      92             : 
      93       72900 :     SvMetaAttributeMemberList&  GetAttrList() { return aAttrList; }
      94          16 :     SvStringHashTable *       GetIdTable() { return pIdTable; }
      95             :     SvMetaTypeMemberList &    GetTypeList();
      96         190 :     SvMetaClassMemberList &   GetClassList()  { return aClassList; }
      97          80 :     SvMetaModuleMemberList &  GetModuleList() { return aModuleList; }
      98             :     SvMetaModule *            GetModule( const OString& rName );
      99             : 
     100             :     // list of used types while writing
     101             :     SvMetaTypeMemberList    aUsedTypes;
     102             :     OString            aIFaceName;
     103             :     SvNumberIdentifier      aStructSlotId;
     104             : 
     105             :     void                    StartNewFile( const OUString& rName );
     106           8 :     void                    SetExportFile( const OUString& rName )
     107           8 :                             { aExportFile = rName; }
     108             :     void                    AppendAttr( SvMetaAttribute *pSlot );
     109         133 :     const SvIdlError &      GetError() const { return aError; }
     110         266 :     void                    SetError( const SvIdlError & r )
     111         266 :                             { aError = r; }
     112             : 
     113         321 :     const OUString &        GetPath() const { return aPath; }
     114        3379 :     SvMetaObjectMemberStack & GetStack()      { return aContextStack; }
     115             : 
     116             :     void                    Write(const OString& rText);
     117             :     void                    WriteError(const OString& rErrWrn,
     118             :                                     const OString& rFileName,
     119             :                                     const OString& rErrorText,
     120             :                                     sal_uLong nRow = 0, sal_uLong nColumn = 0 ) const;
     121             :     void                    WriteError( SvTokenStream & rInStm );
     122             :     void                    SetError( const OString& rError, SvToken * pTok );
     123             :     void                    Push( SvMetaObject * pObj );
     124             :     sal_Bool                    Pop( sal_Bool bOk, SvTokenStream & rInStm, sal_uInt32 nTokPos )
     125             :                             {
     126             :                                 GetStack().Pop();
     127             :                                 if( bOk )
     128             :                                     aError.Clear();
     129             :                                 else
     130             :                                     rInStm.Seek( nTokPos );
     131             :                                 return bOk;
     132             :                             }
     133           5 :     sal_uInt32              GetUniqueId() { return ++nUniqueId; }
     134             :     sal_Bool                FindId( const OString& rIdName, sal_uLong * pVal );
     135             :     sal_Bool                InsertId( const OString& rIdName, sal_uLong nVal );
     136             :     sal_Bool                ReadIdFile( const OUString & rFileName );
     137             : 
     138             :     SvMetaType *            FindType( const OString& rName );
     139             :     static SvMetaType *     FindType( const SvMetaType *, SvMetaTypeMemberList & );
     140             : 
     141             :     SvMetaType *            ReadKnownType( SvTokenStream & rInStm );
     142             :     SvMetaAttribute *       ReadKnownAttr( SvTokenStream & rInStm,
     143             :                                             SvMetaType * pType = NULL );
     144             :     SvMetaAttribute *       SearchKnownAttr( const SvNumberIdentifier& );
     145             :     SvMetaClass *           ReadKnownClass( SvTokenStream & rInStm );
     146             :     void AddDepFile(OUString const& rFileName);
     147             :     bool WriteDepFile(SvFileStream & rStream, OUString const& rTarget);
     148             : };
     149             : 
     150           8 : class SvIdlWorkingBase : public SvIdlDataBase
     151             : {
     152             : public:
     153             :                 explicit SvIdlWorkingBase( const SvCommand& rCmd );
     154             : 
     155             :     sal_Bool        ReadSvIdl( SvTokenStream &, sal_Bool bImported, const OUString & rPath );
     156             :     sal_Bool        WriteSvIdl( SvStream & );
     157             : 
     158             :     sal_Bool        WriteSfx( SvStream & );
     159             :     sal_Bool        WriteHelpIds( SvStream & );
     160             :     sal_Bool        WriteSfxItem( SvStream & );
     161             :     sal_Bool        WriteCSV( SvStream& );
     162             :     sal_Bool        WriteDocumentation( SvStream& );
     163             : };
     164             : 
     165             : #endif // _DATABASE_HXX
     166             : 
     167             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10