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 .
21 #include "idlctypes.hxx"
22 #include "aststack.hxx"
23 #include "options.hxx"
25 #include <string_view>
29 #define PATH_SEPARATOR "/"
31 #define SEPARATOR '\\'
32 #define PATH_SEPARATOR "\\"
44 Idlc(Options
* pOptions
);
49 bool dumpDeps(std::string_view rDepFile
,
50 OString
const& rTarget
);
53 { return m_pOptions
; }
55 { return m_pScopes
.get(); }
57 { return m_pRoot
.get(); }
58 const OString
& getFileName() const
59 { return m_fileName
; }
60 void setFileName(const OString
& fileName
)
61 { m_fileName
= fileName
; addInclude(fileName
); }
62 const OString
& getMainFileName() const
63 { return m_mainFileName
; }
64 void setMainFileName(const OString
& mainFileName
)
65 { m_mainFileName
= mainFileName
; }
66 const OString
& getRealFileName() const
67 { return m_realFileName
; }
68 void setRealFileName(const OString
& realFileName
)
69 { m_realFileName
= realFileName
; }
70 const OString
& getDocumentation()
72 m_bIsDocValid
= false;
73 return m_documentation
;
75 void setDocumentation(const OString
& documentation
)
77 m_documentation
= documentation
;
80 OUString
processDocumentation();
81 bool isInMainFile() const
82 { return m_bIsInMainfile
; }
83 void setInMainfile(bool bInMainfile
)
84 { m_bIsInMainfile
= bInMainfile
; }
85 sal_uInt32
getErrorCount() const
86 { return m_errorCount
; }
89 sal_uInt32
getWarningCount() const
90 { return m_warningCount
; }
91 void incWarningCount()
93 sal_uInt32
getLineNumber() const
94 { return m_lineNumber
; }
95 sal_uInt32
getOffsetStart() const
96 { return m_offsetStart
; }
97 sal_uInt32
getOffsetEnd() const
98 { return m_offsetEnd
; }
99 void setOffset( sal_uInt32 start
, sal_uInt32 end
)
100 { m_offsetStart
= start
; m_offsetEnd
= end
; }
101 void setLineNumber(sal_uInt32 lineNumber
)
102 { m_lineNumber
= lineNumber
; }
105 ParseState
getParseState() const
106 { return m_parseState
; }
107 void setParseState(ParseState parseState
)
108 { m_parseState
= parseState
; }
110 void addInclude(const OString
& inc
)
111 { m_includes
.insert(inc
); }
113 void setPublished(bool published
) { m_published
= published
; }
114 bool isPublished() const { return m_published
; }
119 std::unique_ptr
<AstStack
> m_pScopes
;
120 std::unique_ptr
<AstModule
> m_pRoot
;
122 OString m_mainFileName
;
123 OString m_realFileName
;
124 OString m_documentation
;
127 bool m_bIsInMainfile
;
129 sal_uInt32 m_errorCount
;
130 sal_uInt32 m_warningCount
;
131 sal_uInt32 m_lineNumber
;
132 sal_uInt32 m_offsetStart
;
133 sal_uInt32 m_offsetEnd
;
134 ParseState m_parseState
;
135 std::set
< OString
> m_includes
;
139 typedef ::std::pair
< OString
, OString
> sPair_t
;
140 sal_Int32
compileFile(const OString
* pathname
);
141 // a null pathname means stdin
142 sal_Int32
produceFile(const OString
& filenameBase
,
143 sPair_t
const*const pDepFile
);
144 // filenameBase is filename without ".idl"
145 void removeIfExists(std::string_view pathname
);
147 bool copyFile(const OString
* source
, const OString
& target
);
148 // a null source means stdin
150 bool isFileUrl(std::string_view fileName
);
151 OString
convertToAbsoluteSystemPath(const OString
& fileName
);
152 OString
convertToFileUrl(const OString
& fileName
);
155 Idlc
* setIdlc(Options
* pOptions
);
157 AstDeclaration
const * resolveTypedefs(AstDeclaration
const * type
);
159 AstDeclaration
const * deconstructAndResolveTypedefs(
160 AstDeclaration
const * type
, sal_Int32
* rank
);
162 AstInterface
const * resolveInterfaceTypedefs(AstType
const * type
);
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */