From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- idlc/inc/idlc.hxx | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 idlc/inc/idlc.hxx (limited to 'idlc/inc/idlc.hxx') diff --git a/idlc/inc/idlc.hxx b/idlc/inc/idlc.hxx new file mode 100644 index 000000000..42f16836a --- /dev/null +++ b/idlc/inc/idlc.hxx @@ -0,0 +1,166 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_IDLC_INC_IDLC_HXX +#define INCLUDED_IDLC_INC_IDLC_HXX + +#include "idlctypes.hxx" +#include "aststack.hxx" +#include "options.hxx" +#include + +#ifdef SAL_UNX +#define SEPARATOR '/' +#define PATH_SEPARATOR "/" +#else +#define SEPARATOR '\\' +#define PATH_SEPARATOR "\\" +#endif + +class AstInterface; +class AstModule; +class AstType; +class Options; +class ErrorHandler; + +class Idlc final +{ +public: + Idlc(Options* pOptions); + ~Idlc(); + + void init(); + + bool dumpDeps(OString const& rDepFile, + OString const& rTarget); + + Options* getOptions() + { return m_pOptions; } + AstStack* scopes() + { return m_pScopes.get(); } + AstModule* getRoot() + { return m_pRoot.get(); } + const OString& getFileName() const + { return m_fileName; } + void setFileName(const OString& fileName) + { m_fileName = fileName; addInclude(fileName); } + const OString& getMainFileName() const + { return m_mainFileName; } + void setMainFileName(const OString& mainFileName) + { m_mainFileName = mainFileName; } + const OString& getRealFileName() const + { return m_realFileName; } + void setRealFileName(const OString& realFileName) + { m_realFileName = realFileName; } + const OString& getDocumentation() + { + m_bIsDocValid = false; + return m_documentation; + } + void setDocumentation(const OString& documentation) + { + m_documentation = documentation; + m_bIsDocValid = true; + } + OUString processDocumentation(); + bool isInMainFile() const + { return m_bIsInMainfile; } + void setInMainfile(bool bInMainfile) + { m_bIsInMainfile = bInMainfile; } + sal_uInt32 getErrorCount() const + { return m_errorCount; } + void incErrorCount() + { m_errorCount++; } + sal_uInt32 getWarningCount() const + { return m_warningCount; } + void incWarningCount() + { m_warningCount++; } + sal_uInt32 getLineNumber() const + { return m_lineNumber; } + sal_uInt32 getOffsetStart() const + { return m_offsetStart; } + sal_uInt32 getOffsetEnd() const + { return m_offsetEnd; } + void setOffset( sal_uInt32 start, sal_uInt32 end) + { m_offsetStart = start; m_offsetEnd = end; } + void setLineNumber(sal_uInt32 lineNumber) + { m_lineNumber = lineNumber; } + void incLineNumber() + { m_lineNumber++; } + ParseState getParseState() const + { return m_parseState; } + void setParseState(ParseState parseState) + { m_parseState = parseState; } + + void addInclude(const OString& inc) + { m_includes.insert(inc); } + + void setPublished(bool published) { m_published = published; } + bool isPublished() const { return m_published; } + + void reset(); +private: + Options* m_pOptions; + std::unique_ptr m_pScopes; + std::unique_ptr m_pRoot; + OString m_fileName; + OString m_mainFileName; + OString m_realFileName; + OString m_documentation; + bool m_bIsDocValid; + bool m_bGenerateDoc; + bool m_bIsInMainfile; + bool m_published; + sal_uInt32 m_errorCount; + sal_uInt32 m_warningCount; + sal_uInt32 m_lineNumber; + sal_uInt32 m_offsetStart; + sal_uInt32 m_offsetEnd; + ParseState m_parseState; + std::set< OString > m_includes; +}; + + +typedef ::std::pair< OString, OString > sPair_t; +sal_Int32 compileFile(const OString * pathname); + // a null pathname means stdin +sal_Int32 produceFile(const OString& filenameBase, + sPair_t const*const pDepFile); + // filenameBase is filename without ".idl" +void removeIfExists(const OString& pathname); + +bool copyFile(const OString* source, const OString& target); + // a null source means stdin + +bool isFileUrl(const OString& fileName); +OString convertToAbsoluteSystemPath(const OString& fileName); +OString convertToFileUrl(const OString& fileName); + +Idlc* idlc(); +Idlc* setIdlc(Options* pOptions); + +AstDeclaration const * resolveTypedefs(AstDeclaration const * type); + +AstDeclaration const * deconstructAndResolveTypedefs( + AstDeclaration const * type, sal_Int32 * rank); + +AstInterface const * resolveInterfaceTypedefs(AstType const * type); + +#endif // INCLUDED_IDLC_INC_IDLC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3