Teach symstore more duplicated DLLs
[LibreOffice.git] / idl / inc / database.hxx
blob4d554ee964e108e2eea5a2e3d9ca9d64f4fd5ff5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_IDL_INC_DATABASE_HXX
21 #define INCLUDED_IDL_INC_DATABASE_HXX
23 #include "module.hxx"
24 #include "hash.hxx"
25 #include "lex.hxx"
26 #include <rtl/string.hxx>
28 #include <rtl/ustring.hxx>
29 #include <set>
30 #include <exception>
32 class SvCommand;
34 class SvIdlError
36 OString aText;
37 public:
38 sal_uInt32 nLine, nColumn;
40 SvIdlError() : nLine(0), nColumn(0) {}
41 SvIdlError( sal_uInt32 nL, sal_uInt32 nC )
42 : nLine(nL), nColumn(nC) {}
44 const OString& GetText() const { return aText; }
45 void SetText( const OString& rT ) { aText = rT; }
46 bool IsError() const { return nLine != 0; }
49 class SvParseException : public std::exception
51 public:
52 SvIdlError aError;
53 SvParseException( SvTokenStream const & rInStm, const OString& rError );
54 SvParseException( const OString& rError, SvToken const & rTok );
59 class SvIdlDataBase
61 bool bExport;
62 OUString aExportFile;
63 sal_uInt32 nUniqueId;
64 sal_uInt32 nVerbosity;
65 std::vector<OUString> aIdFileList;
66 std::unique_ptr<SvStringHashTable> pIdTable;
68 SvRefMemberList<SvMetaType *> aTypeList;
69 SvRefMemberList<SvMetaClass *> aClassList;
70 SvRefMemberList<SvMetaModule *> aModuleList;
71 SvRefMemberList<SvMetaSlot *> aSlotList;
72 SvRefMemberList<SvMetaObject *> aContextStack;
74 protected:
75 ::std::set< OUString > m_DepFiles;
76 OUString aPath;
77 SvIdlError aError;
78 void WriteReset()
80 aUsedTypes.clear();
82 public:
83 OUString sSlotMapFile;
85 explicit SvIdlDataBase( const SvCommand& rCmd );
86 ~SvIdlDataBase();
88 SvRefMemberList<SvMetaType *>& GetTypeList();
89 SvRefMemberList<SvMetaClass *>& GetClassList() { return aClassList; }
90 SvRefMemberList<SvMetaModule *>& GetModuleList() { return aModuleList; }
92 // list of used types while writing
93 SvRefMemberList<SvMetaType *> aUsedTypes;
95 void StartNewFile( const OUString& rName );
96 void SetExportFile( const OUString& rName )
97 { aExportFile = rName; }
98 void AppendSlot( SvMetaSlot *pSlot );
99 const SvIdlError & GetError() const { return aError; }
100 void SetError( const SvIdlError & r )
101 { aError = r; }
103 const OUString & GetPath() const { return aPath; }
104 void SetPath(const OUString &s) { aPath = s; }
105 SvRefMemberList<SvMetaObject *>& GetStack() { return aContextStack; }
107 void Write(const OString& rText) const;
108 void WriteError( SvTokenStream & rInStm );
109 void SetError( const OString& rError, SvToken const & rTok );
110 void SetAndWriteError( SvTokenStream & rInStm, const OString& rError );
111 void Push( SvMetaObject * pObj );
112 sal_uInt32 GetUniqueId() { return ++nUniqueId; }
113 bool FindId( const OString& rIdName, sal_uLong * pVal );
114 void InsertId( const OString& rIdName, sal_uLong nVal );
115 bool ReadIdFile( const OString& rFileName );
117 SvMetaType * FindType( const OString& rName );
118 static SvMetaType * FindType( const SvMetaType *, SvRefMemberList<SvMetaType *>& );
120 SvMetaType * ReadKnownType( SvTokenStream & rInStm );
121 SvMetaAttribute * ReadKnownAttr( SvTokenStream & rInStm,
122 SvMetaType * pType );
123 SvMetaAttribute * FindKnownAttr( const SvIdentifier& );
124 SvMetaClass * ReadKnownClass( SvTokenStream & rInStm );
125 SvMetaClass * FindKnownClass( const OString& aName );
126 void AddDepFile(OUString const& rFileName);
127 void WriteDepFile(SvFileStream & rStream, OUString const& rTarget);
130 class SvIdlWorkingBase : public SvIdlDataBase
132 public:
133 explicit SvIdlWorkingBase( const SvCommand& rCmd );
135 bool WriteSfx( SvStream & );
138 #endif // INCLUDED_IDL_INC_DATABASE_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */