diff options
Diffstat (limited to 'autodoc/source/ary')
127 files changed, 18891 insertions, 0 deletions
diff --git a/autodoc/source/ary/cpp/c_builtintype.cxx b/autodoc/source/ary/cpp/c_builtintype.cxx new file mode 100644 index 000000000000..fc245ae0985b --- /dev/null +++ b/autodoc/source/ary/cpp/c_builtintype.cxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cpp/c_builtintype.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_type.hxx> + + +namespace ary +{ +namespace cpp +{ + + + + +//********************** Type **************************// +Rid +Type::inq_RelatedCe() const +{ + return 0; +} + + +//********************** BuiltInType **************************// + +BuiltInType::BuiltInType( const String & i_sName, + E_TypeSpecialisation i_eSpecialisation ) + : sName( i_sName ), + eSpecialisation( i_eSpecialisation ) +{ +} + +String +BuiltInType::SpecializedName_( const char * i_sName, + E_TypeSpecialisation i_eTypeSpecialisation ) +{ + StreamLock + aStrLock(60); + StreamStr & + ret = aStrLock(); + + switch ( i_eTypeSpecialisation ) + { + case TYSP_unsigned: + ret << "u_"; + break; + case TYSP_signed: + if (strcmp(i_sName,"char") == 0) + ret << "s_"; + break; + default: + ; + + } // end switch + + ret << i_sName; + return String(ret.c_str()); +} + +void +BuiltInType::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor,*this); +} + +ary::ClassId +BuiltInType::get_AryClass() const +{ + return class_id; +} + +bool +BuiltInType::inq_IsConst() const +{ + return false; +} + +void +BuiltInType::inq_Get_Text( StreamStr & , // o_rPreName + StreamStr & o_rName, + StreamStr & , // o_rPostName + const Gate & ) const // i_rGate +{ + switch (eSpecialisation) + { + case TYSP_unsigned: o_rName << "unsigned "; break; + case TYSP_signed: o_rName << "signed "; break; + + default: // Does nothing. + ; + } + o_rName << sName; +} + + + + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/c_class.cxx b/autodoc/source/ary/cpp/c_class.cxx new file mode 100644 index 000000000000..8867c1d9e856 --- /dev/null +++ b/autodoc/source/ary/cpp/c_class.cxx @@ -0,0 +1,284 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cpp/c_class.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <slots.hxx> +#include "c_slots.hxx" + + + +namespace ary +{ +namespace cpp +{ + +Class::Class( const String & i_sLocalName, + Ce_id i_nOwner, + E_Protection i_eProtection, + loc::Le_id i_nFile, + E_ClassKey i_eClassKey ) + : aEssentials( i_sLocalName, + i_nOwner, + i_nFile ), + aAssignedNode(), + aBaseClasses(), + aTemplateParameterTypes(), + aClasses(), + aEnums(), + aTypedefs(), + aOperations(), + aStaticOperations(), + aData(), + aStaticData(), + aFriendClasses(), + aFriendOperations(), + aKnownDerivatives(), + eClassKey(i_eClassKey), + eProtection(i_eProtection), + eVirtuality(VIRTUAL_none) +{ + aAssignedNode.Assign_Entity(*this); +} + +Class::~Class() +{ +} + +void +Class::Add_BaseClass( const S_Classes_Base & i_rBaseClass ) +{ + aBaseClasses.push_back(i_rBaseClass); +} + +void +Class::Add_TemplateParameterType( const String & i_sLocalName, + Type_id i_nIdAsType ) +{ + aTemplateParameterTypes.push_back( + List_TplParam::value_type(i_sLocalName,i_nIdAsType) ); +} + +void +Class::Add_LocalClass( const String & i_sLocalName, + Cid i_nId ) +{ + aClasses.push_back( S_LocalCe(i_sLocalName, i_nId) ); +} + +void +Class::Add_LocalEnum( const String & i_sLocalName, + Cid i_nId ) +{ + aEnums.push_back( S_LocalCe(i_sLocalName, i_nId) ); +} + +void +Class::Add_LocalTypedef( const String & i_sLocalName, + Cid i_nId ) +{ + aTypedefs.push_back( S_LocalCe(i_sLocalName, i_nId) ); +} + +void +Class::Add_LocalOperation( const String & i_sLocalName, + Cid i_nId ) +{ + aOperations.push_back( S_LocalCe(i_sLocalName, i_nId) ); +} + +void +Class::Add_LocalStaticOperation( const String & i_sLocalName, + Cid i_nId ) +{ + aStaticOperations.push_back( S_LocalCe(i_sLocalName, i_nId) ); +} + +void +Class::Add_LocalData( const String & i_sLocalName, + Cid i_nId ) +{ + aData.push_back( S_LocalCe(i_sLocalName, i_nId) ); +} + +void +Class::Add_LocalStaticData( const String & i_sLocalName, + Cid i_nId ) +{ + aStaticData.push_back( S_LocalCe(i_sLocalName, i_nId) ); +} + + +struct find_name +{ + find_name( + const String & i_name ) + : sName(i_name) {} + + bool operator()( + const S_LocalCe & i_lce ) const + { return i_lce.sLocalName == sName; } + private: + String sName; +}; + +Ce_id +Class::Search_Child(const String & i_key) const +{ + Ce_id + ret = Ce_id(Search_LocalClass(i_key)); + if (ret.IsValid()) + return ret; + + CIterator_Locals + itret = std::find_if(aEnums.begin(), aEnums.end(), find_name(i_key)); + if (itret != aEnums.end()) + return (*itret).nId; + itret = std::find_if(aTypedefs.begin(), aTypedefs.end(), find_name(i_key)); + if (itret != aTypedefs.end()) + return (*itret).nId; + itret = std::find_if(aData.begin(), aData.end(), find_name(i_key)); + if (itret != aData.end()) + return (*itret).nId; + itret = std::find_if(aStaticData.begin(), aStaticData.end(), find_name(i_key)); + if (itret != aStaticData.end()) + return (*itret).nId; + return Ce_id(0); +} + +Rid +Class::Search_LocalClass( const String & i_sName ) const +{ + CIterator_Locals itFound = PosOfName(aClasses, i_sName); + if (itFound != aClasses.end()) + return (*itFound).nId.Value(); + return 0; +} + +const String & +Class::inq_LocalName() const +{ + return aEssentials.LocalName(); +} + +Cid +Class::inq_Owner() const +{ + return aEssentials.Owner(); +} + +loc::Le_id +Class::inq_Location() const +{ + return aEssentials.Location(); +} + +void +Class::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor,*this); +} + +ClassId +Class::get_AryClass() const +{ + return class_id; +} + +Gid +Class::inq_Id_Group() const +{ + return static_cast<Gid>(Id()); +} + +const ary::cpp::CppEntity & +Class::inq_RE_Group() const +{ + return *this; +} + +const group::SlotList & +Class::inq_Slots() const +{ + static const SlotAccessId aProjectSlotData[] + = { SLOT_Bases, + SLOT_NestedClasses, + SLOT_Enums, + SLOT_Typedefs, + SLOT_Operations, + SLOT_StaticOperations, + SLOT_Data, + SLOT_StaticData, + SLOT_FriendClasses, + SLOT_FriendOperations }; + static const std::vector< SlotAccessId > + aSlots( &aProjectSlotData[0], + &aProjectSlotData[0] + + sizeof aProjectSlotData / sizeof (SlotAccessId) ); + return aSlots; +} + + +DYN Slot * +Class::inq_Create_Slot( SlotAccessId i_nSlot ) const +{ + switch ( i_nSlot ) + { + case SLOT_Bases: return new Slot_BaseClass(aBaseClasses); + case SLOT_NestedClasses: return new Slot_ListLocalCe(aClasses); + case SLOT_Enums: return new Slot_ListLocalCe(aEnums); + case SLOT_Typedefs: return new Slot_ListLocalCe(aTypedefs); + case SLOT_Operations: return new Slot_ListLocalCe(aOperations); + case SLOT_StaticOperations: return new Slot_ListLocalCe(aStaticOperations); + case SLOT_Data: return new Slot_ListLocalCe(aData); + case SLOT_StaticData: return new Slot_ListLocalCe(aStaticData); + case SLOT_FriendClasses: return new Slot_SequentialIds<Ce_id>(aFriendClasses); + case SLOT_FriendOperations: return new Slot_SequentialIds<Ce_id>(aFriendOperations); + default: + return new Slot_Null; + } // end switch +} + +Class::CIterator_Locals +Class::PosOfName( const List_LocalCe & i_rList, + const String & i_sName ) const +{ + for ( CIterator_Locals ret = i_rList.begin(); + ret != i_rList.end(); + ++ret ) + { + if ( (*ret).sLocalName == i_sName ) + return ret; + } + return i_rList.end(); +} + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/c_de.cxx b/autodoc/source/ary/cpp/c_de.cxx new file mode 100644 index 000000000000..4c8024bbef47 --- /dev/null +++ b/autodoc/source/ary/cpp/c_de.cxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cpp/c_de.hxx> + + + +namespace ary +{ +namespace cpp +{ + + + +DefineEntity::DefineEntity( const String & i_name, + loc::Le_id i_declaringFile ) + : sName(i_name), + nLocation(i_declaringFile) +{ +} + + + + +} // end namespace cpp +} // end namespace ary diff --git a/autodoc/source/ary/cpp/c_define.cxx b/autodoc/source/ary/cpp/c_define.cxx new file mode 100644 index 000000000000..4f91ea38c8e6 --- /dev/null +++ b/autodoc/source/ary/cpp/c_define.cxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cpp/c_define.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <prprpr.hxx> + + + + +namespace ary +{ +namespace cpp +{ + + + +Define::Define( const String & i_name, + const StringVector & i_definition, + loc::Le_id i_declaringFile) + : DefineEntity(i_name, i_declaringFile), + aDefinition(i_definition) +{ +} + +Define::~Define() +{ +} + +void +Define::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +Define::get_AryClass() const +{ + return class_id; +} + +const StringVector & +Define::inq_DefinitionText() const +{ + return aDefinition; +} + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/c_enum.cxx b/autodoc/source/ary/cpp/c_enum.cxx new file mode 100644 index 000000000000..6dd76f183e16 --- /dev/null +++ b/autodoc/source/ary/cpp/c_enum.cxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cpp/c_enum.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <slots.hxx> +#include "c_slots.hxx" + + + + +namespace ary +{ +namespace cpp +{ + +Enum::Enum( const String & i_sLocalName, + Ce_id i_nOwner, + E_Protection i_eProtection, + Lid i_nFile ) + : aEssentials( i_sLocalName, + i_nOwner, + i_nFile ), + aValues(), + eProtection(i_eProtection) +{ +} + +Enum::~Enum() +{ +} + +void +Enum::Add_Value( Ce_id i_nId ) +{ + aValues.Add( i_nId ); +} + +const String & +Enum::inq_LocalName() const +{ + return aEssentials.LocalName(); +} + +Cid +Enum::inq_Owner() const +{ + return aEssentials.Owner(); +} + +Lid +Enum::inq_Location() const +{ + return aEssentials.Location(); +} + +void +Enum::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor,*this); +} + +ClassId +Enum::get_AryClass() const +{ + return class_id; +} + +Gid +Enum::inq_Id_Group() const +{ + return static_cast<Gid>(Id()); +} + +const ary::cpp::CppEntity & +Enum::inq_RE_Group() const +{ + return *this; +} + +const group::SlotList & +Enum::inq_Slots() const +{ + static const SlotAccessId aProjectSlotData[] + = { SLOT_Values }; + static const std::vector< SlotAccessId > + aSlots( &aProjectSlotData[0], + &aProjectSlotData[0] + + sizeof aProjectSlotData / sizeof (SlotAccessId) ); + return aSlots; +} + +DYN Slot * +Enum::inq_Create_Slot( SlotAccessId i_nSlot ) const +{ + switch ( i_nSlot ) + { + case SLOT_Values: return new Slot_SequentialIds<Ce_id>(aValues); + default: + return new Slot_Null; + } // end switch +} + + + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/c_enuval.cxx b/autodoc/source/ary/cpp/c_enuval.cxx new file mode 100644 index 000000000000..d133546449bd --- /dev/null +++ b/autodoc/source/ary/cpp/c_enuval.cxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cpp/c_enuval.hxx> + + +// NOT FULLY DECLARED SERVICES + + +namespace ary +{ +namespace cpp +{ + + +EnumValue::EnumValue( const String & i_sLocalName, + Ce_id i_nOwner, + String i_sInitialisation ) + : aEssentials( i_sLocalName, + i_nOwner, + Lid(0) ), + sInitialisation(i_sInitialisation) +{ +} + +EnumValue::~EnumValue() +{ +} + +const String & +EnumValue::inq_LocalName() const +{ + return aEssentials.LocalName(); +} + +Cid +EnumValue::inq_Owner() const +{ + return aEssentials.Owner(); +} + +Lid +EnumValue::inq_Location() const +{ + return aEssentials.Location(); +} + +void +EnumValue::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor,*this); +} + +ClassId +EnumValue::get_AryClass() const +{ + return class_id; +} + + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/c_funct.cxx b/autodoc/source/ary/cpp/c_funct.cxx new file mode 100644 index 000000000000..cfc0a61909b2 --- /dev/null +++ b/autodoc/source/ary/cpp/c_funct.cxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cpp/c_funct.hxx> + + + +// NOT FULLY DECLARED SERVICES +#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 +{ +namespace cpp +{ + +Function::Function( const String & i_sLocalName, + Ce_id i_nOwner, + E_Protection i_eProtection, + Lid i_nFile, + 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<Type_id> & + i_rExceptions ) + : aEssentials( i_sLocalName, + i_nOwner, + i_nFile ), + aTemplateParameterTypes(), + aSignature( Create_ParameterTypeList(i_parameters), + i_conVol ), + nReturnType(i_nReturnType), + eProtection(i_eProtection), + eVirtuality(i_eVirtuality), + aFlags(i_aFlags), + aParameterInfos( Create_NonTypeParameterInfos(i_parameters) ), + pExceptions( i_bThrowExists ? new ExceptionTypeList(i_rExceptions) : 0 ) +{ +} + +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 String & i_sLocalName, + Type_id i_nIdAsType ) +{ + aTemplateParameterTypes.push_back( + List_TplParam::value_type(i_sLocalName, i_nIdAsType) ); +} + + +const String & +Function::inq_LocalName() const +{ + return aEssentials.LocalName(); +} + +Cid +Function::inq_Owner() const +{ + return aEssentials.Owner(); +} + +Lid +Function::inq_Location() const +{ + return aEssentials.Location(); +} + +void +Function::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor,*this); +} + +ClassId +Function::get_AryClass() const +{ + return class_id; +} + + + +} // namespace cpp +} // namespace ary + + + +namespace +{ + +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(); +} + + +StringVector +Create_NonTypeParameterInfos( const std::vector<S_Parameter> & i_rParameters ) +{ + 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 anonymous diff --git a/autodoc/source/ary/cpp/c_macro.cxx b/autodoc/source/ary/cpp/c_macro.cxx new file mode 100644 index 000000000000..6d0e546d4da7 --- /dev/null +++ b/autodoc/source/ary/cpp/c_macro.cxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cpp/c_macro.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <prprpr.hxx> + + + +namespace ary +{ +namespace cpp +{ + + +Macro::Macro( const String & i_name, + const StringVector & i_params, + const StringVector & i_definition, + loc::Le_id i_declaringFile ) + : DefineEntity(i_name, i_declaringFile), + aParams(i_params), + aDefinition(i_definition) +{ +} + +Macro::~Macro() +{ +} + +void +Macro::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor,*this); +} + +ClassId +Macro::get_AryClass() const +{ + return class_id; + + // return RCID_MACRO; +} + +const StringVector & +Macro::inq_DefinitionText() const +{ + return aDefinition; +} + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/c_namesp.cxx b/autodoc/source/ary/cpp/c_namesp.cxx new file mode 100644 index 000000000000..bc49099a824a --- /dev/null +++ b/autodoc/source/ary/cpp/c_namesp.cxx @@ -0,0 +1,294 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cpp/c_namesp.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <algorithm> +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/getncast.hxx> +#include <slots.hxx> +#include "c_slots.hxx" + + +namespace ary +{ +namespace cpp +{ + +typedef std::multimap<String, Ce_id>::const_iterator operations_citer; + +Namespace::Namespace() + : aEssentials(), + aAssignedNode(), + // aLocalNamespaces, + // aLocalClasses, + // aLocalEnums, + // aLocalTypedefs, + // aLocalOperations, + // aLocalVariables, + // aLocalConstants, + pParent(0), + nDepth(0) +{ + aAssignedNode.Assign_Entity(*this); +} + +Namespace::Namespace( const String & i_sLocalName, + Namespace & i_rParent ) + : aEssentials( i_sLocalName, + i_rParent.CeId(), + Lid(0) ), + aAssignedNode(), + // aLocalNamespaces, + // aLocalClasses, + // aLocalEnums, + // aLocalTypedefs, + // aLocalOperations, + // aLocalVariables, + // aLocalConstants, + pParent(&i_rParent), + nDepth(i_rParent.Depth()+1) +{ + aAssignedNode.Assign_Entity(*this); +} + +Namespace::~Namespace() +{ +} + +void +Namespace::Add_LocalNamespace( DYN Namespace & io_rLocalNamespace ) +{ + aLocalNamespaces[io_rLocalNamespace.LocalName()] = &io_rLocalNamespace; +} + +void +Namespace::Add_LocalClass( const String & i_sLocalName, + Cid i_nId ) +{ + aLocalClasses[i_sLocalName] = i_nId; +} + +void +Namespace::Add_LocalEnum( const String & i_sLocalName, + Cid i_nId ) +{ + aLocalEnums[i_sLocalName] = i_nId; +} + +void +Namespace::Add_LocalTypedef( const String & i_sLocalName, + Cid i_nId ) +{ + aLocalTypedefs[i_sLocalName] = i_nId; +} + +void +Namespace::Add_LocalOperation( const String & i_sLocalName, + Cid i_nId ) +{ + aLocalOperations.insert( Map_Operations::value_type(i_sLocalName, i_nId) ); +} + + +void +Namespace::Add_LocalVariable( const String & i_sLocalName, + Cid i_nId ) +{ + aLocalVariables[i_sLocalName] = i_nId; +} + +void +Namespace::Add_LocalConstant( const String & i_sLocalName, + Cid i_nId ) +{ + aLocalConstants[i_sLocalName] = i_nId; +} + +uintt +Namespace::Depth() const +{ + return nDepth; +} + +Namespace * +Namespace::Parent() const +{ + return pParent; +} + +Ce_id +Namespace::Search_Child(const String & i_key) const +{ + Namespace * + ret_nsp = Search_LocalNamespace(i_key); + if (ret_nsp != 0) + return ret_nsp->CeId(); + + Ce_id + ret = Search_LocalClass(i_key); + if (ret.IsValid()) + return ret; + + ret = csv::value_from_map(aLocalEnums, i_key, Ce_id(0)); + if (ret.IsValid()) + return ret; + ret = csv::value_from_map(aLocalTypedefs, i_key, Ce_id(0)); + if (ret.IsValid()) + return ret; + ret = csv::value_from_map(aLocalVariables, i_key, Ce_id(0)); + if (ret.IsValid()) + return ret; + return csv::value_from_map(aLocalConstants, i_key, Ce_id(0)); +} + +Namespace * +Namespace::Search_LocalNamespace( const String & i_sLocalName ) const +{ + return csv::value_from_map(aLocalNamespaces, i_sLocalName, (Namespace*)(0)); +} + +uintt +Namespace::Get_SubNamespaces( std::vector< const Namespace* > & o_rResultList ) const +{ + for ( Map_NamespacePtr::const_iterator it = aLocalNamespaces.begin(); + it != aLocalNamespaces.end(); + ++it ) + { + o_rResultList.push_back( (*it).second ); + } + return o_rResultList.size(); +} + +Ce_id +Namespace::Search_LocalClass( const String & i_sName ) const +{ + return csv::value_from_map(aLocalClasses, i_sName, Ce_id(0)); +} + +void +Namespace::Search_LocalOperations( std::vector<Ce_id> & o_result, + const String & i_sName ) const +{ + operations_citer + itLower = aLocalOperations.lower_bound(i_sName); + if (itLower == aLocalOperations.end()) + return; + if ( (*itLower).first != i_sName ) + return; + + operations_citer + itEnd = aLocalOperations.end(); + for ( operations_citer it = itLower; + it != aLocalOperations.end() ? (*itLower).first == i_sName : false; + ++it ) + { + o_result.push_back((*it).second); + } +} + + +const String & +Namespace::inq_LocalName() const +{ + return aEssentials.LocalName(); +} + +Cid +Namespace::inq_Owner() const +{ + return aEssentials.Owner(); +} + +Lid +Namespace::inq_Location() const +{ + return Lid(0); +} + +void +Namespace::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor,*this); +} + +ClassId +Namespace::get_AryClass() const +{ + return class_id; +} + +Gid +Namespace::inq_Id_Group() const +{ + return static_cast<Gid>(Id()); +} + +const ary::cpp::CppEntity & +Namespace::inq_RE_Group() const +{ + return *this; +} + +const ary::group::SlotList & +Namespace::inq_Slots() const +{ + static const SlotAccessId aProjectSlotData[] + = { SLOT_SubNamespaces, SLOT_Classes, SLOT_Enums, SLOT_Typedefs, SLOT_Operations, + SLOT_Variables, SLOT_Constants }; + static const std::vector< SlotAccessId > + aSlots( &aProjectSlotData[0], + &aProjectSlotData[0] + + sizeof aProjectSlotData / sizeof (SlotAccessId) ); + return aSlots; +} + +DYN Slot * +Namespace::inq_Create_Slot( SlotAccessId i_nSlot ) const +{ + switch ( i_nSlot ) + { + case SLOT_SubNamespaces: return new Slot_SubNamespaces(aLocalNamespaces); + case SLOT_Classes: return new Slot_MapLocalCe(aLocalClasses); + case SLOT_Enums: return new Slot_MapLocalCe(aLocalEnums); + case SLOT_Typedefs: return new Slot_MapLocalCe(aLocalTypedefs); + case SLOT_Operations: return new Slot_MapOperations(aLocalOperations); + case SLOT_Variables: return new Slot_MapLocalCe(aLocalVariables); + case SLOT_Constants: return new Slot_MapLocalCe(aLocalConstants); + default: + return new Slot_Null; + } // end switch +} + + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/c_osigna.cxx b/autodoc/source/ary/cpp/c_osigna.cxx new file mode 100644 index 000000000000..70aa1840ef81 --- /dev/null +++ b/autodoc/source/ary/cpp/c_osigna.cxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cpp/c_osigna.hxx> + + +// NOT FULLY DEFINED SERVICES + + +namespace ary +{ +namespace cpp +{ + + +OperationSignature::OperationSignature( std::vector<Type_id> i_parameterTypes, + E_ConVol i_conVol ) + : aParameterTypes(i_parameterTypes), + eConVol(i_conVol) +{ +} + +int +OperationSignature::Compare( const OperationSignature & i_rSig ) const +{ + if ( aParameterTypes.size() < i_rSig.aParameterTypes.size() ) + return -1; + else if ( i_rSig.aParameterTypes.size() < aParameterTypes.size() ) + return 1; + + ParameterTypeList::const_iterator iMe = aParameterTypes.begin(); + ParameterTypeList::const_iterator iOther = i_rSig.aParameterTypes.begin(); + for ( ; iMe != aParameterTypes.end(); ++iMe, ++iOther ) + { + if ( *iMe < *iOther ) + return -1; + else if ( *iOther < *iMe ) + return 1; + } + + if ( eConVol < i_rSig.eConVol ) + return -1; + else if ( eConVol != i_rSig.eConVol ) + return 1; + + return 0; +} + + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/c_reposypart.cxx b/autodoc/source/ary/cpp/c_reposypart.cxx new file mode 100644 index 000000000000..e1e8085672be --- /dev/null +++ b/autodoc/source/ary/cpp/c_reposypart.cxx @@ -0,0 +1,523 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "c_reposypart.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <ary/getncast.hxx> +#include <ary/namesort.hxx> +#include <ary/cpp/c_builtintype.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_cppentity.hxx> +#include <ary/cpp/c_define.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_enuval.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_macro.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/c_type.hxx> +#include <ary/cpp/usedtype.hxx> +#include <ary/cpp/c_vari.hxx> +#include <ary/loc/locp_le.hxx> +#include <ary/getncast.hxx> +#include <loc_internalgate.hxx> +#include <reposy.hxx> +#include "ca_ce.hxx" +#include "ca_def.hxx" +#include "ca_type.hxx" +#include "cs_ce.hxx" +#include "cs_def.hxx" +#include "cs_type.hxx" + + + +namespace +{ + +using ::ary::GlobalId; +using ::ary::Rid; +using namespace ::ary::cpp; + + +inline bool +IsDefine( const GlobalId & i_id ) +{ + return i_id.Class() == Define::class_id + OR + i_id.Class() == Macro::class_id; +} + + +/// Find Ces +class TypeConnector +{ + public: + TypeConnector( + Gate & i_gate ) + : pGate(&i_gate) {} + ~TypeConnector() {} + + void operator()( + Type & io_rType ) const; + private: + // DATA + Gate * pGate; +}; + +/// Find Ces only known from base class name scope. +class TypeConnector2ndTry +{ + public: + TypeConnector2ndTry( + Gate & i_gate ) + : pGate(&i_gate) {} + ~TypeConnector2ndTry() {} + + void operator()( + Type & io_rType ) const; + private: + // DATA + Gate * pGate; +}; + +/// Reconnect (in both directions) base-derived relations of classes. +class HierarchyLinker +{ + public: + HierarchyLinker( + Gate & i_gate ) + : pGate(&i_gate) {} + + ~HierarchyLinker() {} + + void operator()( + Class & io_rCe ) const; + private: + // DATA + Gate * pGate; +}; + + + +/// Helper functor for ->RepositoryPartition::Get_AlphabeticalList(). +template <class TRAITS> +struct MakeGlobalId +{ + GlobalId operator()( + typename TRAITS::id_type + i_id ) const + { + return GlobalId( TRAITS::EntityOf_(i_id).AryClass(), + i_id.Value() ); + } +}; + + + + +/** Compare two {->GlobalId}s. + + + @todo Move this up to the definition of GlobalId<>. +*/ +struct LesserGlobal +{ + LesserGlobal( + const Ce_Storage & i_ces, + const Def_Storage & i_des ) + : rCes(i_ces), rDes(i_des) {} + + bool operator()( + GlobalId i_1, + GlobalId i_2 ) const; + + private: + const String & NameOf( + GlobalId i_id ) const; + // DATA + const Ce_Storage & rCes; + const Def_Storage & rDes; + ::ary::LesserName aLess; +}; + + +bool +LesserGlobal::operator()( GlobalId i_1, + GlobalId i_2 ) const + { + String s1 = NameOf(i_1); + String s2 = NameOf(i_2); + + if (s1 != s2) + return aLess(s1, s2); + + if ( IsDefine(i_1) != IsDefine(i_2) ) + { + return NOT IsDefine(i_2); + } + else if (IsDefine(i_1)) + { + return i_1.Class() < i_2.Class(); + } + + return Ce_GlobalCompare::Lesser_( + rCes[i_1.Id()], + rCes[i_2.Id()] ); + } + + +} // namespace anonymous + + + + + + +namespace ary +{ +namespace cpp +{ + +DYN InternalGate & +InternalGate::Create_Partition_(RepositoryCenter & i_center) +{ + return *new RepositoryPartition(i_center); +} + + +RepositoryPartition::RepositoryPartition(RepositoryCenter & i_center) + : pRepositoryCenter(&i_center), + pCes(0), + pTypes(0), + pDefs(0), + pLocations(& loc::InternalGate::Create_Locations_()) +{ + pCes = new CeAdmin(*this); + pTypes = new TypeAdmin(*this); + pDefs = new DefAdmin(*this); + pCes->Set_Related(*pTypes); +} + +RepositoryPartition::~RepositoryPartition() +{ +} + +void +RepositoryPartition::Calculate_AllSecondaryInformation() +// const ::autodoc::Options & ) +{ + // KORR_FUTURE + // Forward the options from here. + + Connect_AllTypes_2_TheirRelated_CodeEntites(); +} + +const String & +RepositoryPartition::RepositoryTitle() const +{ + return static_cast< ary::Repository* >(pRepositoryCenter)->Title(); +} + +const CodeEntity * +RepositoryPartition::Search_RelatedCe(Type_id i_type) const +{ + if (NOT i_type.IsValid()) + return 0; + + Ce_id + ce_id = pTypes->Find_Type(i_type).RelatedCe(); + return ce_id.IsValid() + ? & pCes->Find_Ce(ce_id) + : (CodeEntity*)(0); +} + +const ::ary::cpp::CppEntity * +RepositoryPartition::Search_Entity(GlobalId i_id) const +{ + if (i_id.Id() == 0) + return 0; + + if ( NOT IsDefine(i_id) ) + { + // Shall make sure this is a C++ CodeEntity: + csv_assert( i_id.Class() >= Namespace::class_id + AND + i_id.Class() < BuiltInType::class_id + && "Unexpected entity type in cpp::RepositoryPartition" + "::Search_Entity()." ); + return & Ces().Find_Ce( Ce_id(i_id.Id()) ); + } + else + { + return & Defs().Find_Def( De_id(i_id.Id()) ); + } +} + + +const CePilot & +RepositoryPartition::Ces() const +{ + csv_assert(pCes != 0); + return *pCes; +} + +const DefPilot & +RepositoryPartition::Defs() const +{ + csv_assert(pDefs != 0); + return *pDefs; +} + +const TypePilot & +RepositoryPartition::Types() const +{ + csv_assert(pTypes != 0); + return *pTypes; +} + +const loc::LocationPilot & +RepositoryPartition::Locations() const +{ + csv_assert(pLocations != 0); + return *pLocations; +} + +CePilot & +RepositoryPartition::Ces() +{ + csv_assert(pCes != 0); + return *pCes; +} + +DefPilot & +RepositoryPartition::Defs() +{ + csv_assert(pDefs != 0); + return *pDefs; +} + +TypePilot & +RepositoryPartition::Types() +{ + csv_assert(pTypes != 0); + return *pTypes; +} + +loc::LocationPilot & +RepositoryPartition::Locations() +{ + csv_assert(pLocations != 0); + return *pLocations; +} + + +void +RepositoryPartition::Connect_AllTypes_2_TheirRelated_CodeEntites() +{ + TypeConnector + aConnector(*this); + std::for_each( pTypes->Storage().BeginUnreserved(), + pTypes->Storage().End(), + aConnector ); + + typedef ::ary::stg::filter_iterator<CodeEntity,Class> + filter_class_iter; + + HierarchyLinker + aHierarchyLinker(*this); + filter_class_iter itEnd( pCes->Storage().End() ); + for ( filter_class_iter it( pCes->Storage().BeginUnreserved() ); + it != itEnd; + ++it ) + { + if (NOT it.IsValid()) + continue; + + if (is_type<Class>(*it)) + aHierarchyLinker(ary_cast<Class>(*it)); + } + + TypeConnector2ndTry + aConnector2ndTry(*this); + std::for_each( pTypes->Storage().BeginUnreserved(), + pTypes->Storage().End(), + aConnector2ndTry ); +} + +template <class COMPARE> +void Add2Result( + List_GlobalIds & o_result, + const SortedIds<COMPARE> & + i_data, + const char * i_begin, + const char * i_end ); +template <class COMPARE> +void +Add2Result( List_GlobalIds & o_result, + const SortedIds<COMPARE> & i_data, + const char * i_begin, + const char * i_end ) +{ + const size_t + previous_size = o_result.size(); + typename std::vector<typename COMPARE::id_type>::const_iterator + it_beg = i_data.LowerBound(i_begin); + typename std::vector<typename COMPARE::id_type>::const_iterator + it_end = i_data.LowerBound(i_end); + size_t + count_added = static_cast<size_t>( std::distance(it_beg,it_end) ); + o_result.insert( o_result.end(), + count_added, + GlobalId() ); + List_GlobalIds::iterator + it_out = o_result.begin() + previous_size; + std::transform( it_beg, it_end, + it_out, + MakeGlobalId<COMPARE>() ); +} + + +uintt +RepositoryPartition::Get_AlphabeticalList( List_GlobalIds & o_result, + const char * i_begin, + const char * i_end ) const +{ + size_t + ret = o_result.size(); + + const Ce_Storage & + ce_storage = pCes->Storage(); + const Def_Storage & + def_storage = pDefs->Storage(); + + Add2Result( o_result, + ce_storage.TypeIndex(), + i_begin, i_end ); + Add2Result( o_result, + ce_storage.OperationIndex(), + i_begin, i_end ); + Add2Result( o_result, + ce_storage.DataIndex(), + i_begin, i_end ); + Add2Result( o_result, + def_storage.DefineIndex(), + i_begin, i_end ); + Add2Result( o_result, + def_storage.MacroIndex(), + i_begin, i_end ); + + LesserGlobal + aLess(ce_storage, def_storage); + + std::sort(o_result.begin(), o_result.end(), aLess); + + return o_result.size() - ret; +} + + + + +} // namespace cpp +} // namespace ary + + + + + +namespace +{ + + +void +TypeConnector::operator()( Type & io_rType ) const +{ + csv_assert(pGate != 0); + UsedType * + pt = ::ary::ary_cast<UsedType>(&io_rType); + if (pt != 0) + pt->Connect2Ce(pGate->Ces()); +} + +void +TypeConnector2ndTry::operator()( Type & io_rType ) const +{ + csv_assert(pGate != 0); + UsedType * + pt = ::ary::ary_cast<UsedType>(&io_rType); + if (pt != 0) + pt->Connect2CeOnlyKnownViaBaseClass(*pGate); +} + +void +HierarchyLinker::operator()( Class & io_rCe ) const +{ + csv_assert( ::ary::is_type<Class>(io_rCe) ); + Class & + rClass = io_rCe; + + for ( List_Bases::const_iterator it = rClass.BaseClasses().begin(); + it != rClass.BaseClasses().end(); + ++it ) + { + const CodeEntity * + pCe = 0; + Type_id + nTid = (*it).nId; + for ( pCe = pGate->Search_RelatedCe(nTid); + ary::ary_cast<Typedef>(pCe) != 0; + pCe = pGate->Search_RelatedCe(nTid) ) + { + nTid = static_cast< const Typedef* >(pCe)->DescribingType(); + } + const Class * + pClass = ary::ary_cast<Class>(pCe); + if (pClass == 0) + return; + // KORR_FUTURE: we need a non const Find_Class() + const_cast< Class* >(pClass)->Add_KnownDerivative( io_rCe.CeId() ); + } +} + +const String & +LesserGlobal::NameOf(GlobalId i_id) const +{ + if ( NOT IsDefine(i_id) ) + { + return rCes[i_id.Id()].LocalName(); + } + else + { + return rDes[i_id.Id()].LocalName(); + } +} + + + +} // namespace anonymous diff --git a/autodoc/source/ary/cpp/c_reposypart.hxx b/autodoc/source/ary/cpp/c_reposypart.hxx new file mode 100644 index 000000000000..355af34eb7c6 --- /dev/null +++ b/autodoc/source/ary/cpp/c_reposypart.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_CPP_C_REPOSYPART_HXX +#define ARY_CPP_C_REPOSYPART_HXX + + + +// BASE CLASSES +#include <cpp_internalgate.hxx> + +namespace ary +{ +namespace cpp +{ + class CeAdmin; + class DefAdmin; + class TypeAdmin; +} +} + + + + +namespace ary +{ +namespace cpp +{ + + + +/** The C++ partition of the repository. +*/ +class RepositoryPartition : public InternalGate +{ + public: + RepositoryPartition( + RepositoryCenter & i_reposyImpl ); + virtual ~RepositoryPartition(); + + // INHERITED + // Interface Gate: + virtual void Calculate_AllSecondaryInformation(); +// const ::autodoc::Options & +// i_options ); + virtual const String & + RepositoryTitle() const; + virtual const CodeEntity * + Search_RelatedCe( + Type_id i_type ) const; + virtual const ::ary::cpp::CppEntity * + Search_Entity( + GlobalId i_id ) const; + virtual uintt Get_AlphabeticalList( + List_GlobalIds & o_result, + const char * i_begin, + const char * i_end ) const; + virtual const CePilot & + Ces() const; + virtual const DefPilot & + Defs() const; + virtual const TypePilot & + Types() const; + virtual const loc::LocationPilot & + Locations() const; + virtual CePilot & Ces(); + virtual DefPilot & Defs(); + virtual TypePilot & Types(); + virtual loc::LocationPilot & + Locations(); + private: + // Locals + void Connect_AllTypes_2_TheirRelated_CodeEntites(); + + // DATA + RepositoryCenter * pRepositoryCenter; + + Dyn<CeAdmin> pCes; + Dyn<TypeAdmin> pTypes; + Dyn<DefAdmin> pDefs; + Dyn<loc::LocationPilot> + pLocations; +}; + + + + +} // namespace cpp +} // namespace ary +#endif diff --git a/autodoc/source/ary/cpp/c_slots.cxx b/autodoc/source/ary/cpp/c_slots.cxx new file mode 100644 index 000000000000..bdb2351f1aad --- /dev/null +++ b/autodoc/source/ary/cpp/c_slots.cxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <c_slots.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/ary_disp.hxx> +#include <ary/cpp/c_namesp.hxx> + + + +namespace ary +{ +namespace cpp +{ + + + +//*********************** Slot_SubNamespaces ********************// + + +Slot_SubNamespaces::Slot_SubNamespaces( const Map_NamespacePtr & i_rData ) + : pData( &i_rData ) +{ +} + +Slot_SubNamespaces::~Slot_SubNamespaces() +{ +} + +uintt +Slot_SubNamespaces::Size() const +{ + return pData->size(); +} + +void +Slot_SubNamespaces::StoreEntries( ary::Display & o_rDestination ) const +{ + for ( Map_NamespacePtr::const_iterator it = pData->begin(); + it != pData->end(); + ++it ) + { + (*(*it).second).Accept(o_rDestination); + } +} + + +//*********************** Slot_BaseClass ********************// + +Slot_BaseClass::Slot_BaseClass( const List_Bases & i_rData ) + : pData( &i_rData ) +{ +} + +Slot_BaseClass::~Slot_BaseClass() +{ +} + +uintt +Slot_BaseClass::Size() const +{ + return pData->size(); +} + +void +Slot_BaseClass::StoreEntries( ary::Display & o_rDestination ) const +{ + for ( List_Bases::const_iterator it = pData->begin(); + it != pData->end(); + ++it ) + { + csv::CheckedCall(o_rDestination, *it); + } +} + + + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/c_slots.hxx b/autodoc/source/ary/cpp/c_slots.hxx new file mode 100644 index 000000000000..b2b662dbed39 --- /dev/null +++ b/autodoc/source/ary/cpp/c_slots.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_CPP_C_SLOTS_HXX +#define ARY_CPP_C_SLOTS_HXX + +// BASE CLASSES +#include <ary/ceslot.hxx> +// USED SERVICES +#include <ary/cpp/c_slntry.hxx> + + + + +namespace ary +{ +namespace cpp +{ + + +class Slot_SubNamespaces : public ary::Slot +{ + public: + Slot_SubNamespaces( + const Map_NamespacePtr & + i_rData ); + virtual ~Slot_SubNamespaces(); + + virtual uintt Size() const; + + private: + virtual void StoreEntries( + ary::Display & o_rDestination ) const; + // DATA + const Map_NamespacePtr * + pData; +}; + +class Slot_BaseClass : public ary::Slot +{ + public: + Slot_BaseClass( + const List_Bases & i_rData ); + virtual ~Slot_BaseClass(); + + virtual uintt Size() const; + + private: + virtual void StoreEntries( + ary::Display & o_rDestination ) const; + // DATA + const List_Bases * pData; +}; + + + + +} // namespace cpp +} // namespace ary +#endif diff --git a/autodoc/source/ary/cpp/c_traits.cxx b/autodoc/source/ary/cpp/c_traits.cxx new file mode 100644 index 000000000000..f269adaf9b65 --- /dev/null +++ b/autodoc/source/ary/cpp/c_traits.cxx @@ -0,0 +1,223 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cpp/c_traits.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/namesort.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_enuval.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/usedtype.hxx> +#include <ary/getncast.hxx> +#include "cs_ce.hxx" +#include "cs_def.hxx" +#include "cs_type.hxx" + + + + +namespace ary +{ +namespace cpp +{ + + + +//******************** Ce_Traits ********************// +Ce_Traits::entity_base_type & +Ce_Traits::EntityOf_(id_type i_id) +{ + csv_assert(i_id.IsValid()); + return Ce_Storage::Instance_()[i_id]; +} + +//******************** CeNode_Traits ********************// +const symtree::Node<CeNode_Traits> * +CeNode_Traits::NodeOf_(const entity_base_type & i_entity) +{ + if (is_type<Namespace>(i_entity)) + return & ary_cast<Namespace>(i_entity).AsNode(); + else if (is_type<Class>(i_entity)) + return & ary_cast<Class>(i_entity).AsNode(); + return 0; +} + +symtree::Node<CeNode_Traits> * +CeNode_Traits::NodeOf_(entity_base_type & io_entity) +{ + if (is_type<Namespace>(io_entity)) + return & ary_cast<Namespace>(io_entity).AsNode(); + else if (is_type<Class>(io_entity)) + return & ary_cast<Class>(io_entity).AsNode(); + return 0; +} + +Ce_Traits::entity_base_type * +CeNode_Traits::ParentOf_(const entity_base_type & i_entity) +{ + Ce_Traits::id_type + ret = i_entity.Owner(); + if (ret.IsValid()) + { + if (is_type<EnumValue>(i_entity)) + { // Return not the Enum, but the owner of the Enum: + ret = EntityOf_(ret).Owner(); + csv_assert(ret.IsValid()); + } + return &EntityOf_(ret); + } + return 0; +} + +Ce_id +CeNode_Search( const CodeEntity & i_entity, + const String & i_localKey ) +{ + if (is_type<Namespace>(i_entity)) + return ary_cast<Namespace>(i_entity).Search_Child(i_localKey); + else if (is_type<Class>(i_entity)) + return ary_cast<Class>(i_entity).Search_Child(i_localKey); + return Ce_id(0); +} + + + + +//******************** Ce_Compare ********************// +const Ce_Compare::key_type & +Ce_Compare::KeyOf_(const entity_base_type & i_entity) +{ + return i_entity.LocalName(); +} + +bool +Ce_Compare::Lesser_( const key_type & i_1, + const key_type & i_2 ) +{ + static ::ary::LesserName less_; + return less_(i_1,i_2); +} + + +//******************** Ce_GlobalCompare ********************// +void +Get_Qualified( StreamStr & o_out, + const CodeEntity & i_ce ) +{ + if (i_ce.LocalName().empty()) + return; + if (i_ce.Owner().IsValid()) + Get_Qualified(o_out, Ce_Traits::EntityOf_(i_ce.Owner())); + + o_out << i_ce.LocalName() << "::"; +} + + +bool +Ce_GlobalCompare::Lesser_( const key_type & i_1, + const key_type & i_2 ) +{ + static ::ary::LesserName less_; + + if (i_1.LocalName() != i_2.LocalName()) + return less_(i_1.LocalName(), i_2.LocalName()); + + csv_assert(i_1.Owner().IsValid() AND i_2.Owner().IsValid()); + + static StreamStr + aBuffer1_(300); + static StreamStr + aBuffer2_(300); + aBuffer1_.reset(); + aBuffer2_.reset(); + + Get_Qualified(aBuffer1_, Ce_Traits::EntityOf_(i_1.Owner())); + Get_Qualified(aBuffer2_, Ce_Traits::EntityOf_(i_2.Owner())); + if (aBuffer1_.size() >= 2) + aBuffer1_.pop_back(2); + if (aBuffer2_.size() >= 2) + aBuffer2_.pop_back(2); + return less_(aBuffer1_.c_str(), aBuffer2_.c_str()); +} + + + +//******************** Def_Traits ********************// +Def_Traits::entity_base_type & +Def_Traits::EntityOf_(id_type i_id) +{ + csv_assert(i_id.IsValid()); + return Def_Storage::Instance_()[i_id]; +} + +//******************** Def_Compare ********************// +const Def_Compare::key_type & +Def_Compare::KeyOf_(const entity_base_type & i_entity) +{ + return i_entity.LocalName(); +} + +bool +Def_Compare::Lesser_( const key_type & i_1, + const key_type & i_2 ) +{ + static ::ary::LesserName less_; + return less_(i_1,i_2); +} + + + +//******************** Type_Traits ********************// +Type_Traits::entity_base_type & +Type_Traits::EntityOf_(id_type i_id) +{ + csv_assert(i_id.IsValid()); + return Type_Storage::Instance_()[i_id]; +} + +//******************** Type_Compare ********************// +const UsedType_Compare::key_type & +UsedType_Compare::KeyOf_(const entity_base_type & i_entity) +{ + csv_assert( is_type<UsedType>(i_entity) ); + return ary_cast<UsedType>(i_entity); +} + +bool +UsedType_Compare::Lesser_( const key_type & i_1, + const key_type & i_2 ) +{ + return i_1 < i_2; +} + + + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/c_tydef.cxx b/autodoc/source/ary/cpp/c_tydef.cxx new file mode 100644 index 000000000000..284e30810e18 --- /dev/null +++ b/autodoc/source/ary/cpp/c_tydef.cxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cpp/c_tydef.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <slots.hxx> +#include "c_slots.hxx" + + + + +namespace ary +{ +namespace cpp +{ + +Typedef::Typedef( const String & i_sLocalName, + Cid i_nOwner, + E_Protection i_eProtection, + Lid i_nFile, + Tid i_nDescribingType ) + : aEssentials( i_sLocalName, + i_nOwner, + i_nFile ), + nDescribingType(i_nDescribingType), + eProtection(i_eProtection) +{ +} + +Typedef::~Typedef() +{ + +} + +const String & +Typedef::inq_LocalName() const +{ + return aEssentials.LocalName(); +} + +Cid +Typedef::inq_Owner() const +{ + return aEssentials.Owner(); +} + +Lid +Typedef::inq_Location() const +{ + return aEssentials.Location(); +} + +void +Typedef::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor,*this); +} + +ClassId +Typedef::get_AryClass() const +{ + return class_id; +} + + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/c_vari.cxx b/autodoc/source/ary/cpp/c_vari.cxx new file mode 100644 index 000000000000..111eddee277b --- /dev/null +++ b/autodoc/source/ary/cpp/c_vari.cxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cpp/c_vari.hxx> + + +// NOT FULLY DECLARED SERVICES + + + +namespace ary +{ +namespace cpp +{ + +Variable::Variable( const String & i_sLocalName, + Cid i_nOwner, + E_Protection i_eProtection, + Lid i_nFile, + Tid i_nType, + VariableFlags i_aFlags, + const String & i_sArraySize, + const String & i_sInitValue ) + : aEssentials( i_sLocalName, + i_nOwner, + i_nFile ), + nType(i_nType), + eProtection(i_eProtection), + aFlags(i_aFlags), + sArraySize(i_sArraySize), + sInitialisation(i_sInitValue) +{ +} + +Variable::~Variable() +{ +} + +const String & +Variable::inq_LocalName() const +{ + return aEssentials.LocalName(); +} + +Cid +Variable::inq_Owner() const +{ + return aEssentials.Owner(); +} + +Lid +Variable::inq_Location() const +{ + return aEssentials.Location(); +} + +void +Variable::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor,*this); +} + +ClassId +Variable::get_AryClass() const +{ + return class_id; +} + + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/ca_ce.cxx b/autodoc/source/ary/cpp/ca_ce.cxx new file mode 100644 index 000000000000..0bdbc41861a8 --- /dev/null +++ b/autodoc/source/ary/cpp/ca_ce.cxx @@ -0,0 +1,622 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include <precomp.h> +#include "ca_ce.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/qualiname.hxx> +#include <ary/cpp/inpcontx.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_enuval.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/c_type.hxx> +#include <ary/cpp/c_vari.hxx> +#include <ary/cpp/cp_type.hxx> +#include <ary/loc/loc_file.hxx> +#include <ary/getncast.hxx> + + + + + + +namespace +{ + +String Get_NewAnonymousNamespaceName(); +String Get_NewAnonymousName( + char i_start ); + + +} // anonymous namespace + + + + +namespace ary +{ +namespace cpp +{ + + +// KORR_FUTURE +// What about namespace visibility ? +// Perhaps handle all/some visibility transfer only after parse is complete. +void +transfer_visibility( const Class * i_owner, + CodeEntity & o_child ) +{ + if ( i_owner != 0 ? NOT i_owner->IsVisible() : false ) + o_child.Set_InVisible(); +} + +inline const TypePilot & +CeAdmin::Types() const +{ + csv_assert(pTypes != 0); + return *pTypes; +} + + + + + + +CeAdmin::CeAdmin(RepositoryPartition & io_myReposyPartition) + : aStorage(), + pTypes(0), + pCppRepositoryPartition(&io_myReposyPartition) +{ +} + +void +CeAdmin::Set_Related(const TypePilot & i_types) +{ + pTypes = &i_types; +} + +CeAdmin::~CeAdmin() +{ +} + +Namespace & +CeAdmin::CheckIn_Namespace( const InputContext & i_context, + const String & i_localName ) +{ + const String + local_name = NOT i_localName.empty() + ? i_localName + : Get_NewAnonymousNamespaceName(); + Namespace & + rParent = i_context.CurNamespace(); + Namespace * + ret = rParent.Search_LocalNamespace(local_name); + if ( ret == 0 ) + { + ret = &Create_Namespace(rParent, local_name); + } + return *ret; +} + +Class & +CeAdmin::Store_Class( const InputContext & i_context, + const String & i_localName, + E_ClassKey i_eClassKey ) +{ + const String + local_name = i_localName.empty() + ? Get_NewAnonymousName( i_eClassKey == CK_class + ? 'c' + : i_eClassKey == CK_struct + ? 's' + : 'u' ) + : i_localName; + + Class & + ret = * new Class( local_name, + i_context.CurOwner().CeId(), + i_context.CurProtection(), + i_context.CurFile().LeId(), + i_eClassKey ); + aStorage.Store_Type(ret); + i_context.CurOwner().Add_Class(local_name, ret.CeId()); + transfer_visibility(i_context.CurClass(), ret); + + return ret; +} + +Enum & +CeAdmin::Store_Enum( const InputContext & i_context, + const String & i_localName ) +{ + const String + local_name = i_localName.empty() + ? Get_NewAnonymousName('e') + : i_localName; + Enum & + ret = * new Enum( local_name, + i_context.CurOwner().CeId(), + i_context.CurProtection(), + i_context.CurFile().LeId() ); + aStorage.Store_Type(ret); + i_context.CurOwner().Add_Enum(local_name, ret.CeId()); + transfer_visibility(i_context.CurClass(), ret); + + return ret; +} + +Typedef & +CeAdmin::Store_Typedef( const InputContext& i_context, + const String & i_localName, + Type_id i_referredType ) +{ + Typedef & + ret = * new Typedef( i_localName, + i_context.CurOwner().CeId(), + i_context.CurProtection(), + i_context.CurFile().LeId(), + i_referredType ); + aStorage.Store_Type(ret); + i_context.CurOwner().Add_Typedef(i_localName, ret.CeId()); + transfer_visibility(i_context.CurClass(), ret); + + return ret; +} + +Function * +CeAdmin::Store_Operation( const InputContext & i_context, + const String & i_localName, + Type_id i_returnType, + const std::vector<S_Parameter> & i_parameters, + E_Virtuality i_virtuality, + E_ConVol i_conVol, + FunctionFlags i_flags, + bool i_throwExists, + const std::vector<Type_id> & i_exceptions ) +{ + Function & + ret = * new Function( i_localName, + i_context.CurOwner().CeId(), + i_context.CurProtection(), + i_context.CurFile().LeId(), + i_returnType, + i_parameters, + i_conVol, + i_virtuality, + i_flags, + i_throwExists, + i_exceptions ); + + // Check for double declaration: + Ce_id + nAlreadyExistingFunction(0); + switch ( lhf_CheckAndHandle_DuplicateOperation( + nAlreadyExistingFunction, + i_context, + ret) ) + { + case df_discard_new: + delete &ret; + return 0; + case df_replace: + csv_assert(nAlreadyExistingFunction.IsValid()); + aStorage.Replace_Entity( + nAlreadyExistingFunction, + ret ); + break; + case df_no: + aStorage.Store_Operation(ret); // Now it has a valid id. + i_context.CurOwner().Add_Operation( i_localName, ret.CeId(), i_flags.IsStaticMember() ); + break; + default: + csv_assert(false); + } + + transfer_visibility(i_context.CurClass(), ret); + if ( i_context.CurProtection() != PROTECT_global ) + { + Class * + pClass = i_context.CurClass(); + if ( pClass != 0 AND i_virtuality != VIRTUAL_none) + { + pClass->UpdateVirtuality(i_virtuality); + } + } + + return &ret; +} + +Variable & +CeAdmin::Store_Variable( const InputContext& i_context, + const String & i_localName, + Type_id i_type, + VariableFlags i_flags, + const String & i_arraySize, + const String & i_initValue ) +{ + Variable & + ret = * new Variable( i_localName, + i_context.CurOwner().CeId(), + i_context.CurProtection(), + i_context.CurFile().LeId(), + i_type, + i_flags, + i_arraySize, + i_initValue ); + + bool + is_const = Types().Find_Type(i_type).IsConst(); + aStorage.Store_Datum(ret); + i_context.CurOwner().Add_Variable( + i_localName, + ret.CeId(), + is_const, + i_flags.IsStaticMember() ); + transfer_visibility(i_context.CurClass(), ret); + + return ret; +} + +EnumValue & +CeAdmin::Store_EnumValue( const InputContext & i_context, + const String & i_localName, + const String & i_initValue ) +{ + Enum * + parent = i_context.CurEnum(); + csv_assert( parent != 0 ); + + EnumValue & + ret = * new EnumValue( i_localName, + parent->CeId(), + i_initValue ); + aStorage.Store_Datum(ret); + parent->Add_Value(ret.CeId()); + + // KORR also for current enum: + transfer_visibility(i_context.CurClass(), ret); + + return ret; +} + +const Namespace & +CeAdmin::GlobalNamespace() const +{ + return ary_cast<Namespace>( aStorage[predefined::ce_GlobalNamespace] ); +} + +const CodeEntity & +CeAdmin::Find_Ce(Ce_id i_id) const +{ + return aStorage[i_id]; +} + +const CodeEntity * +CeAdmin::Search_Ce(Ce_id i_id) const +{ + return aStorage.Exists(i_id) + ? & aStorage[i_id] + : (const CodeEntity*)(0); +} + +const CodeEntity * +CeAdmin::Search_CeAbsolute( const CodeEntity & i_curScope, + const QualifiedName & i_rSearchedName ) const +{ + const symtree::Node<CeNode_Traits> * + cur_node = CeNode_Traits::NodeOf_(i_curScope); + csv_assert(cur_node != 0); + + Ce_id + ret(0); + cur_node->SearchUp( ret, + i_rSearchedName.first_namespace(), + i_rSearchedName.end_namespace(), + i_rSearchedName.LocalName() ); + return Search_Ce(ret); +} + +const CodeEntity * +CeAdmin::Search_CeLocal( const String & i_localName, + bool i_bIsFunction, + const Namespace & i_rCurNamespace, + const Class * i_pCurClass ) const +{ + // KORR_FUTURE + // See if this is correct. + + Ce_id + ret(0); + + if ( NOT i_bIsFunction ) + { + CesResultList + type_instances = aStorage.TypeIndex().SearchAll(i_localName); + CesResultList + data_instances = aStorage.DataIndex().SearchAll(i_localName); + Ce_id + ret1 = Search_MatchingInstance( + type_instances, + (i_pCurClass + ? i_pCurClass->CeId() + : i_rCurNamespace.CeId()) + ); + Ce_id + ret2 = Search_MatchingInstance( + data_instances, + (i_pCurClass + ? i_pCurClass->CeId() + : i_rCurNamespace.CeId()) + ); + if (NOT ret2.IsValid()) + ret = ret1; + else if (NOT ret1.IsValid()) + ret = ret2; + } + else + { + CesResultList + function_instances = aStorage.OperationIndex().SearchAll(i_localName); + if ( function_instances.size() == 1 ) + ret = *function_instances.begin(); + else + { + ret = Search_MatchingInstance( + function_instances, + (i_pCurClass + ? i_pCurClass->CeId() + : i_rCurNamespace.CeId()) + ); + } + } + + if ( ret.IsValid() ) + return & Find_Ce(ret); + + return 0; +} + +void +CeAdmin::Get_QualifiedName( StreamStr & o_rOut, + const String & i_localName, + Ce_id i_nOwner, + const char * i_sDelimiter ) const +{ + if ( i_localName.empty() OR NOT i_nOwner.IsValid() ) + return; + + const CodeEntity * + pOwner = & Find_Ce( i_nOwner ); + if ( is_type<Enum>(*pOwner) ) + pOwner = &Find_Ce( Ce_id(pOwner->Owner()) ); + + Get_QualifiedName( o_rOut, + pOwner->LocalName(), + Ce_id(pOwner->Owner()), + i_sDelimiter ); + o_rOut + << i_sDelimiter + << i_localName; +} + +void +CeAdmin::Get_SignatureText( StreamStr & o_rOut, + const OperationSignature & i_signature, + const StringVector * i_sParameterNames ) const +{ + OperationSignature::ParameterTypeList::const_iterator + it = i_signature.Parameters().begin(); + OperationSignature::ParameterTypeList::const_iterator + it_end = i_signature.Parameters().end(); + + const StringVector aDummy; + StringVector::const_iterator + itName = i_sParameterNames != 0 + ? i_sParameterNames->begin() + : aDummy.begin(); + StringVector::const_iterator + itName_end = i_sParameterNames != 0 + ? i_sParameterNames->end() + : aDummy.end(); + + bool + bEmpty = (it == it_end); + if (NOT bEmpty) + { + o_rOut << "( "; + Types().Get_TypeText(o_rOut, *it); + if (itName != itName_end) + o_rOut << " " << (*itName); + + for ( ++it; it != it_end; ++it ) + { + o_rOut << ", "; + Types().Get_TypeText(o_rOut, *it); + if (itName != itName_end) + { + ++itName; + if (itName != itName_end) + o_rOut << " " << (*itName); + } + } + o_rOut << " )"; + } + else + { + o_rOut << "( )"; + } + + if ( intt(i_signature.ConVol()) & intt(ary::cpp::CONVOL_const) ) + o_rOut << " const"; + if ( intt(i_signature.ConVol()) & intt(ary::cpp::CONVOL_volatile) ) + o_rOut << " volatile"; +} + +CesResultList +CeAdmin::Search_TypeName(const String & i_sName) const +{ + return aStorage.TypeIndex().SearchAll(i_sName); +} + +Namespace & +CeAdmin::GlobalNamespace() +{ + return ary_cast<Namespace>( aStorage[predefined::ce_GlobalNamespace] ); +} + +CeAdmin::E_DuplicateFunction +CeAdmin::lhf_CheckAndHandle_DuplicateOperation( + Ce_id & o_existentFunction, + const InputContext & i_context, + const Function & i_newFunction ) +{ + if (i_context.CurProtection() != PROTECT_global) + { + // Assume, there will be no duplicates within the same class. + + // KORR_FUTURE + // Assumption may be wrong in case of #defines providing different + // versions for different compilers. + return df_no; + } + + std::vector<Ce_id> + aOperationsWithSameName; + i_context.CurNamespace().Search_LocalOperations( + aOperationsWithSameName, + i_newFunction.LocalName() ); + + for ( std::vector<Ce_id>::const_iterator + it = aOperationsWithSameName.begin(); + it != aOperationsWithSameName.end(); + ++it ) + { + const Function & + rFunction = ary_cast<Function>(aStorage[*it]); + if ( rFunction.LocalName() == i_newFunction.LocalName() + AND rFunction.Signature() == i_newFunction.Signature() ) + { + if (NOT rFunction.IsIdentical(i_newFunction)) + { + // KORR_FUTURE Make this more detailed. + Cerr() << "Non identical function with same signature " + << "found: " + << i_context.CurNamespace().LocalName() + << "::" + << i_newFunction.LocalName() + << "(..)" + << Endl(); + } + o_existentFunction = rFunction.CeId(); + if (rFunction.Docu().Data() == 0) + return df_replace; + else + return df_discard_new; + } + } // end for + + return df_no; +} + +Namespace & +CeAdmin::Create_Namespace( Namespace & o_parent, + const String & i_localName ) +{ + DYN Namespace & + ret = *new Namespace(i_localName, o_parent); + aStorage.Store_Entity(ret); + o_parent.Add_LocalNamespace(ret); + return ret; +} + +Ce_id +CeAdmin::Search_MatchingInstance( CesResultList i_list, + Ce_id i_owner ) const +{ + // KORR + // Multiple results? + + for ( CesList::const_iterator it = i_list.begin(); + it != i_list.end(); + ++it ) + { + const CodeEntity & + ce = aStorage[*it]; + if ( ce.Owner() == i_owner) + { + return *it; + } + } + return Ce_id(0); +} + + + +} // namespace cpp +} // namespace ary + + + +namespace +{ + +uintt G_nLastFreeAnonymousNamespaceNr = 0; +uintt G_nLastFreeAnonymousEntityNr = 0; + +String +Get_NewAnonymousNamespaceName() +{ + StreamLock + sl(100); + return String( sl() + << "namespace_anonymous_" + << ++G_nLastFreeAnonymousNamespaceNr + << csv::c_str ); + +} + +String +Get_NewAnonymousName(char i_cStart) +{ + StreamLock + sl(100); + return String( sl() + << i_cStart + << "_Anonymous__" + << ++G_nLastFreeAnonymousEntityNr + << c_str ); +} + + + +} // namespace anonymous diff --git a/autodoc/source/ary/cpp/ca_ce.hxx b/autodoc/source/ary/cpp/ca_ce.hxx new file mode 100644 index 000000000000..67f9c444e95b --- /dev/null +++ b/autodoc/source/ary/cpp/ca_ce.hxx @@ -0,0 +1,213 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_CPP_CA_CE_HXX +#define ARY_CPP_CA_CE_HXX + +// USED SERVICES + // BASE CLASSES +#include <ary/cpp/cp_ce.hxx> + // OTHER +#include "cs_ce.hxx" + + +namespace ary +{ +namespace cpp +{ + class Ce_Storage; + class RepositoryPartition; +} +} + + + + + +namespace ary +{ +namespace cpp +{ + + + +/** Administrates all C++ code entities (types, operations, variables). +*/ +class CeAdmin : public CePilot +{ + public: + // LIFECYCLE + CeAdmin( + RepositoryPartition & + io_myReposyPartition ); + void Set_Related( + const TypePilot & i_types ); + virtual ~CeAdmin(); + + // INQUIRY + const Ce_Storage & Storage() const; + + // ACCESS + Ce_Storage & Storage(); + + // INHERITED + // Interface CePilot: + virtual Namespace & CheckIn_Namespace( + const InputContext & + i_context, + const String & i_localName ); + virtual Class & Store_Class( + const InputContext & + i_context, + const String & i_localName, + E_ClassKey i_classKey ); + virtual Enum & Store_Enum( + const InputContext & + i_context, + const String & i_localName ); + virtual Typedef & Store_Typedef( + const InputContext & + i_context, + const String & i_localName, + Type_id i_referredType ); + virtual Function * Store_Operation( + const InputContext & + i_context, + const String & i_localName, + Type_id i_returnType, + const std::vector<S_Parameter> & + i_parameters, + E_Virtuality i_virtuality, + E_ConVol i_conVol, + FunctionFlags i_flags, + bool i_throwExists, + const std::vector<Type_id> & + i_exceptions ); + virtual Variable & Store_Variable( + const InputContext & + i_context, + const String & i_localName, + Type_id i_type, + VariableFlags i_flags, + const String & i_arraySize, + const String & i_initValue ); + virtual EnumValue & Store_EnumValue( + const InputContext & + i_context, + const String & i_localName, + const String & i_initValue ); + virtual const Namespace & + GlobalNamespace() const; + virtual const CodeEntity & + Find_Ce( + Ce_id i_id ) const; + virtual const CodeEntity * + Search_Ce( + Ce_id i_id ) const; + virtual const CodeEntity * + Search_CeAbsolute( + const CodeEntity & i_curScope, + const QualifiedName & + i_absoluteName ) const; + virtual const CodeEntity * + Search_CeLocal( + const String & i_relativeName, + bool i_isFunction, + const Namespace & i_curNamespace, + const Class * i_curClass ) const; + virtual void Get_QualifiedName( + StreamStr & o_result, + const String & i_localName, + Ce_id i_owner, + const char * i_delimiter = "::" ) const; + virtual void Get_SignatureText( + StreamStr & o_rOut, + const OperationSignature & + i_signature, + const StringVector * + i_sParameterNames = 0 ) const; + virtual CesResultList + Search_TypeName( + const String & i_sName ) const; + virtual Namespace & GlobalNamespace(); + + private: + // Locals + /// @return true, if function is duplicate. + enum E_DuplicateFunction + { + df_no, + df_replace, + df_discard_new + }; + + /** @param o_existentFunction + The id of the already existing function, else unset. + */ + E_DuplicateFunction lhf_CheckAndHandle_DuplicateOperation( + Ce_id & o_existentFunction, + const InputContext & + i_context, + const Function & i_newFunction ); + Namespace & Create_Namespace( + Namespace & o_parent, + const String & i_localName ); + Ce_id Search_MatchingInstance( + CesResultList i_list, + Ce_id i_owner ) const; + const TypePilot & Types() const; + + // DATA + Ce_Storage aStorage; + const TypePilot * pTypes; + RepositoryPartition * + pCppRepositoryPartition; +}; + + + + +// IMPLEMENTATION +inline const Ce_Storage & +CeAdmin::Storage() const +{ + return aStorage; +} + +inline Ce_Storage & +CeAdmin::Storage() +{ + return aStorage; +} + + + + + +} // namespace cpp +} // namespace ary +#endif diff --git a/autodoc/source/ary/cpp/ca_def.cxx b/autodoc/source/ary/cpp/ca_def.cxx new file mode 100644 index 000000000000..6fa2bf087996 --- /dev/null +++ b/autodoc/source/ary/cpp/ca_def.cxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "ca_def.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_define.hxx> +#include <ary/cpp/c_macro.hxx> +#include <ary/loc/loc_file.hxx> +#include <ary/cpp/inpcontx.hxx> + + + + +namespace ary +{ +namespace cpp +{ + + +DefAdmin::DefAdmin(RepositoryPartition & io_myReposyPartition) + : aStorage(), + pCppRepositoryPartition(&io_myReposyPartition) +{ +} + +DefAdmin::~DefAdmin() +{ +} + +Define & +DefAdmin::Store_Define( const InputContext& i_rContext, + const String & i_sName, + const StringVector & i_rDefinition ) +{ + Define & + ret = *new Define( i_sName, + i_rDefinition, + i_rContext.CurFile().LeId() ); + aStorage.Store_Define(ret); + return ret; + +} + +Macro & +DefAdmin::Store_Macro( const InputContext& i_rContext, + const String & i_sName, + const StringVector & i_rParams, + const StringVector & i_rDefinition ) +{ + Macro & + ret = *new Macro( i_sName, + i_rParams, + i_rDefinition, + i_rContext.CurFile().LeId() ); + aStorage.Store_Macro(ret); + return ret; +} + +const DefineEntity & +DefAdmin::Find_Def(De_id i_id) const +{ + return aStorage[i_id]; +} + +DefsResultList +DefAdmin::AllDefines() const +{ + return csv::make_range( aStorage.DefineIndex().Begin(), + aStorage.DefineIndex().End() ); +} + +DefsResultList +DefAdmin::AllMacros() const +{ + return csv::make_range( aStorage.MacroIndex().Begin(), + aStorage.MacroIndex().End() ); +} + + + + + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/ca_def.hxx b/autodoc/source/ary/cpp/ca_def.hxx new file mode 100644 index 000000000000..266382c8577f --- /dev/null +++ b/autodoc/source/ary/cpp/ca_def.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_CPP_CA_DEF_HXX +#define ARY_CPP_CA_DEF_HXX + +// USED SERVICES + // BASE CLASSES +#include <ary/cpp/cp_def.hxx> + // OTHER +#include "cs_def.hxx" + + + +namespace ary +{ +namespace cpp +{ + class Def_Storage; + class RepositoryPartition; +} +} + + + + + +namespace ary +{ +namespace cpp +{ + + + + +class DefAdmin : public DefPilot +{ + public: + // LIFECYCLE + DefAdmin( + RepositoryPartition & + io_myReposyPartition ); + ~DefAdmin(); + + // INQUIRY + const Def_Storage & Storage() const; + + // INHERITED + // Interface DefPilot: + virtual Define & Store_Define( + const InputContext& i_rContext, + const String & i_sName, + const StringVector & + i_rDefinition ); + virtual Macro & Store_Macro( + const InputContext& i_rContext, + const String & i_sName, + const StringVector & + i_rParams, + const StringVector & + i_rDefinition ); + virtual const DefineEntity & + Find_Def( + De_id i_id ) const; + virtual DefsResultList + AllDefines() const; + virtual DefsResultList + AllMacros() const; + + private: + // DATA + Def_Storage aStorage; + RepositoryPartition * + pCppRepositoryPartition; +}; + + + + +// IMPLEMENTATION +inline const Def_Storage & +DefAdmin::Storage() const +{ + return aStorage; +} + + + +} // namespace cpp +} // namespace ary +#endif diff --git a/autodoc/source/ary/cpp/ca_type.cxx b/autodoc/source/ary/cpp/ca_type.cxx new file mode 100644 index 000000000000..4ebfae31b869 --- /dev/null +++ b/autodoc/source/ary/cpp/ca_type.cxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "ca_type.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_builtintype.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <ary/cpp/inpcontx.hxx> +#include <ary/cpp/usedtype.hxx> +#include <ary/getncast.hxx> +#include "c_reposypart.hxx" +#include "cs_type.hxx" + + + + +namespace ary +{ +namespace cpp +{ + + +TypeAdmin::TypeAdmin(RepositoryPartition & io_myReposyPartition) + : aStorage(), + pCppRepositoryPartition(&io_myReposyPartition) +{ +} + +TypeAdmin::~TypeAdmin() +{ +} + + +// KORR_FUTURE +// Remove unused parameter. + +const Type & +TypeAdmin::CheckIn_UsedType( const InputContext & , + DYN UsedType & pass_type ) +{ + Dyn<UsedType> + pNewType(&pass_type); // Ensure clean up of heap object. + + Type_id + tid(0); + if (pass_type.IsBuiltInType()) + { + tid = aStorage.Search_BuiltInType( + BuiltInType::SpecializedName_( pass_type.LocalName().c_str(), + pass_type.TypeSpecialisation() )); + csv_assert(tid.IsValid()); + return aStorage[tid]; + } + + tid = aStorage.UsedTypeIndex().Search(pass_type); + if (tid.IsValid()) + { + return aStorage[tid]; + } + + // Type does not yet exist: + // Transfer ownership from pNewTypeand assign id: + aStorage.Store_Entity(*pNewType.Release()); + + aStorage.UsedTypeIndex().Add(pass_type.TypeId()); + return pass_type; +} + +const Type & +TypeAdmin::Find_Type(Type_id i_type) const +{ + return aStorage[i_type]; +} + +bool +TypeAdmin::Get_TypeText( StreamStr & o_result, + Type_id i_type ) const +{ + if (NOT i_type.IsValid()) + return false; + aStorage[i_type].Get_Text(o_result, *pCppRepositoryPartition); + return true; +} + +bool +TypeAdmin::Get_TypeText( StreamStr & o_preName, + StreamStr & o_name, + StreamStr & o_postName, + Type_id i_type ) const +{ + if (NOT i_type.IsValid()) + return false; + aStorage[i_type].Get_Text(o_preName, o_name, o_postName, *pCppRepositoryPartition); + return true; +} + +Type_id +TypeAdmin::Tid_Ellipse() const +{ + return Type_id(predefined::t_ellipse); +} + + + + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/ca_type.hxx b/autodoc/source/ary/cpp/ca_type.hxx new file mode 100644 index 000000000000..ae0580709ce8 --- /dev/null +++ b/autodoc/source/ary/cpp/ca_type.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_CPP_CA_TYPE_HXX +#define ARY_CPP_CA_TYPE_HXX + +// USED SERVICES + // BASE CLASSES +#include <ary/cpp/cp_type.hxx> + // OTHER +#include "cs_type.hxx" + + + +namespace ary +{ +namespace cpp +{ + class RepositoryPartition; +} +} + + + + + +namespace ary +{ +namespace cpp +{ + + + +/** Administrates all C++ types as uses in user declarations + as return-, parameter- or variable-types. +*/ +class TypeAdmin : public TypePilot +{ + public: + // LIFECYCLE + TypeAdmin( + RepositoryPartition & + io_myReposyPartition ); + virtual ~TypeAdmin(); + + // INQUIRY + /// @return A list of all stored types that are not C++ or STL builtin types. + const Type_Storage & + Storage() const; + + // ACCESS + Type_Storage & Storage(); + + // INHERITED + // Interface TypePilot: + virtual const Type & + CheckIn_UsedType( + const InputContext & + i_context, + DYN UsedType & pass_type ); + virtual const Type & + Find_Type( + Type_id i_type ) const; + virtual bool Get_TypeText( + StreamStr & o_result, + Type_id i_type ) const; + virtual bool Get_TypeText( + StreamStr & o_preName, /// ::ary::cpp:: + StreamStr & o_name, /// MyClass + StreamStr & o_postName, /// <TplArgument> * const & + Type_id i_type ) const; + virtual Type_id Tid_Ellipse() const; + + private: + // DATA + Type_Storage aStorage; + RepositoryPartition * + pCppRepositoryPartition; +}; + + + + +// IMPLEMENTATION +inline const Type_Storage & +TypeAdmin::Storage() const +{ + return aStorage; +} + +inline Type_Storage & +TypeAdmin::Storage() +{ + return aStorage; +} + + + + + +} // namespace cpp +} // namespace ary +#endif diff --git a/autodoc/source/ary/cpp/cs_ce.cxx b/autodoc/source/ary/cpp/cs_ce.cxx new file mode 100644 index 000000000000..e8c34567e4fd --- /dev/null +++ b/autodoc/source/ary/cpp/cs_ce.cxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "cs_ce.hxx" + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_namesp.hxx> + + + +namespace +{ +const uintt + C_nReservedElements = ::ary::cpp::predefined::ce_MAX; // Skipping "0" and the GlobalNamespace +} + + + + +namespace ary +{ +namespace cpp +{ + +Ce_Storage * Ce_Storage::pInstance_ = 0; + + + +Ce_Storage::Ce_Storage() + : stg::Storage<CodeEntity>(C_nReservedElements), + aTypes(), + aOperations(), + aData() + +{ + Set_Reserved( predefined::ce_GlobalNamespace, + *new Namespace ); + + csv_assert(pInstance_ == 0); + pInstance_ = this; +} + +Ce_Storage::~Ce_Storage() +{ + csv_assert(pInstance_ != 0); + pInstance_ = 0; +} + +Ce_id +Ce_Storage::Store_Type(DYN CodeEntity & pass_ce) +{ + Ce_id + ret = Store_Entity(pass_ce); + aTypes.Add(ret); + return ret; +} + +Ce_id +Ce_Storage::Store_Operation(DYN CodeEntity & pass_ce) +{ + Ce_id + ret = Store_Entity(pass_ce); + aOperations.Add(ret); + return ret; +} + +Ce_id +Ce_Storage::Store_Datum(DYN CodeEntity & pass_ce) +{ + Ce_id + ret = Store_Entity(pass_ce); + aData.Add(ret); + return ret; +} + + + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/cs_ce.hxx b/autodoc/source/ary/cpp/cs_ce.hxx new file mode 100644 index 000000000000..fa150aa71664 --- /dev/null +++ b/autodoc/source/ary/cpp/cs_ce.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_CPP_CS_CE_HXX +#define ARY_CPP_CS_CE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <store/s_storage.hxx> + // OTHER +#include <ary/cpp/c_ce.hxx> +#include <ary/cpp/c_traits.hxx> +#include <sortedids.hxx> + + + +namespace ary +{ +namespace cpp +{ + + +/** The data base for all ->ary::cpp::CodeEntity objects. +*/ +class Ce_Storage : public ::ary::stg::Storage<CodeEntity> +{ + public: + typedef SortedIds<Ce_Compare> Index; + + Ce_Storage(); + virtual ~Ce_Storage(); + + Ce_id Store_Type( + DYN CodeEntity & pass_ce ); + Ce_id Store_Operation( + DYN CodeEntity & pass_ce ); + Ce_id Store_Datum( + DYN CodeEntity & pass_ce ); + + const Index & TypeIndex() const { return aTypes; } + const Index & OperationIndex() const { return aOperations; } + const Index & DataIndex() const { return aData; } + + Index & TypeIndex() { return aTypes; } + Index & OperationIndex() { return aOperations; } + Index & DataIndex() { return aData; } + + static Ce_Storage & Instance_() { csv_assert(pInstance_ != 0); + return *pInstance_; } + private: + // DATA + Index aTypes; + Index aOperations; + Index aData; + + static Ce_Storage * pInstance_; +}; + + + + +namespace predefined +{ + +enum E_CodeEntity +{ + ce_GlobalNamespace = 1, + ce_MAX +}; + +} // namespace predefined + + + + + +} // namespace cpp +} // namespace ary +#endif diff --git a/autodoc/source/ary/cpp/cs_def.cxx b/autodoc/source/ary/cpp/cs_def.cxx new file mode 100644 index 000000000000..d12e5de24164 --- /dev/null +++ b/autodoc/source/ary/cpp/cs_def.cxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "cs_def.hxx" + +// NOT FULLY DEFINED SERVICES + + +namespace +{ +const uintt + C_nReservedElements = ::ary::cpp::predefined::de_MAX; // Skipping "0" +} + + + +namespace ary +{ +namespace cpp +{ + +Def_Storage * Def_Storage::pInstance_ = 0; + + + + +Def_Storage::Def_Storage() + : stg::Storage<DefineEntity>(C_nReservedElements) +{ + csv_assert(pInstance_ == 0); + pInstance_ = this; +} + +Def_Storage::~Def_Storage() +{ + csv_assert(pInstance_ != 0); + pInstance_ = 0; +} + +De_id +Def_Storage::Store_Define(DYN DefineEntity & pass_de) +{ + De_id + ret = Store_Entity(pass_de); + aDefines.Add(ret); + return ret; +} + +De_id +Def_Storage::Store_Macro(DYN DefineEntity & pass_de) +{ + De_id + ret = Store_Entity(pass_de); + aMacros.Add(ret); + return ret; +} + + + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/cs_def.hxx b/autodoc/source/ary/cpp/cs_def.hxx new file mode 100644 index 000000000000..6e1e2ad380c3 --- /dev/null +++ b/autodoc/source/ary/cpp/cs_def.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_CPP_CS_DE_HXX +#define ARY_CPP_CS_DE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <store/s_storage.hxx> + // OTHER +#include <ary/cpp/c_de.hxx> +#include <ary/cpp/c_traits.hxx> +#include <sortedids.hxx> + + + +namespace ary +{ +namespace cpp +{ + + + + +/** The data base for all ->ary::cpp::Type objects. +*/ +class Def_Storage : public ::ary::stg::Storage<DefineEntity> +{ + public: + typedef SortedIds<Def_Compare> Index; + + // LIFECYCLE + Def_Storage(); + virtual ~Def_Storage(); + + De_id Store_Define( + DYN DefineEntity & pass_de ); + De_id Store_Macro( + DYN DefineEntity & pass_de ); + + const Index & DefineIndex() const { return aDefines; } + const Index & MacroIndex() const { return aMacros; } + + Index & DefineIndex() { return aDefines; } + Index & MacroIndex() { return aMacros; } + + static Def_Storage & + Instance_() { csv_assert(pInstance_ != 0); + return *pInstance_; } + private: + // DATA + Index aDefines; + Index aMacros; + + + static Def_Storage * + pInstance_; +}; + + + + +namespace predefined +{ + +enum E_DefineEntity +{ + // 0 is always unused with repository storages. + de_MAX = 1 +}; + +} // namespace predefined + + + + + + +} // namespace cpp +} // namespace ary +#endif diff --git a/autodoc/source/ary/cpp/cs_type.cxx b/autodoc/source/ary/cpp/cs_type.cxx new file mode 100644 index 000000000000..723108dbc49e --- /dev/null +++ b/autodoc/source/ary/cpp/cs_type.cxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "cs_type.hxx" + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_builtintype.hxx> + + +namespace +{ + const uintt + C_nReservedElements = ary::cpp::predefined::t_MAX; // Skipping "0" and the builtin types +} + + +namespace ary +{ +namespace cpp +{ + + + +Type_Storage * Type_Storage::pInstance_ = 0; + + + + +Type_Storage::Type_Storage() + : stg::Storage<Type>(C_nReservedElements), + aBuiltInTypes() +{ + Setup_BuiltInTypes(); + + csv_assert(pInstance_ == 0); + pInstance_ = this; +} + +Type_Storage::~Type_Storage() +{ + csv_assert(pInstance_ != 0); + pInstance_ = 0; +} + +Type_id +Type_Storage::Search_BuiltInType( const String & i_specializedName ) const +{ + return csv::value_from_map(aBuiltInTypes, i_specializedName, Tid(0)); +} + +void +Type_Storage::Setup_BuiltInTypes() +{ + Set_BuiltInType( predefined::t_void, "void" ); + Set_BuiltInType( predefined::t_bool, "bool" ); + Set_BuiltInType( predefined::t_char, "char" ); + Set_BuiltInType( predefined::t_signed_char, "char", TYSP_signed ); + Set_BuiltInType( predefined::t_unsigned_char, "char", TYSP_unsigned ); + Set_BuiltInType( predefined::t_short, "short" ); + Set_BuiltInType( predefined::t_unsigned_short, "short", TYSP_unsigned ); + Set_BuiltInType( predefined::t_int, "int" ); + Set_BuiltInType( predefined::t_unsigned_int, "int", TYSP_unsigned ); + Set_BuiltInType( predefined::t_long, "long" ); + Set_BuiltInType( predefined::t_unsigned_long, "long", TYSP_unsigned ); + Set_BuiltInType( predefined::t_float, "float" ); + Set_BuiltInType( predefined::t_double, "double" ); + Set_BuiltInType( predefined::t_size_t, "size_t" ); + Set_BuiltInType( predefined::t_wchar_t, "wchar_t" ); + Set_BuiltInType( predefined::t_ptrdiff_t, "ptrdiff_t" ); + Set_BuiltInType( predefined::t_ellipse, "..." ); +} + +void +Type_Storage::Set_BuiltInType( Rid i_id, + const char * i_sName, + ary::cpp::E_TypeSpecialisation i_eSpecialisation ) +{ + DYN BuiltInType & + rNew = *new BuiltInType(i_sName, i_eSpecialisation); + Set_Reserved( i_id, rNew); // Here goes the ownership for rNew. + aBuiltInTypes[rNew.SpecializedName()] = rNew.TypeId(); +} + + + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/cs_type.hxx b/autodoc/source/ary/cpp/cs_type.hxx new file mode 100644 index 000000000000..ee8ceee06c12 --- /dev/null +++ b/autodoc/source/ary/cpp/cs_type.hxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_CPP_CS_TYPE_HXX +#define ARY_CPP_CS_TYPE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <store/s_storage.hxx> + // COMPONENTS + // PARAMETERS +#include <ary/cpp/c_type.hxx> +#include <ary/cpp/c_traits.hxx> +#include <ary/cpp/usedtype.hxx> +#include <sortedids.hxx> + + + +namespace ary +{ +namespace cpp +{ + + + +/** The data base for all ->ary::cpp::Type objects. +*/ +class Type_Storage : public ::ary::stg::Storage<Type> +{ + public: + typedef SortedIds<UsedType_Compare> UT_Index; + + Type_Storage(); + virtual ~Type_Storage(); + + const UT_Index & UsedTypeIndex() const; + + UT_Index & UsedTypeIndex(); + Type_id Search_BuiltInType( + const String & i_specializedName ) const; + + static Type_Storage & + Instance_() { csv_assert(pInstance_ != 0); + return *pInstance_; } + private: + // Locals + void Setup_BuiltInTypes(); + void Set_BuiltInType( + Rid i_nId, + const char * i_sName, + ary::cpp::E_TypeSpecialisation + i_eSpecialisation = TYSP_none ); + // DATA + UT_Index aUsedTypes; + std::map<String,Type_id> + aBuiltInTypes; + + + static Type_Storage * + pInstance_; +}; + + + + +namespace predefined +{ + +enum E_Type +{ + // 0 is always unused with repository storages. + t_void = 1, + t_bool, + t_char, + t_signed_char, + t_unsigned_char, + t_short, + t_unsigned_short, + t_int, + t_unsigned_int, + t_long, + t_unsigned_long, + t_float, + t_double, + t_size_t, + t_wchar_t, + t_ptrdiff_t, + t_ellipse, + t_MAX +}; + +} // namespace predefined + + + +// IMPLEMENTATION +inline const Type_Storage::UT_Index & +Type_Storage::UsedTypeIndex() const +{ + return aUsedTypes; +} + +inline Type_Storage::UT_Index & +Type_Storage::UsedTypeIndex() +{ + return aUsedTypes; +} + + +} // namespace cpp +} // namespace ary +#endif diff --git a/autodoc/source/ary/cpp/makefile.mk b/autodoc/source/ary/cpp/makefile.mk new file mode 100644 index 000000000000..5c20a59bd82e --- /dev/null +++ b/autodoc/source/ary/cpp/makefile.mk @@ -0,0 +1,80 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=autodoc +TARGET=ary_cpp + + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + +# --- Files -------------------------------------------------------- + + +OBJFILES= \ + $(OBJ)$/c_builtintype.obj \ + $(OBJ)$/c_class.obj \ + $(OBJ)$/c_de.obj \ + $(OBJ)$/c_define.obj \ + $(OBJ)$/c_enum.obj \ + $(OBJ)$/c_enuval.obj \ + $(OBJ)$/c_funct.obj \ + $(OBJ)$/c_macro.obj \ + $(OBJ)$/c_namesp.obj \ + $(OBJ)$/c_osigna.obj \ + $(OBJ)$/c_reposypart.obj \ + $(OBJ)$/c_slots.obj \ + $(OBJ)$/c_traits.obj \ + $(OBJ)$/c_tydef.obj \ + $(OBJ)$/c_vari.obj \ + $(OBJ)$/ca_ce.obj \ + $(OBJ)$/ca_def.obj \ + $(OBJ)$/ca_type.obj \ + $(OBJ)$/cs_ce.obj \ + $(OBJ)$/cs_def.obj \ + $(OBJ)$/cs_type.obj \ + $(OBJ)$/namechain.obj \ + $(OBJ)$/tplparam.obj \ + $(OBJ)$/usedtype.obj + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/ary/cpp/namechain.cxx b/autodoc/source/ary/cpp/namechain.cxx new file mode 100644 index 000000000000..d164a588dcb9 --- /dev/null +++ b/autodoc/source/ary/cpp/namechain.cxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cpp/namechain.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/usedtype.hxx> +#include <ary/cpp/c_gate.hxx> +#include "tplparam.hxx" + + + +namespace ary +{ +namespace cpp +{ +namespace ut +{ + + +//********************* NameSegment ******************// + +NameSegment::NameSegment( const char * i_sName ) + : sName( i_sName ) + // pTemplate +{ +} + +NameSegment::NameSegment( const NameSegment & i_rSeg ) + : sName(i_rSeg.sName) + // pTemplate +{ + // KORR_FUTURE : Handling of copying of templates. +// csv_assert( NOT i_rSeg.pTemplate ); +} + +NameSegment& NameSegment::operator=(const NameSegment & i_rSeg) +{ + sName = i_rSeg.sName; + return *this; +} + +NameSegment::~NameSegment() +{ +} + +List_TplParameter & +NameSegment::AddTemplate() +{ + return * (pTemplate = new List_TplParameter); +} + +intt +NameSegment::Compare( const NameSegment & i_rOther ) const +{ + intt nResult = strcmp( sName.c_str(), i_rOther.sName.c_str() ); + if (nResult != 0) + return nResult; + if ( bool(pTemplate) != bool(i_rOther.pTemplate) ) + { + if ( NOT pTemplate ) + return -1; + else + return +1; + } + else if ( NOT pTemplate ) + return 0; + else + return pTemplate->Compare( *i_rOther.pTemplate ); +} + +void +NameSegment::Get_Text_AsScope( StreamStr & o_rOut, + const Gate & i_rGate ) const +{ + o_rOut << sName; + if ( pTemplate ) + pTemplate->Get_Text( o_rOut, i_rGate ); +} + +void +NameSegment::Get_Text_AsMainType( StreamStr & o_rName, + StreamStr & o_rPostName, + const Gate & i_rGate ) const +{ + o_rName << sName; + if ( pTemplate ) + pTemplate->Get_Text( o_rPostName, i_rGate ); +} + + +//********************* NameChain ******************// + +NameChain::NameChain() +// : aSegments +{ +} + +NameChain::~NameChain() +{ +} + +void +NameChain::Add_Segment( const char * i_sSeg ) +{ + aSegments.push_back( NameSegment(i_sSeg) ); +} + +List_TplParameter & +NameChain::Templatize_LastSegment() +{ + csv_assert( aSegments.size() > 0 ); + + return aSegments.back().AddTemplate(); +} + +intt +NameChain::Compare( const NameChain & i_rChain ) const +{ + intt nResult = intt(aSegments.size()) - intt(i_rChain.aSegments.size()); + if (nResult != 0) + return nResult; + + std::vector< NameSegment >::const_iterator it1 = aSegments.begin(); + std::vector< NameSegment >::const_iterator it1End = aSegments.end(); + std::vector< NameSegment >::const_iterator it2 = i_rChain.aSegments.begin(); + + for ( ; it1 != it1End; ++it1, ++it2 ) + { + nResult = (*it1).Compare(*it2); + if (nResult != 0) + return nResult; + } + + return 0; +} + +const String & +NameChain::LastSegment() const +{ + if ( aSegments.size() > 0 ) + return aSegments.back().Name(); + return String::Null_(); +} + +void +NameChain::Get_Text( StreamStr & o_rPreName, + StreamStr & o_rName, + StreamStr & o_rPostName, + const Gate & i_rGate ) const +{ + std::vector< NameSegment >::const_iterator it = aSegments.begin(); + std::vector< NameSegment >::const_iterator itEnd = aSegments.end(); + + if ( it == itEnd ) + return; + + for ( --itEnd; it != itEnd; ++it ) + { + (*it).Get_Text_AsScope( o_rPreName, i_rGate ); + o_rPreName << "::"; + } + (*it).Get_Text_AsMainType( o_rName, o_rPostName, i_rGate ); +} + + + +} // namespace ut +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/tplparam.cxx b/autodoc/source/ary/cpp/tplparam.cxx new file mode 100644 index 000000000000..67f8439c0c59 --- /dev/null +++ b/autodoc/source/ary/cpp/tplparam.cxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "tplparam.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/cp_type.hxx> + + +namespace ary +{ +namespace cpp +{ +namespace ut +{ + +TplParameter_Type::TplParameter_Type( Tid i_nType ) + : nType(i_nType) +{ +} + +TplParameter_Type::~TplParameter_Type() +{ +} + +intt +TplParameter_Type::Compare( const TemplateParameter & i_rOther ) const +{ + const TplParameter_Type * pOther + = dynamic_cast< const TplParameter_Type* >( &i_rOther ); + if (pOther == 0) + return -1; + + return static_cast<long>(nType.Value()) + - static_cast<long>(pOther->nType.Value()); +} + +void +TplParameter_Type::Get_Text( StreamStr & o_rOut, + const ary::cpp::Gate & i_rGate ) const +{ + i_rGate.Types().Get_TypeText( o_rOut, nType ); +} + +} // namespace ut +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/cpp/tplparam.hxx b/autodoc/source/ary/cpp/tplparam.hxx new file mode 100644 index 000000000000..f8ee57b968c7 --- /dev/null +++ b/autodoc/source/ary/cpp/tplparam.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_CPP_TPLPARAM_HXX +#define ARY_CPP_TPLPARAM_HXX + +// USED SERVICES +#include <ary/cpp/c_types4cpp.hxx> + + + + +namespace ary +{ +namespace cpp +{ + class UsedType; + class Gate; + +namespace ut +{ + + +class TemplateParameter +{ + public: + virtual ~TemplateParameter() {} + + virtual intt Compare( + const TemplateParameter & + i_rOther ) const = 0; + virtual void Get_Text( + StreamStr & o_rOut, + const ary::cpp::Gate & + i_rGate ) const = 0; +}; + + +class TplParameter_Type : public TemplateParameter +{ + public: + TplParameter_Type( + Tid i_nType ); + ~TplParameter_Type(); + + virtual intt Compare( + const TemplateParameter & + i_rOther ) const; + virtual void Get_Text( + StreamStr & o_rOut, + const ary::cpp::Gate & + i_rGate ) const; + private: + Tid nType; +}; + +} // namespace ut +} // namespace cpp +} // namespace ary +#endif diff --git a/autodoc/source/ary/cpp/usedtype.cxx b/autodoc/source/ary/cpp/usedtype.cxx new file mode 100644 index 000000000000..bf1d864ad68b --- /dev/null +++ b/autodoc/source/ary/cpp/usedtype.cxx @@ -0,0 +1,575 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cpp/usedtype.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/symtreenode.hxx> +#include <ary/cpp/c_ce.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_slntry.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/c_traits.hxx> +#include <ary/cpp/c_types4cpp.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <ary/cpp/cp_type.hxx> +#include <ary/doc/d_oldcppdocu.hxx> +#include <ary/getncast.hxx> +#include "tplparam.hxx" + + + +namespace +{ + +using namespace ::ary::cpp; +typedef std::vector< ary::cpp::E_ConVol > PtrLevelVector; + + +inline bool +result2bool( intt i_nResult ) + { return i_nResult < 0; } + + +intt compare_PtrLevelVector( + const PtrLevelVector & + i_r1, + const PtrLevelVector & + i_r2 ); +inline intt +compare_ConVol( E_ConVol i_e1, + E_ConVol i_e2 ) + { return intt(i_e1) - intt(i_e2); } + +inline intt +compare_bool( bool i_b1, + bool i_b2 ) + { return i_b1 == i_b2 + ? 0 + : i_b1 + ? -1 + : +1; } +inline intt +compare_Specialisation( E_TypeSpecialisation i_e1, + E_TypeSpecialisation i_e2 ) + { return intt(i_e1) - intt(i_e2); } + +inline bool +is_const( E_ConVol i_eCV ) + { return ( intt(i_eCV) & intt(CONVOL_const) ) != 0; } + +inline bool +is_volatile( E_ConVol i_eCV ) + { return ( intt(i_eCV) & intt(CONVOL_volatile) ) != 0; } + + +intt +compare_PtrLevelVector( const PtrLevelVector & i_r1, + const PtrLevelVector & i_r2 ) +{ + intt nResult = i_r1.size() - i_r2.size(); + if ( nResult != 0 ) + return nResult; + + PtrLevelVector::const_iterator it1 = i_r1.begin(); + PtrLevelVector::const_iterator it1End = i_r1.end(); + PtrLevelVector::const_iterator it2 = i_r2.begin(); + + for ( ; it1 != it1End; ++it1, ++it2 ) + { + nResult = compare_ConVol(*it1, *it2); + if ( nResult != 0 ) + return nResult; + } + + return 0; +} + + +} // anonymous namespace + + + + +namespace ary +{ +namespace cpp +{ + +typedef symtree::Node<CeNode_Traits> CeNode; +typedef ut::NameChain::const_iterator nc_iter; + +Ce_id CheckForRelatedCe_inNode( + const CeNode & i_node, + const StringVector& i_qualification, + const String & i_name ); + + +UsedType::UsedType(Ce_id i_scope ) + : aPath(), + aPtrLevels(), + eConVol_Type(CONVOL_none), + bIsReference(false), + bIsAbsolute(false), + bRefers2BuiltInType(false), + eTypeSpecialisation(TYSP_none), + nRelatedCe(0), + nScope(i_scope) +{ +} + +UsedType::~UsedType() +{ +} + + +bool +UsedType::operator<( const UsedType & i_rType ) const +{ + intt nResult = compare_bool( bIsAbsolute, i_rType.bIsAbsolute ); + if ( nResult != 0 ) + return result2bool(nResult); + + nResult = static_cast<intt>(nScope.Value()) + - + static_cast<intt>(i_rType.nScope.Value()); + if ( nResult != 0 ) + return result2bool(nResult); + + nResult = aPath.Compare( i_rType.aPath ); + if ( nResult != 0 ) + return result2bool(nResult); + + nResult = compare_ConVol( eConVol_Type, i_rType.eConVol_Type ); + if ( nResult != 0 ) + return result2bool(nResult); + + nResult = compare_PtrLevelVector( aPtrLevels, i_rType.aPtrLevels ); + if ( nResult != 0 ) + return result2bool(nResult); + + nResult = compare_bool( bIsReference, i_rType.bIsReference ); + if ( nResult != 0 ) + return result2bool(nResult); + + nResult = compare_Specialisation( eTypeSpecialisation, i_rType.eTypeSpecialisation ); + if ( nResult != 0 ) + return result2bool(nResult); + + return false; +} + +void +UsedType::Set_Absolute() +{ + bIsAbsolute = true; +} + +void +UsedType::Add_NameSegment( const char * i_sSeg ) +{ + aPath.Add_Segment(i_sSeg); +} + +ut::List_TplParameter & +UsedType::Enter_Template() +{ + return aPath.Templatize_LastSegment(); +} + +void +UsedType::Set_Unsigned() +{ + eTypeSpecialisation = TYSP_unsigned; +} + +void +UsedType::Set_Signed() +{ + eTypeSpecialisation = TYSP_signed; +} + +void +UsedType::Set_BuiltIn( const char * i_sType ) +{ + aPath.Add_Segment(i_sType); + bRefers2BuiltInType = true; +} + +void +UsedType::Set_Const() +{ + if (PtrLevel() == 0) + eConVol_Type = E_ConVol(eConVol_Type | CONVOL_const); + else + aPtrLevels.back() = E_ConVol(aPtrLevels.back() | CONVOL_const); +} + +void +UsedType::Set_Volatile() +{ + if (PtrLevel() == 0) + eConVol_Type = E_ConVol(eConVol_Type | CONVOL_volatile); + else + aPtrLevels.back() = E_ConVol(aPtrLevels.back() | CONVOL_volatile); +} + +void +UsedType::Add_PtrLevel() +{ + aPtrLevels.push_back(CONVOL_none); +} + +void +UsedType::Set_Reference() +{ + bIsReference = true; +} + +inline bool +IsInternal(const ary::cpp::CodeEntity & i_ce) +{ + const ary::doc::OldCppDocu * + docu = dynamic_cast< const ary::doc::OldCppDocu* >(i_ce.Docu().Data()); + if (docu != 0) + return docu->IsInternal(); + return false; +} + + +void +UsedType::Connect2Ce( const CePilot & i_ces) +{ + StringVector + qualification; + String + name; + Get_NameParts(qualification, name); + + for ( const CeNode * scope_node = CeNode_Traits::NodeOf_( + i_ces.Find_Ce(nScope)); + scope_node != 0; + scope_node = scope_node->Parent() ) + { + nRelatedCe = CheckForRelatedCe_inNode(*scope_node, qualification, name); + if ( nRelatedCe.IsValid() ) + { + if ( IsInternal(i_ces.Find_Ce(nRelatedCe)) ) + nRelatedCe = Ce_id(0); + return; + } + } // end for +} + +void +UsedType::Connect2CeOnlyKnownViaBaseClass(const Gate & i_gate) +{ + csv_assert(nScope.IsValid()); + CesResultList + instances = i_gate.Ces().Search_TypeName( LocalName() ); + + // If there are no matches, or only one match that was already + // accepted, all work is done. + if ( (nRelatedCe.IsValid() AND instances.size() == 1) + OR instances.size() == 0 ) + return; + + StringVector + qualification; + String + name; + Get_NameParts(qualification, name); + + const CodeEntity & + scopece = i_gate.Ces().Find_Ce(nScope); + + // Else search for declaration in own class and then in base classes. + // These would be of higher priority than those in parent namespaces. + Ce_id + foundce = RecursiveSearchCe_InBaseClassesOf( + scopece, qualification, name, i_gate); + if (foundce.IsValid()) + nRelatedCe = foundce; + + if ( nRelatedCe.IsValid() AND IsInternal(i_gate.Ces().Find_Ce(nRelatedCe)) ) + { + nRelatedCe = Ce_id(0); + } +} + +bool +UsedType::IsBuiltInType() const +{ + return bRefers2BuiltInType + AND aPtrLevels.size() == 0 + AND NOT bIsReference + AND eConVol_Type == ary::cpp::CONVOL_none; +} + +const String & +UsedType::LocalName() const +{ + return aPath.LastSegment(); +} + +E_TypeSpecialisation +UsedType::TypeSpecialisation() const +{ + return eTypeSpecialisation; +} + +void +UsedType::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor,*this); +} + +ary::ClassId +UsedType::get_AryClass() const +{ + return class_id; +} + +Rid +UsedType::inq_RelatedCe() const +{ + return nRelatedCe.Value(); +} + +bool +UsedType::inq_IsConst() const +{ + if ( is_const(eConVol_Type) ) + return true; + for ( PtrLevelVector::const_iterator it = aPtrLevels.begin(); + it != aPtrLevels.end(); + ++it ) + { + if ( is_const(*it) ) + return true; + } + + return false; +} + +void +UsedType::inq_Get_Text( StreamStr & o_rPreName, + StreamStr & o_rName, + StreamStr & o_rPostName, + const Gate & i_rGate ) const +{ + if ( is_const(eConVol_Type) ) + o_rPreName << "const "; + if ( is_volatile(eConVol_Type) ) + o_rPreName << "volatile "; + if ( bIsAbsolute ) + o_rPreName << "::"; + + aPath.Get_Text( o_rPreName, o_rName, o_rPostName, i_rGate ); + + for ( PtrLevelVector::const_iterator it = aPtrLevels.begin(); + it != aPtrLevels.end(); + ++it ) + { + o_rPostName << " *"; + if ( is_const(*it) ) + o_rPostName << " const"; + if ( is_volatile(*it) ) + o_rPostName << " volatile"; + } + if ( bIsReference ) + o_rPostName << " &"; +} + +Ce_id +UsedType::RecursiveSearchCe_InBaseClassesOf( const CodeEntity & i_mayBeClass, + const StringVector & i_myQualification, + const String & i_myName, + const Gate & i_gate ) const +{ + // Find in this class? + const CeNode * + basenode = CeNode_Traits::NodeOf_(i_mayBeClass); + if (basenode == 0) + return Ce_id(0); + Ce_id + found = CheckForRelatedCe_inNode(*basenode, i_myQualification, i_myName); + if (found.IsValid()) + return found; + + + const Class * + cl = ary_cast<Class>(&i_mayBeClass); + if (cl == 0) + return Ce_id(0); + + for ( List_Bases::const_iterator it = cl->BaseClasses().begin(); + it != cl->BaseClasses().end(); + ++it ) + { + csv_assert((*it).nId.IsValid()); + Ce_id + base = i_gate.Types().Find_Type((*it).nId).RelatedCe(); + while (base.IsValid() AND is_type<Typedef>(i_gate.Ces().Find_Ce(base)) ) + { + base = i_gate.Types().Find_Type( + ary_cast<Typedef>(i_gate.Ces().Find_Ce(base)) + .DescribingType() ) + .RelatedCe(); + } + + if (base.IsValid()) + { + const CodeEntity & + basece = i_gate.Ces().Find_Ce(base); + found = RecursiveSearchCe_InBaseClassesOf( + basece, i_myQualification, i_myName, i_gate); + if (found.IsValid()) + return found; + } + } // end for + + return Ce_id(0); +} + + +void +UsedType::Get_NameParts( StringVector & o_qualification, + String & o_name ) +{ + nc_iter nit = aPath.begin(); + nc_iter nit_end = aPath.end(); + csv_assert(nit != nit_end); // Each UsedType has to have a local name. + + --nit_end; + o_name = (*nit_end).Name(); + for ( ; + nit != nit_end; + ++nit ) + { + o_qualification.push_back( (*nit).Name() ); + } +} + +Ce_id +CheckForRelatedCe_inNode( const CeNode & i_node, + const StringVector & i_qualification, + const String & i_name ) +{ + if (i_qualification.size() > 0) + { + Ce_id + ret(0); + i_node.SearchBelow( ret, + i_qualification.begin(), + i_qualification.end(), + i_name ); + return ret; + } + else + { + return i_node.Search(i_name); + } +} + + +namespace ut +{ + +List_TplParameter::List_TplParameter() + : aTplParameters() +{ +} + +List_TplParameter::~List_TplParameter() +{ + csv::erase_container_of_heap_ptrs(aTplParameters); +} + +void +List_TplParameter::AddParam_Type( Type_id i_nType ) +{ + aTplParameters.push_back( new TplParameter_Type(i_nType) ); +} + +void +List_TplParameter::Get_Text( StreamStr & o_rOut, + const ary::cpp::Gate & i_rGate ) const +{ + Vector_TplArgument::const_iterator it = aTplParameters.begin(); + Vector_TplArgument::const_iterator itEnd = aTplParameters.end(); + + if ( it == itEnd ) + { + o_rOut << "<>"; + return; + } + + o_rOut << "< "; + + (*it)->Get_Text( o_rOut, i_rGate ); + + for ( ++it; it != itEnd; ++it ) + { + o_rOut << ", "; + (*it)->Get_Text( o_rOut, i_rGate ); + } + + o_rOut << " >"; +} + +intt +List_TplParameter::Compare( const List_TplParameter & i_rOther ) const +{ + intt nResult = intt(aTplParameters.size()) - intt(i_rOther.aTplParameters.size()); + + if (nResult != 0) + return nResult; + + Vector_TplArgument::const_iterator it1 = aTplParameters.begin(); + Vector_TplArgument::const_iterator it1End = aTplParameters.end(); + Vector_TplArgument::const_iterator it2 = i_rOther.aTplParameters.begin(); + + for ( ; it1 != it1End; ++it1, ++it2 ) + { + nResult = (*it1)->Compare( *(*it2) ); + if (nResult != 0) + return nResult; + } + + return 0; +} + + +} // namespace ut +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/doc/d_boolean.cxx b/autodoc/source/ary/doc/d_boolean.cxx new file mode 100644 index 000000000000..9d28b822ce1b --- /dev/null +++ b/autodoc/source/ary/doc/d_boolean.cxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/doc/d_boolean.hxx> + + +// NOT FULLY DEFINED SERVICES + + + +namespace ary +{ +namespace doc +{ + +Boolean::~Boolean() +{ +} + +void +Boolean::do_Accept(csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor,*this); +} + + + + +} // namespace doc +} // namespace ary diff --git a/autodoc/source/ary/doc/d_docu.cxx b/autodoc/source/ary/doc/d_docu.cxx new file mode 100644 index 000000000000..50c841e2fb00 --- /dev/null +++ b/autodoc/source/ary/doc/d_docu.cxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/doc/d_docu.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/doc/d_node.hxx> + +namespace ary +{ +namespace doc +{ + +Documentation::Documentation() + : pData(0) +{ +} + +Documentation::~Documentation() +{ +} + +void +Documentation::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor,*this); +} + + + + +} // namespace doc +} // namespace ary diff --git a/autodoc/source/ary/doc/d_node.cxx b/autodoc/source/ary/doc/d_node.cxx new file mode 100644 index 000000000000..23e30c6ca286 --- /dev/null +++ b/autodoc/source/ary/doc/d_node.cxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/doc/d_node.hxx> + + +namespace ary +{ +namespace doc +{ + + + +Node::~Node() +{ +} + +Node::Node(nodetype::id i_type) + : nType(i_type), + pNext(0) +{ +} + +void +Node::Add_toChain( DYN Node & pass_nextNode ) +{ + if (NOT pNext) + pNext = &pass_nextNode; + else + pNext->Add_toChain(pass_nextNode); +} + +uintt +Node::ListSize() const +{ + return pNext + ? pNext->ListSize() + 1 + : 1; +} + + + +} // namespace doc +} // namespace ary diff --git a/autodoc/source/ary/doc/d_oldcppdocu.cxx b/autodoc/source/ary/doc/d_oldcppdocu.cxx new file mode 100644 index 000000000000..26ab84fb768e --- /dev/null +++ b/autodoc/source/ary/doc/d_oldcppdocu.cxx @@ -0,0 +1,336 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/doc/d_oldcppdocu.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/info/all_tags.hxx> +#include <ary/info/docstore.hxx> +#include <ary/info/infodisp.hxx> +#include <docu_node_ids.hxx> + + + + +namespace ary +{ +namespace doc +{ + +using namespace info; + + + + +unsigned char C_ucNO_INDEX = 255; +typedef DYN StdTag * (F_CREATE)(); + + +OldCppDocu::OldCppDocu() + : Node(docnt::nt_OldCppDocu), + bIsObsolete(false), + bIsInternal(false), + bIsInterface(false) +{ + memset( nTags, C_ucNO_INDEX, size_t(C_eAtTag_NrOfClasses) ); +} + +OldCppDocu::~OldCppDocu() +{ +} + +void +OldCppDocu::Store2( info::DocuStore & o_rDocuStore ) +{ + o_rDocuStore.Store2ConnectedDeclaration(*this); +} + +AtTag * +OldCppDocu::Create_StdTag( E_AtTagId i_eId ) +{ + UINT8 nIndex = static_cast<UINT8>(i_eId); + if ( nTags[nIndex] == C_ucNO_INDEX ) + { + AtTag * ret = new StdTag(i_eId); + NewTag(nIndex) = ret; + return ret; + } + else + { + return GetTag(nIndex).GetFollower(); + } +} + +AtTag * +OldCppDocu::CheckIn_BaseTag() +{ + UINT8 nIndex = atc_base; + if ( nTags[nIndex] == C_ucNO_INDEX ) + { + AtTag * ret = new BaseTag(); + NewTag(nIndex) = ret; + return ret; + } + else + { + return GetTag(nIndex).GetFollower(); + } +} + +AtTag * +OldCppDocu::CheckIn_ExceptionTag() +{ + UINT8 nIndex = atc_exception; + if ( nTags[nIndex] == C_ucNO_INDEX ) + { + AtTag * ret = new ExceptionTag(); + NewTag(nIndex) = ret; + return ret; + } + else + { + return GetTag(nIndex).GetFollower(); + } +} + +AtTag * +OldCppDocu::Create_ImplementsTag() +{ + UINT8 nIndex = atc_implements; + if ( nTags[nIndex] == C_ucNO_INDEX ) + { + AtTag * ret = new ImplementsTag(); + NewTag(nIndex) = ret; + return ret; + } + else + { + return GetTag(nIndex).GetFollower(); + } +} + +AtTag * +OldCppDocu::Create_KeywordTag() +{ + UINT8 nIndex = atc_keyword; + if ( nTags[nIndex] == C_ucNO_INDEX ) + { + AtTag * ret = new KeywordTag(); + NewTag(nIndex) = ret; + return ret; + } + else + { + return GetTag(nIndex).GetFollower(); + } +} + +AtTag * +OldCppDocu::CheckIn_ParameterTag() +{ + UINT8 nIndex = atc_parameter; + if ( nTags[nIndex] == C_ucNO_INDEX ) + { + AtTag * ret = new ParameterTag(); + NewTag(nIndex) = ret; + return ret; + } + else + { + return GetTag(nIndex).GetFollower(); + } +} + +AtTag * +OldCppDocu::CheckIn_SeeTag() +{ + UINT8 nIndex = atc_see; + if ( nTags[nIndex] == C_ucNO_INDEX ) + { + AtTag * ret = new SeeTag(); + NewTag(nIndex) = ret; + return ret; + } + else + { + return GetTag(nIndex).GetFollower(); + } +} + +AtTag * +OldCppDocu::CheckIn_TemplateTag() +{ + UINT8 nIndex = atc_template; + if ( nTags[nIndex] == C_ucNO_INDEX ) + { + AtTag * ret = new TemplateTag(); + NewTag(nIndex) = ret; + return ret; + } + else + { + return GetTag(nIndex).GetFollower(); + } +} + +AtTag * +OldCppDocu::Create_LabelTag() +{ + UINT8 nIndex = atc_label; + if ( nTags[nIndex] == C_ucNO_INDEX ) + { + AtTag * ret = new LabelTag(); + NewTag(nIndex) = ret; + return ret; + } + else + { + return GetTag(nIndex).GetFollower(); + } +} + +AtTag * +OldCppDocu::Create_DefaultTag() +{ + UINT8 nIndex = atid_descr; + if ( nTags[nIndex] == C_ucNO_INDEX ) + { + AtTag * ret = new StdTag(atid_descr); + NewTag(nIndex) = ret; + return ret; + } + else + { + return GetTag(nIndex).GetFollower(); + } +} + +AtTag * +OldCppDocu::Create_SinceTag() +{ + UINT8 nIndex = atc_since; + if ( nTags[nIndex] == C_ucNO_INDEX ) + { + AtTag * ret = new SinceTag(); + NewTag(nIndex) = ret; + return ret; + } + else + { + return GetTag(nIndex).GetFollower(); + } +} + + +void +OldCppDocu::Replace_AtShort_By_AtDescr() +{ + unsigned char nPosInTags = nTags[atid_short]; + if ( nPosInTags == C_ucNO_INDEX ) + return; + + AtTag * pTag = aTags[ nPosInTags ]; + if ( pTag == 0 ) // Should be csv_assert(). + return; + + csv_assert( dynamic_cast< StdTag* >(pTag) != 0 ); + StdTag * pStdTag = static_cast< StdTag* >(pTag); + + pStdTag->ChangeId2(atid_descr); + nTags[atid_short] = C_ucNO_INDEX; + nTags[atid_descr] = nPosInTags; +} + +void +OldCppDocu::Set_Obsolete() +{ + bIsObsolete = true; +} + +void +OldCppDocu::Set_Internal() +{ + bIsInternal = true; +} + +const AtTag & +OldCppDocu::Short() const +{ + static const StdTag aNull_(atid_short); + + unsigned char nPosInTags = nTags[atid_short]; + if ( nPosInTags != C_ucNO_INDEX ) + { + AtTag * pTag = aTags[ nPosInTags ]; + if ( pTag != 0 ) // Should be csv_assert(). + { + return *pTag; + } + } + + return aNull_; +} + +AtTag * & +OldCppDocu::NewTag(UINT8 i_nIndex) +{ + nTags[i_nIndex] = static_cast<UINT8>(aTags.size()); + aTags.push_back(0); + return aTags.back(); +} + +AtTag & +OldCppDocu::GetTag( UINT8 i_nIndex ) +{ + csv_assert( i_nIndex < C_eAtTag_NrOfClasses ); + csv_assert( nTags[i_nIndex] != C_ucNO_INDEX ); + csv_assert( aTags[nTags[i_nIndex]] != 0 ); + return * aTags[nTags[i_nIndex]]; +} + +bool +OldCppDocu::IsInternal() const +{ + return bIsInternal; +} + +bool +OldCppDocu::IsInterface() const +{ + return bIsInterface; +} + +void +OldCppDocu::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor, *this); +} + +} // namespace doc +} // namespace ary diff --git a/autodoc/source/ary/doc/d_oldidldocu.cxx b/autodoc/source/ary/doc/d_oldidldocu.cxx new file mode 100644 index 000000000000..1c61a6ac0fb0 --- /dev/null +++ b/autodoc/source/ary/doc/d_oldidldocu.cxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/doc/d_oldidldocu.hxx> + +// NOT FULLY DEFINED SERVICES +#include <docu_node_ids.hxx> + + + +namespace ary +{ +namespace doc +{ + +using namespace ::ary::inf; + + +OldIdlDocu::OldIdlDocu() + : Node(docnt::nt_OldIdlDocu), + aShort(), + aDescription(), + aDeprecatedText(), + aTags(), + pExternShort(0), + bIsPublished(false), + bIsDeprecated(false), + bIsOptional(false) +{ +} + +OldIdlDocu::~OldIdlDocu() +{ +} + +void +OldIdlDocu::AddToken2DeprecatedText( DYN DocuToken & let_drToken ) +{ + aDeprecatedText.AddToken(let_drToken); +} + +void +OldIdlDocu::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor, *this); +} + + + +} // namespace info +} // namespace ary diff --git a/autodoc/source/ary/doc/makefile.mk b/autodoc/source/ary/doc/makefile.mk new file mode 100644 index 000000000000..21989dcc5827 --- /dev/null +++ b/autodoc/source/ary/doc/makefile.mk @@ -0,0 +1,58 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=autodoc +TARGET=ary_doc + + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + + +OBJFILES= \ + $(OBJ)$/d_boolean.obj \ + $(OBJ)$/d_docu.obj \ + $(OBJ)$/d_node.obj \ + $(OBJ)$/d_oldcppdocu.obj \ + $(OBJ)$/d_oldidldocu.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/autodoc/source/ary/idl/i2s_calculator.cxx b/autodoc/source/ary/idl/i2s_calculator.cxx new file mode 100644 index 000000000000..111e9548b941 --- /dev/null +++ b/autodoc/source/ary/idl/i2s_calculator.cxx @@ -0,0 +1,992 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "i2s_calculator.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <algorithm> +#include <string.h> +#include <cosv/file.hxx> +//#include <adc_manager.hxx> +//#include <adc_options.hxx> +#include <ary/qualiname.hxx> +#include <ary/idl/i_enum.hxx> +#include <ary/idl/i_exception.hxx> +#include <ary/idl/i_function.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_interface.hxx> +#include <ary/idl/ik_interface.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/i_property.hxx> +#include <ary/idl/i_service.hxx> +#include <ary/idl/i_singleton.hxx> +#include <ary/idl/i_siservice.hxx> +#include <ary/idl/i_sisingleton.hxx> +#include <ary/idl/i_struct.hxx> +#include <ary/idl/i_structelem.hxx> +#include <ary/idl/i_typedef.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/idl/ip_type.hxx> +#include <ary/namesort.hxx> +#include <nametreenode.hxx> +#include "i_nnfinder.hxx" +#include "ia_ce.hxx" +#include "ia_type.hxx" +#include "is_ce.hxx" +#include "is_type.hxx" +#include "it_ce.hxx" +#include "it_explicit.hxx" +#include "it_sequence.hxx" +#include "it_xnameroom.hxx" + + + +namespace ary +{ +namespace idl +{ + +template <class DEST> +DEST * +SecondariesCalculator::SearchCe4Type(Type_id i_type) +{ + Ce_id + ce = lhf_Search_CeFromTypeId(i_type); + if (ce.IsValid()) + return ary_cast<DEST>(& my_CeStorage()[ce]); + return 0; +} + + +typedef stg::const_iterator<CodeEntity> stg_citerator; +typedef stg::iterator<CodeEntity> stg_iterator; + +typedef stg::filter_iterator<CodeEntity,Interface> + interface_iterator; + +typedef stg::filter_iterator<Type,ExplicitType> + explicittype_iterator; + +typedef ary::stg::const_filter_iterator<CodeEntity,Typedef> + typedef_citerator; + + +inline Service * +SecondariesCalculator::lhf_SearchService( Type_id i_nType ) +{ + return SearchCe4Type<Service>(i_nType); +} + +inline Interface * +SecondariesCalculator::lhf_SearchInterface( Type_id i_nType ) +{ + return SearchCe4Type<Interface>(i_nType); +} + +inline Struct * +SecondariesCalculator::lhf_SearchStruct( Type_id i_nType ) +{ + return SearchCe4Type<Struct>(i_nType); +} + +inline Exception * +SecondariesCalculator::lhf_SearchException( Type_id i_nType ) +{ + return SearchCe4Type<Exception>(i_nType); +} + +inline const Ce_Storage & +SecondariesCalculator::my_CeStorage() const +{ + csv_assert(pCes != 0); + return pCes->Storage(); +} + +inline const Type_Storage & +SecondariesCalculator::my_TypeStorage() const +{ + csv_assert(pTypes != 0); + return pTypes->Storage(); +} + +inline Ce_Storage & +SecondariesCalculator::my_CeStorage() +{ + csv_assert(pCes != 0); + return pCes->Storage(); +} + +inline Type_Storage & +SecondariesCalculator::my_TypeStorage() +{ + csv_assert(pTypes != 0); + return pTypes->Storage(); +} + +inline void +SecondariesCalculator::insert_into2sList( CodeEntity & o_out, + int i_listIndex, + Ce_id i_nCe ) + { o_out.Secondaries().Access_List(i_listIndex).push_back(i_nCe); } + + +SecondariesCalculator::SecondariesCalculator( CeAdmin & i_ces, + TypeAdmin & i_types ) + : pCes(&i_ces), + pTypes(&i_types) +{ +} + +SecondariesCalculator::~SecondariesCalculator() +{ +} + + +void +SecondariesCalculator::CheckAllInterfaceBases() +{ + Module & + rGlobalNamespace = pCes->GlobalNamespace(); + QualifiedName + aXInterface("::com::sun::star::uno::XInterface","::"); + + const Type & + rType = pTypes->CheckIn_Type( aXInterface, + 0, + rGlobalNamespace.CeId(), + 0 ); + Type_id + nTypeXInterface = rType.TypeId(); + const ExplicitType & + rExplType = ary_cast<ExplicitType>(rType); + Ce_id + nCeXInterface = lhf_Search_CeForType(rExplType); + + interface_iterator itEnd( my_CeStorage().End() ); + for ( interface_iterator it( my_CeStorage().BeginUnreserved() ); + it != itEnd; + ++it ) + { + if (NOT it.IsValid()) + continue; + + Interface & + rInterface = *it; + if ( NOT rInterface.HasBase() // According to UNO IDL syntax, an interface without base has com::sun::star::uno::XInterface as base. + AND rInterface.CeId() != nCeXInterface ) // XInterface must not be base of itself. + { + rInterface.Add_Base(nTypeXInterface, 0); + } + } // end for +} + +void +SecondariesCalculator::Connect_Types2Ces() +{ + explicittype_iterator itEnd( my_TypeStorage().End() ); + for ( explicittype_iterator it( my_TypeStorage().BeginUnreserved() ); + it != itEnd; + ++it ) + { + if (NOT it.IsValid()) + continue; + + ExplicitType & + rType = ary_cast<ExplicitType>(*it); + Ce_id + nRelatedCe = lhf_Search_CeForType(rType); + if (nRelatedCe.IsValid()) + { + Ce_Type * + pNew = new Ce_Type(nRelatedCe, rType.TemplateParameters()); + my_TypeStorage().Replace_Entity( rType.TypeId(), + *pNew ); + } + } // end for +} + +void +SecondariesCalculator::Gather_CrossReferences() +{ + gather_Synonyms(); + + for ( stg_iterator it = my_CeStorage().Begin(); + it != my_CeStorage().End(); + ++it ) + { + (*it).Accept( static_cast< SPInst_asHost& >(*this) ); + + } // end for + + sort_All2s(); +} + +void +SecondariesCalculator::Make_Links2DeveloperManual( + const String & i_devman_reffilepath ) +{ +// const autodoc::Options & +// rOptions = TheAutodocManager().TheOptions(); +// +// const String & +// rDeveloperManual_URL +// = rOptions.Get_Extra(autodoc::OPT_developer_guide); +// const String +// rDeveloperManual_ReferenceFile +// = rOptions.Get_Extra(autodoc::OPT_developer_guide_refs_file); + +// if ( rDeveloperManual_URL.length() == 0 +// OR +// rDeveloperManual_ReferenceFile.length() == 0 ) +// { +// return; +// } + + csv::File + aFile(i_devman_reffilepath, csv::CFM_READ); + csv::OpenCloseGuard + aFileOpener(aFile); + if (aFileOpener) + { + Read_Links2DevManual(aFile); + } +} + +namespace +{ + +enum E_LinkMode +{ + link2descr, + link2ref +}; + +struct OrderCeIdsByName +{ + OrderCeIdsByName( + const Ce_Storage & i_storage ) + : rStorage(i_storage), + aNameComparison() {} + bool operator()( + Ce_id i_ce1, + Ce_id i_ce2 ) const + { + return aNameComparison( rStorage[i_ce1].LocalName(), + rStorage[i_ce2].LocalName() ); + } + + private: + const Ce_Storage & rStorage; + LesserName aNameComparison; +}; + + +} + + + +void +SecondariesCalculator::do_Process( const Service & i_rData ) +{ + const Service & + rService = ary_cast<Service>(i_rData); + + // Interfaces: + assignImplementation_toAServicesInterfaces( rService.CeId(), + rService.CeId(), + interface_2s_ExportingServices ); + // Services and their interfaces: + recursive_AssignIncludingService(rService.CeId(), rService); +} + +void +SecondariesCalculator::do_Process( const Interface & i_rData ) +{ + assign_AsDerivedInterface( ary_cast<Interface>(i_rData) ); +} + +void +SecondariesCalculator::do_Process( const Struct & i_rData ) +{ + assign_AsDerivedStruct( ary_cast<Struct>(i_rData) ); +} + +void +SecondariesCalculator::do_Process( const Exception & i_rData ) +{ + assign_AsDerivedException( ary_cast<Exception>(i_rData) ); +} + +void +SecondariesCalculator::do_Process( const Typedef & ) +{ + // KORR_FUTURE + // Find out what was meant here ??? + +// const Typedef & +// rTypedef = ary_cast<Typedef>(i_rData); +} + +void +SecondariesCalculator::do_Process( const Singleton & i_rData ) +{ + const Singleton & + rSingleton = ary_cast<Singleton>(i_rData); + + Service * + pServ = lhf_SearchService(rSingleton.AssociatedService()); + if (pServ != 0) + { + insert_into2sUnique( *pServ, + service_2s_InstantiatingSingletons, + rSingleton.CeId() ); + } + + // Interfaces: + assignImplementation_toAServicesInterfaces( rSingleton.CeId(), + lhf_Search_CeFromTypeId(rSingleton.AssociatedService()), + interface_2s_ExportingSingletons ); +} + +void +SecondariesCalculator::do_Process( const SglIfcService & i_rData ) +{ + const SglIfcService & + rSglIfcService = ary_cast<SglIfcService>(i_rData); + + assignImplementation_toAServicesInterfaces( rSglIfcService.CeId(), + rSglIfcService.CeId(), + interface_2s_ExportingServices ); +} + +void +SecondariesCalculator::do_Process( const SglIfcSingleton & i_rData ) +{ + const SglIfcSingleton & + rSglIfcSingleton = ary_cast<SglIfcSingleton>(i_rData); + + Type_id nBase = rSglIfcSingleton.BaseInterface(); + recursive_AssignImplementation_toExportedInterface( rSglIfcSingleton.CeId(), + nBase, + interface_2s_ExportingSingletons ); +} + +void +SecondariesCalculator::do_Process( const Function & i_rData ) +{ + const Function & + rFunction = ary_cast<Function>(i_rData); + + recursive_AssignFunction_toCeAsReturn(rFunction.CeId(), rFunction.ReturnType()); + + for ( Function::ParamList::const_iterator itp = rFunction.Parameters().begin(); + itp != rFunction.Parameters().end(); + ++itp ) + { + recursive_AssignFunction_toCeAsParameter(rFunction.CeId(), (*itp).Type()); + } // end for (itp) + + for ( Function::ExceptionList::const_iterator itx = rFunction.Exceptions().begin(); + itx != rFunction.Exceptions().end(); + ++itx ) + { + Exception * + pX = lhf_SearchException(*itx); + if (pX != 0) + { + insert_into2sUnique(*pX, exception_2s_RaisingFunctions, rFunction.CeId()); + } + } // end for (itx) +} + +void +SecondariesCalculator::do_Process( const StructElement & i_rData ) +{ + const StructElement & + rStructElement = ary_cast<StructElement>(i_rData); + + recursive_AssignStructElement_toCeAsDataType(rStructElement.CeId(), rStructElement.Type()); +} + +void +SecondariesCalculator::do_Process( const Property & i_rData ) +{ + const Property & + rProperty = ary_cast<Property>(i_rData); + + recursive_AssignStructElement_toCeAsDataType(rProperty.CeId(), rProperty.Type()); +} + +Ce_id +SecondariesCalculator::lhf_Search_CeForType( const ExplicitType & i_rType ) const +{ + const ExplicitNameRoom & + rExplicitNameRoom = ary_cast<ExplicitNameRoom>( + my_TypeStorage()[i_rType.NameRoom()] ); + Find_ModuleNode + rNodeFinder( my_CeStorage(), + rExplicitNameRoom.NameChain_Begin(), + rExplicitNameRoom.NameChain_End(), + i_rType.Name() ); + + if ( rExplicitNameRoom.IsAbsolute() ) + { + const Module & + rGlobalNamespace = ary_cast<Module>( + my_CeStorage()[predefined::ce_GlobalNamespace]); + return Search_SubTree( rGlobalNamespace, + rNodeFinder ); + } + else + { + const Module & + rStartModule = ary_cast<Module>( + my_CeStorage()[i_rType.ModuleOfOccurrence()]); + Ce_id ret = Search_SubTree_UpTillRoot( rStartModule, + rNodeFinder ); + return ret; + } // endif (rExplicitNameRoom.IsAbsolute()) else +} + +Ce_id +SecondariesCalculator::lhf_Search_CeFromTypeId( Type_id i_nType ) const +{ + if (NOT i_nType.IsValid()) + return Ce_id(0); + const Ce_Type * + pType = ary_cast<Ce_Type>( & my_TypeStorage()[i_nType] ); + return pType != 0 + ? pType->RelatedCe() + : Ce_id_Null(); +} + +void +SecondariesCalculator::assign_CurLink( char * i_text, + const String & i_link, + const String & i_linkUI, + bool i_isDescr, + int i_lineCount ) +{ + csv_assert(i_text != 0); + + const ary::idl::Module * + pModule = & ary_cast<Module>( + my_CeStorage()[predefined::ce_GlobalNamespace]); + + char * pPastNext = 0; + char * pNext = i_text; + for ( ; + (pPastNext = strstr(pNext,".")) != 0; + pNext = pPastNext + 1 ) + { + String sNext(pNext, pPastNext-pNext); + Ce_id nModule = pModule->Search_Name(sNext); + if (nModule.IsValid()) + { + pModule = ary_cast<Module>( & my_CeStorage()[nModule] ); + } + else + { + pModule = 0; + } + + if (pModule == 0) + { + Cerr() << "Warning: Invalid line nr. " + << i_lineCount + << " in DevelopersGuide reference file:\n" + << reinterpret_cast< const char* >(i_text) + << "\n" + << Endl(); + return; + } + } // end for + + pPastNext = strchr(pNext,':'); + bool bMember = pPastNext != 0; + String sCe( pNext, (bMember ? csv::str::size(pPastNext-pNext) : csv::str::maxsize) ); + +// KORR_FUTURE +// String sMember(bMember ? pPastNext+1, ""); + + Ce_id nCe = pModule->Search_Name(sCe); + if (NOT nCe.IsValid()) + { + Cerr() << "Warning: Invalid line nr. " + << i_lineCount + << " in DevelopersGuide reference file:\n" + << reinterpret_cast< const char* >(i_text) + << "\n" + << Endl(); + return; + } + + CodeEntity & + rCe = my_CeStorage()[nCe]; + if (NOT bMember) + { + if (i_isDescr) + rCe.Secondaries().Add_Link2DescriptionInManual(i_link, i_linkUI); + else + rCe.Secondaries().Add_Link2RefInManual(i_link, i_linkUI); + return; + } + else + { + // KORR_FUTURE + // Provisorial just doing nothing (or may be + // adding a link at main Ces lists). +// if (i_isDescr) +// rCe.Secondaries().Add_Link2DescriptionInManual(i_link); +// else +// rCe.Secondaries().Add_Link2RefInManual(i_link); + } +} + +void +SecondariesCalculator::gather_Synonyms() +{ + const Ce_Storage & + cstrg = my_CeStorage(); + typedef_citerator itEnd(cstrg.End()); + for ( typedef_citerator it(cstrg.Begin()); + it != itEnd; + ++it ) + { + if (NOT it.IsValid()) + continue; + + const Typedef & + rTypedef = *it; + recursive_AssignAsSynonym(rTypedef.CeId(), rTypedef); + } // end for (itTd) +} + +void +SecondariesCalculator::recursive_AssignAsSynonym( Ce_id i_synonymousTypedefsId, + const Typedef & i_TypedefToCheck ) +{ + Ce_id + nCe = lhf_Search_CeFromTypeId(i_TypedefToCheck.DefiningType()); + if (NOT nCe.IsValid()) + return; + CodeEntity & + rCe = my_CeStorage()[nCe]; + + switch (rCe.AryClass()) // KORR_FUTURE: make this faster, remove switch. + { + case Interface::class_id: + insert_into2sList( rCe, + interface_2s_SynonymTypedefs, + i_synonymousTypedefsId ); + break; + case Struct::class_id: + insert_into2sList( rCe, + struct_2s_SynonymTypedefs, + i_synonymousTypedefsId ); + break; + case Enum::class_id: + insert_into2sList( rCe, + enum_2s_SynonymTypedefs, + i_synonymousTypedefsId ); + break; + case Typedef::class_id: + insert_into2sList( rCe, + typedef_2s_SynonymTypedefs, + i_synonymousTypedefsId ); + recursive_AssignAsSynonym( i_synonymousTypedefsId, + static_cast< Typedef& >(rCe) ); + break; + // default: do nothing. + } +} + +void +SecondariesCalculator::recursive_AssignIncludingService( Ce_id i_includingServicesId, + const Service & i_ServiceToCheckItsIncludes ) +{ + Dyn_StdConstIterator<CommentedRelation> + pIncludedServices; + i_ServiceToCheckItsIncludes.Get_IncludedServices(pIncludedServices); + + for ( StdConstIterator<CommentedRelation> & + itServ = *pIncludedServices; + itServ; + ++itServ ) + { + Service * + pServ = lhf_SearchService((*itServ).Type()); + if (pServ != 0) + { + insert_into2sUnique( *pServ, + service_2s_IncludingServices, + i_includingServicesId + ); + recursive_AssignIncludingService(i_includingServicesId, *pServ); + + } // end if + + assignImplementation_toAServicesInterfaces( i_includingServicesId, + lhf_Search_CeFromTypeId( (*itServ).Type() ), + interface_2s_ExportingServices ); + } // end for +} + +void +SecondariesCalculator::assign_AsDerivedInterface( const Interface & i_rDerived ) +{ + ary::Dyn_StdConstIterator<ary::idl::CommentedRelation> + pHelp; + ary::idl::ifc_interface::attr::Get_Bases(pHelp, i_rDerived); + + for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *pHelp; + it.operator bool(); + ++it ) + { + Interface * + pIfc = lhf_SearchInterface( (*it).Type() ); + if (pIfc == 0) + continue; + + insert_into2sList( *pIfc, + interface_2s_Derivations, + i_rDerived.CeId() ); + } // end for +} + +void +SecondariesCalculator::assign_AsDerivedStruct( const Struct & i_rDerived ) +{ + Type_id + nBase = i_rDerived.Base(); + if (nBase.IsValid()) + { + Struct * + pParent = lhf_SearchStruct(nBase); + if (pParent != 0) + { + insert_into2sList( *pParent, + struct_2s_Derivations, + i_rDerived.CeId() ); + } + } +} + +void +SecondariesCalculator::assign_AsDerivedException( const Exception & i_rDerived ) +{ + Type_id + nBase = i_rDerived.Base(); + if (nBase.IsValid()) + { + Exception * + pParent = lhf_SearchException(nBase); + if (pParent != 0) + { + insert_into2sList( *pParent, + exception_2s_Derivations, + i_rDerived.CeId() ); + } // end if + } // end if +} + +void +SecondariesCalculator::assignImplementation_toAServicesInterfaces( + Ce_id i_nImpl, + Ce_id i_nService, + E_2s_of_Interface i_eList ) +{ + if (NOT i_nService.IsValid()) + return; + Service * + pService = ary_cast<Service>( & my_CeStorage()[i_nService] ); + SglIfcService * + pSglIfcService = ary_cast<SglIfcService>( & my_CeStorage()[i_nService] ); + + if (pService != 0) + { + Dyn_StdConstIterator<CommentedRelation> + pSupportedInterfaces; + pService->Get_SupportedInterfaces(pSupportedInterfaces); + + for ( StdConstIterator<CommentedRelation> & + itInfc = *pSupportedInterfaces; + itInfc.operator bool(); + ++itInfc ) + { + recursive_AssignImplementation_toExportedInterface( i_nImpl, + (*itInfc).Type(), + i_eList ); + } // end for + } + else if (pSglIfcService != 0) + { + Type_id nBase = pSglIfcService->BaseInterface(); + recursive_AssignImplementation_toExportedInterface( i_nImpl, + nBase, + i_eList ); + } // end if +} + +void +SecondariesCalculator::recursive_AssignImplementation_toExportedInterface( + Ce_id i_nService, + Type_id i_nExportedInterface, + E_2s_of_Interface i_eList ) +{ + Interface * + pIfc = lhf_SearchInterface(i_nExportedInterface); + if (pIfc == 0) + return; + + insert_into2sUnique( *pIfc, + i_eList, + i_nService ); + Dyn_StdConstIterator<CommentedRelation> + pBases; + ary::idl::ifc_interface::attr::Get_Bases(pBases, *pIfc); + for ( StdConstIterator<CommentedRelation> & it = *pBases; + it.operator bool(); + ++it ) + { + recursive_AssignImplementation_toExportedInterface(i_nService, (*it).Type(), i_eList); + } +} + +void +SecondariesCalculator::recursive_AssignFunction_toCeAsReturn( Ce_id i_nFunction, + Type_id i_nReturnType ) +{ + Ce_id + nCe = lhf_Search_CeFromTypeId(i_nReturnType); + if (NOT nCe.IsValid()) + return; + + CodeEntity & + rCe = my_CeStorage()[nCe]; + switch (rCe.AryClass()) // KORR_FUTURE: make this faster, remove switch. + { + case Interface::class_id: + insert_into2sList( rCe, + interface_2s_AsReturns, + i_nFunction ); + break; + case Struct::class_id: + insert_into2sList( rCe, + struct_2s_AsReturns, + i_nFunction ); + break; + case Enum::class_id: + insert_into2sList( rCe, + enum_2s_AsReturns, + i_nFunction ); + break; + case Typedef::class_id: + insert_into2sList( rCe, + typedef_2s_AsReturns, + i_nFunction ); + recursive_AssignFunction_toCeAsReturn( i_nFunction, + static_cast< Typedef& >(rCe).DefiningType() ); + break; + // default: do nothing. + } +} + +void +SecondariesCalculator::recursive_AssignFunction_toCeAsParameter( Ce_id i_nFunction, + Type_id i_nParameterType ) +{ + Ce_id + nCe = lhf_Search_CeFromTypeId(i_nParameterType); + if (NOT nCe.IsValid()) + return; + + CodeEntity & + rCe = my_CeStorage()[nCe]; + switch (rCe.AryClass()) // KORR_FUTURE: make this faster, remove switch. + { + case Interface::class_id: + insert_into2sList( rCe, + interface_2s_AsParameters, + i_nFunction ); + break; + case Struct::class_id: + insert_into2sList( rCe, + struct_2s_AsParameters, + i_nFunction ); + break; + case Enum::class_id: + insert_into2sList( rCe, + enum_2s_AsParameters, + i_nFunction ); + break; + case Typedef::class_id: + insert_into2sList( rCe, + typedef_2s_AsParameters, + i_nFunction ); + recursive_AssignFunction_toCeAsParameter( i_nFunction, + static_cast< Typedef& >(rCe).DefiningType() ); + break; + // default: do nothing. + } +} + +void +SecondariesCalculator::recursive_AssignStructElement_toCeAsDataType( Ce_id i_nDataElement, + Type_id i_nDataType ) +{ + Ce_id + nCe = lhf_Search_CeFromTypeId(i_nDataType); + if (NOT nCe.IsValid()) + return; + + CodeEntity & + rCe = my_CeStorage()[nCe]; + switch (rCe.AryClass()) // KORR_FUTURE: make this faster, remove switch. + { + case Interface::class_id: + insert_into2sList( rCe, + interface_2s_AsDataTypes, + i_nDataElement ); + break; + case Struct::class_id: + insert_into2sList( rCe, + struct_2s_AsDataTypes, + i_nDataElement ); + break; + case Enum::class_id: + insert_into2sList( rCe, + enum_2s_AsDataTypes, + i_nDataElement ); + break; + case Typedef::class_id: + insert_into2sList( rCe, + typedef_2s_AsDataTypes, + i_nDataElement ); + recursive_AssignFunction_toCeAsParameter( i_nDataElement, + static_cast< Typedef& >(rCe).DefiningType() ); + break; + // default: do nothing. + } // end switch +} + +void +SecondariesCalculator::insert_into2sUnique( CodeEntity & o_out, + int i_listIndex, + Ce_id i_nCe ) +{ + std::vector<Ce_id> & + rOut = o_out.Secondaries().Access_List(i_listIndex); + if (std::find(rOut.begin(),rOut.end(),i_nCe) != rOut.end()) + return; + rOut.push_back(i_nCe); +} + +void +SecondariesCalculator::sort_All2s() +{ + OrderCeIdsByName + aIdOrdering(my_CeStorage()); + + for ( stg_iterator it = my_CeStorage().Begin(); + it != my_CeStorage().End(); + ++it ) + { + Ce_2s & + r2s = (*it).Secondaries(); + int iCount = r2s.CountXrefLists(); + for (int i = 0; i < iCount; ++i) + { + std::sort( r2s.Access_List(i).begin(), + r2s.Access_List(i).end(), + aIdOrdering ); + } // end for (i) + } // end for (it) +} + +void +SecondariesCalculator::Read_Links2DevManual( csv::bstream & i_file ) +{ + StreamLock aLine(300); + StreamStr & rLine = aLine(); + + + String sCurLink; + String sCurLinkUI; + E_LinkMode eCurMode = link2ref; + + int lineCount = 0; + const char * sLink = "LINK:"; + const char * sDescr = "DESCR:"; + const char * sTopic = "TOPIC:"; + const char * sRef = "REF:"; + const UINT8 cMaxASCIINumWhiteSpace = 32; + + while (NOT i_file.eod()) + { + ++lineCount; + + rLine.reset(); + rLine.operator_read_line(i_file); + + if ( *rLine.c_str() >= 'a' ) + { + assign_CurLink(rLine.begin(), sCurLink, sCurLinkUI, eCurMode == link2descr, lineCount); + } + else if ( strncmp(rLine.c_str(), sLink, strlen(sLink)) == 0 ) + { + sCurLink = rLine.c_str()+5; + sCurLinkUI.clear(); + } + else if ( strncmp(rLine.c_str(), sDescr, strlen(sDescr)) == 0 ) + { + sCurLinkUI = rLine.c_str()+6; + } + else if ( strncmp(rLine.c_str(), sTopic, strlen(sTopic)) == 0 ) + { + eCurMode = link2descr; + } + else if ( strncmp(rLine.c_str(), sRef, strlen(sRef)) == 0 ) + { + eCurMode = link2ref; + } + else if (static_cast<UINT8>(*rLine.c_str()) > cMaxASCIINumWhiteSpace) + { + assign_CurLink(rLine.begin(), sCurLink, sCurLinkUI, eCurMode == link2descr, lineCount); + } + // else + // Ignore empty line. + + } // end while +} + + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i2s_calculator.hxx b/autodoc/source/ary/idl/i2s_calculator.hxx new file mode 100644 index 000000000000..2ebde4d9400c --- /dev/null +++ b/autodoc/source/ary/idl/i2s_calculator.hxx @@ -0,0 +1,295 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDL_I2S_CALCULATOR_HXX +#define ARY_IDL_I2S_CALCULATOR_HXX + + +// USED SERVICES + // BASE CLASSES +#include <cosv/tpl/processor.hxx> + // PARAMETERS +#include <ary/idl/i_types4idl.hxx> + + +namespace ary +{ +namespace idl +{ + class CeAdmin; + class Ce_Storage; + class TypeAdmin; + class Type_Storage; + class Module; + class ExplicitType; + class Function; + class Interface; + class Property; + class Typedef; + class Service; + class Singleton; + class SglIfcService; + class SglIfcSingleton; + class Struct; + class StructElement; + class Exception; + class Ce_2s; +} +} + + + + + + +namespace ary +{ +namespace idl +{ + + +enum E_2s_of_Service +{ + service_2s_IncludingServices, + service_2s_InstantiatingSingletons +}; + +enum E_2s_of_Interface +{ + interface_2s_Derivations, + interface_2s_ExportingServices, + interface_2s_ExportingSingletons, + interface_2s_SynonymTypedefs, +// interface_2s_UsingTypedefs, + interface_2s_AsReturns, +// interface_2s_AsIndirectReturns, + interface_2s_AsParameters, +// interface_2s_AsIndirectParameters, + interface_2s_AsDataTypes +}; + +enum E_2s_of_Struct +{ + struct_2s_Derivations, + struct_2s_SynonymTypedefs, +// struct_2s_UsingTypedefs, + struct_2s_AsReturns, +// struct_2s_AsIndirectReturns, + struct_2s_AsParameters, +// struct_2s_AsIndirectParameters, + struct_2s_AsDataTypes +}; + +enum E_2s_of_Enum +{ + enum_2s_SynonymTypedefs, +// enum_2s_UsingTypedefs, + enum_2s_AsReturns, +// enum_2s_AsIndirectReturns, + enum_2s_AsParameters, +// enum_2s_AsIndirectParameters, + enum_2s_AsDataTypes +}; + +enum E_2s_of_Typedef +{ + typedef_2s_SynonymTypedefs, +// typedef_2s_UsingTypedefs, + typedef_2s_AsReturns, +// typedef_2s_AsIndirectReturns, + typedef_2s_AsParameters, +// typedef_2s_AsIndirectParameters, + typedef_2s_AsDataTypes +}; + +enum E_2s_of_Exceptions +{ + exception_2s_Derivations, + exception_2s_RaisingFunctions +}; + + + +class SPInst_asHost : public csv::ProcessorIfc, + public csv::ConstProcessor<Service>, + public csv::ConstProcessor<Interface>, + public csv::ConstProcessor<Struct>, + public csv::ConstProcessor<Exception>, + public csv::ConstProcessor<Typedef>, + public csv::ConstProcessor<Singleton>, + public csv::ConstProcessor<Function>, + public csv::ConstProcessor<StructElement>, + public csv::ConstProcessor<Property>, + public csv::ConstProcessor<SglIfcService>, + public csv::ConstProcessor<SglIfcSingleton> +{ +}; + + + + +/** This class scans the parsed data and produces several + secondary data like cross references and alphabetical indices. + + In this declaration "Secondaries" or "2s" mean those secondary data. + + @see Ce_2s +*/ +class SecondariesCalculator : public SPInst_asHost +{ + public: + // LIFECYCLE + SecondariesCalculator( + CeAdmin & i_ces, + TypeAdmin & i_types ); + virtual ~SecondariesCalculator(); + + // OPERATIONS + void CheckAllInterfaceBases(); + void Connect_Types2Ces(); + void Gather_CrossReferences(); + void Make_Links2DeveloperManual( + const String & i_devman_reffilepath ); + + private: + // Interface CeHost These are the points to gather cross + // references: + virtual void do_Process( + const Service & i_rData ); + virtual void do_Process( + const Interface & i_rData ); + virtual void do_Process( + const Struct & i_rData ); + virtual void do_Process( + const Exception & i_rData ); + virtual void do_Process( + const Typedef & i_rData ); + virtual void do_Process( + const Singleton & i_rData ); + virtual void do_Process( + const Function & i_rData ); + virtual void do_Process( + const StructElement & + i_rData ); + virtual void do_Process( + const Property & i_rData ); + virtual void do_Process( + const SglIfcService & + i_rData ); + virtual void do_Process( + const SglIfcSingleton & + i_rData ); + + // Locals + const Ce_Storage & my_CeStorage() const; + const Type_Storage & + my_TypeStorage() const; + Ce_Storage & my_CeStorage(); + Type_Storage & my_TypeStorage(); + + template <class DEST> + DEST * SearchCe4Type( + Type_id i_type ); + Ce_id lhf_Search_CeForType( + const ExplicitType & + i_rType ) const; + Ce_id lhf_Search_CeFromTypeId( + Type_id i_nType ) const; + Service * lhf_SearchService( + Type_id i_nServ ); + Interface * lhf_SearchInterface( + Type_id i_nIfc ); + Struct * lhf_SearchStruct( + Type_id i_nIfc ); + Exception * lhf_SearchException( + Type_id i_nIfc ); + void assign_CurLink( + char * i_text, + const String & i_link, + const String & i_linkUI, + bool i_isDescr, /// @descr true: description, false: reference. + int i_lineCount ); + void gather_Synonyms(); + void recursive_AssignAsSynonym( + Ce_id i_synonymousTypedefsId, + const Typedef & i_TypedefToCheck ); + void recursive_AssignIncludingService( + Ce_id i_includingServicesId, + const Service & i_ServiceToCheckItsIncludes ); + void assign_AsDerivedInterface( + const Interface & i_rDerived ); + void assign_AsDerivedStruct( + const Struct & i_rDerived ); + void assign_AsDerivedException( + const Exception & i_rDerived ); + void assignImplementation_toAServicesInterfaces( + Ce_id i_nImpl, + Ce_id i_nService, + E_2s_of_Interface i_eList ); + void recursive_AssignImplementation_toExportedInterface( + Ce_id i_nService, + Type_id i_nExportedInterface, + E_2s_of_Interface i_eList ); + void recursive_AssignFunction_toCeAsReturn( + Ce_id i_nFunction, + Type_id i_nReturnType ); + void recursive_AssignFunction_toCeAsParameter( + Ce_id i_nFunction, + Type_id i_nParameterType ); + + /** @param i_nDataElement + May be the ID of an struct element as well as an exception element + or a property. + */ + void recursive_AssignStructElement_toCeAsDataType( + Ce_id i_nDataElement, + Type_id i_nDataType ); + void insert_into2sList( + CodeEntity & o_out, + int i_listIndex, + Ce_id i_nCe ); + void insert_into2sUnique( + CodeEntity & o_out, + int i_listIndex, + Ce_id i_nCe ); + /// Sorts secondary production lists alphabetical. + void sort_All2s(); + + void Read_Links2DevManual( + csv::bstream & i_file ); + + // DATA + CeAdmin * pCes; + TypeAdmin * pTypes; +}; + + + + +} // namespace idl +} // namespace ary +#endif diff --git a/autodoc/source/ary/idl/i_attribute.cxx b/autodoc/source/ary/idl/i_attribute.cxx new file mode 100644 index 000000000000..ec78a58bd758 --- /dev/null +++ b/autodoc/source/ary/idl/i_attribute.cxx @@ -0,0 +1,159 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_attribute.hxx> +#include <ary/idl/ik_attribute.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <ary/getncast.hxx> +#include <sci_impl.hxx> + + +namespace ary +{ +namespace idl +{ + + +Attribute::Attribute( const String & i_sName, + Ce_id i_nService, + Ce_id i_nModule, + Type_id i_nType, + bool i_bReadonly, + bool i_bBound ) + : sName(i_sName), + nOwner(i_nService), + nNameRoom(i_nModule), + nType(i_nType), + aGetExceptions(), + aSetExceptions(), + bReadonly(i_bReadonly), + bBound(i_bBound) +{ +} + +Attribute::~Attribute() +{ +} + + +void +Attribute::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor,*this); +} + +ClassId +Attribute::get_AryClass() const +{ + return class_id; +} + +const String & +Attribute::inq_LocalName() const +{ + return sName; +} + +Ce_id +Attribute::inq_NameRoom() const +{ + return nNameRoom; +} + +Ce_id +Attribute::inq_Owner() const +{ + return nOwner; +} + +E_SightLevel +Attribute::inq_SightLevel() const +{ + return sl_Member; +} + +namespace ifc_attribute +{ + +inline const Attribute & +attribute_cast( const CodeEntity & i_ce ) +{ + csv_assert( is_type<Attribute>(i_ce) ); + return static_cast< const Attribute& >(i_ce); +} + +bool +attr::HasAnyStereotype( const CodeEntity & i_ce ) +{ + const Attribute & rAttr = attribute_cast(i_ce); + return rAttr.bReadonly OR rAttr.bBound; +} + +bool +attr::IsReadOnly( const CodeEntity & i_ce ) +{ + return attribute_cast(i_ce).bReadonly; +} + +bool +attr::IsBound( const CodeEntity & i_ce ) +{ + return attribute_cast(i_ce).bBound; +} + +Type_id +attr::Type( const CodeEntity & i_ce ) +{ + return attribute_cast(i_ce).nType; +} + +void +attr::Get_GetExceptions( Dyn_TypeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result + = new SCI_Vector<Type_id>( attribute_cast(i_ce).aGetExceptions ); +} + +void +attr::Get_SetExceptions( Dyn_TypeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result + = new SCI_Vector<Type_id>( attribute_cast(i_ce).aSetExceptions ); +} + + +} // namespace ifc_attribute + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_ce.cxx b/autodoc/source/ary/idl/i_ce.cxx new file mode 100644 index 000000000000..783e3a9b93f7 --- /dev/null +++ b/autodoc/source/ary/idl/i_ce.cxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_ce.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/doc/d_oldidldocu.hxx> +#include <ary/getncast.hxx> + + +namespace ary +{ +namespace idl +{ + +namespace +{ + const Ce_2s aConstCe2sDummy; +} + + + +CodeEntity::CodeEntity() + : aDocu(), + p2s(0) +{ +} + +CodeEntity::~CodeEntity() +{ +} + +const Ce_2s & +CodeEntity::Secondaries() const +{ + if (p2s) + return *p2s; + return aConstCe2sDummy; +} + +Ce_2s & +CodeEntity::Secondaries() +{ + if (p2s) + return *p2s; + p2s = Ce_2s::Create_(AryClass()); + return *p2s; +} + + + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_ce2s.cxx b/autodoc/source/ary/idl/i_ce2s.cxx new file mode 100644 index 000000000000..0898b7867086 --- /dev/null +++ b/autodoc/source/ary/idl/i_ce2s.cxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_ce.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <ary/getncast.hxx> + + +namespace ary +{ +namespace idl +{ + +namespace +{ +const std::vector<Ce_id> C_sNullVector_Ce_ids; +} + + +Ce_2s::~Ce_2s() +{ + csv::erase_container_of_heap_ptrs(aXrefLists); +} + +DYN Ce_2s * +Ce_2s::Create_( ClassId ) +{ + return new Ce_2s; +} + + +std::vector<Ce_id> & +Ce_2s::Access_List( int i_indexOfList ) +{ + csv_assert(i_indexOfList >= 0 AND i_indexOfList < 1000); + + while (i_indexOfList >= (int) aXrefLists.size()) + { + aXrefLists.push_back(new std::vector<Ce_id>); + } + return *aXrefLists[i_indexOfList]; +} + +const std::vector<Ce_id> & +Ce_2s::List( int i_indexOfList ) const +{ + if (uintt(i_indexOfList) < aXrefLists.size()) + return *aXrefLists[i_indexOfList]; + else + return C_sNullVector_Ce_ids; +} + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_comrela.cxx b/autodoc/source/ary/idl/i_comrela.cxx new file mode 100644 index 000000000000..8f5d164b5479 --- /dev/null +++ b/autodoc/source/ary/idl/i_comrela.cxx @@ -0,0 +1,47 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_comrela.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/ary.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/idl/ip_type.hxx> + + +namespace ary +{ +namespace idl +{ + +// KORR_FUTURE Currently unneeded file. May become useful later. + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_constant.cxx b/autodoc/source/ary/idl/i_constant.cxx new file mode 100644 index 000000000000..ac6a7124935f --- /dev/null +++ b/autodoc/source/ary/idl/i_constant.cxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_constant.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <ary/idl/ik_constant.hxx> + + +namespace ary +{ +namespace idl +{ + +Constant::Constant( const String & i_sName, + Ce_id i_nOwner, + Ce_id i_nNameRoom, + Type_id i_nType, + const String & i_sInitValue ) + : sName(i_sName), + nNameRoom(i_nNameRoom), + nOwner(i_nOwner), + nType(i_nType), + sInitValue(i_sInitValue) +{ +} + +Constant::~Constant() +{ +} + +void +Constant::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + + +ClassId +Constant::get_AryClass() const +{ + return class_id; +} + +const String & +Constant::inq_LocalName() const +{ + return sName; +} + +Ce_id +Constant::inq_NameRoom() const +{ + return nNameRoom; +} + +Ce_id +Constant::inq_Owner() const +{ + return nOwner; +} + +E_SightLevel +Constant::inq_SightLevel() const +{ + return sl_Member; +} + + +namespace ifc_constant +{ + +inline const Constant & +constant_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == Constant::class_id ); + return static_cast< const Constant& >(i_ce); +} + +Type_id +attr::Type( const CodeEntity & i_ce ) +{ + return constant_cast(i_ce).nType; +} + +const String & +attr::Value( const CodeEntity & i_ce ) +{ + return constant_cast(i_ce).sInitValue; +} + +} // namespace ifc_constant + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_constgroup.cxx b/autodoc/source/ary/idl/i_constgroup.cxx new file mode 100644 index 000000000000..434b054ea3f1 --- /dev/null +++ b/autodoc/source/ary/idl/i_constgroup.cxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_constgroup.hxx> +#include <ary/idl/ik_constgroup.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <sci_impl.hxx> + + +namespace ary +{ +namespace idl +{ + + +ConstantsGroup::ConstantsGroup( const String & i_sName, + Ce_id i_nModule ) + : sName(i_sName), + nModule(i_nModule), + aConstants() +{ +} + +ConstantsGroup::~ConstantsGroup() +{ +} + +void +ConstantsGroup::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +ConstantsGroup::get_AryClass() const +{ + return class_id; +} + +const String & +ConstantsGroup::inq_LocalName() const +{ + return sName; +} + +Ce_id +ConstantsGroup::inq_NameRoom() const +{ + return nModule; +} + +Ce_id +ConstantsGroup::inq_Owner() const +{ + return nModule; +} + +E_SightLevel +ConstantsGroup::inq_SightLevel() const +{ + return sl_File; +} + + +namespace ifc_constgroup +{ + +inline const ConstantsGroup & +constgroup_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == ConstantsGroup::class_id ); + return static_cast< const ConstantsGroup& >(i_ce); +} + +void +attr::Get_Constants( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(constgroup_cast(i_ce).aConstants); +} + +} // namespace ifc_constgroup + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_enum.cxx b/autodoc/source/ary/idl/i_enum.cxx new file mode 100644 index 000000000000..30ee8e39e146 --- /dev/null +++ b/autodoc/source/ary/idl/i_enum.cxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_enum.hxx> +#include <ary/idl/ik_enum.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <sci_impl.hxx> +#include "i2s_calculator.hxx" + + +namespace ary +{ +namespace idl +{ + +Enum::Enum( const String & i_sName, + Ce_id i_nOwner ) + : sName(i_sName), + nOwner(i_nOwner), + aValues() +{ +} + +Enum::~Enum() +{ +} + +void +Enum::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +Enum::get_AryClass() const +{ + return class_id; +} + +const String & +Enum::inq_LocalName() const +{ + return sName; +} + +Ce_id +Enum::inq_NameRoom() const +{ + return nOwner; +} + +Ce_id +Enum::inq_Owner() const +{ + return nOwner; +} + +E_SightLevel +Enum::inq_SightLevel() const +{ + return sl_File; +} + + +namespace ifc_enum +{ + +inline const Enum & +enum_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == Enum::class_id ); + return static_cast< const Enum& >(i_ce); +} + +void +attr::Get_Values( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(enum_cast(i_ce).aValues); +} + + +void +xref::Get_SynonymTypedefs( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(enum_2s_SynonymTypedefs)); +} + +void +xref::Get_AsReturns( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(enum_2s_AsReturns)); +} + +void +xref::Get_AsParameters( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(enum_2s_AsParameters)); +} + +void +xref::Get_AsDataTypes( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(enum_2s_AsDataTypes)); +} + +} // namespace ifc_enum + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_enumvalue.cxx b/autodoc/source/ary/idl/i_enumvalue.cxx new file mode 100644 index 000000000000..7ee139f9ba4c --- /dev/null +++ b/autodoc/source/ary/idl/i_enumvalue.cxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_enumvalue.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <ary/idl/ik_enumvalue.hxx> + + +namespace ary +{ +namespace idl +{ + +EnumValue::EnumValue( const String & i_sName, + Ce_id i_nOwner, + Ce_id i_nNameRoom, + const String & i_sInitValue ) + : sName(i_sName), + nOwner(i_nOwner), + nNameRoom(i_nNameRoom), + sValue(i_sInitValue) +{ +} + +EnumValue::~EnumValue() +{ +} + +void +EnumValue::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +EnumValue::get_AryClass() const +{ + return class_id; +} + +const String & +EnumValue::inq_LocalName() const +{ + return sName; +} + +Ce_id +EnumValue::inq_NameRoom() const +{ + return nNameRoom; +} + +Ce_id +EnumValue::inq_Owner() const +{ + return nOwner; +} + +E_SightLevel +EnumValue::inq_SightLevel() const +{ + return sl_Member; +} + + + +namespace ifc_enumvalue +{ + +inline const EnumValue & +enumvalue_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == EnumValue::class_id ); + return static_cast< const EnumValue& >(i_ce); +} + +const String & +attr::Value( const CodeEntity & i_ce ) +{ + return enumvalue_cast(i_ce).sValue; +} + + +} // namespace ifc_enumvalue + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_exception.cxx b/autodoc/source/ary/idl/i_exception.cxx new file mode 100644 index 000000000000..cf98da1719a7 --- /dev/null +++ b/autodoc/source/ary/idl/i_exception.cxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_exception.hxx> +#include <ary/idl/ik_exception.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <sci_impl.hxx> +#include "i2s_calculator.hxx" + + + +namespace ary +{ +namespace idl +{ + +Exception::Exception( const String & i_sName, + Ce_id i_nOwner, + Type_id i_nBase ) + : sName(i_sName), + nOwner(i_nOwner), + nBase(i_nBase), + aElements() +{ +} + +Exception::~Exception() +{ +} + +void +Exception::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +Exception::get_AryClass() const +{ + return class_id; +} + +const String & +Exception::inq_LocalName() const +{ + return sName; +} + +Ce_id +Exception::inq_NameRoom() const +{ + return nOwner; +} + +Ce_id +Exception::inq_Owner() const +{ + return nOwner; +} + +E_SightLevel +Exception::inq_SightLevel() const +{ + return sl_File; +} + + +namespace ifc_exception +{ + +inline const Exception & +exception_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == Exception::class_id ); + return static_cast< const Exception& >(i_ce); +} + +Type_id +attr::Base( const CodeEntity & i_ce ) +{ + return exception_cast(i_ce).nBase; +} + +void +attr::Get_Elements( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>( exception_cast(i_ce).aElements ); +} + + +void +xref::Get_Derivations( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(exception_2s_Derivations)); +} + +void +xref::Get_RaisingFunctions( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(exception_2s_RaisingFunctions)); +} + + +} // namespace ifc_exception + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_function.cxx b/autodoc/source/ary/idl/i_function.cxx new file mode 100644 index 000000000000..141ebb084c32 --- /dev/null +++ b/autodoc/source/ary/idl/i_function.cxx @@ -0,0 +1,165 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_function.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <sci_impl.hxx> + + + +namespace ary +{ +namespace idl +{ + +Function::Function( const String & i_sName, + Ce_id i_nOwner, + Ce_id i_nNameRoom, + Type_id i_nReturnType, + bool i_bOneWay ) + : sName(i_sName), + nOwner(i_nOwner), + nNameRoom(i_nNameRoom), + nReturnType(i_nReturnType), + aParameters(), + aExceptions(), + bOneWay(i_bOneWay), + bEllipse(false) +{ +} + +Function::Function( const String & i_sName, + Ce_id i_nOwner, + Ce_id i_nNameRoom ) + : sName(i_sName), + nOwner(i_nOwner), + nNameRoom(i_nNameRoom), + nReturnType(0), + aParameters(), + aExceptions(), + bOneWay(false), + bEllipse(false) +{ +} + +Function::~Function() +{ +} + +void +Function::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +Function::get_AryClass() const +{ + return class_id; +} + +const String & +Function::inq_LocalName() const +{ + return sName; +} + +Ce_id +Function::inq_NameRoom() const +{ + return nNameRoom; +} + +Ce_id +Function::inq_Owner() const +{ + return nOwner; +} + +E_SightLevel +Function::inq_SightLevel() const +{ + return sl_Member; +} + + +namespace ifc_function +{ + +inline const Function & +function_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == Function::class_id ); + return static_cast< const Function& >(i_ce); +} + +Type_id +attr::ReturnType( const CodeEntity & i_ce ) +{ + return function_cast(i_ce).nReturnType; +} + +bool +attr::IsOneway( const CodeEntity & i_ce ) +{ + return function_cast(i_ce).bOneWay; +} + +bool +attr::HasEllipse( const CodeEntity & i_ce ) +{ + return function_cast(i_ce).bEllipse; +} + +void +attr::Get_Parameters( Dyn_StdConstIterator<ary::idl::Parameter> & o_result, + const CodeEntity & i_ce ) +{ + o_result + = new SCI_Vector<Parameter>( function_cast(i_ce).aParameters ); +} + +void +attr::Get_Exceptions( Dyn_TypeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result + = new SCI_Vector<Type_id>( function_cast(i_ce).aExceptions ); +} + + + + + +} // namespace ifc_function + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_interface.cxx b/autodoc/source/ary/idl/i_interface.cxx new file mode 100644 index 000000000000..4e4b61a071eb --- /dev/null +++ b/autodoc/source/ary/idl/i_interface.cxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_interface.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <ary/idl/ik_interface.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <sci_impl.hxx> +#include "i2s_calculator.hxx" + + +namespace ary +{ +namespace idl +{ + + +class Interface_2s +{ +}; + + +Interface::Interface( const String & i_sName, + Ce_id i_nOwner ) + : sName(i_sName), + nOwner(i_nOwner), + aBases(), + aFunctions(), + aAttributes(), + p2s() +{ +} + +Interface::~Interface() +{ + for ( RelationList::iterator it = aBases.begin(); + it != aBases.end(); + ++it ) + { + delete (*it).Info(); + } +} + +void +Interface::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +Interface::get_AryClass() const +{ + return class_id; +} + +const String & +Interface::inq_LocalName() const +{ + return sName; +} + +Ce_id +Interface::inq_NameRoom() const +{ + return nOwner; +} + +Ce_id +Interface::inq_Owner() const +{ + return nOwner; +} + +E_SightLevel +Interface::inq_SightLevel() const +{ + return sl_File; +} + + +namespace ifc_interface +{ + +inline const Interface & +interface_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == Interface::class_id ); + return static_cast< const Interface& >(i_ce); +} + +void +attr::Get_Bases( Dyn_StdConstIterator<CommentedRelation> & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<CommentedRelation>(interface_cast(i_ce).aBases); +} + +void +attr::Get_Functions( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(interface_cast(i_ce).aFunctions); +} + +void +attr::Get_Attributes( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(interface_cast(i_ce).aAttributes); +} + +void +xref::Get_Derivations( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(interface_2s_Derivations)); +} + +void +xref::Get_SynonymTypedefs( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(interface_2s_SynonymTypedefs)); +} + +void +xref::Get_ExportingServices( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(interface_2s_ExportingServices)); +} + +void +xref::Get_ExportingSingletons( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(interface_2s_ExportingSingletons)); +} + +void +xref::Get_AsReturns( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(interface_2s_AsReturns)); +} + +void +xref::Get_AsParameters( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(interface_2s_AsParameters)); +} + +void +xref::Get_AsDataTypes( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(interface_2s_AsDataTypes)); +} + + + + +} // namespace ifc_interface + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_module.cxx b/autodoc/source/ary/idl/i_module.cxx new file mode 100644 index 000000000000..b5b7453fa3b0 --- /dev/null +++ b/autodoc/source/ary/idl/i_module.cxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_module.hxx> +#include <ary/idl/ik_module.hxx> + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/i_service.hxx> +#include <ary/idl/i_interface.hxx> +#include <ary/idl/i_struct.hxx> +#include <ary/idl/i_exception.hxx> +#include <ary/idl/i_enum.hxx> +#include <ary/idl/i_typedef.hxx> +#include <ary/idl/i_constgroup.hxx> +#include <ary/idl/i_singleton.hxx> +#include <ary/idl/i_siservice.hxx> +#include <ary/idl/i_sisingleton.hxx> +#include <ary/idl/ip_ce.hxx> +#include <nametreenode.hxx> + + +namespace ary +{ +namespace idl +{ + +Module::Module() + : pImpl( new NameTreeNode<Ce_id> ) +{ +} + +Module::Module( const String & i_sName, + const Module & i_rParent ) + : pImpl( new NameTreeNode<Ce_id>( i_sName, + *i_rParent.pImpl, + i_rParent.CeId() ) ) +{ +} + +Module::~Module() +{ +} + +void +Module::Add_Name( const String & i_sName, + Ce_id i_nCodeEntity ) +{ + pImpl->Add_Name(i_sName, i_nCodeEntity); +} + +Ce_id +Module::Search_Name( const String & i_sName ) const +{ + return pImpl->Search_Name(i_sName); +} + +void +Module::Get_Names( Dyn_StdConstIterator<Ce_id> & o_rResult ) const +{ + pImpl->Get_Names( o_rResult ); +} + +void +Module::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +Module::get_AryClass() const +{ + return class_id; +} + +const String & +Module::inq_LocalName() const +{ + return pImpl->Name(); +} + +Ce_id +Module::inq_NameRoom() const +{ + return pImpl->Parent(); +} + +Ce_id +Module::inq_Owner() const +{ + return pImpl->Parent(); +} + +E_SightLevel +Module::inq_SightLevel() const +{ + return sl_Module; +} + + +namespace ifc_module +{ + +inline const Module & +module_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == Module::class_id ); + return static_cast< const Module& >(i_ce); +} + +typedef NameTreeNode<Ce_id>::Map_LocalNames NameMap; + +void +attr::Get_AllChildrenSeparated( std::vector< const CodeEntity* > & o_nestedModules, + std::vector< const CodeEntity* > & o_services, + std::vector< const CodeEntity* > & o_interfaces, + std::vector< const CodeEntity* > & o_structs, + std::vector< const CodeEntity* > & o_exceptions, + std::vector< const CodeEntity* > & o_enums, + std::vector< const CodeEntity* > & o_typedefs, + std::vector< const CodeEntity* > & o_constantGroups, + std::vector< const CodeEntity* > & o_singletons, + const CePilot & i_pilot, + const CodeEntity & i_ce ) +{ + const CodeEntity * + pCe = 0; + NameMap::const_iterator + itEnd = module_cast(i_ce).pImpl->LocalNames().end(); + for ( NameMap::const_iterator + it = module_cast(i_ce).pImpl->LocalNames().begin(); + it != itEnd; + ++it ) + { + pCe = &i_pilot.Find_Ce( (*it).second ); + switch (pCe->AryClass()) + { + case Module::class_id: + o_nestedModules.push_back(pCe); + break; + case SglIfcService::class_id: + case Service::class_id: + o_services.push_back(pCe); + break; + case Interface::class_id: + o_interfaces.push_back(pCe); + break; + case Struct::class_id: + o_structs.push_back(pCe); + break; + case Exception::class_id: + o_exceptions.push_back(pCe); + break; + case Enum::class_id: + o_enums.push_back(pCe); + break; + case Typedef::class_id: + o_typedefs.push_back(pCe); + break; + case ConstantsGroup::class_id: + o_constantGroups.push_back(pCe); + break; + case SglIfcSingleton::class_id: + case Singleton::class_id: + o_singletons.push_back(pCe); + break; + } + } // end for +} + + +} // namespace ifc_module + + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_namelookup.cxx b/autodoc/source/ary/idl/i_namelookup.cxx new file mode 100644 index 000000000000..5b07d5a73c16 --- /dev/null +++ b/autodoc/source/ary/idl/i_namelookup.cxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_namelookup.hxx> + +// NOT FULLY DECLARED SERVICES +#include <sci_impl.hxx> + +namespace ary +{ +namespace idl +{ + +NameLookup::NameLookup() + : aNames() +{ +} + +NameLookup::~NameLookup() +{ +} + +void +NameLookup::Add_Name( const String & i_name, + Ce_id i_id, + ClassId i_class, + Ce_id i_owner ) +{ + aNames.insert( std::pair< const String, NameProperties>( + i_name, + NameProperties( i_id, + i_class, + i_owner ))); +} + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_nnfinder.hxx b/autodoc/source/ary/idl/i_nnfinder.hxx new file mode 100644 index 000000000000..3355a5f89030 --- /dev/null +++ b/autodoc/source/ary/idl/i_nnfinder.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDL_NNFINDER_HXX +#define ARY_IDL_NNFINDER_HXX + +// USED SERVICES +#include "is_ce.hxx" + + + + +namespace ary +{ +namespace idl +{ + + +/** Gives context info for tree search functions. + + @collab ->ary::Search_SubTree<>() + @collab ->ary::Search_SubTree_UpTillRoot<>() +*/ +class Find_ModuleNode +{ + public: + typedef Ce_id id_type; + typedef StringVector::const_iterator name_iterator; + + // LIFECYCLE + Find_ModuleNode( + const Ce_Storage & i_rStorage, + name_iterator it_begin, + name_iterator it_end, + const String & i_sName ) + : rStorage(i_rStorage), + itBegin(it_begin), + itEnd(it_end), + sName2Search(i_sName) { if (itBegin != itEnd ? (*itBegin).empty() : false) ++itBegin; } + // OPERATIONS + const Module * operator()( + id_type i_id ) const + { return i_id.IsValid() + ? & ary_cast<Module>(rStorage[i_id]) + : 0; } + + name_iterator Begin() const { return itBegin; } + name_iterator End() const { return itEnd; } + const String & Name2Search() const { return sName2Search; } + + private: + // DATA + const Ce_Storage & rStorage; + name_iterator itBegin; + name_iterator itEnd; + String sName2Search; +}; + + + + +class Types_forSetCe_Id +{ + public: + typedef Ce_id element_type; + typedef Ce_Storage find_type; + + // KORR_FUTURE: Check, if this sorting is right or the ary standard + // sorting should be used. + struct sort_type + { + sort_type( + const find_type & i_rFinder ) + : rFinder(i_rFinder) {} + bool operator()( + const element_type & + i_r1, + const element_type & + i_r2 ) const + { + return rFinder[i_r1].LocalName() + < rFinder[i_r2].LocalName(); + } + + private: + const find_type & rFinder; + + }; +}; + + +} // namespace idl +} // namespace ary +#endif diff --git a/autodoc/source/ary/idl/i_param.cxx b/autodoc/source/ary/idl/i_param.cxx new file mode 100644 index 000000000000..bdaadeee0964 --- /dev/null +++ b/autodoc/source/ary/idl/i_param.cxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_param.hxx> + + +// NOT FULLY DEFINED SERVICES + + + +namespace ary +{ +namespace idl +{ + +Parameter::Parameter( const String & i_sName, + Type_id i_nType, + E_ParameterDirection i_eDirection ) + : sName(i_sName), + nType(i_nType), + eDirection(i_eDirection) +{ +} + +Parameter::~Parameter() +{ +} + + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_property.cxx b/autodoc/source/ary/idl/i_property.cxx new file mode 100644 index 000000000000..852e06f4ced0 --- /dev/null +++ b/autodoc/source/ary/idl/i_property.cxx @@ -0,0 +1,171 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_property.hxx> +#include <ary/idl/ik_property.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> + + +namespace ary +{ +namespace idl +{ + + +Property::Property( const String & i_sName, + Ce_id i_nService, + Ce_id i_nModule, + Type_id i_nType, + Stereotypes i_stereotypes ) + : sName(i_sName), + nOwner(i_nService), + nNameRoom(i_nModule), + nType(i_nType), + aStereotypes(i_stereotypes) +{ +} + +Property::~Property() +{ +} + + +void +Property::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +Property::get_AryClass() const +{ + return class_id; +} + +const String & +Property::inq_LocalName() const +{ + return sName; +} + +Ce_id +Property::inq_NameRoom() const +{ + return nNameRoom; +} + +Ce_id +Property::inq_Owner() const +{ + return nOwner; +} + +E_SightLevel +Property::inq_SightLevel() const +{ + return sl_Member; +} + +namespace ifc_property +{ + +inline const Property & +property_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == Property::class_id ); + return static_cast< const Property& >(i_ce); +} + +bool +attr::HasAnyStereotype( const CodeEntity & i_ce ) +{ + return property_cast(i_ce).aStereotypes.HasAny(); +} + +bool +attr::IsReadOnly( const CodeEntity & i_ce ) +{ + return property_cast(i_ce).aStereotypes.IsReadOnly(); +} + +bool +attr::IsBound( const CodeEntity & i_ce ) +{ + return property_cast(i_ce).aStereotypes.IsBound(); +} + +bool +attr::IsConstrained( const CodeEntity & i_ce ) +{ + return property_cast(i_ce).aStereotypes.IsConstrained(); +} + +bool +attr::IsMayBeAmbiguous( const CodeEntity & i_ce ) +{ + return property_cast(i_ce).aStereotypes.IsMayBeAmbiguous(); +} + +bool +attr::IsMayBeDefault( const CodeEntity & i_ce ) +{ + return property_cast(i_ce).aStereotypes.IsMayBeDefault(); +} + +bool +attr::IsMayBeVoid( const CodeEntity & i_ce ) +{ + return property_cast(i_ce).aStereotypes.IsMayBeVoid(); +} + +bool +attr::IsRemovable( const CodeEntity & i_ce ) +{ + return property_cast(i_ce).aStereotypes.IsRemovable(); +} + +bool +attr::IsTransient( const CodeEntity & i_ce ) +{ + return property_cast(i_ce).aStereotypes.IsTransient(); +} + +Type_id +attr::Type( const CodeEntity & i_ce ) +{ + return property_cast(i_ce).nType; +} + +} // namespace ifc_property + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_reposypart.cxx b/autodoc/source/ary/idl/i_reposypart.cxx new file mode 100644 index 000000000000..c0edd33feeb7 --- /dev/null +++ b/autodoc/source/ary/idl/i_reposypart.cxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "i_reposypart.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_namelookup.hxx> +#include <idl_internalgate.hxx> +#include "ia_ce.hxx" +#include "ia_type.hxx" +#include "i2s_calculator.hxx" +#include "is_ce.hxx" +#include "is_type.hxx" + + + + +namespace ary +{ +namespace idl +{ + + +DYN InternalGate & +InternalGate::Create_Partition_(RepositoryCenter & i_center) +{ + return *new RepositoryPartition(i_center); +} + + + +RepositoryPartition::RepositoryPartition( RepositoryCenter & i_repository ) + : pCenter(&i_repository), + pCes(0), + pTypes(0), + pNamesDictionary(new NameLookup) +{ + pTypes = new TypeAdmin; + pCes = new CeAdmin(*pNamesDictionary, *pTypes); +} + +RepositoryPartition::~RepositoryPartition() +{ +} + +void +RepositoryPartition::Calculate_AllSecondaryInformation( + const String & i_devman_reffilepath ) +{ + // KORR_FUTURE + // Forward the options from here. + + SecondariesCalculator + secalc(*pCes,*pTypes); + + secalc.CheckAllInterfaceBases(); + secalc.Connect_Types2Ces(); + secalc.Gather_CrossReferences(); + + if ( NOT i_devman_reffilepath.empty() ) + { + secalc.Make_Links2DeveloperManual(i_devman_reffilepath); + } +} + +const CePilot & +RepositoryPartition::Ces() const +{ + return *pCes; +} + +const TypePilot & +RepositoryPartition::Types() const +{ + return *pTypes; +} + +CePilot & +RepositoryPartition::Ces() +{ + return *pCes; +} + +TypePilot & +RepositoryPartition::Types() +{ + return *pTypes; +} + + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_reposypart.hxx b/autodoc/source/ary/idl/i_reposypart.hxx new file mode 100644 index 000000000000..f28e1f1364d7 --- /dev/null +++ b/autodoc/source/ary/idl/i_reposypart.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDL_I_REPOSYPART_HXX +#define ARY_IDL_I_REPOSYPART_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <idl_internalgate.hxx> + // OTHER + + +namespace ary +{ +namespace idl +{ + class CeAdmin; + class TypeAdmin; + class NameLookup; +} +} + + + + + +namespace ary +{ +namespace idl +{ + + + +/** The idl part of the Autodoc repository. +*/ +class RepositoryPartition : public InternalGate +{ + public: + // LIFECYCLE + RepositoryPartition( + RepositoryCenter & i_repository ); + ~RepositoryPartition(); + // INHERITED + // Interface Gate: + virtual void Calculate_AllSecondaryInformation( + const String & i_devman_reffilepath ); +// const ::autodoc::Options & +// i_options ); + virtual const CePilot & + Ces() const; + virtual const TypePilot & + Types() const; + virtual CePilot & Ces(); + virtual TypePilot & Types(); + + private: + // DATA + RepositoryCenter * pCenter; + + Dyn<CeAdmin> pCes; + Dyn<TypeAdmin> pTypes; + Dyn<NameLookup> pNamesDictionary; +}; + + + + +} // namespace idl +} // namespace ary +#endif diff --git a/autodoc/source/ary/idl/i_service.cxx b/autodoc/source/ary/idl/i_service.cxx new file mode 100644 index 000000000000..14eb20a1096d --- /dev/null +++ b/autodoc/source/ary/idl/i_service.cxx @@ -0,0 +1,171 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_service.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <ary/idl/ik_service.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <sci_impl.hxx> +#include "i2s_calculator.hxx" + + +namespace ary +{ +namespace idl +{ + +Service::Service( const String & i_sName, + Ce_id i_nOwner ) + : sName(i_sName), + nOwner(i_nOwner), + aIncludedServices(), + aSupportedInterfaces(), + aProperties() +{ +} + +Service::~Service() +{ + for ( RelationList::iterator it = aIncludedServices.begin(); + it != aIncludedServices.end(); + ++it ) + { + delete (*it).Info(); + } + + for ( RelationList::iterator it = aSupportedInterfaces.begin(); + it != aSupportedInterfaces.end(); + ++it ) + { + delete (*it).Info(); + } +} + +void +Service::Get_SupportedInterfaces( Dyn_StdConstIterator<CommentedRelation> & o_rResult ) const +{ + o_rResult = new SCI_Vector<CommentedRelation>(aSupportedInterfaces); +} + +void +Service::Get_IncludedServices( Dyn_StdConstIterator<CommentedRelation> & o_rResult ) const +{ + o_rResult = new SCI_Vector<CommentedRelation>(aIncludedServices); +} + +void +Service::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +Service::get_AryClass() const +{ + return class_id; +} + +const String & +Service::inq_LocalName() const +{ + return sName; +} + +Ce_id +Service::inq_NameRoom() const +{ + return nOwner; +} + +Ce_id +Service::inq_Owner() const +{ + return nOwner; +} + +E_SightLevel +Service::inq_SightLevel() const +{ + return sl_File; +} + + +namespace ifc_service +{ + +inline const Service & +service_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == Service::class_id ); + return static_cast< const Service& >(i_ce); +} + +void +attr::Get_IncludedServices( Dyn_StdConstIterator<CommentedRelation> & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<CommentedRelation>( service_cast(i_ce).aIncludedServices ); +} + +void +attr::Get_ExportedInterfaces( Dyn_StdConstIterator<CommentedRelation> & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<CommentedRelation>( service_cast(i_ce).aSupportedInterfaces ); +} + +void +attr::Get_Properties( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>( service_cast(i_ce).aProperties ); +} + +void +xref::Get_IncludingServices( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(service_2s_IncludingServices)); +} + +void +xref::Get_InstantiatingSingletons( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(service_2s_InstantiatingSingletons)); +} + + +} // namespace ifc_service + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_singleton.cxx b/autodoc/source/ary/idl/i_singleton.cxx new file mode 100644 index 000000000000..fcc6ef580756 --- /dev/null +++ b/autodoc/source/ary/idl/i_singleton.cxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_singleton.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <ary/idl/ik_singleton.hxx> +#include <sci_impl.hxx> + + +namespace ary +{ +namespace idl +{ + +Singleton::Singleton( const String & i_sName, + Ce_id i_nOwner ) + : sName(i_sName), + nOwner(i_nOwner), + nService() +{ +} + +Singleton::~Singleton() +{ +} + +void +Singleton::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +Singleton::get_AryClass() const +{ + return class_id; +} + +const String & +Singleton::inq_LocalName() const +{ + return sName; +} + +Ce_id +Singleton::inq_NameRoom() const +{ + return nOwner; +} + +Ce_id +Singleton::inq_Owner() const +{ + return nOwner; +} + +E_SightLevel +Singleton::inq_SightLevel() const +{ + return sl_File; +} + + +namespace ifc_singleton +{ + +inline const Singleton & +singleton_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == Singleton::class_id ); + return static_cast< const Singleton& >(i_ce); +} + +Type_id +attr::AssociatedService( const CodeEntity & i_ce ) +{ + return singleton_cast(i_ce).nService; +} + +} // namespace ifc_singleton + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_siservice.cxx b/autodoc/source/ary/idl/i_siservice.cxx new file mode 100644 index 000000000000..2aff0288cec3 --- /dev/null +++ b/autodoc/source/ary/idl/i_siservice.cxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_siservice.hxx> +#include <ary/idl/ik_siservice.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <sci_impl.hxx> + + +namespace ary +{ +namespace idl +{ + +SglIfcService::SglIfcService( const String & i_sName, + Ce_id i_nOwner, + Type_id i_nBaseInterface ) + : sName(i_sName), + nOwner(i_nOwner), + nBaseInterface(i_nBaseInterface), + aConstructors() +{ +} + +SglIfcService::~SglIfcService() +{ +} + +void +SglIfcService::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +SglIfcService::get_AryClass() const +{ + return class_id; +} + +const String & +SglIfcService::inq_LocalName() const +{ + return sName; +} + +Ce_id +SglIfcService::inq_NameRoom() const +{ + return nOwner; +} + +Ce_id +SglIfcService::inq_Owner() const +{ + return nOwner; +} + +E_SightLevel +SglIfcService::inq_SightLevel() const +{ + return sl_File; +} + + +namespace ifc_sglifcservice +{ + +inline const SglIfcService & +sglifcservice_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == SglIfcService::class_id ); + return static_cast< const SglIfcService& >(i_ce); +} + +Type_id +attr::BaseInterface( const CodeEntity & i_ce ) +{ + return sglifcservice_cast(i_ce).nBaseInterface; +} + +void +attr::Get_Constructors( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>( sglifcservice_cast(i_ce).aConstructors ); +} + +} // namespace ifc_sglifcservice + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_sisingleton.cxx b/autodoc/source/ary/idl/i_sisingleton.cxx new file mode 100644 index 000000000000..d731f341153b --- /dev/null +++ b/autodoc/source/ary/idl/i_sisingleton.cxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_sisingleton.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <ary/idl/ik_sisingleton.hxx> + + + +namespace ary +{ +namespace idl +{ + +SglIfcSingleton::SglIfcSingleton( const String & i_sName, + Ce_id i_nOwner, + Type_id i_nBaseInterface ) + : sName(i_sName), + nOwner(i_nOwner), + nBaseInterface(i_nBaseInterface) +{ +} + +SglIfcSingleton::~SglIfcSingleton() +{ +} + +void +SglIfcSingleton::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +SglIfcSingleton::get_AryClass() const +{ + return class_id; +} + +const String & +SglIfcSingleton::inq_LocalName() const +{ + return sName; +} + +Ce_id +SglIfcSingleton::inq_NameRoom() const +{ + return nOwner; +} + +Ce_id +SglIfcSingleton::inq_Owner() const +{ + return nOwner; +} + +E_SightLevel +SglIfcSingleton::inq_SightLevel() const +{ + return sl_File; +} + +namespace ifc_sglifcsingleton +{ + +inline const SglIfcSingleton & +sglifcsingleton_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == SglIfcSingleton::class_id ); + return static_cast< const SglIfcSingleton& >(i_ce); +} + +Type_id +attr::BaseInterface( const CodeEntity & i_ce ) +{ + return sglifcsingleton_cast(i_ce).nBaseInterface; +} + + +} // namespace ifc_sglifcsingleton + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_struct.cxx b/autodoc/source/ary/idl/i_struct.cxx new file mode 100644 index 000000000000..dfffa3522813 --- /dev/null +++ b/autodoc/source/ary/idl/i_struct.cxx @@ -0,0 +1,163 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_struct.hxx> +#include <ary/idl/ik_struct.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <sci_impl.hxx> +#include "i2s_calculator.hxx" + + +namespace ary +{ +namespace idl +{ + +Struct::Struct( const String & i_sName, + Ce_id i_nOwner, + Type_id i_nBase, + const String & i_sTemplateParameter, + Type_id i_nTemplateParameterType ) + : sName(i_sName), + nOwner(i_nOwner), + nBase(i_nBase), + sTemplateParameter(i_sTemplateParameter), + nTemplateParameterType(i_nTemplateParameterType), + aElements() +{ +} + +Struct::~Struct() +{ +} + +void +Struct::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +Struct::get_AryClass() const +{ + return class_id; +} + +const String & +Struct::inq_LocalName() const +{ + return sName; +} + +Ce_id +Struct::inq_NameRoom() const +{ + return nOwner; +} + +Ce_id +Struct::inq_Owner() const +{ + return nOwner; +} + +E_SightLevel +Struct::inq_SightLevel() const +{ + return sl_File; +} + + +namespace ifc_struct +{ + +inline const Struct & +struct_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == Struct::class_id ); + return static_cast< const Struct& >(i_ce); +} + +Type_id +attr::Base( const CodeEntity & i_ce ) +{ + return struct_cast(i_ce).nBase; +} + +void +attr::Get_Elements( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>( struct_cast(i_ce).aElements ); +} + + +void +xref::Get_Derivations( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(struct_2s_Derivations)); +} + +void +xref::Get_SynonymTypedefs( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(struct_2s_SynonymTypedefs)); +} + +void +xref::Get_AsReturns( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(struct_2s_AsReturns)); +} + +void +xref::Get_AsParameters( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(struct_2s_AsParameters)); +} + +void +xref::Get_AsDataTypes( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(struct_2s_AsDataTypes)); +} + +} // namespace ifc_struct + + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_structelem.cxx b/autodoc/source/ary/idl/i_structelem.cxx new file mode 100644 index 000000000000..1a19d195f457 --- /dev/null +++ b/autodoc/source/ary/idl/i_structelem.cxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_structelem.hxx> +#include <ary/idl/ik_structelem.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <sci_impl.hxx> + + +namespace ary +{ +namespace idl +{ + + +StructElement::StructElement( const String & i_sName, + Ce_id i_nOwner, + Ce_id i_nNameRoom, + Type_id i_nType ) + : sName(i_sName), + nOwner(i_nOwner), + nNameRoom(i_nNameRoom), + nType(i_nType) +{ +} + +StructElement::~StructElement() +{ +} + +void +StructElement::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +StructElement::get_AryClass() const +{ + return class_id; +} + +const String & +StructElement::inq_LocalName() const +{ + return sName; +} + +Ce_id +StructElement::inq_NameRoom() const +{ + return nNameRoom; +} + +Ce_id +StructElement::inq_Owner() const +{ + return nOwner; +} + +E_SightLevel +StructElement::inq_SightLevel() const +{ + return sl_Member; +} + + +namespace ifc_structelement +{ + +inline const StructElement & +selem_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == StructElement::class_id ); + return static_cast< const StructElement& >(i_ce); +} + +Type_id +attr::Type( const CodeEntity & i_ce ) +{ + return selem_cast(i_ce).nType; +} + +} // namespace ifc_structelement + + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_traits.cxx b/autodoc/source/ary/idl/i_traits.cxx new file mode 100644 index 000000000000..1c12c5bc996f --- /dev/null +++ b/autodoc/source/ary/idl/i_traits.cxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_traits.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/namesort.hxx> +#include "is_ce.hxx" + + + +namespace ary +{ +namespace idl +{ + + + +//******************** Ce_Traits ********************// +Ce_Traits::entity_base_type & +Ce_Traits::EntityOf_(id_type i_id) +{ + csv_assert(i_id.IsValid()); + return Ce_Storage::Instance_()[i_id]; +} + +//******************** Ce_Compare ********************// +const Ce_Compare::key_type & +Ce_Compare::KeyOf_(const entity_base_type & i_entity) +{ + return i_entity.LocalName(); +} + +bool +Ce_Compare::Lesser_( const key_type & i_1, + const key_type & i_2 ) +{ + static ::ary::LesserName less_; + return less_(i_1,i_2); +} + + + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/i_typedef.cxx b/autodoc/source/ary/idl/i_typedef.cxx new file mode 100644 index 000000000000..f33ef60921ca --- /dev/null +++ b/autodoc/source/ary/idl/i_typedef.cxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/idl/i_typedef.hxx> +#include <ary/idl/ik_typedef.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/processor.hxx> +#include <sci_impl.hxx> +#include "i2s_calculator.hxx" + + +namespace ary +{ +namespace idl +{ + + +Typedef::Typedef( const String & i_sName, + Ce_id i_nOwner, + Type_id i_nDefiningType ) + : sName(i_sName), + nOwner(i_nOwner), + nDefiningType(i_nDefiningType) +{ +} + +Typedef::~Typedef() +{ +} + +void +Typedef::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +Typedef::get_AryClass() const +{ + return class_id; +} + +const String & +Typedef::inq_LocalName() const +{ + return sName; +} + +Ce_id +Typedef::inq_NameRoom() const +{ + return nOwner; +} + +Ce_id +Typedef::inq_Owner() const +{ + return nOwner; +} + +E_SightLevel +Typedef::inq_SightLevel() const +{ + return sl_File; +} + + +namespace ifc_typedef +{ + +inline const Typedef & +typedef_cast( const CodeEntity & i_ce ) +{ + csv_assert( i_ce.AryClass() == Typedef::class_id ); + return static_cast< const Typedef& >(i_ce); +} + +Type_id +attr::DefiningType( const CodeEntity & i_ce ) +{ + return typedef_cast(i_ce).nDefiningType; +} + + +void +xref::Get_SynonymTypedefs( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(typedef_2s_SynonymTypedefs)); +} + +void +xref::Get_AsReturns( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(typedef_2s_AsReturns)); +} + +void +xref::Get_AsParameters( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(typedef_2s_AsParameters)); +} + +void +xref::Get_AsDataTypes( Dyn_CeIterator & o_result, + const CodeEntity & i_ce ) +{ + o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(typedef_2s_AsDataTypes)); +} + +} // namespace ifc_typedef + + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/ia_ce.cxx b/autodoc/source/ary/idl/ia_ce.cxx new file mode 100644 index 000000000000..f78f5050a7db --- /dev/null +++ b/autodoc/source/ary/idl/ia_ce.cxx @@ -0,0 +1,581 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "ia_ce.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <algorithm> +#include <cosv/tpl/tpltools.hxx> +#include <ary/idl/i_attribute.hxx> +#include <ary/idl/i_constant.hxx> +#include <ary/idl/i_constgroup.hxx> +#include <ary/idl/i_enum.hxx> +#include <ary/idl/i_enumvalue.hxx> +#include <ary/idl/i_exception.hxx> +#include <ary/idl/i_function.hxx> +#include <ary/idl/i_interface.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/i_namelookup.hxx> +#include <ary/idl/i_property.hxx> +#include <ary/idl/i_service.hxx> +#include <ary/idl/i_singleton.hxx> +#include <ary/idl/i_siservice.hxx> +#include <ary/idl/i_sisingleton.hxx> +#include <ary/idl/i_struct.hxx> +#include <ary/idl/i_structelem.hxx> +#include <ary/idl/i_traits.hxx> +#include <ary/idl/i_typedef.hxx> +#include <idsort.hxx> +#include "ia_type.hxx" +#include "is_ce.hxx" +#include "it_tplparam.hxx" + + + + +namespace ary +{ +namespace idl +{ + +inline Module & +CeAdmin::lhf_Access_Module( Ce_id i_nId ) + { return ary_cast<Module>(Storage()[i_nId]); } + +inline void +CeAdmin::lhf_Put2Storage_and_AssignId( CodeEntity & pass_io_rCe ) + { // This also assigns an ID to pass_io_rCe: + Storage().Store_Entity(pass_io_rCe); + my_NameDictionary().Add_Name( pass_io_rCe.LocalName(), + pass_io_rCe.CeId(), + pass_io_rCe.AryClass(), + pass_io_rCe.Owner() ); + } + +inline void +CeAdmin::lhf_Store_NewEntity( DYN CodeEntity & pass_io_rCe, + Module & i_rOwner ) +{ + lhf_Put2Storage_and_AssignId(pass_io_rCe); + i_rOwner.Add_Name(pass_io_rCe.LocalName(), pass_io_rCe.CeId()); +} + +inline void +CeAdmin::lhf_Store_NewEntity( DYN CodeEntity & pass_io_rCe, + Ce_id i_nOwnerModule ) +{ + lhf_Store_NewEntity(pass_io_rCe, lhf_Access_Module(i_nOwnerModule)); +} + + + +CeAdmin::CeAdmin( NameLookup & io_rNameDictionary, + TypeAdmin & io_rTypePilot ) + : pStorage(new Ce_Storage), + pGlobalNamespace(0), + pNameDictionary(&io_rNameDictionary), + pTypePilot(&io_rTypePilot) +{ + Storage().Set_Reserved( + predefined::ce_GlobalNamespace, + *new Module ); + pGlobalNamespace = &lhf_Access_Module(Ce_id(predefined::ce_GlobalNamespace)); +} + +CeAdmin::~CeAdmin() +{ +} + + + +Module & +CeAdmin::CheckIn_Module( Ce_id i_nParentId, + const String & i_sName ) +{ + Module & rOwner = lhf_Access_Module(i_nParentId); + Ce_id nId = rOwner.Search_Name(i_sName); + if (nId.IsValid()) + { + return lhf_Access_Module(nId); + } + + Module & ret = *new Module( i_sName, + rOwner ); + lhf_Store_NewEntity(ret, rOwner); + return ret; +} + +Service & +CeAdmin::Store_Service( Ce_id i_nOwner, + const String & i_sName ) +{ + Service & ret = *new Service( i_sName, + i_nOwner ); + lhf_Store_NewEntity(ret, i_nOwner); + return ret; +} + +SglIfcService & +CeAdmin::Store_SglIfcService( Ce_id i_nOwner, + const String & i_sName, + Type_id i_nBaseInterface ) +{ + SglIfcService & + ret = *new SglIfcService( i_sName, + i_nOwner, + i_nBaseInterface ); + lhf_Store_NewEntity(ret, i_nOwner); + return ret; +} + +Interface & +CeAdmin::Store_Interface( Ce_id i_nOwner, + const String & i_sName, + Type_id i_nBase ) +{ + Interface & ret = *new Interface( i_sName, + i_nOwner ); + lhf_Store_NewEntity(ret, i_nOwner); + if (i_nBase.IsValid()) + ret.Add_Base(i_nBase, 0); + return ret; +} + +Struct & +CeAdmin::Store_Struct( Ce_id i_nOwner, + const String & i_sName, + Type_id i_nBase, + const String & i_sTemplateParam ) +{ + if (NOT i_sTemplateParam.empty()) + { + return lhf_Store_TplStruct( i_nOwner, + i_sName, + i_nBase, + i_sTemplateParam ); + } + + Struct & ret = *new Struct( i_sName, + i_nOwner, + i_nBase, + String::Null_(), + Type_id::Null_() ); + lhf_Store_NewEntity(ret, i_nOwner); + + return ret; +} + +Exception & +CeAdmin::Store_Exception( Ce_id i_nOwner, + const String & i_sName, + Type_id i_nBase ) +{ + Exception & ret = *new Exception( i_sName, + i_nOwner, + i_nBase ); + lhf_Store_NewEntity(ret, i_nOwner); + return ret; +} + +Enum & +CeAdmin::Store_Enum( Ce_id i_nOwner, + const String & i_sName ) +{ + Enum & ret = *new Enum( i_sName, + i_nOwner ); + lhf_Store_NewEntity(ret, i_nOwner); + return ret; +} + +Typedef & +CeAdmin::Store_Typedef( Ce_id i_nOwner, + const String & i_sName, + Type_id i_nDefiningType ) +{ + Typedef & ret = *new Typedef( i_sName, + i_nOwner, + i_nDefiningType ); + lhf_Store_NewEntity(ret, i_nOwner); + return ret; +} + + +ConstantsGroup & +CeAdmin::Store_ConstantsGroup( Ce_id i_nOwner, + const String & i_sName ) +{ + ConstantsGroup & ret = *new ConstantsGroup( i_sName, + i_nOwner ); + lhf_Store_NewEntity(ret, i_nOwner); + return ret; +} + +Singleton & +CeAdmin::Store_Singleton( Ce_id i_nOwner, + const String & i_sName ) +{ + Singleton & ret = *new Singleton( i_sName, + i_nOwner ); + lhf_Store_NewEntity(ret, i_nOwner); + return ret; +} + +SglIfcSingleton & +CeAdmin::Store_SglIfcSingleton( Ce_id i_nOwner, + const String & i_sName, + Type_id i_nBaseInterface ) +{ + SglIfcSingleton & + ret = *new SglIfcSingleton( i_sName, + i_nOwner, + i_nBaseInterface ); + lhf_Store_NewEntity(ret, i_nOwner); + return ret; +} + +Constant & +CeAdmin::Store_Constant( Ce_id i_nOwner, + const String & i_sName, + Type_id i_nType, + const String & i_sValue ) +{ + ConstantsGroup & + rOwner = ary_cast<ConstantsGroup>(Storage()[i_nOwner]); + Constant & ret = *new Constant( i_sName, + i_nOwner, + rOwner.NameRoom(), + i_nType, + i_sValue ); + lhf_Put2Storage_and_AssignId(ret); + rOwner.Add_Constant(ret.CeId()); + return ret; +} + +Property & +CeAdmin::Store_Property( Ce_id i_nOwner, + const String & i_sName, + Type_id i_nType, + Property::Stereotypes i_stereotypes ) +{ + Service & + rOwner = ary_cast<Service>(Storage()[i_nOwner]); + Property & ret = *new Property( i_sName, + i_nOwner, + rOwner.NameRoom(), + i_nType, + i_stereotypes ); + lhf_Put2Storage_and_AssignId(ret); + rOwner.Add_Property(ret.CeId()); + return ret; +} + +Function & +CeAdmin::Store_Function( Ce_id i_nOwner, + const String & i_sName, + Type_id i_nReturnType, + bool i_bOneWay ) +{ + Interface & + rOwner = ary_cast<Interface>(Storage()[i_nOwner]); + Function & ret = *new Function( i_sName, + i_nOwner, + rOwner.NameRoom(), + i_nReturnType, + i_bOneWay); + lhf_Put2Storage_and_AssignId(ret); + rOwner.Add_Function(ret.CeId()); + return ret; +} + +Function & +CeAdmin::Store_ServiceConstructor( Ce_id i_nOwner, + const String & i_sName ) +{ + SglIfcService & + rOwner = ary_cast<SglIfcService>(Storage()[i_nOwner]); + Function & ret = *new Function( i_sName, + i_nOwner, + rOwner.NameRoom() ); + lhf_Put2Storage_and_AssignId(ret); + rOwner.Add_Constructor(ret.CeId()); + return ret; +} + +StructElement & +CeAdmin::Store_StructMember( Ce_id i_nOwner, + const String & i_sName, + Type_id i_nType ) +{ + Struct & + rOwner = ary_cast<Struct>(Storage()[i_nOwner]); + StructElement & ret = *new StructElement( i_sName, + i_nOwner, + rOwner.NameRoom(), + i_nType ); + lhf_Put2Storage_and_AssignId(ret); + rOwner.Add_Member(ret.CeId()); + return ret; +} + +StructElement & +CeAdmin::Store_ExceptionMember( Ce_id i_nOwner, + const String & i_sName, + Type_id i_nType ) +{ + Exception & + rOwner = ary_cast<Exception>(Storage()[i_nOwner]); + StructElement & ret = *new StructElement( i_sName, + i_nOwner, + rOwner.NameRoom(), + i_nType ); + lhf_Put2Storage_and_AssignId(ret); + rOwner.Add_Member(ret.CeId()); + return ret; +} + +EnumValue & +CeAdmin::Store_EnumValue( Ce_id i_nOwner, + const String & i_sName, + const String & i_sValue ) +{ + Enum & + rOwner = ary_cast<Enum>(Storage()[i_nOwner]); + EnumValue & ret = *new EnumValue( i_sName, + i_nOwner, + rOwner.NameRoom(), + i_sValue ); + lhf_Put2Storage_and_AssignId(ret); + rOwner.Add_Value(ret.CeId()); + return ret; +} + +Attribute & +CeAdmin::Store_Attribute( Ce_id i_nOwner, + const String & i_sName, + Type_id i_nType, + bool i_bReadOnly, + bool i_bBound ) +{ + Interface & + rOwner = ary_cast<Interface>(Storage()[i_nOwner]); + + Attribute & ret = *new Attribute ( i_sName, + i_nOwner, + rOwner.NameRoom(), + i_nType, + i_bReadOnly, + i_bBound ); + lhf_Put2Storage_and_AssignId(ret); + rOwner.Add_Attribute(ret.CeId()); + return ret; +} + +const Module & +CeAdmin::GlobalNamespace() const +{ + csv_assert(pGlobalNamespace); + return *pGlobalNamespace; +} + +const CodeEntity & +CeAdmin::Find_Ce( Ce_id i_nId ) const +{ + return Storage()[i_nId]; + +} + +const Module & +CeAdmin::Find_Module( Ce_id i_nId ) const +{ + return ary_cast<Module>(Storage()[i_nId]); +} + +const Module * +CeAdmin::Search_Module( Ce_id i_nId ) const +{ + if (NOT i_nId.IsValid()) + return 0; + return ary_cast<Module>( & Storage()[i_nId] ); +} + +const Function & +CeAdmin::Find_Function( Ce_id i_nId ) const +{ + return ary_cast<Function>(Storage()[i_nId]); +} + +const Property & +CeAdmin::Find_Property( Ce_id i_nId ) const +{ + return ary_cast<Property>(Storage()[i_nId]); +} + +const EnumValue & +CeAdmin::Find_EnumValue( Ce_id i_nId ) const +{ + return ary_cast<EnumValue>(Storage()[i_nId]); +} + +const Constant & +CeAdmin::Find_Constant( Ce_id i_nId ) const +{ + return ary_cast<Constant>(Storage()[i_nId]); +} + +const StructElement & +CeAdmin::Find_StructElement( Ce_id i_nId ) const +{ + return ary_cast<StructElement>(Storage()[i_nId]); +} + +void +CeAdmin::Get_Text( StringVector & o_module, + String & o_ce, + String & o_member, + const CodeEntity & i_ce ) const +{ + const CodeEntity * pCe = &i_ce; + csv::erase_container(o_module); + o_ce.clear(); + o_member.clear(); + + switch ( pCe->SightLevel() ) + { + // Here are intentionally no breaks! + case sl_Member: + if ( is_type<Function>(*pCe) ) + o_member = StreamLock(200)() + << pCe->LocalName() + << "()" + << c_str; + else + o_member = pCe->LocalName(); + pCe = & Storage()[pCe->Owner()]; + case sl_File: + o_ce = pCe->LocalName(); + pCe = & Storage()[pCe->NameRoom()]; + case sl_Module: + get_ModuleText(o_module,*pCe); + break; + default: + csv_assert(false); + } // end switch +} + +const NameLookup & +CeAdmin::NameDictionary() const +{ + return *pNameDictionary; +} + + +void +CeAdmin::Get_AlphabeticalIndex( std::vector<Ce_id> & o_rResult, + alphabetical_index::E_Letter i_cLetter ) const +{ + const int C_nLowerUpperDiff = 'a'-'A'; + + // Establishing filter: + UINT8 filter[256]; + + UINT8 nLetter = static_cast<UINT8>(i_cLetter); + memset(filter, 0, 256); + filter[nLetter] = 1; + if ( i_cLetter != alphabetical_index::non_alpha ) + filter[nLetter - C_nLowerUpperDiff] = 1; + + // Gather entities which start with i_cLetter: + o_rResult.reserve(1000); + idl::Ce_Storage::c_iter + itEnd = Storage().End(); + for ( idl::Ce_Storage::c_iter it = Storage().BeginUnreserved(); + it != itEnd; + ++it ) + { + if ( filter[ static_cast<UINT8>(*(*it).LocalName().c_str()) ] == 1 ) + o_rResult.push_back( (*it).CeId() ); + } + + std::sort( o_rResult.begin(), + o_rResult.end(), + IdSorter<Ce_Compare>() ); +} + + +Module & +CeAdmin::GlobalNamespace() +{ + csv_assert(pGlobalNamespace); + return *pGlobalNamespace; +} + +CodeEntity & +CeAdmin::Find_Ce( Ce_id i_nId ) +{ + return Storage()[i_nId]; +} + +void +CeAdmin::get_ModuleText( StringVector & o_module, + const CodeEntity & i_ce ) const +{ + if (i_ce.NameRoom().IsValid()) + { + const CodeEntity & + rParent = Storage()[i_ce.NameRoom()]; + get_ModuleText(o_module, rParent); + o_module.push_back(i_ce.LocalName()); + } +} + +Struct & +CeAdmin::lhf_Store_TplStruct( Ce_id i_nOwner, + const String & i_sName, + Type_id i_nBase, + const String & i_sTemplateParam ) +{ + csv_assert(NOT i_sTemplateParam.empty()); + + TemplateParamType & + rTpt = pTypePilot->Store_TemplateParamType(i_sTemplateParam); + + Struct & ret = *new Struct( i_sName, + i_nOwner, + i_nBase, + i_sTemplateParam, + rTpt.TypeId() ); + lhf_Store_NewEntity(ret, i_nOwner); + rTpt.Set_StructId(ret.CeId()); + + return ret; +} + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/ia_ce.hxx b/autodoc/source/ary/idl/ia_ce.hxx new file mode 100644 index 000000000000..48d8907eb3a3 --- /dev/null +++ b/autodoc/source/ary/idl/ia_ce.hxx @@ -0,0 +1,253 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDL_IA_CE_HXX +#define ARY_IDL_IA_CE_HXX + + +// USED SERVICES + // BASE CLASSES +#include <ary/idl/ip_ce.hxx> + // COMPONENTS + // PARAMETERS + + +namespace ary +{ +namespace idl +{ + +class Ce_Storage; +class TypeAdmin; + + +/** @resp + Implements ::ary::idl::CePilot. Provides the access logic for all + IDL code entities. + + @collab Ce_Storage + @collab TypeAdmin + + @see CodeEntity +*/ +class CeAdmin : public CePilot +{ + public: + // LIFECYCLE + CeAdmin( + NameLookup & io_rNameDictionary, + TypeAdmin & io_rTypePilot ); + virtual ~CeAdmin(); + + // OPERATIONS + + // INQUIRY + const Ce_Storage & Storage() const; + + // ACCESS + Ce_Storage & Storage(); + + // INHERITED + // Interface ::ary::idl::CePilot: + virtual Module & CheckIn_Module( + Ce_id i_nParentId, + const String & i_sName ); + virtual Service & Store_Service( + Ce_id i_nOwner, + const String & i_sName ); + virtual SglIfcService & + Store_SglIfcService( + Ce_id i_nOwner, + const String & i_sName, + Type_id i_nBaseInterface ); + virtual Interface & Store_Interface( + Ce_id i_nOwner, + const String & i_sName, + Type_id i_nBase ); + virtual Struct & Store_Struct( + Ce_id i_nOwner, + const String & i_sName, + Type_id i_nBase, + const String & i_sTemplateParam ); + virtual Exception & Store_Exception( + Ce_id i_nOwner, + const String & i_sName, + Type_id i_nBase ); + virtual Enum & Store_Enum( + Ce_id i_nOwner, + const String & i_sName ); + virtual Typedef & Store_Typedef( + Ce_id i_nOwner, + const String & i_sName, + Type_id i_nDefiningType ); + virtual ConstantsGroup & + Store_ConstantsGroup( + Ce_id i_nOwner, + const String & i_sName ); + virtual Singleton & Store_Singleton( + Ce_id i_nOwner, + const String & i_sName ); + virtual SglIfcSingleton & + Store_SglIfcSingleton( + Ce_id i_nOwner, + const String & i_sName, + Type_id i_nBaseInterface ); + + virtual Constant & Store_Constant( + Ce_id i_nOwner, + const String & i_sName, + Type_id i_nType, + const String & i_sValue ); + virtual Property & Store_Property( + Ce_id i_nOwner, + const String & i_sName, + Type_id i_nType, + Property::Stereotypes + i_stereotypes ); + virtual Function & Store_Function( + Ce_id i_nOwner, + const String & i_sName, + Type_id i_nReturnType, + bool i_bOneWay ); + virtual Function & Store_ServiceConstructor( + Ce_id i_nOwner, + const String & i_sName ); + virtual StructElement & + Store_StructMember( + Ce_id i_nOwner, + const String & i_sName, + Type_id i_nType ); + virtual StructElement & + Store_ExceptionMember( + Ce_id i_nOwner, + const String & i_sName, + Type_id i_nType ); + virtual EnumValue & Store_EnumValue( + Ce_id i_nOwner, + const String & i_sName, + const String & i_sValue ); + virtual Attribute & Store_Attribute( + Ce_id i_nOwner, + const String & i_sName, + Type_id i_nType, + bool i_bReadOnly, + bool i_bBound ); + + virtual const Module & + GlobalNamespace() const; + virtual const CodeEntity & + Find_Ce( + Ce_id i_nId ) const; + virtual const Module & + Find_Module( + Ce_id i_nId ) const; + virtual const Module * + Search_Module( + Ce_id i_nId ) const; + virtual const Function & + Find_Function( + Ce_id i_nId ) const; + virtual const Property & + Find_Property( + Ce_id i_nId ) const; + virtual const EnumValue & + Find_EnumValue( + Ce_id i_nId ) const; + virtual const Constant & + Find_Constant( + Ce_id i_nId ) const; + virtual const StructElement & + Find_StructElement( + Ce_id i_nId ) const; + virtual void Get_Text( + StringVector & o_module, + String & o_ce, + String & o_member, + const CodeEntity & i_ce ) const; + virtual const NameLookup & + NameDictionary() const; + virtual void Get_AlphabeticalIndex( + std::vector<Ce_id> & + o_rResult, + alphabetical_index::E_Letter + i_cLetter) const; + // ACCESS + virtual Module & GlobalNamespace(); + virtual CodeEntity & + Find_Ce( + Ce_id i_nId ); + private: + // Locals + Module & lhf_Access_Module( + Ce_id i_nId ); + void lhf_Put2Storage_and_AssignId( + CodeEntity & pass_io_rCe ); + void lhf_Store_NewEntity( + DYN CodeEntity & pass_io_rCe, + Module & i_rOwner ); + void lhf_Store_NewEntity( + DYN CodeEntity & pass_io_rCe, + Ce_id i_nOwnerModule ); + void get_ModuleText( + StringVector & o_module, + const CodeEntity & i_ce ) const; + Struct & lhf_Store_TplStruct( + Ce_id i_nOwner, + const String & i_sName, + Type_id i_nBase, + const String & i_sTemplateParam ); + + const Ce_Storage & my_Storage() const; + Ce_Storage & my_Storage(); + NameLookup & my_NameDictionary() { return *pNameDictionary; } + + // DATA + Dyn<Ce_Storage> pStorage; /// @inv pStorage != 0; + Module * pGlobalNamespace; + NameLookup * pNameDictionary; + TypeAdmin * pTypePilot; +}; + + +// IMPLEMENTATION +inline const Ce_Storage & +CeAdmin::Storage() const +{ + return *pStorage; +} + +inline Ce_Storage & +CeAdmin::Storage() +{ + return *pStorage; +} + + + +} // namespace idl +} // namespace ary +#endif diff --git a/autodoc/source/ary/idl/ia_type.cxx b/autodoc/source/ary/idl/ia_type.cxx new file mode 100644 index 000000000000..eb47d355c9ae --- /dev/null +++ b/autodoc/source/ary/idl/ia_type.cxx @@ -0,0 +1,364 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "ia_type.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/qualiname.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/i_type.hxx> +#include <ary/idl/ip_ce.hxx> +#include "ia_ce.hxx" +#include "is_type.hxx" +#include "it_builtin.hxx" +#include "it_ce.hxx" +#include "it_explicit.hxx" +#include "it_sequence.hxx" +#include "it_tplparam.hxx" +#include "it_xnameroom.hxx" + + + +namespace ary +{ +namespace idl +{ + +String MakeTemplateName( + const String & i_localName, + const std::vector<Type_id> & + i_templateParameters ); + + + +inline CeAdmin & +TypeAdmin::my_Ces() const + { return *pCes; } + +inline void +TypeAdmin::lhf_Put2Storage_and_AssignId( DYN Type & pass_io_rType ) + { // This also assigns an ID to pass_io_rType: + Storage().Store_Entity(pass_io_rType); } + +inline Type_id +TypeAdmin::lhf_findBuiltInType( const String & i_sName ) + { return ary_cast<ExplicitNameRoom>(Storage()[nXNameRoom_Root]) + .Search_Name(i_sName); } + +inline const ExplicitNameRoom & +TypeAdmin::find_ExplicitNameRoom( Type_id i_nType ) const +{ + return ary_cast<ExplicitNameRoom>(Storage()[i_nType]); +} + +inline ExplicitNameRoom & +TypeAdmin::find_ExplicitNameRoom( Type_id i_nType ) +{ + return ary_cast<ExplicitNameRoom>(Storage()[i_nType]); +} + +ExplicitNameRoom & +TypeAdmin::lhf_CheckIn_XNameRoom( const QualifiedName & i_rName, + Ce_id i_nModuleOfOccurrence ) +{ + Type_id nRoot = i_rName.IsAbsolute() + ? Type_id( predefined::type_GlobalXNameRoom ) + : lhf_Get_NameRoomRoot_forModuleofOccurrence( i_nModuleOfOccurrence ).TypeId(); + + if ( i_rName.NamespaceDepth() == 0 ) + return find_ExplicitNameRoom(nRoot); + + QualifiedName::namespace_iterator it = i_rName.first_namespace(); + ExplicitNameRoom * + ret = & find_ExplicitNameRoom(nRoot); + for ( ; it != i_rName.end_namespace(); ++it ) + { + Type_id + found = ret->Search_Name(*it); + if (found.IsValid()) + { + ret = & find_ExplicitNameRoom(found); + } + else + { + ExplicitNameRoom & + rNew = *new ExplicitNameRoom(*it, *ret); + lhf_Put2Storage_and_AssignId(rNew); + ret->Add_Name( rNew.Name(), rNew.TypeId() ); + ret = &rNew; + } + + } // end for + return *ret; +} + +Type_id +TypeAdmin::lhf_CheckIn_TypeName( const String & i_sLocalName, + ExplicitNameRoom & io_rXNameRoom, + Ce_id i_nModuleOfOccurrence, + const std::vector<Type_id> * i_templateParameters ) +{ + String sSearchLocalName( i_sLocalName ); + if ( i_templateParameters != 0 + ? i_templateParameters->size() > 0 + : false ) + { + sSearchLocalName = MakeTemplateName( + i_sLocalName, + *i_templateParameters); + } + + Type_id + ret = io_rXNameRoom.Search_Name(sSearchLocalName); + if (NOT ret.IsValid()) + { + DYN Type & + rNewType = *new ExplicitType( i_sLocalName, + io_rXNameRoom.TypeId(), + i_nModuleOfOccurrence, + i_templateParameters ); + lhf_Put2Storage_and_AssignId(rNewType); + ret = rNewType.TypeId(); + io_rXNameRoom.Add_Name( sSearchLocalName, ret ); + } + return ret; +} + +Type_id +TypeAdmin::lhf_CheckIn_Sequence(Type_id i_nType) +{ + Type_id + ret = Storage().Search_SequenceOf(i_nType); + + if (NOT ret.IsValid()) + { + DYN Type & + rNewSeq = *new Sequence(i_nType); + lhf_Put2Storage_and_AssignId(rNewSeq); + ret = rNewSeq.Id(); + Storage().Add_Sequence(i_nType, ret); + } + return ret; +} + +void +TypeAdmin::lhf_CheckIn_BuiltInType( const char * i_sName, + Rid i_nId ) +{ + DYN BuiltInType & + rNewType = *new BuiltInType(i_sName); + Storage().Set_Reserved(i_nId, rNewType); + + // Put them into both roots, to catch the syntactically correct + // (though unlikely) ::Any, ::long etc. + Type_id + nId(i_nId); + find_ExplicitNameRoom(nXNameRoom_Root).Add_Name(i_sName, nId); + find_ExplicitNameRoom(nXNameRoom_Global).Add_Name(i_sName, nId); +} + +ExplicitNameRoom & +TypeAdmin::lhf_Get_NameRoomRoot_forModuleofOccurrence( Ce_id i_nModuleOfOccurrence ) +{ + const Type_id * + pFound = csv::find_in_map( aMap_ModuleOfOccurrence2NameRoomRoot, + i_nModuleOfOccurrence ); + if (pFound != 0) + return find_ExplicitNameRoom(*pFound); + + ExplicitNameRoom & + ret = *new ExplicitNameRoom; + lhf_Put2Storage_and_AssignId(ret); + aMap_ModuleOfOccurrence2NameRoomRoot.insert(std::pair< const Ce_id, Type_id>(i_nModuleOfOccurrence,ret.TypeId())); + return ret; +} + +TypeAdmin::TypeAdmin() + : pStorage(new Type_Storage), + pCes(0), // Needs to be set directly after creation. + nXNameRoom_Root( static_cast<ary::Rid>(predefined::type_Root_ofXNameRooms) ), + nXNameRoom_Global( static_cast<ary::Rid>(predefined::type_GlobalXNameRoom) ), + aMap_ModuleOfOccurrence2NameRoomRoot() +{ + DYN ExplicitNameRoom & + drRoot = *new ExplicitNameRoom; + Storage().Set_Reserved( nXNameRoom_Root.Value(), drRoot ); + + DYN ExplicitNameRoom & + drGlobal = *new ExplicitNameRoom(String::Null_(), drRoot); + Storage().Set_Reserved( nXNameRoom_Global.Value(), drGlobal ); + drRoot.Add_Name( drGlobal.Name(), nXNameRoom_Global ); + + lhf_Setup_BuildInTypes(); +} + +TypeAdmin::~TypeAdmin() +{ +} + +void +TypeAdmin::lhf_Setup_BuildInTypes() +{ + lhf_CheckIn_BuiltInType("any", predefined::type_any); + lhf_CheckIn_BuiltInType("boolean", predefined::type_boolean); + lhf_CheckIn_BuiltInType("byte", predefined::type_byte); + lhf_CheckIn_BuiltInType("char", predefined::type_char); + lhf_CheckIn_BuiltInType("double", predefined::type_double); + lhf_CheckIn_BuiltInType("float", predefined::type_float); + lhf_CheckIn_BuiltInType("hyper", predefined::type_hyper); + lhf_CheckIn_BuiltInType("long", predefined::type_long); + lhf_CheckIn_BuiltInType("short", predefined::type_short); + lhf_CheckIn_BuiltInType("string", predefined::type_string); + lhf_CheckIn_BuiltInType("type", predefined::type_type); + lhf_CheckIn_BuiltInType("void", predefined::type_void); + lhf_CheckIn_BuiltInType("unsigned hyper", predefined::type_u_hyper); + lhf_CheckIn_BuiltInType("unsigned long", predefined::type_u_long); + lhf_CheckIn_BuiltInType("unsigned short", predefined::type_u_short); +} + +const Type & +TypeAdmin::CheckIn_Type( QualifiedName & i_rFullName, + uintt i_nSequenceCount, + Ce_id i_nModuleOfOccurrence, + const std::vector<Type_id> * i_templateParameters ) +{ + // Look in built-in types: + Type_id + nType = lhf_findBuiltInType(i_rFullName.LocalName()); + if (NOT nType.IsValid()) + { // No built-in type: + ExplicitNameRoom & + rNameRoom = lhf_CheckIn_XNameRoom(i_rFullName,i_nModuleOfOccurrence); + nType = lhf_CheckIn_TypeName( i_rFullName.LocalName(), + rNameRoom, + i_nModuleOfOccurrence, + i_templateParameters ); + } // endif + + for ( uintt s = 0; s < i_nSequenceCount; ++s ) + { + nType = lhf_CheckIn_Sequence(nType); + } + + return Storage()[nType]; +} + +TemplateParamType & +TypeAdmin::Store_TemplateParamType( String i_sName ) +{ + DYN TemplateParamType & + ret = *new TemplateParamType( i_sName ); + lhf_Put2Storage_and_AssignId(ret); + return ret; +} + +const Type & +TypeAdmin::Find_Type( Type_id i_nType ) const +{ + return Storage()[i_nType]; +} + +String +TypeAdmin::Search_LocalNameOf( Type_id i_nType ) const +{ + const Type * + pType = Storage().Exists(i_nType) + ? 0 + : & Storage()[i_nType]; + if (pType != 0) + { + switch (pType->AryClass()) + { + case Ce_Type::class_id: + case ExplicitType::class_id: + case BuiltInType::class_id: + return static_cast< const Named_Type& >(*pType).Name(); + } + } + return String::Null_(); +} + +Ce_id +TypeAdmin::Search_CeRelatedTo( Type_id i_nType ) const +{ + const Ce_Type * + ret = ary_cast<Ce_Type>( & Storage()[i_nType] ); + return ret != 0 + ? ret->RelatedCe() + : Ce_id_Null(); +} + +const ExplicitNameRoom & +TypeAdmin::Find_XNameRoom( Type_id i_nType ) const +{ + return find_ExplicitNameRoom(i_nType); +} + +bool +TypeAdmin::IsBuiltInOrRelated( const Type & i_rType ) const +{ + if ( is_type<BuiltInType>(i_rType) ) + return true; + else + { + const Type * + pType = &i_rType; + while (is_type<Sequence>(*pType)) + { + Type_id + nt = ary_cast<Sequence>(pType)->RelatedType(); + if (NOT nt.IsValid()) + return false; + pType = & Storage()[nt]; + } + return is_type<BuiltInType>(*pType); + } +} + + +String +MakeTemplateName( const String & i_localName, + const std::vector<Type_id> & ) +{ + StreamLock + sl(200); + + // This is the simple solution, assuming that there is only + // one version of templatisation allowed with a given name. + return + sl() + << i_localName + << C_cTemplateDelimiter + << c_str; +} + + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/ia_type.hxx b/autodoc/source/ary/idl/ia_type.hxx new file mode 100644 index 000000000000..050519234626 --- /dev/null +++ b/autodoc/source/ary/idl/ia_type.hxx @@ -0,0 +1,170 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDL_IA_TYPE_HXX +#define ARY_IDL_IA_TYPE_HXX + + +// USED SERVICES + // BASE CLASSES +#include <ary/idl/ip_type.hxx> + // COMPONENTS + // PARAMETERS +#include "is_type.hxx" + + +namespace ary +{ +namespace idl +{ + + +class Type_Storage; +class CeAdmin; +class TemplateParamType; + + +class TypeAdmin : public TypePilot +{ + public: + // LIFECYCLE + TypeAdmin(); + + void Assign_CePilot( + CeAdmin & io_rCes ); + virtual ~TypeAdmin(); + + // OPERATIONS + TemplateParamType & Store_TemplateParamType( + String i_sName ); + // INQUIRY + const Type_Storage & + Storage() const; + // ACCESS + Type_Storage & Storage(); + + // INHERITED + // Interface TypePilot: + virtual const Type & + CheckIn_Type( + QualifiedName & i_rFullName, + uintt i_nSequenceCount, + Ce_id i_nModuleOfOccurrence, + const std::vector<Type_id> * + i_templateParameters ); + virtual const Type & + Find_Type( + Type_id i_nType ) const; + virtual String Search_LocalNameOf( + Type_id i_nType ) const; + virtual Ce_id Search_CeRelatedTo( + Type_id i_nType ) const; + virtual const ExplicitNameRoom & + Find_XNameRoom( + Type_id i_nType ) const; + virtual bool IsBuiltInOrRelated( + const Type & i_rType ) const; + private: + // Locals + CeAdmin & my_Ces() const; + + void lhf_Put2Storage_and_AssignId( + DYN Type & pass_io_rType ); + + ExplicitNameRoom & lhf_CheckIn_XNameRoom( + const QualifiedName & + i_rName, + Ce_id i_nModuleOfOccurrence ); + Type_id lhf_CheckIn_TypeName( + const String & i_sLocalName, + ExplicitNameRoom & io_rExplicitNameRoom, + Ce_id i_nModuleOfOccurrence, + const std::vector<Type_id> * + i_templateParameters ); + Type_id lhf_CheckIn_Sequence( + Type_id i_nType ); + void lhf_CheckIn_BuiltInType( + const char * i_sName, + Rid i_nId ); + const ExplicitNameRoom & + find_ExplicitNameRoom( + Type_id i_nType ) const; + ExplicitNameRoom & find_ExplicitNameRoom( + Type_id i_nType ); + ExplicitNameRoom & lhf_Get_NameRoomRoot_forModuleofOccurrence( + Ce_id i_nModuleOfOccurrence ); + + /// @return Type_id::Null_(), if not found. + Type_id lhf_findBuiltInType( + const String & i_sName ); + /// @precond nGlobalNamespace must be valid. + void lhf_Setup_BuildInTypes(); + + // DATA + Type_Storage * pStorage; /// @inv pStorage != 0 + CeAdmin * pCes; /// @inv pCes != 0 + + // Data for saving time: + Type_id nXNameRoom_Root; /** @descr This is different from nXNameRoom_Global, because + the root of explicit name rooms in code without leading "::" is unknown. + */ + Type_id nXNameRoom_Global; + + // HACK, because this needs to be saved somehow and is not in storage: + std::map<Ce_id, Type_id> + aMap_ModuleOfOccurrence2NameRoomRoot; +}; + + + + + +// IMPLEMENTATION +inline const Type_Storage & +TypeAdmin::Storage() const +{ + return *pStorage; +} + +inline Type_Storage & +TypeAdmin::Storage() +{ + return *pStorage; +} + +inline void +TypeAdmin::Assign_CePilot( CeAdmin & io_rCes ) +{ + pCes = &io_rCes; +} + + + + +} // namespace idl +} // namespace ary +#endif diff --git a/autodoc/source/ary/idl/is_ce.cxx b/autodoc/source/ary/idl/is_ce.cxx new file mode 100644 index 000000000000..eb4b93a6dfce --- /dev/null +++ b/autodoc/source/ary/idl/is_ce.cxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "is_ce.hxx" + +// NOT FULLY DEFINED SERVICES + +namespace +{ + const uintt + C_nReservedElements = ary::idl::predefined::ce_MAX; // Skipping "0" and the GlobalNamespace +} + + +namespace ary +{ +namespace idl +{ + +Ce_Storage * Ce_Storage::pInstance_ = 0; + + + + +Ce_Storage::Ce_Storage() + : stg::Storage<CodeEntity>(C_nReservedElements) +{ + csv_assert(pInstance_ == 0); + pInstance_ = this; +} + +Ce_Storage::~Ce_Storage() +{ + csv_assert(pInstance_ != 0); + pInstance_ = 0; +} + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/is_ce.hxx b/autodoc/source/ary/idl/is_ce.hxx new file mode 100644 index 000000000000..c1edee0b23ff --- /dev/null +++ b/autodoc/source/ary/idl/is_ce.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDL_IS_CE_HXX +#define ARY_IDL_IS_CE_HXX + +// BASE CLASSES +#include <store/s_storage.hxx> +// USED SERVICES +#include <ary/idl/i_ce.hxx> + + + + +namespace ary +{ +namespace idl +{ + + +/** The data base for all ->ary::idl::CodeEntity objects. +*/ +class Ce_Storage : public ::ary::stg::Storage< ::ary::idl::CodeEntity > +{ + public: + Ce_Storage(); + virtual ~Ce_Storage(); + + static Ce_Storage & Instance_() { csv_assert(pInstance_ != 0); + return *pInstance_; } + private: + // DATA + static Ce_Storage * pInstance_; +}; + + + + +namespace predefined +{ + +enum E_CodeEntity +{ + ce_GlobalNamespace = 1, + ce_MAX +}; + +} // namespace predefined + + + + +} // namespace idl +} // namespace ary +#endif diff --git a/autodoc/source/ary/idl/is_type.cxx b/autodoc/source/ary/idl/is_type.cxx new file mode 100644 index 000000000000..269286413b17 --- /dev/null +++ b/autodoc/source/ary/idl/is_type.cxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "is_type.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> + +namespace +{ + +const uintt + C_nReservedElements = ary::idl::predefined::type_MAX; // Skipping "0" and the built in types. +} + + +namespace ary +{ +namespace idl +{ + +Type_Storage * Type_Storage::pInstance_ = 0; + + + +Type_Storage::Type_Storage() + : stg::Storage<Type>(C_nReservedElements), + aSequenceIndex() +{ + csv_assert(pInstance_ == 0); + pInstance_ = this; +} + +Type_Storage::~Type_Storage() +{ + csv_assert(pInstance_ != 0); + pInstance_ = 0; +} + +void +Type_Storage::Add_Sequence( Type_id i_nRelatedType, + Type_id i_nSequence ) +{ + aSequenceIndex[i_nRelatedType] = i_nSequence; +} + +Type_id +Type_Storage::Search_SequenceOf( Type_id i_nRelatedType ) +{ + return csv::value_from_map(aSequenceIndex, i_nRelatedType); +} + + + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/is_type.hxx b/autodoc/source/ary/idl/is_type.hxx new file mode 100644 index 000000000000..b905602238f0 --- /dev/null +++ b/autodoc/source/ary/idl/is_type.hxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDL_IS_TYPE_HXX +#define ARY_IDL_IS_TYPE_HXX + +// BASE CLASSES +#include <store/s_storage.hxx> +// USED SERVICES +#include <ary/idl/i_type.hxx> + + + + +namespace ary +{ +namespace idl +{ + + +/** The data base for all ->ary::idl::CodeEntity objects. +*/ +class Type_Storage : public ::ary::stg::Storage< ::ary::idl::Type > +{ + public: + Type_Storage(); + ~Type_Storage(); + + + void Add_Sequence( + Type_id i_nRelatedType, + Type_id i_nSequence ); + + Type_id Search_SequenceOf( + Type_id i_nRelatedType ); + + static Type_Storage & + Instance_(); + private: + /** value_type.first := id of the base type + value_type.second := id of the sequence<base type> + */ + typedef std::map<Type_id,Type_id> Map_Sequences; + + // DATA + Map_Sequences aSequenceIndex; + + static Type_Storage * + pInstance_; +}; + + + +namespace predefined +{ + +enum E_Type +{ + type_Root_ofXNameRooms = 1, + type_GlobalXNameRoom, + type_any, + type_boolean, + type_byte, + type_char, + type_double, + type_float, + type_hyper, + type_long, + type_short, + type_string, + type_type, + type_void, + type_u_hyper, + type_u_long, + type_u_short, + type_ellipse, // ... + type_MAX +}; + +} // namespace predefined + + + + +// IMPLEMENTATION +inline Type_Storage & +Type_Storage::Instance_() +{ + csv_assert(pInstance_ != 0); + return *pInstance_; +} + + + + +} // namespace idl +} // namespace ary +#endif diff --git a/autodoc/source/ary/idl/it_builtin.cxx b/autodoc/source/ary/idl/it_builtin.cxx new file mode 100644 index 000000000000..9c543a7bc798 --- /dev/null +++ b/autodoc/source/ary/idl/it_builtin.cxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "it_builtin.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/processor.hxx> + + + +namespace ary +{ +namespace idl +{ + + + +BuiltInType::BuiltInType( const char * i_sName ) + : Named_Type(i_sName) +{ +} + +BuiltInType::~BuiltInType() +{ +} + +ClassId +BuiltInType::get_AryClass() const +{ + return class_id; +} + +void +BuiltInType::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +void +BuiltInType::inq_Get_Text( StringVector & , // o_module + String & o_name, + Ce_id & , // o_nRelatedCe + int & , // o_nSequenceCount + const Gate & ) const // i_rGate +{ + o_name = Name(); +} + + + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/it_builtin.hxx b/autodoc/source/ary/idl/it_builtin.hxx new file mode 100644 index 000000000000..1e3ca7fcc90f --- /dev/null +++ b/autodoc/source/ary/idl/it_builtin.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDL_IT_BUILTIN_HXX +#define ARY_IDL_IT_BUILTIN_HXX + +// BASE CLASSES +#include "it_named.hxx" + + + + +namespace ary +{ +namespace idl +{ + + +/** A type defined by the IDL language. +*/ +class BuiltInType : public Named_Type +{ + public: + enum E_ClassId { class_id = 2200 }; + + // LIFECYCLE + BuiltInType( + const char * i_sName ); + virtual ~BuiltInType(); + + private: + // Interface csv::ConstProcessorClient: + virtual void do_Accept( + csv::ProcessorIfc & io_processor ) const; + // Interface Object: + virtual ClassId get_AryClass() const; + + // Interface Type: + virtual void inq_Get_Text( + StringVector & o_module, + String & o_name, + Ce_id & o_nRelatedCe, + int & o_nSequenceCount, + const Gate & i_rGate ) const; +}; + + + + +} // namespace idl +} // namespace ary +#endif diff --git a/autodoc/source/ary/idl/it_ce.cxx b/autodoc/source/ary/idl/it_ce.cxx new file mode 100644 index 000000000000..1fca8585f941 --- /dev/null +++ b/autodoc/source/ary/idl/it_ce.cxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "it_ce.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/processor.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/ip_ce.hxx> + + + +namespace ary +{ +namespace idl +{ + + +Ce_Type::Ce_Type( Ce_id i_relatedCe, + const std::vector<Type_id> * i_templateParameters ) + : nRelatedCe(i_relatedCe), + pTemplateParameters(0) +{ + if (i_templateParameters != 0) + pTemplateParameters = new std::vector<Type_id>(*i_templateParameters); +} + +Ce_Type::~Ce_Type() +{ +} + +ClassId +Ce_Type::get_AryClass() const +{ + return class_id; +} + +void +Ce_Type::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +void +Ce_Type::inq_Get_Text( StringVector & o_module, + String & o_name, + Ce_id & o_nRelatedCe, + int & , // o_nSequenceCount + const Gate & i_rGate ) const +{ + String sDummyMember; + + const CodeEntity & + rCe = i_rGate.Ces().Find_Ce(nRelatedCe); + i_rGate.Ces().Get_Text( o_module, + o_name, + sDummyMember, + rCe ); + o_nRelatedCe = nRelatedCe; +} + +const std::vector<Type_id> * +Ce_Type::inq_TemplateParameters() const +{ + return pTemplateParameters.Ptr(); +} + + + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/it_ce.hxx b/autodoc/source/ary/idl/it_ce.hxx new file mode 100644 index 000000000000..f2de201503d8 --- /dev/null +++ b/autodoc/source/ary/idl/it_ce.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDL_IT_CE_HXX +#define ARY_IDL_IT_CE_HXX + +// BASE CLASSES +#include <ary/idl/i_type.hxx> + + + + +namespace ary +{ +namespace idl +{ + + +/** A named ->Type related to its corresponding + ->CodeEntity. +*/ +class Ce_Type : public Type +{ + public: + enum E_ClassId { class_id = 2201 }; + + // LIFECYCLE + Ce_Type( + Ce_id i_relatedCe, + const std::vector<Type_id> * + i_templateParameters ); + virtual ~Ce_Type(); + + // INQUIRY + Ce_id RelatedCe() const { return nRelatedCe; } + + private: + // Interface csv::ConstProcessorClient: + virtual void do_Accept( + csv::ProcessorIfc & io_processor ) const; + // Interface Object: + virtual ClassId get_AryClass() const; + + // Interface Type: + virtual void inq_Get_Text( + StringVector & o_module, + String & o_name, + Ce_id & o_nRelatedCe, + int & o_nSequemceCount, + const Gate & i_rGate ) const; + virtual const std::vector<Type_id> * + inq_TemplateParameters() const; + // DATA + Ce_id nRelatedCe; + Dyn< std::vector<Type_id> > + pTemplateParameters; +}; + + + + +} // namespace idl +} // namespace ary +#endif diff --git a/autodoc/source/ary/idl/it_explicit.cxx b/autodoc/source/ary/idl/it_explicit.cxx new file mode 100644 index 000000000000..552abe5b586b --- /dev/null +++ b/autodoc/source/ary/idl/it_explicit.cxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "it_explicit.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/processor.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/idl/ip_type.hxx> +#include "it_xnameroom.hxx" + + + +namespace ary +{ +namespace idl +{ + + +ExplicitType::ExplicitType( const String & i_sName, + Type_id i_nXNameRoom, + Ce_id i_nModuleOfOccurrence, + const std::vector<Type_id> * + i_templateParameters ) + : Named_Type(i_sName), + nXNameRoom(i_nXNameRoom), + nModuleOfOccurrence(i_nModuleOfOccurrence), + pTemplateParameters(0) +{ + if (i_templateParameters != 0) + pTemplateParameters = new std::vector<Type_id>(*i_templateParameters); +} + +ExplicitType::~ExplicitType() +{ +} + +ClassId +ExplicitType::get_AryClass() const +{ + return class_id; +} + +void +ExplicitType::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +void +ExplicitType::inq_Get_Text( StringVector & o_module, + String & o_name, + Ce_id & o_nRelatedCe, + int & o_nSequenceCount, + const Gate & i_rGate ) const +{ + const ExplicitNameRoom & + rNameRoom = i_rGate.Types().Find_XNameRoom(nXNameRoom); + rNameRoom.Get_Text(o_module,o_name,o_nRelatedCe,o_nSequenceCount,i_rGate); + + o_name = Name(); +} + +const std::vector<Type_id> * +ExplicitType::inq_TemplateParameters() const +{ + return pTemplateParameters.Ptr(); +} + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/it_explicit.hxx b/autodoc/source/ary/idl/it_explicit.hxx new file mode 100644 index 000000000000..8a3d8d76a24d --- /dev/null +++ b/autodoc/source/ary/idl/it_explicit.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDL_IT_EXPLICIT_HXX +#define ARY_IDL_IT_EXPLICIT_HXX + +// BASE CLASSES +#include "it_named.hxx" + + + + +namespace ary +{ +namespace idl +{ + + +/** A named @->Type, not yet related to its corresponding + @->CodeEntity. +*/ +class ExplicitType : public Named_Type +{ + public: + enum E_ClassId { class_id = 2203 }; + + // LIFECYCLE + ExplicitType( + const String & i_sName, + Type_id i_nXNameRoom, + Ce_id i_nModuleOfOccurrence, + const std::vector<Type_id> * + i_templateParameters ); + virtual ~ExplicitType(); + + // INQUIRY + Ce_id ModuleOfOccurrence() const + { return nModuleOfOccurrence; } + Type_id NameRoom() const { return nXNameRoom; } + + private: + // Interface csv::ConstProcessorClient: + virtual void do_Accept( + csv::ProcessorIfc & io_processor ) const; + // Interface CppEntity: + virtual ClassId get_AryClass() const; + + // Interface Type: + virtual void inq_Get_Text( + StringVector & o_module, + String & o_name, + Ce_id & o_nRelatedCe, + int & o_nSequemceCount, + const Gate & i_rGate ) const; + virtual const std::vector<Type_id> * + inq_TemplateParameters() const; + // DATA + Type_id nXNameRoom; // As written in code. + Ce_id nModuleOfOccurrence; + Dyn< const std::vector<Type_id> > + pTemplateParameters; +}; + + + + +} // namespace idl +} // namespace ary +#endif diff --git a/autodoc/source/ary/idl/it_named.hxx b/autodoc/source/ary/idl/it_named.hxx new file mode 100644 index 000000000000..a1f431368b6d --- /dev/null +++ b/autodoc/source/ary/idl/it_named.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDL_IT_NAMED_HXX +#define ARY_IDL_IT_NAMED_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <ary/idl/i_type.hxx> + // COMPONENTS + // PARAMETERS + + +namespace ary +{ +namespace idl +{ + + + + +/** Represents types with a name - in opposite to e.g. sequences, + which do not have one. +*/ +class Named_Type : public Type +{ + public: + // LIFECYCLE + virtual ~Named_Type() {} + + // INQUIRY + const String & Name() const { return sName; } + + protected: + Named_Type( + const String & i_sName ) + : sName(i_sName) { } + private: + // DATA + String sName; +}; + + + +} // namespace idl +} // namespace ary + + +#endif + diff --git a/autodoc/source/ary/idl/it_sequence.cxx b/autodoc/source/ary/idl/it_sequence.cxx new file mode 100644 index 000000000000..144c64ca6c80 --- /dev/null +++ b/autodoc/source/ary/idl/it_sequence.cxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "it_sequence.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/processor.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_type.hxx> + + + +namespace ary +{ +namespace idl +{ + + +Sequence::Sequence( Type_id i_nRelatedType ) + : nRelatedType(i_nRelatedType) +{ +} + +Sequence::~Sequence() +{ +} + +ClassId +Sequence::get_AryClass() const +{ + return class_id; +} + +void +Sequence::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +void +Sequence::inq_Get_Text( StringVector & o_module, + String & o_name, + Ce_id & o_nRelatedCe, + int & o_nSequenceCount, + const Gate & i_rGate ) const +{ + ++o_nSequenceCount; + + i_rGate.Types().Find_Type(nRelatedType) + .Get_Text( o_module, + o_name, + o_nRelatedCe, + o_nSequenceCount, + i_rGate ); +} + +const Type & +Sequence::inq_FirstEnclosedNonSequenceType(const Gate & i_rGate) const +{ + return i_rGate.Types().Find_Type(nRelatedType).FirstEnclosedNonSequenceType(i_rGate); +} + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/it_sequence.hxx b/autodoc/source/ary/idl/it_sequence.hxx new file mode 100644 index 000000000000..c4a29d410fd5 --- /dev/null +++ b/autodoc/source/ary/idl/it_sequence.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDL_IT_SEQUENCE_HXX +#define ARY_IDL_IT_SEQUENCE_HXX + +// BASE CLASSES +#include <ary/idl/i_type.hxx> + + + + +namespace ary +{ +namespace idl +{ + + +/** A sequence (an array of a type). +*/ +class Sequence : public Type +{ + public: + enum E_ClassId { class_id = 2202 }; + + // LIFECYCLE + Sequence( + Type_id i_nRelatedType ); + virtual ~Sequence(); + + // INQUIRY + Type_id RelatedType() const { return nRelatedType; } + + private: + // Interface csv::ConstProcessorClient: + virtual void do_Accept( + csv::ProcessorIfc & io_processor ) const; + // Interface Object: + virtual ClassId get_AryClass() const; + + // Interface Type: + virtual void inq_Get_Text( + StringVector & o_module, + String & o_name, + Ce_id & o_nRelatedCe, + int & o_nSequemceCount, + const Gate & i_rGate ) const; + virtual const Type & + inq_FirstEnclosedNonSequenceType( + const Gate & i_rGate ) const; + // DATA + Type_id nRelatedType; +}; + + + + +} // namespace idl +} // namespace ary +#endif diff --git a/autodoc/source/ary/idl/it_tplparam.cxx b/autodoc/source/ary/idl/it_tplparam.cxx new file mode 100644 index 000000000000..cde0d096c85f --- /dev/null +++ b/autodoc/source/ary/idl/it_tplparam.cxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "it_tplparam.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/processor.hxx> + + + +namespace ary +{ +namespace idl +{ + + + +TemplateParamType::TemplateParamType( const char * i_sName ) + : Named_Type(i_sName) +{ +} + +TemplateParamType::~TemplateParamType() +{ +} + +ClassId +TemplateParamType::get_AryClass() const +{ + return class_id; +} + +void +TemplateParamType::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +void +TemplateParamType::inq_Get_Text( StringVector & , // o_module + String & o_name, + Ce_id & , // o_nRelatedCe + int & , // o_nSequenceCount + const Gate & ) const // i_rGate +{ + o_name = Name(); +} + + +//************* Implemented default function for idl::Type ********// + +const std::vector<Type_id> * +Type::inq_TemplateParameters() const +{ + return 0; +} + +const Type & +Type::inq_FirstEnclosedNonSequenceType(const Gate & ) const +{ + return *this; +} + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/it_tplparam.hxx b/autodoc/source/ary/idl/it_tplparam.hxx new file mode 100644 index 000000000000..608332d6c9de --- /dev/null +++ b/autodoc/source/ary/idl/it_tplparam.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDL_IT_TPLPARAM_HXX +#define ARY_IDL_IT_TPLPARAM_HXX + +// BASE CLASSES +#include "it_named.hxx" + + + + +namespace ary +{ +namespace idl +{ + + +/** @resp Represents a template type when it is used within the + declaring struct. +*/ +class TemplateParamType : public Named_Type +{ + public: + enum E_ClassId { class_id = 2205 }; + + // LIFECYCLE + TemplateParamType( + const char * i_sName ); + virtual ~TemplateParamType(); + + Ce_id StructId() const; /// The struct which declares this type. + void Set_StructId( + Ce_id i_nStruct ); + private: + // Interface csv::ConstProcessorClient: + virtual void do_Accept( + csv::ProcessorIfc & io_processor ) const; + // Interface Object: + virtual ClassId get_AryClass() const; + + // Interface Type: + virtual void inq_Get_Text( + StringVector & o_module, + String & o_name, + Ce_id & o_nRelatedCe, + int & o_nSequenceCount, + const Gate & i_rGate ) const; + // DATA + Ce_id nStruct; /// The struct which declares this type. +}; + + + + +// IMPLEMENTATION +inline Ce_id +TemplateParamType::StructId() const +{ + return nStruct; +} + +inline void +TemplateParamType::Set_StructId( Ce_id i_nStruct ) +{ + nStruct = i_nStruct; +} + + + + +} // namespace idl +} // namespace ary +#endif diff --git a/autodoc/source/ary/idl/it_xnameroom.cxx b/autodoc/source/ary/idl/it_xnameroom.cxx new file mode 100644 index 000000000000..a990fdb7982e --- /dev/null +++ b/autodoc/source/ary/idl/it_xnameroom.cxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "it_xnameroom.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/processor.hxx> +#include <cosv/tpl/tpltools.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_type.hxx> + + + +namespace ary +{ +namespace idl +{ + + +ExplicitNameRoom::ExplicitNameRoom() + : aImpl() +{ +} + +ExplicitNameRoom::ExplicitNameRoom( const String & i_sName, + const ExplicitNameRoom & i_rParent ) + : aImpl( i_sName, i_rParent.aImpl, i_rParent.TypeId() ) +{ +} + +ExplicitNameRoom::~ExplicitNameRoom() +{ +} + +ClassId +ExplicitNameRoom::get_AryClass() const +{ + return class_id; +} + +void +ExplicitNameRoom::do_Accept( csv::ProcessorIfc & io_processor ) const +{ + csv::CheckedCall(io_processor, *this); +} + +void +ExplicitNameRoom::inq_Get_Text( StringVector & o_module, + String & , // o_name + Ce_id & , // o_nRelatedCe + int & , // o_nSequemceCount + const Gate & ) const // i_rGate +{ + StringVector::const_iterator it = NameChain_Begin(); + if ( it != NameChain_End() + ? (*it).empty() + : false ) + { // Don't put out the root global namespace + ++it; + } + + for ( ; + it != NameChain_End(); + ++it ) + { + o_module.push_back(*it); + } +} + + + + +} // namespace idl +} // namespace ary diff --git a/autodoc/source/ary/idl/it_xnameroom.hxx b/autodoc/source/ary/idl/it_xnameroom.hxx new file mode 100644 index 000000000000..ea9513605cb6 --- /dev/null +++ b/autodoc/source/ary/idl/it_xnameroom.hxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDL_IT_XNAMEROOM_HXX +#define ARY_IDL_IT_XNAMEROOM_HXX + +// BASE CLASSES +#include <ary/idl/i_type.hxx> +#include <nametreenode.hxx> + + + + +namespace ary +{ +namespace idl +{ + + +/** A namespace for ->Type s, as they are explicitely written in code. + + The search/identification string is usually the local name of + the Type. But for templated structs, the search string has this + pattern: + <LocalName> '<' <StringOfTemplateTypeId> +*/ +class ExplicitNameRoom : public Type +{ + public: + enum E_ClassId { class_id = 2204 }; + + // LIFECYCLE + ExplicitNameRoom(); + ExplicitNameRoom( + const String & i_sName, + const ExplicitNameRoom & + i_rParent ); + virtual ~ExplicitNameRoom(); + + // OPERATIONS + /** @param i_sSearchString + A local type name usually. + For templated types see class docu. + @see ExplicitNameRoom + */ + void Add_Name( + const String & i_sSearchString, + Type_id i_nId ) + { aImpl.Add_Name(i_sSearchString,i_nId); } + // INQUIRY + const String & Name() const { return aImpl.Name(); } + intt Depth() const { return aImpl.Depth(); } + void Get_FullName( + StringVector & o_rText, + Ce_idList * o_pRelatedCes, + const Gate & i_rGate ) const; + bool IsAbsolute() const { return Depth() > 0 + ? (*NameChain_Begin()).empty() + : false; } + /** @param i_sSearchString + A local type name usually. + For templated types see class docu. + @see ExplicitNameRoom + */ + Type_id Search_Name( + const String & i_sSearchString ) const + { return aImpl.Search_Name(i_sSearchString); } + + StringVector::const_iterator + NameChain_Begin() const + { return aImpl.NameChain_Begin(); } + StringVector::const_iterator + NameChain_End() const + { return aImpl.NameChain_End(); } + private: + // Interface csv::ConstProcessorClient: + virtual void do_Accept( + csv::ProcessorIfc & io_processor ) const; + // Interface Object: + virtual ClassId get_AryClass() const; + + // Interface Type: + virtual void inq_Get_Text( + StringVector & o_module, + String & o_name, + Ce_id & o_nRelatedCe, + int & o_nSequemceCount, + const Gate & i_rGate ) const; + // DATA + NameTreeNode<Type_id> + aImpl; +}; + + + + +} // namespace idl +} // namespace ary +#endif diff --git a/autodoc/source/ary/idl/makefile.mk b/autodoc/source/ary/idl/makefile.mk new file mode 100644 index 000000000000..bf260e2c521e --- /dev/null +++ b/autodoc/source/ary/idl/makefile.mk @@ -0,0 +1,87 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=autodoc +TARGET=ary_idl + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + +# --- Files -------------------------------------------------------- + + +OBJFILES= \ + $(OBJ)$/i_attribute.obj \ + $(OBJ)$/i_ce.obj \ + $(OBJ)$/i_ce2s.obj \ + $(OBJ)$/i_comrela.obj \ + $(OBJ)$/i_constant.obj \ + $(OBJ)$/i_constgroup.obj \ + $(OBJ)$/i_enum.obj \ + $(OBJ)$/i_enumvalue.obj \ + $(OBJ)$/i_exception.obj \ + $(OBJ)$/i_function.obj \ + $(OBJ)$/i_interface.obj \ + $(OBJ)$/i_module.obj \ + $(OBJ)$/i_namelookup.obj \ + $(OBJ)$/i_param.obj \ + $(OBJ)$/i_property.obj \ + $(OBJ)$/i_reposypart.obj \ + $(OBJ)$/i_service.obj \ + $(OBJ)$/i_singleton.obj \ + $(OBJ)$/i_siservice.obj \ + $(OBJ)$/i_sisingleton.obj \ + $(OBJ)$/i_struct.obj \ + $(OBJ)$/i_structelem.obj \ + $(OBJ)$/i_traits.obj \ + $(OBJ)$/i_typedef.obj \ + $(OBJ)$/i2s_calculator.obj \ + $(OBJ)$/ia_ce.obj \ + $(OBJ)$/ia_type.obj \ + $(OBJ)$/is_ce.obj \ + $(OBJ)$/is_type.obj \ + $(OBJ)$/it_builtin.obj \ + $(OBJ)$/it_ce.obj \ + $(OBJ)$/it_explicit.obj \ + $(OBJ)$/it_sequence.obj \ + $(OBJ)$/it_tplparam.obj \ + $(OBJ)$/it_xnameroom.obj + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/autodoc/source/ary/inc/cpp_internalgate.hxx b/autodoc/source/ary/inc/cpp_internalgate.hxx new file mode 100644 index 000000000000..723e019cb4f6 --- /dev/null +++ b/autodoc/source/ary/inc/cpp_internalgate.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_CPP_INTERNALGATE_HXX +#define ARY_CPP_INTERNALGATE_HXX + +// BASE CLASSES +#include <ary/cpp/c_gate.hxx> + +namespace ary +{ + class RepositoryCenter; +} + + + + +namespace ary +{ +namespace cpp +{ + + +/** Provides access to the ->cpp::RepositoryPartition as far as is needed + by the ->RepositoryCenter. +*/ +class InternalGate : public ::ary::cpp::Gate +{ + public: + virtual ~InternalGate() {} + + static DYN InternalGate & + Create_Partition_( + RepositoryCenter & i_center ); +}; + + + + +} // namespace cpp +} // namespace ary +#endif diff --git a/autodoc/source/ary/inc/cross_refs.hxx b/autodoc/source/ary/inc/cross_refs.hxx new file mode 100644 index 000000000000..8f6b98aabc05 --- /dev/null +++ b/autodoc/source/ary/inc/cross_refs.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_CROSS_REFS_HXX +#define ARY_CROSS_REFS_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +#include "sorted_idset.hxx" + + +template <class VALUE_LIST, class TYPES> +class CrossReferences +{ + public: + typedef TYPES::element_type element; + + /// Checks for double occurences + void Add( + VALUE_LIST::index_type + i_nPosition + const element & i_rElem ); + void Get_List( + Dyn_StdConstIterator<element> & + o_rResult ) const; + private: + SortedIdSet<TYPES> aData[VALUE_LIST::max]; +}; + + + +namespace ary +{ + +template <class TYPES> +class SortedIdSet +{ + public: + typedef typename TYPES::element_type element; + typedef typename TYPES::sort_type sorter; + typedef typename TYPES::find_type finder; + + SortedIdSet( + const finder & i_rFinder ) + : aSorter(i_rFinder), + aData(aSorter) {} + ~SortedIdSet() {} + + void Get_Begin( + Dyn_StdConstIterator<element> & + o_rResult ) + { o_rResult = new SCI_Set<FINDER>(aData); } + void Add( + const element & i_rElement ) + { aData.insert(i_rElement); } + + private: + typedef std::set<element, sorter> Set; + + // DATA + sorter aSorter; + Set aData; +}; + + +} // namespace ary + + + +#endif + diff --git a/autodoc/source/ary/inc/idl_internalgate.hxx b/autodoc/source/ary/inc/idl_internalgate.hxx new file mode 100644 index 000000000000..783971f7295f --- /dev/null +++ b/autodoc/source/ary/inc/idl_internalgate.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDL_INTERNALGATE_HXX +#define ARY_IDL_INTERNALGATE_HXX + +// BASE CLASSES +#include <ary/idl/i_gate.hxx> + +namespace ary +{ + class RepositoryCenter; +} + + + + +namespace ary +{ +namespace idl +{ + + +/** Provides access to the ->idl::RepositoryPartition as far as is needed + by the ->RepositoryCenter. +*/ +class InternalGate : public ::ary::idl::Gate +{ + public: + virtual ~InternalGate() {} + + static DYN InternalGate & + Create_Partition_( + RepositoryCenter & i_center ); +}; + + + + +} // namespace idl +} // namespace ary +#endif diff --git a/autodoc/source/ary/inc/idsort.hxx b/autodoc/source/ary/inc/idsort.hxx new file mode 100644 index 000000000000..d0bbaa37e7a2 --- /dev/null +++ b/autodoc/source/ary/inc/idsort.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_IDSORT_HXX +#define ARY_IDSORT_HXX + + +/** A compare function that sorts ids of repository entities in the same + storage. + + @see ::ary::SortedIds +*/ +template<class COMPARE> +struct IdSorter +{ + bool operator()( + typename COMPARE::id_type + i_1, + typename COMPARE::id_type + i_2 ) const + { return COMPARE::Lesser_( + COMPARE::KeyOf_(COMPARE::EntityOf_(i_1)), + COMPARE::KeyOf_(COMPARE::EntityOf_(i_2)) ); + } +}; + + +#endif diff --git a/autodoc/source/ary/inc/loc_internalgate.hxx b/autodoc/source/ary/inc/loc_internalgate.hxx new file mode 100644 index 000000000000..13409e6364de --- /dev/null +++ b/autodoc/source/ary/inc/loc_internalgate.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_LOC_INTERNALGATE_HXX +#define ARY_LOC_INTERNALGATE_HXX + +// USED SERVICES + +namespace ary +{ +namespace loc +{ + class LocationPilot; +} +} + + + + +namespace ary +{ +namespace loc +{ + + +/** Additional access to locations for the repository implementation. +*/ +class InternalGate +{ + public: + + static DYN LocationPilot & + Create_Locations_(); +}; + + +} // namespace loc +} // namespace ary +#endif diff --git a/autodoc/source/ary/inc/nametreenode.hxx b/autodoc/source/ary/inc/nametreenode.hxx new file mode 100644 index 000000000000..c7d77faaab34 --- /dev/null +++ b/autodoc/source/ary/inc/nametreenode.hxx @@ -0,0 +1,210 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_NAMETREENODE_HXX +#define ARY_NAMETREENODE_HXX +// KORR_DEPRECATED_3.0 +// Replace by ::ary::symtree::Node. + +// USED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <sci_impl.hxx> +// HACK because of SunPro 5.2 compiler bug with templates: +#include <ary/idl/i_module.hxx> + + + + +namespace ary +{ + + +/** Implementation of a node in a namespace-tree. +*/ +template<class ITEM_ID> +class NameTreeNode +{ + public: + typedef NameTreeNode self; + typedef ITEM_ID item_id; + typedef StringVector::const_iterator name_iterator; + typedef std::map<String, item_id> Map_LocalNames; + + // LIFECYCLE + NameTreeNode(); + NameTreeNode( + const String & i_sName, + const self & i_rParent, + ITEM_ID i_nParentId ); + virtual ~NameTreeNode(); + + // OPERATIONS + void Add_Name( + const String & i_sName, + item_id i_nId ); + // INQUIRY + const String & Name() const { return Depth() > 0 ? aCompleteNameChain.back() : String::Null_(); } + item_id Parent() const { return nParent; } + intt Depth() const { return aCompleteNameChain.size(); } + + bool IsEquivalent( + const NameTreeNode & + i_rNode ) const; + name_iterator NameChain_Begin() const { return aCompleteNameChain.begin(); } + name_iterator NameChain_End() const { return aCompleteNameChain.end(); } + + item_id Search_Name( + const String & i_sName ) const; + void Get_Names( + Dyn_StdConstIterator<ITEM_ID> & + o_rResult ) const; + const Map_LocalNames & + LocalNames() const { return aLocalNames; } + private: + // Locals + Map_LocalNames & LocalNames() { return aLocalNames; } + + // DATA + Map_LocalNames aLocalNames; + StringVector aCompleteNameChain; + item_id nParent; +}; + + + + +// IMPLEMENTATION +template<class ITEM_ID> +NameTreeNode<ITEM_ID>::NameTreeNode() + : aLocalNames(), + aCompleteNameChain(), + nParent(0) +{ +} + +template<class ITEM_ID> +NameTreeNode<ITEM_ID>::NameTreeNode( const String & i_sName, + const self & i_rParent, + ITEM_ID i_nParentId ) + : aLocalNames(), + aCompleteNameChain(), + nParent(i_nParentId) +{ + aCompleteNameChain.reserve(i_rParent.Depth()+1); + for ( name_iterator it = i_rParent.NameChain_Begin(); + it != i_rParent.NameChain_End(); + ++it ) + { + aCompleteNameChain.push_back(*it); + } + aCompleteNameChain.push_back(i_sName); +} + +template<class ITEM_ID> +NameTreeNode<ITEM_ID>::~NameTreeNode() +{ +} + + +template<class ITEM_ID> +inline void +NameTreeNode<ITEM_ID>::Add_Name( const String & i_sName, + item_id i_nId ) +{ + LocalNames().insert( typename Map_LocalNames::value_type(i_sName, i_nId) ); +} + + +template<class ITEM_ID> +inline bool +NameTreeNode<ITEM_ID>::IsEquivalent( const NameTreeNode & i_rNode ) const +{ + return aCompleteNameChain == i_rNode.aCompleteNameChain; +} + +template<class ITEM_ID> +inline ITEM_ID +NameTreeNode<ITEM_ID>::Search_Name( const String & i_sName ) const +{ + return csv::value_from_map(LocalNames(),i_sName, ITEM_ID(0)); +} + +template<class ITEM_ID> +inline void +NameTreeNode<ITEM_ID>::Get_Names( Dyn_StdConstIterator<ITEM_ID> & o_rResult ) const +{ + o_rResult = new SCI_DataInMap<String,item_id>(LocalNames()); +} + + +// HACK because of SunPro 5.2 compiler bug with templates: +// ary::idl::Module has to be "FIND_NODE::node_type" +// must be solved later somehow. +template <class FIND_NODE> +typename FIND_NODE::id_type +Search_SubTree( const ary::idl::Module & i_rStart, + const FIND_NODE & i_rNodeFinder ) +{ + const ary::idl::Module * + ret = &i_rStart; + + for ( StringVector::const_iterator it = i_rNodeFinder.Begin(); + it != i_rNodeFinder.End() AND ret != 0; + ++it ) + { + ret = i_rNodeFinder(ret->Search_Name(*it)); + } + + typename FIND_NODE::id_type nret(0); + return ret != 0 + ? ret->Search_Name(i_rNodeFinder.Name2Search()) + : nret; +} + +template <class FIND_NODE> +typename FIND_NODE::id_type +Search_SubTree_UpTillRoot( const ary::idl::Module & i_rStart, + const FIND_NODE & i_rNodeFinder ) +{ + typename FIND_NODE::id_type + ret(0); + for ( const ary::idl::Module * start = &i_rStart; + start != 0 AND NOT ret.IsValid(); + start = i_rNodeFinder(start->Owner()) ) + { + ret = Search_SubTree( *start, + i_rNodeFinder ); + } + return ret; +} +// END Hack for SunPro 5.2 compiler bug. + + + + +} // namespace ary +#endif diff --git a/autodoc/source/ary/inc/reposy.hxx b/autodoc/source/ary/inc/reposy.hxx new file mode 100644 index 000000000000..6bdfd907ce04 --- /dev/null +++ b/autodoc/source/ary/inc/reposy.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_REPOSY_HXX +#define ARY_REPOSY_HXX + +// BASE CLASSES +#include <ary/ary.hxx> +// USED SERVICES +#include <cosv/ploc_dir.hxx> + +namespace ary +{ +namespace cpp +{ + class InternalGate; +} +namespace idl +{ + class InternalGate; +} +} // namespace ary + + + + +namespace ary +{ + + +/** Implements ::ary::Repository. + + @see Repository +*/ + +class RepositoryCenter : public ::ary::Repository +{ + public: + // LIFECYCLE + RepositoryCenter(); + virtual ~RepositoryCenter(); + + // INHERITED + // Interface Repository: + virtual const cpp::Gate & Gate_Cpp() const; + virtual const idl::Gate & Gate_Idl() const; + virtual const String & Title() const; + virtual cpp::Gate & Gate_Cpp(); + virtual idl::Gate & Gate_Idl(); + virtual void Set_Title(const String & i_sName ); + + private: + // DATA + String sDisplayedName; /// Name to be displayed for human users. + csv::ploc::Directory + aLocation; + Dyn<cpp::InternalGate> + pCppPartition; + Dyn<idl::InternalGate> + pIdlPartition; +}; + + + + +} // namespace ary +#endif diff --git a/autodoc/source/ary/inc/sci_impl.hxx b/autodoc/source/ary/inc/sci_impl.hxx new file mode 100644 index 000000000000..26c5236904b9 --- /dev/null +++ b/autodoc/source/ary/inc/sci_impl.hxx @@ -0,0 +1,413 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_SCI_IMPL_HXX +#define ARY_SCI_IMPL_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <ary/stdconstiter.hxx> + // COMPONENTS + // PARAMETERS + + +namespace ary +{ + + +//************************* SCI_Vector **********************************// + +template <class ELEM> +class SCI_Vector : public StdConstIterator<ELEM> +{ + public: + typedef std::vector<ELEM> source; + typedef typename source::const_iterator source_iterator; + + SCI_Vector( + const source & i_rSource ); + virtual ~SCI_Vector(); + + private: + // Interface StdConstIterator<>: + virtual void do_Advance(); + virtual const ELEM * + inq_CurElement() const; + virtual bool inq_IsSorted() const; + + // DATA + source_iterator itRun; + source_iterator itEnd; +}; + + + +//************************* SCI_Map **********************************// + +template <class KEY, class VALUE> +class SCI_Map : public StdConstIterator< typename std::map<KEY,VALUE>::value_type > +{ + public: + typedef std::map<KEY,VALUE> source; + typedef typename source::const_iterator source_iterator; + + SCI_Map( + const source & i_rSource ); + virtual ~SCI_Map(); + + private: + // Interface StdConstIterator<>: + virtual void do_Advance(); + virtual const typename std::map<KEY,VALUE>::value_type * + inq_CurElement() const; + virtual bool inq_IsSorted() const; + + // DATA + source_iterator itRun; + source_iterator itEnd; +}; + + +//************************* SCI_MultiMap **********************************// + +template <class KEY, class VALUE> +class SCI_MultiMap : public StdConstIterator< typename std::multimap<KEY,VALUE>::value_type > +{ + public: + typedef std::multimap<KEY,VALUE> source; + typedef typename source::const_iterator source_iterator; + + SCI_MultiMap( + const source & i_rSource ); + SCI_MultiMap( + source_iterator i_begin, + source_iterator i_end ); + virtual ~SCI_MultiMap(); + + private: + // Interface StdConstIterator<>: + virtual void do_Advance(); + virtual const typename std::multimap<KEY,VALUE>::value_type * + inq_CurElement() const; + virtual bool inq_IsSorted() const; + + // DATA + source_iterator itRun; + source_iterator itEnd; +}; + + + +//************************* SCI_Set **********************************// + + +template <class TYPES> +class SCI_Set : public StdConstIterator<typename TYPES::element_type> +{ + public: + typedef typename TYPES::element_type element; + typedef typename TYPES::sort_type sorter; + typedef std::set<element, sorter> source; + typedef typename source::const_iterator source_iterator; + + SCI_Set( + const source & i_rSource ); + virtual ~SCI_Set(); + + private: + // Interface StdConstIterator<>: + virtual void do_Advance(); + virtual const element * + inq_CurElement() const; + virtual bool inq_IsSorted() const; + + // DATA + source_iterator itRun; + source_iterator itEnd; +}; + +//************************* SCI_DataInMap **********************************// + +template <class KEY, class VALUE> +class SCI_DataInMap : public StdConstIterator<VALUE> +{ + public: + typedef std::map<KEY,VALUE> source; + typedef typename source::const_iterator source_iterator; + + SCI_DataInMap( + const source & i_rSource ); + virtual ~SCI_DataInMap(); + + private: + // Interface StdConstIterator<>: + virtual void do_Advance(); + virtual const VALUE * + inq_CurElement() const; + virtual bool inq_IsSorted() const; + + // DATA + source_iterator itRun; + source_iterator itEnd; +}; + + + + + +//********************************************************************// + + +// IMPLEMENTATION + +template <class ELEM> +SCI_Vector<ELEM>::SCI_Vector( const source & i_rSource ) + : itRun(i_rSource.begin()), + itEnd(i_rSource.end()) +{ +} + +template <class ELEM> +SCI_Vector<ELEM>::~SCI_Vector() +{ +} + + +template <class ELEM> +void +SCI_Vector<ELEM>::do_Advance() +{ + if (itRun != itEnd) + ++itRun; +} + +template <class ELEM> +const ELEM * +SCI_Vector<ELEM>::inq_CurElement() const +{ + if (itRun != itEnd) + return &(*itRun); + return 0; +} + +template <class ELEM> +bool +SCI_Vector<ELEM>::inq_IsSorted() const +{ + return false; +} + + + + +template <class KEY, class VALUE> +SCI_Map<KEY,VALUE>::SCI_Map( const source & i_rSource ) + : itRun(i_rSource.begin()), + itEnd(i_rSource.end()) +{ +} + +template <class KEY, class VALUE> +SCI_Map<KEY,VALUE>::~SCI_Map() +{ +} + +template <class KEY, class VALUE> +void +SCI_Map<KEY,VALUE>::do_Advance() +{ + if (itRun != itEnd) + ++itRun; +} + +template <class KEY, class VALUE> +const typename std::map<KEY,VALUE>::value_type * +SCI_Map<KEY,VALUE>::inq_CurElement() const +{ + if (itRun != itEnd) + return &(*itRun); + return 0; +} + + +template <class KEY, class VALUE> +bool +SCI_Map<KEY,VALUE>::inq_IsSorted() const +{ + return true; +} + + + + + + + +template <class KEY, class VALUE> +SCI_MultiMap<KEY,VALUE>::SCI_MultiMap( const source & i_rSource ) + : itRun(i_rSource.begin()), + itEnd(i_rSource.end()) +{ +} + +template <class KEY, class VALUE> +SCI_MultiMap<KEY,VALUE>::SCI_MultiMap( source_iterator i_begin, + source_iterator i_end ) + : itRun(i_begin), + itEnd(i_end) +{ +} + +template <class KEY, class VALUE> +SCI_MultiMap<KEY,VALUE>::~SCI_MultiMap() +{ +} + +template <class KEY, class VALUE> +void +SCI_MultiMap<KEY,VALUE>::do_Advance() +{ + if (itRun != itEnd) + ++itRun; +} + +template <class KEY, class VALUE> +const typename std::multimap<KEY,VALUE>::value_type * +SCI_MultiMap<KEY,VALUE>::inq_CurElement() const +{ + if (itRun != itEnd) + return &(*itRun); + return 0; +} + + +template <class KEY, class VALUE> +bool +SCI_MultiMap<KEY,VALUE>::inq_IsSorted() const +{ + return true; +} + + + + + + + + +template <class ELEM> +SCI_Set<ELEM>::SCI_Set( const source & i_rSource ) + : itRun(i_rSource.begin()), + itEnd(i_rSource.end()) +{ +} + +template <class ELEM> +SCI_Set<ELEM>::~SCI_Set() +{ +} + + +template <class ELEM> +void +SCI_Set<ELEM>::do_Advance() +{ + if (itRun != itEnd) + ++itRun; +} + +template <class ELEM> +const typename SCI_Set<ELEM>::element * +SCI_Set<ELEM>::inq_CurElement() const +{ + if (itRun != itEnd) + return &(*itRun); + return 0; +} + +template <class ELEM> +bool +SCI_Set<ELEM>::inq_IsSorted() const +{ + return true; +} + + + + + + + +template <class KEY, class VALUE> +SCI_DataInMap<KEY,VALUE>::SCI_DataInMap( const source & i_rSource ) + : itRun(i_rSource.begin()), + itEnd(i_rSource.end()) +{ +} + +template <class KEY, class VALUE> +SCI_DataInMap<KEY,VALUE>::~SCI_DataInMap() +{ +} + +template <class KEY, class VALUE> +void +SCI_DataInMap<KEY,VALUE>::do_Advance() +{ + if (itRun != itEnd) + ++itRun; +} + +template <class KEY, class VALUE> +const VALUE * +SCI_DataInMap<KEY,VALUE>::inq_CurElement() const +{ + if (itRun != itEnd) + return &(*itRun).second; + return 0; +} + + +template <class KEY, class VALUE> +bool +SCI_DataInMap<KEY,VALUE>::inq_IsSorted() const +{ + return true; +} + + + + + + + +} // namespace ary + + +#endif diff --git a/autodoc/source/ary/inc/slots.hxx b/autodoc/source/ary/inc/slots.hxx new file mode 100644 index 000000000000..f5c449f7a30a --- /dev/null +++ b/autodoc/source/ary/inc/slots.hxx @@ -0,0 +1,163 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_SLOTS_HXX +#define ARY_SLOTS_HXX + + +// USED SERVICES + // BASE CLASSES +#include <ary/ceslot.hxx> + // COMPONENTS + // PARAMETERS +#include <ary/ary_disp.hxx> +#include <ary/types.hxx> +#include <ary/sequentialids.hxx> +#include <ary/cpp/c_types4cpp.hxx> +#include <ary/cpp/c_slntry.hxx> + + + +namespace ary +{ + + +class Slot_Null : public Slot +{ + public: + virtual ~Slot_Null(); + + virtual void StoreAt( + Display & o_rDestination ) const; + virtual uintt Size() const; + + private: + virtual void StoreEntries( + Display & o_rDestination ) const; +}; + +class Slot_MapLocalCe : public Slot +{ + public: + Slot_MapLocalCe( + const cpp::Map_LocalCe & i_rData ); + virtual ~Slot_MapLocalCe(); + virtual uintt Size() const; + + private: + virtual void StoreEntries( + Display & o_rDestination ) const; + // DATA + const cpp::Map_LocalCe * + pData; +}; + +class Slot_MapOperations : public Slot +{ + public: + Slot_MapOperations( + const std::multimap<String, cpp::Ce_id> & + i_rData ); + virtual ~Slot_MapOperations(); + virtual uintt Size() const; + + private: + virtual void StoreEntries( + Display & o_rDestination ) const; + // DATA + const std::multimap<String, cpp::Ce_id> * + pData; +}; + +class Slot_ListLocalCe : public Slot +{ + public: + Slot_ListLocalCe( + const cpp::List_LocalCe & + i_rData ); + virtual ~Slot_ListLocalCe(); + + virtual uintt Size() const; + + private: + virtual void StoreEntries( + Display & o_rDestination ) const; + // DATA + const cpp::List_LocalCe * + pData; +}; + +template <class ID> +class Slot_SequentialIds : public Slot +{ + public: + Slot_SequentialIds( + const SequentialIds<ID> & + i_rData ) + : pData(&i_rData) {} + virtual ~Slot_SequentialIds(); + + virtual uintt Size() const; + + private: + virtual void StoreEntries( + Display & o_rDestination ) const; + // DATA + const SequentialIds<ID> * + pData; +}; + + +template <class ID> +Slot_SequentialIds<ID>::~Slot_SequentialIds() +{ +} + +template <class ID> +uintt +Slot_SequentialIds<ID>::Size() const +{ + return pData->Size(); +} + +template <class ID> +void +Slot_SequentialIds<ID>::StoreEntries( Display & o_rDestination ) const +{ + for ( typename SequentialIds<ID>::const_iterator it = pData->Begin(); + it != pData->End(); + ++it ) + { + o_rDestination.DisplaySlot_Rid( (*it).Value() ); + } +} + + + + +} // namespace ary +#endif diff --git a/autodoc/source/ary/inc/sorted_idset.hxx b/autodoc/source/ary/inc/sorted_idset.hxx new file mode 100644 index 000000000000..93c00a1091ca --- /dev/null +++ b/autodoc/source/ary/inc/sorted_idset.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_SORTED_IDSET_HXX +#define ARY_SORTED_IDSET_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <set> + // PARAMETERS +#include "csi_impl.hxx" + + +template <class XY> class SortedIdSet; + +class Interface_2s +{ + public: + /// Checks for double occurences + void Add_ExportingService( + Ce_id i_nId ); + void Get_ExportingServices( + Dyn_StdConstIterator<Ce_id> & + o_rResult ) const; + private: + Dyn<SortedIdSet> pExportingServices; +}; + + + +namespace ary +{ + +template <class TYPES> +class SortedIdSet +{ + public: + typedef typename TYPES::element_type element; + typedef typename TYPES::sort_type sorter; + typedef typename TYPES::find_type finder; + + SortedIdSet( + const finder & i_rFinder ) + : aSorter(i_rFinder), + aData(aSorter) {} + ~SortedIdSet() {} + + void Get_Begin( + Dyn_StdConstIterator<element> & + o_rResult ) + { o_rResult = new SCI_Set<FINDER>(aData); } + void Add( + const element & i_rElement ) + { aData.insert(i_rElement); } + + private: + typedef std::set<element, sorter> Set; + + // DATA + sorter aSorter; + Set aData; +}; + + +} // namespace ary + + + +#endif + diff --git a/autodoc/source/ary/inc/sortedids.hxx b/autodoc/source/ary/inc/sortedids.hxx new file mode 100644 index 000000000000..9bebaa9b19a5 --- /dev/null +++ b/autodoc/source/ary/inc/sortedids.hxx @@ -0,0 +1,237 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_SORTEDIDS_HXX +#define ARY_SORTEDIDS_HXX + + +// USED SERVICES +#include <algorithm> +#include <cosv/tpl/range.hxx> + + + + +namespace ary +{ + + +/** Implementation of a set of children to an entity in the Autodoc + repository. The children are sorted. + + @tpl COMPARE + Needs to provide types: + entity_base_type + id_type + key_type + + and functions: + static entity_base_type & + EntityOf_( + id_type i_id ); + static const key_type & + KeyOf_( + const entity_type & i_entity ); + static bool Lesser_( + const key_type & i_1, + const key_type & i_2 ); +*/ +template<class COMPARE> +class SortedIds +{ + public: + typedef typename COMPARE::id_type element_t; + typedef typename COMPARE::key_type key_t; + typedef std::vector<element_t> data_t; + typedef typename data_t::const_iterator const_iterator; + typedef typename data_t::iterator iterator; + typedef csv::range<const_iterator> search_result_t; + + // LIFECYCLE + explicit SortedIds( + std::size_t i_reserve = 0 ); + ~SortedIds(); + + // OPERATIONS + void Add( + element_t i_elem ); + // INQUIRY + const_iterator Begin() const; + const_iterator End() const; + + element_t Search( + const key_t & i_key ) const; + search_result_t SearchAll( + const key_t & i_key ) const; + const_iterator LowerBound( + const key_t & i_key ) const; + + private: + typedef typename COMPARE::entity_base_type entity_t; + + // Locals + iterator LowerBound( + const key_t & i_key ); + + static const key_t & + KeyOf_( + element_t i_child ); + template <class ITER> + static ITER impl_LowerBound_( + ITER i_begin, + ITER i_end, + const key_t & i_key ); + + // DATA + data_t aData; +}; + + + + +// IMPLEMENTATION +template<class COMPARE> +inline const typename SortedIds<COMPARE>::key_t & +SortedIds<COMPARE>::KeyOf_(element_t i_child) +{ + return COMPARE::KeyOf_(COMPARE::EntityOf_(i_child)); +} + +template<class COMPARE> +SortedIds<COMPARE>::SortedIds(std::size_t i_reserve) + : aData() +{ + if (i_reserve > 0) + aData.reserve(i_reserve); +} + +template<class COMPARE> +SortedIds<COMPARE>::~SortedIds() +{ +} + +template<class COMPARE> +void +SortedIds<COMPARE>::Add(element_t i_elem) +{ + aData.insert( LowerBound( KeyOf_(i_elem) ), + i_elem ); +} + +template<class COMPARE> +inline typename SortedIds<COMPARE>::const_iterator +SortedIds<COMPARE>::Begin() const +{ + return aData.begin(); +} + +template<class COMPARE> +inline typename SortedIds<COMPARE>::const_iterator +SortedIds<COMPARE>::End() const +{ + return aData.end(); +} + +template<class COMPARE> +typename SortedIds<COMPARE>::element_t +SortedIds<COMPARE>::Search(const key_t & i_key) const +{ + const_iterator + ret = LowerBound(i_key); + return ret != aData.end() AND NOT COMPARE::Lesser_(i_key, KeyOf_(*ret)) + ? *ret + : element_t(0); +} + +template<class COMPARE> +typename SortedIds<COMPARE>::search_result_t +SortedIds<COMPARE>::SearchAll(const key_t & i_key) const +{ + const_iterator + r1 = LowerBound(i_key); + const_iterator + r2 = r1; + while ( r2 != aData.end() + AND NOT COMPARE::Lesser_(i_key, KeyOf_(*r2)) ) + { + ++r2; + } + + return csv::make_range(r1,r2); +} + +template<class COMPARE> +inline typename SortedIds<COMPARE>::const_iterator +SortedIds<COMPARE>::LowerBound(const key_t & i_key) const +{ + return impl_LowerBound_( aData.begin(), + aData.end(), + i_key ); +} + +template<class COMPARE> +inline typename SortedIds<COMPARE>::iterator +SortedIds<COMPARE>::LowerBound(const key_t & i_key) +{ + return impl_LowerBound_( aData.begin(), + aData.end(), + i_key ); +} + +template<class COMPARE> +template <class ITER> +ITER +SortedIds<COMPARE>::impl_LowerBound_( ITER i_begin, + ITER i_end, + const key_t & i_key ) +{ + ITER i1 = i_begin; + ITER i2 = i_end; + + for ( ITER it = i1 + (i2-i1)/2; + i1 != i2; + it = i1 + (i2-i1)/2 ) + { + if ( COMPARE::Lesser_(KeyOf_(*it), i_key) ) + { + i1 = it; + ++i1; + } + else + { + i2 = it; + } + } // end for + + return i1; +} + + + + +} // namespace ary +#endif diff --git a/autodoc/source/ary/inc/store/s_base.hxx b/autodoc/source/ary/inc/store/s_base.hxx new file mode 100644 index 000000000000..e14fc2652293 --- /dev/null +++ b/autodoc/source/ary/inc/store/s_base.hxx @@ -0,0 +1,180 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_STORE_S_BASE_HXX +#define ARY_STORE_S_BASE_HXX + +// USED SERVICES +#include <deque> +#include <cosv/tpl/tpltools.hxx> + + + + +namespace ary +{ +namespace stg +{ + + +/** The basic storage container of the repository. + + @collab Storage + Implements Storage. Not used elsewhere. + + @tpl ENTITY + The type of *it, where it is of type c_iter, has to be ENTITY * const. +*/ +template <class ENTITY> +class Base +{ + public: + // LIFECYCLE + typedef std::deque< ENTITY* > impl_type; + typedef typename impl_type::const_iterator c_iter; + + + /** @param i_nrOfReservedItems + The number of actual items to reserve, including the item + at index [0] that is always empty and unused. + */ + Base( + uintt i_nrOfReservedItems ); + ~Base(); + + // OPERATORS + ENTITY * operator[]( + uintt i_index ) const; + // OPERATIONS + uintt Add_Entity( /// @return the index of the new element. + DYN ENTITY & pass_newEntity ); + DYN ENTITY * Set_Entity( /// @return the previous value. + uintt i_index, + DYN ENTITY & pass_newEntity ); + // INQUIRY + uintt Size() const; /// Incl. reserved size. + uintt ReservedSize() const; /// Incl. zero for element at [0]. + + c_iter Begin() const; /// @return location of index 1, because 0 is always empty. + c_iter BeginUnreserved() const; + c_iter End() const; + + private: + // DATA + impl_type aData; + uintt nReservedSize; +}; + + + +// IMPLEMENTATION + +template <class ENTITY> +Base<ENTITY>::Base(uintt i_nrOfReservedItems) + : aData(i_nrOfReservedItems, 0), + nReservedSize(i_nrOfReservedItems) +{ +} + +template <class ENTITY> +Base<ENTITY>::~Base() +{ + csv::erase_container_of_heap_ptrs(aData); +} + + +template <class ENTITY> +ENTITY * +Base<ENTITY>::operator[](uintt i_index) const +{ + if (i_index < aData.size()) + return aData[i_index]; + return 0; +} + +template <class ENTITY> +uintt +Base<ENTITY>::Add_Entity(DYN ENTITY & pass_newEntity) +{ + aData.push_back(&pass_newEntity); + return aData.size() - 1; +} + +template <class ENTITY> +DYN ENTITY * +Base<ENTITY>::Set_Entity( uintt i_index, + DYN ENTITY & pass_newEntity ) +{ + csv_assert(i_index != 0 AND i_index < aData.size()); + + Dyn<ENTITY> + ret(aData[i_index]); + aData[i_index] = &pass_newEntity; + return ret.Release(); +} + +template <class ENTITY> +uintt +Base<ENTITY>::Size() const +{ + return aData.size(); +} + +template <class ENTITY> +uintt +Base<ENTITY>::ReservedSize() const +{ + return nReservedSize; +} + +template <class ENTITY> +typename Base<ENTITY>::c_iter +Base<ENTITY>::Begin() const +{ + return aData.begin() + 1; +} + +template <class ENTITY> +typename Base<ENTITY>::c_iter +Base<ENTITY>::BeginUnreserved() const +{ + return aData.begin() + nReservedSize; +} + +template <class ENTITY> +typename Base<ENTITY>::c_iter +Base<ENTITY>::End() const +{ + return aData.end(); +} + + + + +} // namespace stg +} // namespace ary +#endif diff --git a/autodoc/source/ary/inc/store/s_iterator.hxx b/autodoc/source/ary/inc/store/s_iterator.hxx new file mode 100644 index 000000000000..af5c991ba9a9 --- /dev/null +++ b/autodoc/source/ary/inc/store/s_iterator.hxx @@ -0,0 +1,237 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_STORE_S_ITERATOR_HXX +#define ARY_STORE_S_ITERATOR_HXX + +// USED SERVICES +#include <ary/getncast.hxx> +#include "s_base.hxx" + + + + +namespace ary +{ +namespace stg +{ + + +template <class> class const_iterator; +template <class, class> class const_filter_iterator; + + +/** A non-const iterator that runs on a ->Storage<>. + + @collab Storage<> +*/ +template <class ENTITY> +class iterator : public std::iterator<std::forward_iterator_tag, ENTITY> +{ + public: + typedef iterator<ENTITY> self; + typedef typename Base<ENTITY>::impl_type impl_container; + typedef typename impl_container::const_iterator impl_type; + + // OPERATORS + iterator() + : itImpl() {} + explicit iterator( + impl_type i_impl) + : itImpl(i_impl) {} + ~iterator() {} + + bool operator==( + self i_other ) const + { return itImpl == i_other.itImpl; } + bool operator!=( + self i_other ) const + { return itImpl != i_other.itImpl; } + ENTITY & operator*() const { csv_assert(*itImpl != 0); + return *(*itImpl); } + self & operator++() { ++itImpl; return *this; } + self operator++(int) { return self(itImpl++); } + + private: + friend class const_iterator<ENTITY>; // For const_iterator(iterator); + impl_type ImplIterator() const { return itImpl; } + + // DATA + impl_type itImpl; +}; + + +/** A const iterator that runs on a ->Storage<>. + + @collab Storage<> +*/ +template <class ENTITY> +class const_iterator : + public std::iterator<std::forward_iterator_tag, const ENTITY> +{ + public: + typedef const_iterator<ENTITY> self; + typedef typename Base<ENTITY>::impl_type impl_container; + typedef typename impl_container::const_iterator impl_type; + + // OPERATORS + const_iterator() + : itImpl() {} + explicit const_iterator( + impl_type i_impl) + : itImpl(i_impl) {} + const_iterator( // implicit conversions allowed + ::ary::stg::iterator<ENTITY> i_it ) + : itImpl(i_it.ImplIterator()) {} + ~const_iterator() {} + + bool operator==( + self i_other ) const + { return itImpl == i_other.itImpl; } + bool operator!=( + self i_other ) const + { return itImpl != i_other.itImpl; } + const ENTITY & operator*() const { csv_assert(*itImpl != 0); + return *(*itImpl); } + self & operator++() { ++itImpl; return *this; } + self operator++(int) { return self(itImpl++); } + + private: + // DATA + impl_type itImpl; +}; + + + + + +/** A non const iterator that runs on a ->Storage<> and returns only + the elements of a specific type. + + @tpl ENTITY + The element type of the ->Storage<> + + @tpl FILTER + The actual type of the returned items. FILTER needs to be derived from + ENTITY. + + @collab Storage<> +*/ +template <class ENTITY, class FILTER> +class filter_iterator : + public std::iterator<std::forward_iterator_tag, FILTER> +{ + public: + typedef filter_iterator<ENTITY,FILTER> self; + typedef ::ary::stg::iterator<ENTITY> impl_type; + + // OPERATORS + filter_iterator() + : itCur() {} + explicit filter_iterator( + impl_type i_cur ) + : itCur(i_cur) {} + ~filter_iterator() {} + + bool operator==( + self i_other ) const + { return itCur == i_other.itCur; } + bool operator!=( + self i_other ) const + { return itCur != i_other.itCur; } + FILTER & operator*() const { csv_assert(IsValid()); + return static_cast< FILTER& >(*itCur); } + self & operator++() { ++itCur; + return *this; } + self operator++(int) { return self(itCur++); } + bool IsValid() const { return ary::is_type<FILTER>(*itCur); } + + private: + friend class const_filter_iterator<ENTITY,FILTER>; // For const_filter_iterator(filter_iterator); + impl_type ImplCur() const { return itCur; } + + // DATA + impl_type itCur; +}; + + +/** A const iterator that runs on a ->Storage<> and returns only + the elements of a specific type. + + @tpl ENTITY + The element type of the ->Storage<> + + @tpl FILTER + The actual type of the returned items. FILTER needs to be derived from + ENTITY. + + @collab Storage<> +*/ +template <class ENTITY, class FILTER> +class const_filter_iterator : + public std::iterator<std::forward_iterator_tag, const FILTER> +{ + public: + typedef const_filter_iterator<ENTITY,FILTER> self; + typedef ::ary::stg::const_iterator<ENTITY> impl_type; + + // OPERATORS + const_filter_iterator() + : itCur() {} + explicit const_filter_iterator( + impl_type i_cur ) + : itCur(i_cur) {} + explicit const_filter_iterator( // implicit conversions allowed + filter_iterator<ENTITY,FILTER> + i_it ) + : itCur(i_it.ImplCur()) {} + ~const_filter_iterator() + {} + bool operator==( + self i_other ) const + { return itCur == i_other.itCur; } + bool operator!=( + self i_other ) const + { return itCur != i_other.itCur; } + const FILTER & operator*() const { csv_assert(IsValid()); + return static_cast< const FILTER& >(*itCur); } + self & operator++() { ++itCur; + return *this; } + self operator++(int) { return self(itCur++); } + bool IsValid() const { return ary::is_type<FILTER>(*itCur); } + + private: + // DATA + impl_type itCur; +}; + + + + +} // namespace stg +} // namespace ary +#endif diff --git a/autodoc/source/ary/inc/store/s_storage.hxx b/autodoc/source/ary/inc/store/s_storage.hxx new file mode 100644 index 000000000000..aace69ef6678 --- /dev/null +++ b/autodoc/source/ary/inc/store/s_storage.hxx @@ -0,0 +1,294 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_STORE_S_STORAGE_HXX +#define ARY_STORE_S_STORAGE_HXX + +// USED SERVICES +#include <ary/types.hxx> +#include "s_iterator.hxx" + + + + +namespace ary +{ +namespace stg +{ + + +/** The storage unit of one class of commomly stored repository + entities. +*/ +template <class ENTITY> +class Storage +{ + public: + typedef Base<ENTITY> container_type; + typedef ary::TypedId<ENTITY> key_type; + typedef stg::const_iterator<ENTITY> c_iter; + typedef stg::iterator<ENTITY> iter; + + // LIFECYCLE + virtual ~Storage() {} + + // OPERATORS + const ENTITY & operator[]( + key_type i_id ) const; + ENTITY & operator[]( + key_type i_id ); + const ENTITY & operator[]( + Rid i_index ) const; + ENTITY & operator[]( + Rid i_index ); + // OPERATIONS + /// Sets the id of the new entity. + key_type Store_Entity( + DYN ENTITY & pass_newEntity ); + /// Sets the id of the new entity. + void Set_Reserved( + uintt i_index, + DYN ENTITY & pass_newEntity ); + /// Sets the id of the new entity. + void Replace_Entity( + key_type i_index, + DYN ENTITY & pass_newEntity ); + // INQUIRY + bool Exists( + key_type i_id ) const; + bool Exists( + Rid i_index ) const; + + c_iter Begin() const; + c_iter BeginUnreserved() const; + c_iter End() const; + + // ACCESS + iter Begin(); + iter BeginUnreserved(); + iter End(); + + protected: + Storage( + uintt i_nrOfReservedItems ); + private: + // DATA + container_type aData; +}; + + + + + + +// IMPLEMENTATION + +// Used later, so implemented first. +template <class ENTITY> +inline bool +Storage<ENTITY>::Exists(Rid i_index) const +{ + return 0 < i_index AND i_index < aData.Size(); +} + +template <class ENTITY> +inline bool +Storage<ENTITY>::Exists(key_type i_id) const +{ + return Exists(i_id.Value()); +} + +template <class ENTITY> +inline const ENTITY & +Storage<ENTITY>::operator[](Rid i_index) const +{ + csv_assert(Exists(i_index)); + return * aData[i_index]; +} + +template <class ENTITY> +inline ENTITY & +Storage<ENTITY>::operator[](Rid i_index) +{ + csv_assert(Exists(i_index)); + return * aData[i_index]; +} + +template <class ENTITY> +inline const ENTITY & +Storage<ENTITY>::operator[](key_type i_id) const +{ + return operator[](i_id.Value()); +} + +template <class ENTITY> +inline ENTITY & +Storage<ENTITY>::operator[](key_type i_id) +{ + return operator[](i_id.Value()); +} + +template <class ENTITY> +typename Storage<ENTITY>::key_type +Storage<ENTITY>::Store_Entity(DYN ENTITY & pass_newEntity) +{ + csv_assert( aData.Size() >= aData.ReservedSize() ); + Rid + ret( aData.Add_Entity(pass_newEntity) ); + pass_newEntity.Set_Id(ret); + return key_type(ret); +} + +template <class ENTITY> +void +Storage<ENTITY>::Set_Reserved(uintt i_index, + DYN ENTITY & pass_newEntity) +{ + // 0 must not be used. + csv_assert( i_index != 0 ); + // Make sure, i_index actually is the id of a reserved item. + csv_assert( i_index < aData.ReservedSize() ); + + // If there was a previous entity, it will be deleted by + // the destructor of pOldEntity. + Dyn<ENTITY> + pOldEntity(aData.Set_Entity(i_index, pass_newEntity)); + pass_newEntity.Set_Id(i_index); +} + +template <class ENTITY> +void +Storage<ENTITY>::Replace_Entity( key_type i_index, + DYN ENTITY & pass_newEntity ) +{ + uintt + nIndex = i_index.Value(); + // Make sure, i_index actually is the id of an existing, + // non reserved entity. + csv_assert( csv::in_range(aData.ReservedSize(), nIndex, aData.Size()) ); + + // If there was a previous entity, it will be deleted by + // the destructor of pOldEntity. + Dyn<ENTITY> + pOldEntity(aData.Set_Entity(nIndex, pass_newEntity)); + pass_newEntity.Set_Id(nIndex); +} + +template <class ENTITY> +inline +typename Storage<ENTITY>::c_iter +Storage<ENTITY>::Begin() const +{ + return c_iter(aData.Begin()); +} + +template <class ENTITY> +inline +typename Storage<ENTITY>::c_iter +Storage<ENTITY>::BeginUnreserved() const +{ + return c_iter(aData.BeginUnreserved()); +} + +template <class ENTITY> +inline +typename Storage<ENTITY>::c_iter +Storage<ENTITY>::End() const +{ + return c_iter(aData.End()); +} + +template <class ENTITY> +inline +typename Storage<ENTITY>::iter +Storage<ENTITY>::Begin() +{ + return iter(aData.Begin()); +} + +template <class ENTITY> +inline +typename Storage<ENTITY>::iter +Storage<ENTITY>::BeginUnreserved() +{ + return iter(aData.BeginUnreserved()); +} + +template <class ENTITY> +inline +typename Storage<ENTITY>::iter +Storage<ENTITY>::End() +{ + return iter(aData.End()); +} + +template <class ENTITY> +inline +Storage<ENTITY>::Storage(uintt i_nrOfReservedItems) + : aData(i_nrOfReservedItems) +{ + // Make sure Rid and uintt are the same type, because + // the interface of this uses Rid, but the interface of + // container_type uses uintt. + csv_assert( sizeof(uintt) == sizeof(Rid) ); +} + + + + +// HELPER FUNCTIONS + +/** @return 0, if data are not there. +*/ +template <class ENTITY> +inline const ENTITY * +Search( const Storage<ENTITY> & i_storage, + Rid i_id ) +{ + if (NOT i_storage.Exists(i_id)) + return 0; + return &i_storage[i_id]; +} + +/** @return 0, if data are not there. +*/ +template <class ENTITY> +inline ENTITY * +SearchAccess( const Storage<ENTITY> & i_storage, + Rid i_id ) +{ + if (NOT i_storage.Exists(i_id)) + return 0; + return &i_storage[i_id]; +} + + + + +} // namespace stg +} // namespace ary +#endif diff --git a/autodoc/source/ary/inc/traits_impl.hxx b/autodoc/source/ary/inc/traits_impl.hxx new file mode 100644 index 000000000000..77c84c819ba6 --- /dev/null +++ b/autodoc/source/ary/inc/traits_impl.hxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_TRAITS_IMPL_HXX +#define ARY_TRAITS_IMPL_HXX + + +// USED SERVICES +#include <ary/getncast.hxx> + + +namespace ary +{ +namespace traits +{ + + +/** Finds the node assigned to an entity, if that entity has a specific + actual type. + + @tpl NODE + The assumed actual type of io_node. +*/ +template<class NODE> +const typename NODE::node_t * + NodeOf( + const typename NODE::traits_t::entity_base_type & + io_node ); + +/** Finds the node assigned to an entity, if that entity has a specific + actual type. + + @tpl NODE + The assumed actual type of io_node. +*/ +template<class NODE> +typename NODE::node_t * + NodeOf( + typename NODE::traits_t::entity_base_type & + io_node ); + +/** Finds a child to a node. +*/ +template<class NODE, class KEY> +typename NODE::traits_t::id_type + Search_Child( + const typename NODE::traits_t::entity_base_type & + i_node, + const KEY & i_localKey ); + + + + +// IMPLEMENTATION + +template<class NODE> +const typename NODE::node_t * +NodeOf(const typename NODE::traits_t::entity_base_type & io_node) +{ + const NODE * + pn = ary_cast<NODE>(&io_node); + if (pn != 0) + return & pn->AsNode(); + return 0; +} + +template<class NODE> +typename NODE::node_t * +NodeOf(typename NODE::traits_t::entity_base_type & io_node) +{ + NODE * + pn = ary_cast<NODE>(&io_node); + if (pn != 0) + return & pn->AsNode(); + return 0; +} + +template<class NODE, class KEY> +typename NODE::traits_t::id_type +Search_Child( const typename NODE::traits_t::entity_base_type & i_node, + const KEY & i_localKey ) +{ + const NODE * + pn = ary_cast<NODE>(&i_node); + if (pn != 0) + return pn->Search_Child(i_localKey); + return typename NODE::traits_t::id_type(0); +} + + + + +} // namespace traits +} // namespace ary +#endif diff --git a/autodoc/source/ary/info/all_dts.cxx b/autodoc/source/ary/info/all_dts.cxx new file mode 100644 index 000000000000..7dfbf737538b --- /dev/null +++ b/autodoc/source/ary/info/all_dts.cxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/info/all_dts.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/info/infodisp.hxx> + + +namespace ary +{ +namespace info +{ + + +void +DT_Text::do_StoreAt( DocuDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_DT_Text(*this); +} + +bool +DT_Text::inq_IsWhite() const +{ + return false; +} + +void +DT_MaybeLink::do_StoreAt( DocuDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_DT_MaybeLink(*this); +} + +bool +DT_MaybeLink::inq_IsWhite() const +{ + return false; +} + +void +DT_Whitespace::do_StoreAt( DocuDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_DT_Whitespace(*this); +} + +bool +DT_Whitespace::inq_IsWhite() const +{ + return true; +} + +void +DT_Eol::do_StoreAt( DocuDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_DT_Eol(*this); +} + +bool +DT_Eol::inq_IsWhite() const +{ + return true; +} + +void +DT_Xml::do_StoreAt( DocuDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_DT_Xml(*this); +} + +bool +DT_Xml::inq_IsWhite() const +{ + return false; +} + + +} // namespace info +} // namespace ary + diff --git a/autodoc/source/ary/info/all_tags.cxx b/autodoc/source/ary/info/all_tags.cxx new file mode 100644 index 000000000000..76d8192690ff --- /dev/null +++ b/autodoc/source/ary/info/all_tags.cxx @@ -0,0 +1,569 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/info/all_tags.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <limits> +#include <ary/info/infodisp.hxx> +#include <adc_cl.hxx> + + +namespace ary +{ +namespace info +{ + + + +//***************************** StdTag ***********************// + + +StdTag::StdTag( E_AtTagId i_eId ) + : eId(i_eId), + // aText, + pNext(0) +{ +} + +bool +StdTag::Add_SpecialMeaningToken( const char * , + intt ) +{ + // Does nothing + + // KORR_FUTURE + // Should be a logical exception: + // csv_assert(false); + return false; +} + +UINT8 +StdTag::NrOfSpecialMeaningTokens() const +{ + return 0; +} + +AtTag * +StdTag::GetFollower() +{ + if (pNext != 0) + return pNext->GetFollower(); + pNext = new StdTag(eId); + return pNext; +} + +void +StdTag::do_StoreAt( DocuDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_StdTag( *this ); +} + +DocuText * +StdTag::Text() +{ + return &aText; +} + + + +//***************************** BaseTag ***********************// + +BaseTag::BaseTag() + : // sBase + // aText + pNext(0) +{ +} + +bool +BaseTag::Add_SpecialMeaningToken( const char * i_sText, + intt i_nNr ) +{ + if ( i_nNr == 1 ) + { + sBase.AssignText(i_sText,"::"); + return true; + } + return false; +} + +const char * +BaseTag::Title() const +{ + return "Base Classes"; +} + +UINT8 +BaseTag::NrOfSpecialMeaningTokens() const +{ + return 1; +} + +AtTag * +BaseTag::GetFollower() +{ + if (pNext != 0) + return pNext->GetFollower(); + pNext = new BaseTag; + return pNext; +} + +DocuText * +BaseTag::Text() +{ + return &aText; +} + + + +//***************************** ExceptionTag ***********************// + +ExceptionTag::ExceptionTag() + : // sException, + // aText + pNext(0) +{ +} + +bool +ExceptionTag::Add_SpecialMeaningToken( const char * i_sText, + intt i_nNr ) +{ + if ( i_nNr == 1 ) + { + sException.AssignText(i_sText,"::"); + return true; + } + return false; +} + +const char * +ExceptionTag::Title() const +{ + return "Thrown Exceptions"; +} + +UINT8 +ExceptionTag::NrOfSpecialMeaningTokens() const +{ + return 1; +} + +AtTag * +ExceptionTag::GetFollower() +{ + if (pNext != 0) + return pNext->GetFollower(); + pNext = new ExceptionTag; + return pNext; +} + +DocuText * +ExceptionTag::Text() +{ + return &aText; +} + + +//***************************** ImplementsTag ***********************// + +ImplementsTag::ImplementsTag() + : // sBase + // aText + pNext(0) +{ +} + +bool +ImplementsTag::Add_SpecialMeaningToken( const char * i_sText, + intt i_nNr ) +{ + if ( i_nNr == 1 ) + { + sName.AssignText(i_sText,"::"); + } + else + { + GetFollower()->Add_SpecialMeaningToken(i_sText,1); + } + return true; +} + +const char * +ImplementsTag::Title() const +{ + return "Implements"; +} + +UINT8 +ImplementsTag::NrOfSpecialMeaningTokens() const +{ + return std::numeric_limits<UINT8>::max(); +} + +AtTag * +ImplementsTag::GetFollower() +{ + if (pNext != 0) + return pNext->GetFollower(); + pNext = new ImplementsTag; + return pNext; +} + +DocuText * +ImplementsTag::Text() +{ + return 0; +} + + +//***************************** KeywordTag ***********************// + + +KeywordTag::KeywordTag() +// : sKeys +{ +} + +bool +KeywordTag::Add_SpecialMeaningToken( const char * i_sText, + intt ) +{ + sKeys.push_back(i_sText); + return true; +} + +const char * +KeywordTag::Title() const +{ + return "Keywords"; +} + +UINT8 +KeywordTag::NrOfSpecialMeaningTokens() const +{ + return std::numeric_limits<UINT8>::max(); +} + +AtTag * +KeywordTag::GetFollower() +{ + return this; +} + +DocuText * +KeywordTag::Text() +{ + return 0; +} + + + +//***************************** ParameterTag ***********************// + + +ParameterTag::ParameterTag() + : // sName + // aText + pNext(0) +{ +} + +bool +ParameterTag::Add_SpecialMeaningToken( const char * i_sText, + intt i_nNr ) +{ + if ( i_nNr == 1 ) + { + sName = i_sText; + return true; + } + else if (i_nNr == 2) + { + uintt nLen = strlen(i_sText); + if (*i_sText == '[' AND i_sText[nLen-1] == ']') + { + sValidRange = String(i_sText+1, nLen-2); + return true; + } + } + return false; +} + +UINT8 +ParameterTag::NrOfSpecialMeaningTokens() const +{ + return 2; +} + +AtTag * +ParameterTag::GetFollower() +{ + if (pNext != 0) + return pNext->GetFollower(); + return pNext = new ParameterTag; +} + +DocuText * +ParameterTag::Text() +{ + return &aText; +} + +void +ParameterTag::do_StoreAt( DocuDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_ParameterTag( *this ); +} + + + +//***************************** SeeTag ***********************// + + + +SeeTag::SeeTag() +// : sReferences +{ +} + +bool +SeeTag::Add_SpecialMeaningToken( const char * i_sText, + intt ) +{ + static QualifiedName aNull_; + sReferences.push_back(aNull_); + sReferences.back().AssignText(i_sText,"::"); + + return true; +} + +const char * +SeeTag::Title() const +{ + return "See Also"; +} + +UINT8 +SeeTag::NrOfSpecialMeaningTokens() const +{ + return std::numeric_limits<UINT8>::max(); +} + +AtTag * +SeeTag::GetFollower() +{ + return this; +} + +void +SeeTag::do_StoreAt( DocuDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_SeeTag( *this ); +} + +DocuText * +SeeTag::Text() +{ + return 0; +} + + + +//***************************** TemplateTag ***********************// + + +TemplateTag::TemplateTag() + : // sName + // aText + pNext(0) +{ +} + +bool +TemplateTag::Add_SpecialMeaningToken( const char * i_sText, + intt i_nNr ) +{ + if ( i_nNr == 1 ) + { + sName = i_sText; + return true; + } + return false; +} + +const char * +TemplateTag::Title() const +{ + return "Template Parameters"; +} + +UINT8 +TemplateTag::NrOfSpecialMeaningTokens() const +{ + return 1; +} + +AtTag * +TemplateTag::GetFollower() +{ + if (pNext != 0) + return pNext->GetFollower(); + return pNext = new TemplateTag; +} + +void +TemplateTag::do_StoreAt( DocuDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_TemplateTag( *this ); +} + + +DocuText * +TemplateTag::Text() +{ + return &aText; +} + + +//***************************** LabelTag ***********************// + + + +LabelTag::LabelTag() + : sLabel() +{ +} + +bool +LabelTag::Add_SpecialMeaningToken( const char * i_sText, + intt i_nNr ) +{ + if ( i_nNr == 1 AND sLabel.length() == 0 ) + { + sLabel = i_sText; + return true; + } + // KORR_FUTURE +// else // Throw exception because of double label. + return false; +} + +const char * +LabelTag::Title() const +{ + return "Label"; +} + +UINT8 +LabelTag::NrOfSpecialMeaningTokens() const +{ + return 1; +} + +AtTag * +LabelTag::GetFollower() +{ + return this; +} + +DocuText * +LabelTag::Text() +{ + return 0; +} + + +//***************************** SinceTag ***********************// + +SinceTag::SinceTag() + : sVersion() +{ +} + +bool +SinceTag::Add_SpecialMeaningToken( const char * i_sText, + intt ) +{ + const char cCiphersend = '9' + 1; + if ( sVersion.empty() + AND NOT csv::in_range('0', *i_sText, cCiphersend) + AND autodoc::CommandLine::Get_().DoesTransform_SinceTag() ) + { + return true; + } + + if (sVersion.empty()) + { + sVersion = i_sText; + } + else + { + StreamLock sHelp(100); + sVersion = sHelp() << sVersion << " " << i_sText << c_str; + } + + return true; +} + +const char * +SinceTag::Title() const +{ + return "Label"; +} + +UINT8 +SinceTag::NrOfSpecialMeaningTokens() const +{ + return UINT8(-1); +} + +AtTag * +SinceTag::GetFollower() +{ + return this; +} + +void +SinceTag::do_StoreAt( DocuDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_SinceTag( *this ); +} + +DocuText * +SinceTag::Text() +{ + return 0; +} + + +} // namespace info +} // namespace ary + diff --git a/autodoc/source/ary/info/ci_attag.cxx b/autodoc/source/ary/info/ci_attag.cxx new file mode 100644 index 000000000000..e9afb6e106f7 --- /dev/null +++ b/autodoc/source/ary/info/ci_attag.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/info/ci_attag.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/info/all_dts.hxx> +#include <ary/info/ci_text.hxx> + + +namespace ary +{ +namespace info +{ + +void +AtTag::Set_HtmlUseInDocuText( bool i_bUseIt ) +{ + DocuText * pText = Text(); + if ( pText != 0 ) + pText->Set_HtmlUse(i_bUseIt); +} + +void +AtTag::Add_Token( const char * i_sText ) +{ + DocuText * pText = Text(); + if (pText != 0) + pText->Add_Token( *new DT_Text(i_sText) ); +} + +void +AtTag::Add_PotentialLink( const char * i_sText, + bool i_bIsGlobal, + bool i_bIsFunction ) +{ + DocuText * pText = Text(); + if (pText != 0) + pText->Add_Token( *new DT_MaybeLink(i_sText, i_bIsGlobal, i_bIsFunction) ); +} + +void +AtTag::Add_Whitespace( UINT8 i_nLength ) +{ + DocuText * pText = Text(); + if (pText != 0) + pText->Add_Token( *new DT_Whitespace(i_nLength) ); +} + +void +AtTag::Add_Eol() +{ + DocuText * pText = Text(); + if (pText != 0) + pText->Add_Token( *new DT_Eol ); +} + +void +AtTag::do_StoreAt( DocuDisplay & ) const +{ + // Dummy +} + +} // namespace info +} // namespace ary + + diff --git a/autodoc/source/ary/info/ci_text.cxx b/autodoc/source/ary/info/ci_text.cxx new file mode 100644 index 000000000000..12710c5fd53b --- /dev/null +++ b/autodoc/source/ary/info/ci_text.cxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/info/ci_text.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/info/all_dts.hxx> + + +namespace ary +{ +namespace info +{ + +DocuText::DocuText() + : bUsesHtml(false) +{ +} + +DocuText::~DocuText() +{ + for ( TokenList::iterator iter = aTokens.begin(); + iter != aTokens.end(); + ++iter ) + { + delete (*iter); + } +} + +void +DocuText::StoreAt( DocuDisplay & o_rDisplay ) const +{ + ary::info::DocuText::TokenList::const_iterator itEnd = aTokens.end(); + for ( ary::info::DocuText::TokenList::const_iterator it = aTokens.begin(); + it != itEnd; + ++it ) + { + (*it)->StoreAt(o_rDisplay); + } +} + +} // namespace info +} // namespace ary + + diff --git a/autodoc/source/ary/info/makefile.mk b/autodoc/source/ary/info/makefile.mk new file mode 100644 index 000000000000..0c507ba3f4fe --- /dev/null +++ b/autodoc/source/ary/info/makefile.mk @@ -0,0 +1,60 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=autodoc +TARGET=ary_info + + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + + +OBJFILES= \ + $(OBJ)$/all_dts.obj \ + $(OBJ)$/all_tags.obj \ + $(OBJ)$/ci_attag.obj \ + $(OBJ)$/ci_text.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/ary/kernel/ary_disp.cxx b/autodoc/source/ary/kernel/ary_disp.cxx new file mode 100644 index 000000000000..2e652f28a664 --- /dev/null +++ b/autodoc/source/ary/kernel/ary_disp.cxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/ary_disp.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <ary/cpp/c_ce.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/cp_ce.hxx> + + + +namespace ary +{ + +void +Display::DisplaySlot_Rid( ary::Rid i_nId ) +{ + const cpp::Gate * + pGate = Get_ReFinder(); + if (pGate != 0) + { + const ary::cpp::CodeEntity * + pRE = pGate->Ces().Search_Ce( cpp::Ce_id(i_nId) ); + if (pRE != 0) + { + pRE->Accept( *this ); + return; + } + } + + do_DisplaySlot_Rid( i_nId ); +} + + +void +Display::DisplaySlot_LocalCe( ary::cpp::Ce_id i_nId, + const String & i_sName ) +{ + const cpp::Gate * + pGate = Get_ReFinder(); + if (pGate != 0) + { + const ary::cpp::CodeEntity * + pRE = pGate->Ces().Search_Ce(i_nId); + if (pRE != 0) + { + pRE->Accept( *this ); + return; + } + } + + do_DisplaySlot_LocalCe( i_nId, i_sName ); +} + + + +// Dummy implementations for class Display + +void +Display::do_StartSlot() +{ +} + +void +Display::do_FinishSlot() +{ +} + +void +Display::do_DisplaySlot_Rid( ary::Rid ) +{ +} + +void +Display::do_DisplaySlot_LocalCe( ary::cpp::Ce_id , + const String & ) +{ +} + + +} // namespace ary diff --git a/autodoc/source/ary/kernel/cessentl.cxx b/autodoc/source/ary/kernel/cessentl.cxx new file mode 100644 index 000000000000..ea32736b6a2a --- /dev/null +++ b/autodoc/source/ary/kernel/cessentl.cxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/cessentl.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_ce.hxx> +#include <ary/doc/d_oldcppdocu.hxx> + + +namespace ary +{ +namespace cpp +{ + + +CeEssentials::CeEssentials() + : sLocalName(), + nOwner(0), + nLocation(0) +{ +} + +CeEssentials::CeEssentials( const String & i_sLocalName, + Cid i_nOwner, + loc::Le_id i_nLocation ) + : sLocalName(i_sLocalName), + nOwner(i_nOwner), + nLocation(i_nLocation) +{ +} + +CeEssentials::~CeEssentials() +{ +} + + + +inline bool +IsInternal(const doc::Documentation & i_doc) +{ + const ary::doc::OldCppDocu * + docu = dynamic_cast< const ary::doc::OldCppDocu* >(i_doc.Data()); + if (docu != 0) + return docu->IsInternal(); + return false; +} + + +bool +CodeEntity::IsVisible() const +{ + // KORR_FUTURE: Improve the whole handling of internal and visibility. + return bIsVisible && NOT IsInternal(Docu()); +} + + + +} // namespace cpp +} // namespace ary diff --git a/autodoc/source/ary/kernel/makefile.mk b/autodoc/source/ary/kernel/makefile.mk new file mode 100644 index 000000000000..6c90252bc3b8 --- /dev/null +++ b/autodoc/source/ary/kernel/makefile.mk @@ -0,0 +1,63 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=autodoc +TARGET=ary_kernel + + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + + +OBJFILES= \ + $(OBJ)$/ary_disp.obj \ + $(OBJ)$/cessentl.obj \ + $(OBJ)$/namesort.obj \ + $(OBJ)$/qualiname.obj \ + $(OBJ)$/reposy.obj \ + $(OBJ)$/slots.obj + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/ary/kernel/namesort.cxx b/autodoc/source/ary/kernel/namesort.cxx new file mode 100644 index 000000000000..a404d754fb07 --- /dev/null +++ b/autodoc/source/ary/kernel/namesort.cxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/namesort.hxx> + + +// NOT FULLY DEFINED SERVICES + + + +namespace +{ + + +int C_cAutodocNameOrdering1[256] = + { 0,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, // 0 .. + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, // 32 .. + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,255,255, 255,255,255,255, + + 255, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, // 64 .. + 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61,255, 255,255,255, 63, + 255, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, // 96 .. + 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61,255, 255,255,255,255, + + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, //128 .. + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, //160 .. + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, + + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255 + }; + +int C_cAutodocNameOrdering2[256] = + { 0,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, // 0 .. + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, // 32 .. + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,255,255, 255,255,255,255, + + 255, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, // 64 .. + 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61,255, 255,255,255, 63, + 255, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, // 96 .. + 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62,255, 255,255,255,255, + + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, //128 .. + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, //160 .. + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, + + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, + 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255 + }; + + +} // namespace anonymous + + +namespace ary +{ + + +const csv::CharOrder_Table +LesserName::aOrdering1_(C_cAutodocNameOrdering1); + +const csv::CharOrder_Table +LesserName::aOrdering2_(C_cAutodocNameOrdering2); + + + +} // namespace ary diff --git a/autodoc/source/ary/kernel/qualiname.cxx b/autodoc/source/ary/kernel/qualiname.cxx new file mode 100644 index 000000000000..1c844b20a731 --- /dev/null +++ b/autodoc/source/ary/kernel/qualiname.cxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/qualiname.hxx> + + +// NOT FULLY DECLARED SERVICES + + +namespace ary +{ + + +QualifiedName::QualifiedName( uintt i_nSize ) + : aNamespace(), + sLocalName(), + bIsAbsolute(false), + bIsFunction() +{ + if (i_nSize > 0) + aNamespace.reserve(i_nSize); +} + +QualifiedName::QualifiedName( const char * i_sText, + const char * i_sSeparator ) + : aNamespace(), + sLocalName(), + bIsAbsolute(false), + bIsFunction() +{ + AssignText(i_sText,i_sSeparator); +} + +QualifiedName::~QualifiedName() +{ +} + +void +QualifiedName::AssignText( const char * i_sText, + const char * i_sSeparator ) +{ + csv_assert(NOT csv::no_str(i_sText) AND NOT csv::no_str(i_sSeparator)); + bIsAbsolute = false; + bIsFunction = false; + csv::erase_container( aNamespace ); + + uintt nSepLen = strlen(i_sSeparator); + const char * sNext = i_sText; + + const char * ps = strstr( i_sText, i_sSeparator ); + if (ps == i_sText) + { + bIsAbsolute = true; + sNext = ps + nSepLen; + } + + for ( ps = strstr(sNext, i_sSeparator); + ps != 0; + ps = strstr(sNext, i_sSeparator) ) + { + String sPart(sNext, ps - sNext); + aNamespace.push_back(sPart); + sNext = ps + nSepLen; + } + + uintt sNameLen = strlen(sNext); + if ( sNameLen > 2 ) + { + ps = sNext + sNameLen - 2; + if (*ps == '(' AND *(ps+1) == ')') + { + sNameLen -= 2; + bIsFunction = true; + } + } + sLocalName = String(sNext,sNameLen); +} + + +} // namespace ary diff --git a/autodoc/source/ary/kernel/reposy.cxx b/autodoc/source/ary/kernel/reposy.cxx new file mode 100644 index 000000000000..9ef4b3f4ca7f --- /dev/null +++ b/autodoc/source/ary/kernel/reposy.cxx @@ -0,0 +1,218 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <reposy.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <cpp_internalgate.hxx> +#include <idl_internalgate.hxx> + + +namespace ary +{ + + +//***************** Repository ************// + +DYN Repository & +Repository::Create_() +{ + return *new RepositoryCenter; +} + + + + +RepositoryCenter::RepositoryCenter() + : sDisplayedName(), + aLocation(), + pCppPartition(0), + pIdlPartition(0) +{ + pCppPartition = & cpp::InternalGate::Create_Partition_(*this); + pIdlPartition = & idl::InternalGate::Create_Partition_(*this); +} + +RepositoryCenter::~RepositoryCenter() +{ +} + +const ::ary::cpp::Gate & +RepositoryCenter::Gate_Cpp() const +{ + csv_assert(pCppPartition); + return *pCppPartition; +} + +const ::ary::idl::Gate & +RepositoryCenter::Gate_Idl() const +{ + csv_assert(pIdlPartition); + return *pIdlPartition; +} + +const String & +RepositoryCenter::Title() const +{ + return sDisplayedName; +} + + +::ary::cpp::Gate & +RepositoryCenter::Gate_Cpp() +{ + csv_assert(pCppPartition); + return *pCppPartition; +} + +::ary::idl::Gate & +RepositoryCenter::Gate_Idl() +{ + csv_assert(pIdlPartition); + return *pIdlPartition; +} + +void +RepositoryCenter::Set_Title(const String & i_sName) +{ + sDisplayedName = i_sName; +} + + + + +//********************* Repository Type Info Data ****************// + +// !!! IMPORTANT - NEVER DELETE OR CHANGE - ADDING ALLOWED + + + +/* ClassType-Ids + ------------- + + cpp 1000 + idl 2000 + corba 3000 + java 4000 + information 5000 + logic location 6000 + phys location 7000 + sec. prod. 8000 + + + cpp + --- + Namespace 1000 + Class 1001 + Enum 1002 + Typedef 1003 + Function 1004 + Variable 1005 + EnumValue 1006 + NamespaceAlias 1007 + + BuiltInType 1200 + CeType_Final 1201 + CeType_Extern 1202 + UsedType 1203 + PtrType 1211 + RefType 1212 + ConstType 1221 + VolatileType 1222 + ArrayType 1230 + TemplateInstance 1235 + FunctionPtr 1240 + DataMemberPtr 1250 + OperationMemberPtr 1260 + + TplParam_Type 1301 + TplParam_Value 1302 + + OpSignature 1400 + + Define 1601 + Macro 1602 + + ProjectGroup 1901 + FileGroup 1902 + + TopProject 1921 + + + + idl + --- + + Module 2000 + Interface 2001 + Function 2002 + Service 2003 + Property 2004 + Enum 2005 + EnumValue 2006 + Typedef 2007 + Struct 2008 + StructElement 2009 + Exception 2010 + ConstantGroup 2011 + Constant 2012 + Singleton 2013 + Attribute 2014 + SglIfcService 2015 + SglIfcSingleton 2016 + + BuiltInType 2200 + CeType 2201 + Sequence 2202 + ExplicitType 2203 + ExplicitNameRoom 2204 + TemplateParamType 2205 + + + java + ---- + Package 4000 + Interface 4001 + Class 4002 + + physical location + ----------------- + Root 7000 + Directory 7030 + File 7100 + + + info + ---- + CodeInformation + (IDL) 11002 +*/ + + +} // namespace ary diff --git a/autodoc/source/ary/kernel/slots.cxx b/autodoc/source/ary/kernel/slots.cxx new file mode 100644 index 000000000000..ef2e06ae8388 --- /dev/null +++ b/autodoc/source/ary/kernel/slots.cxx @@ -0,0 +1,164 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <slots.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/ary_disp.hxx> + + + +namespace ary +{ + + +//*********************** Slot ********************// + + +void +Slot::StoreAt( Display & o_rDestination ) const +{ + o_rDestination.StartSlot(); + StoreEntries(o_rDestination); + o_rDestination.FinishSlot(); +} + + +//*********************** Slot_Null ********************// + +Slot_Null::~Slot_Null() +{ +} + +void +Slot_Null::StoreAt( Display & ) const +{ + // Does nothing +} + +uintt +Slot_Null::Size() const +{ + return 0; +} + +void +Slot_Null::StoreEntries( Display & ) const +{ + // Does nothing +} + +//*********************** Slot_MapLocalCe ********************// + +Slot_MapLocalCe::Slot_MapLocalCe( const cpp::Map_LocalCe & i_rData ) + : pData(&i_rData) +{ +} + +Slot_MapLocalCe::~Slot_MapLocalCe() +{ +} + +uintt +Slot_MapLocalCe::Size() const +{ + return pData->size();; +} + +void +Slot_MapLocalCe::StoreEntries( Display & o_rDestination ) const +{ + for ( cpp::Map_LocalCe::const_iterator it = pData->begin(); + it != pData->end(); + ++it ) + { + o_rDestination.DisplaySlot_LocalCe( (*it).second, (*it).first ); + } +} + + + +//*********************** Slot_MapOperations ********************// + +Slot_MapOperations::Slot_MapOperations( const std::multimap<String, cpp::Ce_id> & i_rData ) + : pData(&i_rData) +{ +} + +Slot_MapOperations::~Slot_MapOperations() +{ +} + +uintt +Slot_MapOperations::Size() const +{ + return pData->size();; +} + +void +Slot_MapOperations::StoreEntries( Display & o_rDestination ) const +{ + for ( std::multimap<String, cpp::Ce_id>::const_iterator it = pData->begin(); + it != pData->end(); + ++it ) + { + o_rDestination.DisplaySlot_LocalCe( (*it).second, (*it).first ); + } +} + +//*********************** Slot_ListLocalCe ********************// + +Slot_ListLocalCe::Slot_ListLocalCe( const cpp::List_LocalCe & i_rData ) + : pData(&i_rData) +{ +} + +Slot_ListLocalCe::~Slot_ListLocalCe() +{ +} + +uintt +Slot_ListLocalCe::Size() const +{ + return pData->size();; +} + +void +Slot_ListLocalCe::StoreEntries( Display & o_rDestination ) const +{ + for ( cpp::List_LocalCe::const_iterator it = pData->begin(); + it != pData->end(); + ++it ) + { + o_rDestination.DisplaySlot_LocalCe( (*it).nId, (*it).sLocalName ); + } +} + + +} // namespace ary diff --git a/autodoc/source/ary/loc/loc_dir.cxx b/autodoc/source/ary/loc/loc_dir.cxx new file mode 100644 index 000000000000..616b8775eca0 --- /dev/null +++ b/autodoc/source/ary/loc/loc_dir.cxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/loc/loc_dir.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/loc/loc_file.hxx> +#include <sortedids.hxx> +#include "locs_le.hxx" + + +namespace ary +{ +namespace loc +{ + +struct Directory::Container +{ + typedef SortedIds<Le_Compare> SortedChildList; + + SortedChildList aSubDirectories; + SortedChildList aFiles; + + Container() + : aSubDirectories(), + aFiles() + {} +}; + + + + +Directory::Directory(Le_id i_assignedRoot) + : sLocalName(), + nParentDirectory(0), + nAssignedRoot(i_assignedRoot), + aAssignedNode(), + pChildren(new Container) +{ + aAssignedNode.Assign_Entity(*this); +} + +Directory::Directory( const String & i_localName, + Le_id i_parentDirectory ) + : sLocalName(i_localName), + nParentDirectory(i_parentDirectory), + nAssignedRoot(0), + aAssignedNode(), + pChildren(new Container) +{ + aAssignedNode.Assign_Entity(*this); +} + +Directory::~Directory() +{ +} + +void +Directory::Add_Dir(const Directory & i_dir) +{ + pChildren->aSubDirectories.Add(i_dir.LeId()); +} + +void +Directory::Add_File(const File & i_file) +{ + pChildren->aFiles.Add(i_file.LeId()); +} + +Le_id +Directory::Search_Dir(const String & i_name) const +{ + return pChildren->aSubDirectories.Search(i_name); +} + +Le_id +Directory::Search_File(const String & i_name) const +{ + return pChildren->aFiles.Search(i_name); +} + +void +Directory::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor,*this); +} + +ClassId +Directory::get_AryClass() const +{ + return class_id; +} + +const String & +Directory::inq_LocalName() const +{ + return sLocalName; +} + +Le_id +Directory::inq_ParentDirectory() const +{ + return nParentDirectory; +} + + +} // namespace loc +} // namespace ary diff --git a/autodoc/source/ary/loc/loc_file.cxx b/autodoc/source/ary/loc/loc_file.cxx new file mode 100644 index 000000000000..5a7a67089e17 --- /dev/null +++ b/autodoc/source/ary/loc/loc_file.cxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/loc/loc_file.hxx> + + +// NOT FULLY DEFINED SERVICES + + + +namespace ary +{ +namespace loc +{ + +File::File( const String & i_sLocalName, + Le_id i_nParentDirectory ) + : FileBase(i_sLocalName, i_nParentDirectory) +{ +} + +File::~File() +{ +} + +void +File::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor, *this); +} + +ClassId +File::get_AryClass() const +{ + return class_id; +} + + + +} // namespace loc +} // namespace ary diff --git a/autodoc/source/ary/loc/loc_filebase.cxx b/autodoc/source/ary/loc/loc_filebase.cxx new file mode 100644 index 000000000000..f7a6afcc4858 --- /dev/null +++ b/autodoc/source/ary/loc/loc_filebase.cxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/loc/loc_filebase.hxx> + + +// NOT FULLY DEFINED SERVICES + + + +namespace ary +{ +namespace loc +{ + +FileBase::FileBase( const String & i_localName, + Le_id i_parentDirectory ) + : sLocalName(i_localName), + nParentDirectory(i_parentDirectory) +{ +} + +const String & +FileBase::inq_LocalName() const +{ + return sLocalName; +} + +Le_id +FileBase::inq_ParentDirectory() const +{ + return nParentDirectory; +} + + + +} // namespace loc +} // namespace ary diff --git a/autodoc/source/ary/loc/loc_root.cxx b/autodoc/source/ary/loc/loc_root.cxx new file mode 100644 index 000000000000..3cf8e47c1181 --- /dev/null +++ b/autodoc/source/ary/loc/loc_root.cxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/loc/loc_root.hxx> + + +// NOT FULLY DEFINED SERVICES + + +namespace ary +{ +namespace loc +{ + + +Root::Root(const csv::ploc::Path & i_path) + : aPath(i_path), + sPathAsString(), + aMyDirectory(0) +{ + StreamLock + path_string(700); + path_string() << i_path; + sPathAsString = path_string().c_str(); +} + +Root::~Root() +{ +} + +void +Root::do_Accept(csv::ProcessorIfc & io_processor) const +{ + csv::CheckedCall(io_processor,*this); +} + +ClassId +Root::get_AryClass() const +{ + return class_id; +} + +const String & +Root::inq_LocalName() const +{ + return sPathAsString; +} + +Le_id +Root::inq_ParentDirectory() const +{ + return Le_id::Null_(); +} + + + +} // namespace loc +} // namespace ary diff --git a/autodoc/source/ary/loc/loc_traits.cxx b/autodoc/source/ary/loc/loc_traits.cxx new file mode 100644 index 000000000000..875b6aae17ee --- /dev/null +++ b/autodoc/source/ary/loc/loc_traits.cxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <ary/loc/loc_traits.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/namesort.hxx> +#include <ary/getncast.hxx> +#include "locs_le.hxx" + + + +namespace ary +{ +namespace loc +{ + + +//******************** Le_Traits ************************// +Le_Traits::entity_base_type & +Le_Traits::EntityOf_(id_type i_id) +{ + csv_assert(i_id.IsValid()); + return Le_Storage::Instance_()[i_id]; +} + +//******************** LeNode_Traits ************************// +symtree::Node<LeNode_Traits> * +LeNode_Traits::NodeOf_(entity_base_type & io_entity) +{ + if (is_type<Directory>(io_entity)) + return & ary_cast<Directory>(io_entity).AsNode(); + return 0; +} + +Le_Traits::entity_base_type * +LeNode_Traits::ParentOf_(const entity_base_type & i_entity) +{ + Le_Traits::id_type + ret = i_entity.ParentDirectory(); + if (ret.IsValid()) + return &EntityOf_(ret); + return 0; +} + +//******************** Le_Compare ************************// +const Le_Compare::key_type & +Le_Compare::KeyOf_(const entity_base_type & i_entity) +{ + return i_entity.LocalName(); +} + +bool +Le_Compare::Lesser_( const key_type & i_1, + const key_type & i_2 ) +{ + static ::ary::LesserName less_; + return less_(i_1,i_2); +} + + + + +} // namespace loc +} // namespace ary diff --git a/autodoc/source/ary/loc/loca_le.cxx b/autodoc/source/ary/loc/loca_le.cxx new file mode 100644 index 000000000000..27a4339fc93d --- /dev/null +++ b/autodoc/source/ary/loc/loca_le.cxx @@ -0,0 +1,181 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "loca_le.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/loc/loc_dir.hxx> +#include <ary/loc/loc_file.hxx> +#include <ary/loc/loc_root.hxx> +#include <loc_internalgate.hxx> +#include "locs_le.hxx" + + + + +namespace ary +{ +namespace loc +{ + +DYN LocationPilot & +InternalGate::Create_Locations_() +{ + return *new LocationAdmin; +} + + + + +inline Le_Storage & +LocationAdmin::Storage() const +{ + csv_assert(pStorage); + return *pStorage.MutablePtr(); +} + + +LocationAdmin::LocationAdmin() + : pStorage(new Le_Storage) +{ +} + +LocationAdmin::~LocationAdmin() +{ +} + +Root & +LocationAdmin::CheckIn_Root(const csv::ploc::Path & i_path) +{ + Dyn<Root> + p_new( new Root(i_path) ); + + Le_id + id = Storage().RootIndex().Search(p_new->LocalName()); + if ( id.IsValid() ) + { + return ary_cast<Root>(Storage()[id]); + } + + Root * + ret = p_new.Ptr(); + Storage().Store_Entity(*p_new.Release()); + Storage().RootIndex().Add(ret->LeId()); + + Directory * + p_rootdir = new Directory(ret->LeId()); + Storage().Store_Entity(*p_rootdir); + ret->Assign_Directory(p_rootdir->LeId()); + + return *ret; +} + +File & +LocationAdmin::CheckIn_File( const String & i_name, + const csv::ploc::DirectoryChain & i_subPath, + Le_id i_root ) +{ + Root & + root = Find_Root(i_root); + Directory & + parent_dir = CheckIn_Directories( + Find_Directory(root.MyDir()), + i_subPath.Begin(), + i_subPath.End() ); + Le_id + fid = parent_dir.Search_File(i_name); + if (NOT fid.IsValid()) + { + File * + ret = new File(i_name, parent_dir.LeId()); + Storage().Store_Entity(*ret); + parent_dir.Add_File(*ret); + return *ret; + } + else + { + return Find_File(fid); + } +} + +Root & +LocationAdmin::Find_Root(Le_id i_id) const +{ + return ary_cast<Root>(Storage()[i_id]); +} + +Directory & +LocationAdmin::Find_Directory(Le_id i_id) const +{ + return ary_cast<Directory>(Storage()[i_id]); +} + +File & +LocationAdmin::Find_File(Le_id i_id) const +{ + return ary_cast<File>(Storage()[i_id]); +} + +Directory & +LocationAdmin::CheckIn_Directory( Directory & io_parent, + const String & i_name ) +{ + Le_id + did = io_parent.Search_Dir(i_name); + if (NOT did.IsValid()) + { + Directory * + ret = new Directory(i_name, io_parent.LeId()); + Storage().Store_Entity(*ret); + io_parent.Add_Dir(*ret); + return *ret; + } + else + { + return Find_Directory(did); + } +} + +Directory & +LocationAdmin::CheckIn_Directories( + Directory & io_root, + StringVector::const_iterator i_beginSubPath, + StringVector::const_iterator i_endSubPath ) +{ + if (i_beginSubPath == i_endSubPath) + return io_root; + + Directory & + next = CheckIn_Directory(io_root, *i_beginSubPath); + return CheckIn_Directories(next, i_beginSubPath+1, i_endSubPath); +} + + +} // namespace loc +} // namespace ary diff --git a/autodoc/source/ary/loc/loca_le.hxx b/autodoc/source/ary/loc/loca_le.hxx new file mode 100644 index 000000000000..a898f34c104f --- /dev/null +++ b/autodoc/source/ary/loc/loca_le.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_LOC_LOCA_LE_HXX +#define ARY_LOC_LOCA_LE_HXX + +// BASE CLASSES +#include <ary/loc/locp_le.hxx> + +namespace ary +{ +namespace loc +{ + class Le_Storage; +} +} + + + + +namespace ary +{ +namespace loc +{ + + +/** Provides access to files and directories stored in the + repository. +*/ +class LocationAdmin : public LocationPilot +{ + public: + LocationAdmin(); + virtual ~LocationAdmin(); + + // INHERITED + // Interface LocationPilot: + virtual Root & CheckIn_Root( + const csv::ploc::Path & + i_rPath ); + virtual File & CheckIn_File( + const String & i_name, + const csv::ploc::DirectoryChain & + i_subPath, + Le_id i_root ); + + virtual Root & Find_Root( + Le_id i_id ) const; + virtual Directory & Find_Directory( + Le_id i_id ) const; + virtual File & Find_File( + Le_id i_id ) const; + private: + // Locals + Le_Storage & Storage() const; + Directory & CheckIn_Directory( + Directory & io_parent, + const String & i_name ); + Directory & CheckIn_Directories( + Directory & io_root, + StringVector::const_iterator + i_beginSubPath, + StringVector::const_iterator + i_endSubPath ); + // DATA + Dyn<Le_Storage> pStorage; +}; + + + + +} // namespace loc +} // namespace ary +#endif diff --git a/autodoc/source/ary/loc/locs_le.cxx b/autodoc/source/ary/loc/locs_le.cxx new file mode 100644 index 000000000000..6031dc2c92d4 --- /dev/null +++ b/autodoc/source/ary/loc/locs_le.cxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "locs_le.hxx" + +// NOT FULLY DEFINED SERVICES + + +namespace +{ + const uintt + C_nReservedElements = ary::loc::predefined::le_MAX; // Skipping "0" +} + + + +namespace ary +{ +namespace loc +{ + +Le_Storage * Le_Storage::pInstance_ = 0; + + + + +Le_Storage::Le_Storage() + : stg::Storage<LocationEntity>(C_nReservedElements) +{ + csv_assert(pInstance_ == 0); + pInstance_ = this; +} + +Le_Storage::~Le_Storage() +{ + csv_assert(pInstance_ != 0); + pInstance_ = 0; +} + + +} // namespace loc +} // namespace ary diff --git a/autodoc/source/ary/loc/locs_le.hxx b/autodoc/source/ary/loc/locs_le.hxx new file mode 100644 index 000000000000..19301dffa2f2 --- /dev/null +++ b/autodoc/source/ary/loc/locs_le.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ARY_LOC_LOCS_LE_HXX +#define ARY_LOC_LOCS_LE_HXX + +// BASE CLASSES +#include <store/s_storage.hxx> +// USED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/loc/loc_le.hxx> +#include <ary/loc/loc_root.hxx> +#include <sortedids.hxx> + + + + +namespace ary +{ +namespace loc +{ + + +/** The data base for all ->ary::cpp::CodeEntity objects. +*/ +class Le_Storage : public ::ary::stg::Storage<LocationEntity> +{ + public: + typedef SortedIds<Le_Compare> Index; + + Le_Storage(); + virtual ~Le_Storage(); + + const Index & RootIndex() const { return aRoots; } + Index & RootIndex() { return aRoots; } + + static Le_Storage & Instance_() { csv_assert(pInstance_ != 0); + return *pInstance_; } + private: + // DATA + Index aRoots; + + static Le_Storage * pInstance_; +}; + + + + +namespace predefined +{ + +enum E_LocationEntity +{ + le_MAX = 1 +}; + +} // namespace predefined + + + + +} // namespace cpp +} // namespace ary +#endif diff --git a/autodoc/source/ary/loc/makefile.mk b/autodoc/source/ary/loc/makefile.mk new file mode 100644 index 000000000000..e4aa0e9b43f5 --- /dev/null +++ b/autodoc/source/ary/loc/makefile.mk @@ -0,0 +1,61 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=autodoc +TARGET=ary_loc + + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + + +OBJFILES= \ + $(OBJ)$/loc_dir.obj \ + $(OBJ)$/loc_file.obj \ + $(OBJ)$/loc_filebase.obj \ + $(OBJ)$/loc_root.obj \ + $(OBJ)$/loc_traits.obj \ + $(OBJ)$/loca_le.obj \ + $(OBJ)$/locs_le.obj + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk |