fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / idlc / source / astoperation.cxx
blob6e9f6753a06446ac3f5d4009d22c5988e30dfc7c
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 .
20 #include <idlc/astoperation.hxx>
21 #include <idlc/asttype.hxx>
22 #include <idlc/astbasetype.hxx>
23 #include <idlc/astparameter.hxx>
24 #include <idlc/errorhandler.hxx>
26 #include <registry/writer.hxx>
28 void AstOperation::setExceptions(DeclList const * pExceptions)
30 if (pExceptions != 0) {
31 m_exceptions = *pExceptions;
35 bool AstOperation::isVariadic() const {
36 DeclList::const_iterator i(getIteratorEnd());
37 return i != getIteratorBegin()
38 && static_cast< AstParameter const * >(*(--i))->isRest();
41 bool AstOperation::dumpBlob(typereg::Writer & rBlob, sal_uInt16 index)
43 sal_uInt16 nParam = getNodeCount(NT_parameter);
44 sal_uInt16 nExcep = nExceptions();
45 RTMethodMode methodMode = RTMethodMode::TWOWAY;
47 OUString returnTypeName;
48 if (m_pReturnType == 0) {
49 returnTypeName = "void";
50 } else {
51 returnTypeName = OStringToOUString(
52 m_pReturnType->getRelativName(), RTL_TEXTENCODING_UTF8);
54 rBlob.setMethodData(
55 index, getDocumentation(), methodMode,
56 OStringToOUString(getLocalName(), RTL_TEXTENCODING_UTF8),
57 returnTypeName, nParam, nExcep);
59 if ( nParam )
61 DeclList::const_iterator iter = getIteratorBegin();
62 DeclList::const_iterator end = getIteratorEnd();
63 RTParamMode paramMode;
64 sal_uInt16 paramIndex = 0;
65 while ( iter != end )
67 AstDeclaration* pDecl = *iter;
68 if ( pDecl->getNodeType() == NT_parameter )
70 AstParameter* pParam = static_cast<AstParameter*>(pDecl);
71 switch (pParam->getDirection())
73 case DIR_IN :
74 paramMode = RT_PARAM_IN;
75 break;
76 case DIR_OUT :
77 paramMode = RT_PARAM_OUT;
78 break;
79 case DIR_INOUT :
80 paramMode = RT_PARAM_INOUT;
81 break;
82 default:
83 paramMode = RT_PARAM_INVALID;
84 break;
86 if (pParam->isRest()) {
87 paramMode = static_cast< RTParamMode >(
88 paramMode | RT_PARAM_REST);
91 rBlob.setMethodParameterData(
92 index, paramIndex++, paramMode,
93 OStringToOUString(
94 pDecl->getLocalName(), RTL_TEXTENCODING_UTF8),
95 OStringToOUString(
96 pParam->getType()->getRelativName(),
97 RTL_TEXTENCODING_UTF8));
99 ++iter;
103 if ( nExcep )
105 DeclList::iterator iter = m_exceptions.begin();
106 DeclList::iterator end = m_exceptions.end();
107 sal_uInt16 exceptIndex = 0;
108 while ( iter != end )
110 rBlob.setMethodExceptionTypeName(
111 index, exceptIndex++,
112 OStringToOUString(
113 (*iter)->getRelativName(), RTL_TEXTENCODING_UTF8));
114 ++iter;
118 return true;
121 AstDeclaration* AstOperation::addDeclaration(AstDeclaration* pDecl)
123 return AstScope::addDeclaration(pDecl);
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */