bump product version to 7.2.5.1
[LibreOffice.git] / idl / inc / database.hxx
blobdcdf935931c58ad0902cd6a60d1e0f5c4c2982d4
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 <string_view>
31 #include <exception>
33 class SvCommand;
35 class SvIdlError
37 OString aText;
38 public:
39 sal_uInt32 nLine, nColumn;
41 SvIdlError() : nLine(0), nColumn(0) {}
42 SvIdlError( sal_uInt32 nL, sal_uInt32 nC )
43 : nLine(nL), nColumn(nC) {}
45 const OString& GetText() const { return aText; }
46 void SetText( const OString& rT ) { aText = rT; }
47 bool IsError() const { return nLine != 0; }
50 class SvParseException final : public std::exception
52 public:
53 SvIdlError aError;
54 SvParseException( SvTokenStream const & rInStm, const OString& rError );
55 SvParseException( const OString& rError, SvToken const & rTok );
60 class SvIdlDataBase
62 bool bExport;
63 OUString aExportFile;
64 sal_uInt32 nUniqueId;
65 sal_uInt32 nVerbosity;
66 std::vector<OUString> aIdFileList;
67 std::unique_ptr<SvStringHashTable> pIdTable;
69 SvRefMemberList<SvMetaType *> aTypeList;
70 SvRefMemberList<SvMetaClass *> aClassList;
71 SvRefMemberList<SvMetaModule *> aModuleList;
72 SvRefMemberList<SvMetaSlot *> aSlotList;
73 SvRefMemberList<SvMetaObject *> aContextStack;
75 protected:
76 ::std::set< OUString > m_DepFiles;
77 OUString aPath;
78 SvIdlError aError;
79 void WriteReset()
81 aUsedTypes.clear();
83 public:
84 OUString sSlotMapFile;
86 explicit SvIdlDataBase( const SvCommand& rCmd );
87 ~SvIdlDataBase();
89 SvRefMemberList<SvMetaType *>& GetTypeList();
90 SvRefMemberList<SvMetaClass *>& GetClassList() { return aClassList; }
91 SvRefMemberList<SvMetaModule *>& GetModuleList() { return aModuleList; }
93 // list of used types while writing
94 SvRefMemberList<SvMetaType *> aUsedTypes;
96 void StartNewFile( std::u16string_view rName );
97 void SetExportFile( const OUString& rName )
98 { aExportFile = rName; }
99 void AppendSlot( SvMetaSlot *pSlot );
100 const SvIdlError & GetError() const { return aError; }
101 void SetError( const SvIdlError & r )
102 { aError = r; }
104 const OUString & GetPath() const { return aPath; }
105 void SetPath(const OUString &s) { aPath = s; }
106 SvRefMemberList<SvMetaObject *>& GetStack() { return aContextStack; }
108 void Write(const OString& rText) const;
109 void WriteError( SvTokenStream & rInStm );
110 void SetError( const OString& rError, SvToken const & rTok );
111 void SetAndWriteError( SvTokenStream & rInStm, const OString& rError );
112 void Push( SvMetaObject * pObj );
113 sal_uInt32 GetUniqueId() { return ++nUniqueId; }
114 bool FindId( const OString& rIdName, sal_uInt32 * pVal );
115 void InsertId( const OString& rIdName, sal_uInt32 nVal );
116 bool ReadIdFile( std::string_view rFileName );
118 SvMetaType * FindType( std::string_view rName );
119 static SvMetaType * FindType( const SvMetaType *, SvRefMemberList<SvMetaType *>& );
121 SvMetaType * ReadKnownType( SvTokenStream & rInStm );
122 SvMetaAttribute * ReadKnownAttr( SvTokenStream & rInStm,
123 SvMetaType * pType );
124 SvMetaAttribute * FindKnownAttr( const SvIdentifier& );
125 SvMetaClass * ReadKnownClass( SvTokenStream & rInStm );
126 SvMetaClass * FindKnownClass( std::string_view aName );
127 void AddDepFile(OUString const& rFileName);
128 void WriteDepFile(SvFileStream & rStream, std::u16string_view rTarget);
131 class SvIdlWorkingBase : public SvIdlDataBase
133 public:
134 explicit SvIdlWorkingBase( const SvCommand& rCmd );
136 bool WriteSfx( SvStream & );
139 #endif // INCLUDED_IDL_INC_DATABASE_HXX
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */