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>
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
53 SvParseException( SvTokenStream
const & rInStm
, const OString
& rError
);
54 SvParseException( const OString
& rError
, SvToken
const & rTok
);
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
;
75 ::std::set
< OUString
> m_DepFiles
;
83 OUString sSlotMapFile
;
85 explicit SvIdlDataBase( const SvCommand
& rCmd
);
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
)
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
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: */