diff options
author | Rüdiger Timm <rt@openoffice.org> | 2004-03-30 15:45:40 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2004-03-30 15:45:40 +0000 |
commit | 867df357bf7cc62d69740bf05edad2571237af61 (patch) | |
tree | c029308e33bc4265f65b6205a8d1aa50530270e7 /idlc/source/astoperation.cxx | |
parent | a3069a8c45810ac7fabc1a5d96b95d934f820d51 (diff) |
INTEGRATION: CWS sb14 (1.3.4); FILE MERGED
2004/03/15 09:53:56 sb 1.3.4.4: #i21150# Adapted to new extensible type writer interface; added support for bound interface attributes.
2004/03/12 14:30:29 sb 1.3.4.3: #i21150# Added support for extended attributes (still need to fix TODO in AstAttribute::dumpBlob.
2004/03/05 08:35:19 sb 1.3.4.2: #i21150# Support for rest parameters; clean up.
2004/03/01 12:59:23 sb 1.3.4.1: #i21150# Added optional interface inheritance; added -stdin switch; do not warn about bad member names of com.sun.star.uno.Uik; some general clean up and added const qualifiers.
Diffstat (limited to 'idlc/source/astoperation.cxx')
-rw-r--r-- | idlc/source/astoperation.cxx | 82 |
1 files changed, 44 insertions, 38 deletions
diff --git a/idlc/source/astoperation.cxx b/idlc/source/astoperation.cxx index 428e502a609b..9bb4fef446e1 100644 --- a/idlc/source/astoperation.cxx +++ b/idlc/source/astoperation.cxx @@ -2,9 +2,9 @@ * * $RCSfile: astoperation.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: hr $ $Date: 2004-02-04 13:23:25 $ + * last change: $Author: rt $ $Date: 2004-03-30 16:45:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,34 +74,17 @@ #include <idlc/errorhandler.hxx> #endif +#include "registry/writer.hxx" + using namespace ::rtl; -void AstOperation::addExceptions(StringList* pExceptions) +void AstOperation::setExceptions(DeclList const * pExceptions) { - if ( isOneway() ) - { - idlc()->error()->error1(EIDL_ONEWAY_RAISE_CONFLICT, this); - } - - StringList::iterator iter = pExceptions->begin(); - StringList::iterator end = pExceptions->end(); - AstDeclaration* pDecl = NULL; - while ( iter != end) - { - pDecl = lookupByName(*iter); - if ( !pDecl ) - { - idlc()->error()->lookupError(*iter); - return; + if (pExceptions != 0) { + if (isOneway()) { + idlc()->error()->error1(EIDL_ONEWAY_RAISE_CONFLICT, this); } - if ( (pDecl->getNodeType() == NT_exception) ) - { - m_exceptions.push_back(pDecl); - } else - { - idlc()->error()->error1(EIDL_ILLEGAL_RAISES, this); - } - ++iter; + m_exceptions = *pExceptions; } } @@ -115,7 +98,13 @@ sal_Bool AstOperation::isVoid() return sal_False; } -sal_Bool AstOperation::dumpBlob(RegistryTypeWriter& rBlob, sal_uInt16 index) +bool AstOperation::isVariadic() const { + DeclList::const_iterator i(getIteratorEnd()); + return i != getIteratorBegin() + && static_cast< AstParameter const * >(*(--i))->isRest(); +} + +sal_Bool AstOperation::dumpBlob(typereg::Writer & rBlob, sal_uInt16 index) { sal_uInt16 nParam = getNodeCount(NT_parameter); sal_uInt16 nExcep = nExceptions(); @@ -124,14 +113,22 @@ sal_Bool AstOperation::dumpBlob(RegistryTypeWriter& rBlob, sal_uInt16 index) if ( isOneway() ) methodMode = RT_MODE_ONEWAY; - rBlob.setMethodData(index, OStringToOUString(getLocalName(), RTL_TEXTENCODING_UTF8), - OStringToOUString(getReturnType()->getRelativName(), RTL_TEXTENCODING_UTF8), - methodMode, nParam, nExcep, getDocumentation()); + rtl::OUString returnTypeName; + if (m_pReturnType == 0) { + returnTypeName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("void")); + } else { + returnTypeName = rtl::OStringToOUString( + m_pReturnType->getRelativName(), RTL_TEXTENCODING_UTF8); + } + rBlob.setMethodData( + index, getDocumentation(), methodMode, + OStringToOUString(getLocalName(), RTL_TEXTENCODING_UTF8), + returnTypeName, nParam, nExcep); if ( nParam ) { - DeclList::iterator iter = getIteratorBegin(); - DeclList::iterator end = getIteratorEnd(); + DeclList::const_iterator iter = getIteratorBegin(); + DeclList::const_iterator end = getIteratorEnd(); AstDeclaration* pDecl = NULL; AstParameter* pParam = NULL; RTParamMode paramMode; @@ -157,11 +154,18 @@ sal_Bool AstOperation::dumpBlob(RegistryTypeWriter& rBlob, sal_uInt16 index) paramMode = RT_PARAM_INVALID; break; } + if (pParam->isRest()) { + paramMode = static_cast< RTParamMode >( + paramMode | RT_PARAM_REST); + } - rBlob.setParamData(index, paramIndex++, - OStringToOUString(pParam->getType()->getRelativName(), RTL_TEXTENCODING_UTF8), - OStringToOUString(pDecl->getLocalName(), RTL_TEXTENCODING_UTF8), - paramMode); + rBlob.setMethodParameterData( + index, paramIndex++, paramMode, + OStringToOUString( + pDecl->getLocalName(), RTL_TEXTENCODING_UTF8), + OStringToOUString( + pParam->getType()->getRelativName(), + RTL_TEXTENCODING_UTF8)); } ++iter; } @@ -174,8 +178,10 @@ sal_Bool AstOperation::dumpBlob(RegistryTypeWriter& rBlob, sal_uInt16 index) sal_uInt16 exceptIndex = 0; while ( iter != end ) { - rBlob.setExcData(index, exceptIndex++, - OStringToOUString((*iter)->getRelativName(), RTL_TEXTENCODING_UTF8) ); + rBlob.setMethodExceptionTypeName( + index, exceptIndex++, + OStringToOUString( + (*iter)->getRelativName(), RTL_TEXTENCODING_UTF8)); ++iter; } } |