bump product version to 7.2.5.1
[LibreOffice.git] / idlc / inc / errorhandler.hxx
blob9b49f5df441a5c94a0537a1be67c05ad03e34202
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 .
19 #ifndef INCLUDED_IDLC_INC_ERRORHANDLER_HXX
20 #define INCLUDED_IDLC_INC_ERRORHANDLER_HXX
22 #include "astdeclaration.hxx"
23 #include "astexpression.hxx"
24 #include "astenum.hxx"
26 enum class ErrorCode
28 SyntaxError, // Syntax error in IDL input
29 // More details will be gleaned from examining
30 // the parse state
31 RedefScope, // Redefinition inside defining scope
32 CoercionFailure, // Coercion failure
33 ScopeConflict, // Between fwd declare and full declare
34 IllegalAdd, // Illegal add action
35 IllegalRaises, // Error in "raises" clause
36 CantInherit, // Cannot inherit from non-interface
37 IdentNotFound, // Identifier not found
38 CannotInheritFromForward, // Cannot inherit from fwd decl interface
39 ExpectedConstant, // We got something else...
40 Eval, // Error in evaluating expression
41 ForwardDeclLookup, // Tried to lookup in fwd declared intf
42 RecursiveType, // Illegal recursive use of type
43 NotAType, // Not a type
44 InterfaceMemberLookup, // interface is not defined or a fwd declaration not exists
45 ServiceMemberLookup,
46 DefinedAttributeFlag,
47 WrongAttributeKeyword,
48 MissingAttributeKeyword,
49 BadAttributeFlags,
50 ExpectedOptional,
51 MixedInheritance,
52 DoubleInheritance,
53 DoubleMember,
54 ConstructorParameterNotIn,
55 ConstructorRestParameterNotFirst,
56 RestParameterNotLast,
57 RestParameterNotAny,
58 MethodHasRestParameter,
59 ReadOnlyAttributeSetExceptions,
60 UnsignedTypeArgument,
61 WrongNumberOfTypeArguments,
62 InstantiatedStructTypeTypedef,
63 IdenticalTypeParameters,
64 StructTypeTemplateWithBase,
65 PublishedForward,
66 PublishedusesUnpublished,
67 SimilarConstructors
70 enum class WarningCode
72 WrongNamingConvention // type or identifier doesn't fulfill the UNO naming convention
75 class ErrorHandler
77 public:
78 // Report errors with varying numbers of arguments
79 static void error0(ErrorCode e);
80 static void error1(ErrorCode e, AstDeclaration const * d);
81 static void error2(
82 ErrorCode e, AstDeclaration const * d1, AstDeclaration const * d2);
83 static void error3(ErrorCode e, AstDeclaration const * d1, AstDeclaration const * d2, AstDeclaration const * d3);
85 // Warning
86 static void warning0(WarningCode e, const char* warningmsg);
88 // Report a syntax error in IDL input
89 static void syntaxError(ParseState state, sal_Int32 lineNumber, const char* errmsg);
91 // Report an unsuccessful coercion attempt
92 static void coercionError(AstExpression *pExpr, ExprType et);
94 // Report a failed name lookup attempt
95 static void lookupError(const OString& n);
96 // Report a failed name lookup attempt
97 static void lookupError(ErrorCode e, const OString& n, AstDeclaration const * pScope);
100 // Report a type error
101 static void noTypeError(AstDeclaration const * pDecl);
103 static void inheritanceError(NodeType nodeType, const OString* name, AstDeclaration const * pDecl);
105 static void flagError(ErrorCode e, sal_uInt32 flag);
107 static void forwardLookupError(const AstDeclaration* pForward, const OString& name);
109 static void constantExpected(AstDeclaration const * pDecl, const OString& name);
111 static void evalError(AstExpression* pExpr);
113 static bool checkPublished(AstDeclaration const * decl, bool bOptional=false);
116 #endif // INCLUDED_IDLC_INC_ERRORHANDLER_HXX
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */