diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2007-11-02 14:26:30 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2007-11-02 14:26:30 +0000 |
commit | 75e017cacec33b6fcf5f867020f3b439f51ef1d3 (patch) | |
tree | dbb6906af5450a2063b2fe991f16b11a4da9f888 /autodoc/source/ary/cpp/c_funct.cxx | |
parent | INTEGRATION: CWS adc18 (1.5.2); FILE MERGED (diff) | |
download | core-75e017cacec33b6fcf5f867020f3b439f51ef1d3.tar.gz core-75e017cacec33b6fcf5f867020f3b439f51ef1d3.zip |
INTEGRATION: CWS adc18 (1.4.2); FILE MERGED
2007/10/18 13:27:00 np 1.4.2.1: #i81775#
Diffstat (limited to 'autodoc/source/ary/cpp/c_funct.cxx')
-rw-r--r-- | autodoc/source/ary/cpp/c_funct.cxx | 205 |
1 files changed, 155 insertions, 50 deletions
diff --git a/autodoc/source/ary/cpp/c_funct.cxx b/autodoc/source/ary/cpp/c_funct.cxx index 7267bab2c683..994d31f440bc 100644 --- a/autodoc/source/ary/cpp/c_funct.cxx +++ b/autodoc/source/ary/cpp/c_funct.cxx @@ -4,9 +4,9 @@ * * $RCSfile: c_funct.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: vg $ $Date: 2007-09-18 13:25:22 $ + * last change: $Author: hr $ $Date: 2007-11-02 15:25:07 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -39,9 +39,49 @@ // NOT FULLY DECLARED SERVICES -#include "rcids.hxx" -#include <ary/cpp/cpp_disp.hxx> +#include <algorithm> +#include <ary/cpp/c_funct.hxx> + + + + + +namespace +{ +using namespace ::ary::cpp; + + +class Parameter_2_NonTypeParamInfo +{ + public: + String operator()( + const S_Parameter & i_rParam ) const; +}; + +class Parameter_2_Type +{ + public: + Type_id operator()( + const S_Parameter & i_rParam ) const + { return i_rParam.nType; } +}; +/** @return + A vector with Strings like this: + "ParamName" or "ParamName[ArraySize]" or "ParamName = InitValue". +*/ +StringVector Create_NonTypeParameterInfos( + const std::vector<S_Parameter> & + i_rParameters ); +/** @return + A vector of the parameters' type ids. +*/ +std::vector<Type_id> + Create_ParameterTypeList( + const std::vector<S_Parameter> & + i_rParameters ); + +} // namspace anonymous namespace ary @@ -50,66 +90,88 @@ namespace cpp { Function::Function() - : // aEssentials, - nSignature(0), + : aEssentials(), + aTemplateParameterTypes(), + aSignature(), nReturnType(0), eProtection(PROTECT_global), - eVirtuality(VIRTUAL_none) - // aFlags, - // aParameterInfos, - // pExceptions + eVirtuality(VIRTUAL_none), + aFlags(), + aParameterInfos(), + pExceptions() { } -Function::Function( Cid i_nId, - const udmstri & i_sLocalName, - Cid i_nOwner, +Function::Function( const String & i_sLocalName, + Ce_id i_nOwner, E_Protection i_eProtection, Lid i_nFile, - Tid i_nReturnType, - OSid i_nSignature, - StringVector & i_rNonType_ParameterInfos, + Type_id i_nReturnType, + const std::vector<S_Parameter> & + i_parameters, + E_ConVol i_conVol, E_Virtuality i_eVirtuality, FunctionFlags i_aFlags, bool i_bThrowExists, - const std::vector<Tid> & i_rExceptions ) - - : aEssentials( i_nId, - i_sLocalName, + const std::vector<Type_id> & + i_rExceptions ) + : aEssentials( i_sLocalName, i_nOwner, i_nFile ), - // aTemplateParameterTypes - nSignature(i_nSignature), + aTemplateParameterTypes(), + aSignature( Create_ParameterTypeList(i_parameters), + i_conVol ), nReturnType(i_nReturnType), eProtection(i_eProtection), eVirtuality(i_eVirtuality), aFlags(i_aFlags), - // aParameterInfos, + aParameterInfos( Create_NonTypeParameterInfos(i_parameters) ), pExceptions( i_bThrowExists ? new ExceptionTypeList(i_rExceptions) : 0 ) { - std::swap( aParameterInfos, i_rNonType_ParameterInfos ); } Function::~Function() { } +bool +Function::IsIdentical( const Function & i_f ) const +{ + return + LocalName() == i_f.LocalName() + AND + Owner() == i_f.Owner() + AND + aSignature == i_f.aSignature + AND + nReturnType == i_f.nReturnType + AND + eProtection == i_f.eProtection + AND + eVirtuality == i_f.eVirtuality + AND + aFlags == i_f.aFlags + AND + ( NOT pExceptions AND NOT i_f.pExceptions + OR + ( pExceptions AND i_f.pExceptions + ? *pExceptions == *i_f.pExceptions + : false ) + ) + AND + aTemplateParameterTypes.size() == i_f.aTemplateParameterTypes.size(); +} + void -Function::Add_TemplateParameterType( const udmstri & i_sLocalName, - Tid i_nIdAsType ) +Function::Add_TemplateParameterType( const String & i_sLocalName, + Type_id i_nIdAsType ) { aTemplateParameterTypes.push_back( List_TplParam::value_type(i_sLocalName, i_nIdAsType) ); } -Cid -Function::inq_Id() const -{ - return aEssentials.Id(); -} - -const udmstri & +const String & Function::inq_LocalName() const { return aEssentials.LocalName(); @@ -128,36 +190,79 @@ Function::inq_Location() const } void -Function::do_StoreAt( ary::Display & o_rOut ) const +Function::do_Accept(csv::ProcessorIfc & io_processor) const { - ary::cpp::Display * pD = dynamic_cast< ary::cpp::Display* >(&o_rOut); - if (pD != 0) - { - pD->Display_Function(*this); - } + csv::CheckedCall(io_processor,*this); } -RCid -Function::inq_RC() const +ClassId +Function::get_AryClass() const { - return RC_(); + return class_id; } -const ary::Documentation & -Function::inq_Info() const + +} // namespace cpp +} // namespace ary + + + +namespace { - return aEssentials.Info(); + +String +Parameter_2_NonTypeParamInfo::operator()( const ary::cpp::S_Parameter & i_rParam ) const +{ + static StreamStr aParamName_(1020); + aParamName_.seekp(0); + + aParamName_ << i_rParam.sName; + if ( i_rParam.sSizeExpression.length() > 0 ) + { + aParamName_ << '[' + << i_rParam.sSizeExpression + << ']'; + } + if ( i_rParam.sInitExpression.length() > 0 ) + { + aParamName_ << " = " + << i_rParam.sInitExpression; + } + + return aParamName_.c_str(); } -void -Function::do_Add_Documentation( DYN ary::Documentation & let_drInfo ) + +StringVector +Create_NonTypeParameterInfos( const std::vector<S_Parameter> & i_rParameters ) { - aEssentials.SetInfo(let_drInfo); + static Parameter_2_NonTypeParamInfo + aTransformFunction_; + + StringVector + ret(i_rParameters.size(), String::Null_()); + std::transform( i_rParameters.begin(), i_rParameters.end(), + ret.begin(), + aTransformFunction_ ); + return ret; +} + +std::vector<Type_id> +Create_ParameterTypeList( const std::vector<S_Parameter> & i_rParameters ) +{ + static Parameter_2_Type + aTransformFunction_; + + std::vector<Type_id> + ret(i_rParameters.size(), Type_id(0)); + std::transform( i_rParameters.begin(), i_rParameters.end(), + ret.begin(), + aTransformFunction_ ); + return ret; } -} // namespace cpp -} // namespace ary +} // namespace anonymous |