1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
26 #include <rtl/string.hxx>
28 #include <rtl/ustring.hxx>
30 #include <string_view>
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
54 SvParseException( SvTokenStream
const & rInStm
, const OString
& rError
);
55 SvParseException( const OString
& rError
, SvToken
const & rTok
);
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
;
76 ::std::set
< OUString
> m_DepFiles
;
84 OUString sSlotMapFile
;
86 explicit SvIdlDataBase( const SvCommand
& rCmd
);
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
)
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
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: */