diff options
Diffstat (limited to 'autodoc/source')
509 files changed, 83912 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..8d6ee3977be6 --- /dev/null +++ b/autodoc/source/ary/cpp/c_builtintype.cxx @@ -0,0 +1,130 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_builtintype.cxx,v $ + * $Revision: 1.3 $ + * + * 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..1847c767a24b --- /dev/null +++ b/autodoc/source/ary/cpp/c_class.cxx @@ -0,0 +1,287 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_class.cxx,v $ + * $Revision: 1.6 $ + * + * 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..113c18a30a03 --- /dev/null +++ b/autodoc/source/ary/cpp/c_de.cxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_de.cxx,v $ + * $Revision: 1.3 $ + * + * 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..fdcaf9645a96 --- /dev/null +++ b/autodoc/source/ary/cpp/c_define.cxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_define.cxx,v $ + * $Revision: 1.6 $ + * + * 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..520411258db3 --- /dev/null +++ b/autodoc/source/ary/cpp/c_enum.cxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_enum.cxx,v $ + * $Revision: 1.6 $ + * + * 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..9406a004f917 --- /dev/null +++ b/autodoc/source/ary/cpp/c_enuval.cxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_enuval.cxx,v $ + * $Revision: 1.6 $ + * + * 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..bd8ad201b5a0 --- /dev/null +++ b/autodoc/source/ary/cpp/c_funct.cxx @@ -0,0 +1,250 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_funct.cxx,v $ + * $Revision: 1.6 $ + * + * 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..ab9b1f70dd42 --- /dev/null +++ b/autodoc/source/ary/cpp/c_macro.cxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_macro.cxx,v $ + * $Revision: 1.6 $ + * + * 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..d8c39360f049 --- /dev/null +++ b/autodoc/source/ary/cpp/c_namesp.cxx @@ -0,0 +1,297 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_namesp.cxx,v $ + * $Revision: 1.7 $ + * + * 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..4842d1b15f9c --- /dev/null +++ b/autodoc/source/ary/cpp/c_osigna.cxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_osigna.cxx,v $ + * $Revision: 1.6 $ + * + * 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..ece40fa5ca95 --- /dev/null +++ b/autodoc/source/ary/cpp/c_reposypart.cxx @@ -0,0 +1,526 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_reposypart.cxx,v $ + * $Revision: 1.6 $ + * + * 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..6407ebc2165a --- /dev/null +++ b/autodoc/source/ary/cpp/c_reposypart.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_reposypart.hxx,v $ + * $Revision: 1.3 $ + * + * 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..34d73bb909fd --- /dev/null +++ b/autodoc/source/ary/cpp/c_slots.cxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_slots.cxx,v $ + * $Revision: 1.6 $ + * + * 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..3bccfaf8c89a --- /dev/null +++ b/autodoc/source/ary/cpp/c_slots.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_slots.hxx,v $ + * $Revision: 1.4 $ + * + * 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..23e9bd4fd626 --- /dev/null +++ b/autodoc/source/ary/cpp/c_traits.cxx @@ -0,0 +1,226 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_traits.cxx,v $ + * $Revision: 1.3 $ + * + * 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..d7927efd27a5 --- /dev/null +++ b/autodoc/source/ary/cpp/c_tydef.cxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_tydef.cxx,v $ + * $Revision: 1.6 $ + * + * 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..32dbac810112 --- /dev/null +++ b/autodoc/source/ary/cpp/c_vari.cxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_vari.cxx,v $ + * $Revision: 1.6 $ + * + * 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..0ded345826b7 --- /dev/null +++ b/autodoc/source/ary/cpp/ca_ce.cxx @@ -0,0 +1,625 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ca_ce.cxx,v $ + * $Revision: 1.4 $ + * + * 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..885d90cc2d13 --- /dev/null +++ b/autodoc/source/ary/cpp/ca_ce.hxx @@ -0,0 +1,216 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ca_ce.hxx,v $ + * $Revision: 1.3 $ + * + * 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..b5f8de74ae04 --- /dev/null +++ b/autodoc/source/ary/cpp/ca_def.cxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ca_def.cxx,v $ + * $Revision: 1.3 $ + * + * 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..463be0249939 --- /dev/null +++ b/autodoc/source/ary/cpp/ca_def.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ca_def.hxx,v $ + * $Revision: 1.3 $ + * + * 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..7dfe7bdbc114 --- /dev/null +++ b/autodoc/source/ary/cpp/ca_type.cxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ca_type.cxx,v $ + * $Revision: 1.8 $ + * + * 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..bfcfdd2a54d1 --- /dev/null +++ b/autodoc/source/ary/cpp/ca_type.hxx @@ -0,0 +1,130 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ca_type.hxx,v $ + * $Revision: 1.3 $ + * + * 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..16b572ecc1b8 --- /dev/null +++ b/autodoc/source/ary/cpp/cs_ce.cxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cs_ce.cxx,v $ + * $Revision: 1.3 $ + * + * 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..9b46d6fec984 --- /dev/null +++ b/autodoc/source/ary/cpp/cs_ce.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cs_ce.hxx,v $ + * $Revision: 1.3 $ + * + * 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..380fc597af8b --- /dev/null +++ b/autodoc/source/ary/cpp/cs_def.cxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cs_def.cxx,v $ + * $Revision: 1.3 $ + * + * 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..f8dce5725636 --- /dev/null +++ b/autodoc/source/ary/cpp/cs_def.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cs_def.hxx,v $ + * $Revision: 1.3 $ + * + * 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..e0ed8e951d1b --- /dev/null +++ b/autodoc/source/ary/cpp/cs_type.cxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cs_type.cxx,v $ + * $Revision: 1.3 $ + * + * 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..87e606d70bdd --- /dev/null +++ b/autodoc/source/ary/cpp/cs_type.hxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cs_type.hxx,v $ + * $Revision: 1.3 $ + * + * 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..edea62272c2e --- /dev/null +++ b/autodoc/source/ary/cpp/makefile.mk @@ -0,0 +1,84 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.4 $ +# +# 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..daff4541dc62 --- /dev/null +++ b/autodoc/source/ary/cpp/namechain.cxx @@ -0,0 +1,199 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: namechain.cxx,v $ + * $Revision: 1.3 $ + * + * 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..b773f8777d57 --- /dev/null +++ b/autodoc/source/ary/cpp/tplparam.cxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tplparam.cxx,v $ + * $Revision: 1.7 $ + * + * 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..5a937963e01b --- /dev/null +++ b/autodoc/source/ary/cpp/tplparam.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tplparam.hxx,v $ + * $Revision: 1.4 $ + * + * 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..e60b60492c4e --- /dev/null +++ b/autodoc/source/ary/cpp/usedtype.cxx @@ -0,0 +1,578 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: usedtype.cxx,v $ + * $Revision: 1.8 $ + * + * 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..acec2303bfed --- /dev/null +++ b/autodoc/source/ary/doc/d_boolean.cxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: d_boolean.cxx,v $ + * $Revision: 1.3 $ + * + * 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..21d0ea502b7b --- /dev/null +++ b/autodoc/source/ary/doc/d_docu.cxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: d_docu.cxx,v $ + * $Revision: 1.3 $ + * + * 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..ff7cafabc9ff --- /dev/null +++ b/autodoc/source/ary/doc/d_node.cxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: d_node.cxx,v $ + * $Revision: 1.3 $ + * + * 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..26aee0059f61 --- /dev/null +++ b/autodoc/source/ary/doc/d_oldcppdocu.cxx @@ -0,0 +1,339 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: d_oldcppdocu.cxx,v $ + * $Revision: 1.3 $ + * + * 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..43f6cdabd779 --- /dev/null +++ b/autodoc/source/ary/doc/d_oldidldocu.cxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: d_oldidldocu.cxx,v $ + * $Revision: 1.3 $ + * + * 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..f64ba0785dfe --- /dev/null +++ b/autodoc/source/ary/doc/makefile.mk @@ -0,0 +1,62 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# 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..f300c2da2f90 --- /dev/null +++ b/autodoc/source/ary/idl/i2s_calculator.cxx @@ -0,0 +1,995 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i2s_calculator.cxx,v $ + * $Revision: 1.4 $ + * + * 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..82d91ee452a9 --- /dev/null +++ b/autodoc/source/ary/idl/i2s_calculator.hxx @@ -0,0 +1,298 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i2s_calculator.hxx,v $ + * $Revision: 1.3 $ + * + * 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..f83f2b0eee24 --- /dev/null +++ b/autodoc/source/ary/idl/i_attribute.cxx @@ -0,0 +1,162 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_attribute.cxx,v $ + * $Revision: 1.7 $ + * + * 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..d93fe89a3ea1 --- /dev/null +++ b/autodoc/source/ary/idl/i_ce.cxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_ce.cxx,v $ + * $Revision: 1.6 $ + * + * 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..a43751b859e4 --- /dev/null +++ b/autodoc/source/ary/idl/i_ce2s.cxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_ce2s.cxx,v $ + * $Revision: 1.7 $ + * + * 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..1cc4b688c586 --- /dev/null +++ b/autodoc/source/ary/idl/i_comrela.cxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_comrela.cxx,v $ + * $Revision: 1.6 $ + * + * 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..46a26a8b6e61 --- /dev/null +++ b/autodoc/source/ary/idl/i_constant.cxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_constant.cxx,v $ + * $Revision: 1.7 $ + * + * 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..4b5a0b4501a5 --- /dev/null +++ b/autodoc/source/ary/idl/i_constgroup.cxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_constgroup.cxx,v $ + * $Revision: 1.6 $ + * + * 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..e9a2ac723bf4 --- /dev/null +++ b/autodoc/source/ary/idl/i_enum.cxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_enum.cxx,v $ + * $Revision: 1.7 $ + * + * 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..04f7e040c4e7 --- /dev/null +++ b/autodoc/source/ary/idl/i_enumvalue.cxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_enumvalue.cxx,v $ + * $Revision: 1.6 $ + * + * 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..defd987fb41e --- /dev/null +++ b/autodoc/source/ary/idl/i_exception.cxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_exception.cxx,v $ + * $Revision: 1.6 $ + * + * 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..0b2bb0073596 --- /dev/null +++ b/autodoc/source/ary/idl/i_function.cxx @@ -0,0 +1,168 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_function.cxx,v $ + * $Revision: 1.7 $ + * + * 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..d4a234681bf6 --- /dev/null +++ b/autodoc/source/ary/idl/i_interface.cxx @@ -0,0 +1,199 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_interface.cxx,v $ + * $Revision: 1.8 $ + * + * 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..e82a874b2242 --- /dev/null +++ b/autodoc/source/ary/idl/i_module.cxx @@ -0,0 +1,207 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_module.cxx,v $ + * $Revision: 1.7 $ + * + * 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..1a818387610c --- /dev/null +++ b/autodoc/source/ary/idl/i_namelookup.cxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_namelookup.cxx,v $ + * $Revision: 1.8 $ + * + * 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..3aef855dda40 --- /dev/null +++ b/autodoc/source/ary/idl/i_nnfinder.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_nnfinder.hxx,v $ + * $Revision: 1.4 $ + * + * 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..d46c98e9ff27 --- /dev/null +++ b/autodoc/source/ary/idl/i_param.cxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_param.cxx,v $ + * $Revision: 1.6 $ + * + * 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..fd23f079cf6d --- /dev/null +++ b/autodoc/source/ary/idl/i_property.cxx @@ -0,0 +1,174 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_property.cxx,v $ + * $Revision: 1.8 $ + * + * 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..9855b17f19db --- /dev/null +++ b/autodoc/source/ary/idl/i_reposypart.cxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_reposypart.cxx,v $ + * $Revision: 1.8 $ + * + * 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..007f3a64b254 --- /dev/null +++ b/autodoc/source/ary/idl/i_reposypart.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_reposypart.hxx,v $ + * $Revision: 1.3 $ + * + * 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..7d3f3cdb3b3c --- /dev/null +++ b/autodoc/source/ary/idl/i_service.cxx @@ -0,0 +1,174 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_service.cxx,v $ + * $Revision: 1.7 $ + * + * 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..422a8480c029 --- /dev/null +++ b/autodoc/source/ary/idl/i_singleton.cxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_singleton.cxx,v $ + * $Revision: 1.6 $ + * + * 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..ee3383a35720 --- /dev/null +++ b/autodoc/source/ary/idl/i_siservice.cxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_siservice.cxx,v $ + * $Revision: 1.7 $ + * + * 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..e8335a66f926 --- /dev/null +++ b/autodoc/source/ary/idl/i_sisingleton.cxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_sisingleton.cxx,v $ + * $Revision: 1.7 $ + * + * 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..3adde8d9bff0 --- /dev/null +++ b/autodoc/source/ary/idl/i_struct.cxx @@ -0,0 +1,166 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_struct.cxx,v $ + * $Revision: 1.8 $ + * + * 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..dceb862d4329 --- /dev/null +++ b/autodoc/source/ary/idl/i_structelem.cxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_structelem.cxx,v $ + * $Revision: 1.6 $ + * + * 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..a3169dec585b --- /dev/null +++ b/autodoc/source/ary/idl/i_traits.cxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_traits.cxx,v $ + * $Revision: 1.3 $ + * + * 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..c367d23c22d7 --- /dev/null +++ b/autodoc/source/ary/idl/i_typedef.cxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: i_typedef.cxx,v $ + * $Revision: 1.7 $ + * + * 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..acaea51d1c83 --- /dev/null +++ b/autodoc/source/ary/idl/ia_ce.cxx @@ -0,0 +1,584 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ia_ce.cxx,v $ + * $Revision: 1.3 $ + * + * 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..c6b6c9f96c39 --- /dev/null +++ b/autodoc/source/ary/idl/ia_ce.hxx @@ -0,0 +1,256 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ia_ce.hxx,v $ + * $Revision: 1.3 $ + * + * 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..853d51d4d201 --- /dev/null +++ b/autodoc/source/ary/idl/ia_type.cxx @@ -0,0 +1,367 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ia_type.cxx,v $ + * $Revision: 1.3 $ + * + * 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..6b80be2cdc52 --- /dev/null +++ b/autodoc/source/ary/idl/ia_type.hxx @@ -0,0 +1,173 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ia_type.hxx,v $ + * $Revision: 1.3 $ + * + * 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..e3e14aa541a0 --- /dev/null +++ b/autodoc/source/ary/idl/is_ce.cxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: is_ce.cxx,v $ + * $Revision: 1.7 $ + * + * 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..278970c52c6b --- /dev/null +++ b/autodoc/source/ary/idl/is_ce.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: is_ce.hxx,v $ + * $Revision: 1.4 $ + * + * 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..a84668473434 --- /dev/null +++ b/autodoc/source/ary/idl/is_type.cxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: is_type.cxx,v $ + * $Revision: 1.8 $ + * + * 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..33bdda1d3068 --- /dev/null +++ b/autodoc/source/ary/idl/is_type.hxx @@ -0,0 +1,125 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: is_type.hxx,v $ + * $Revision: 1.5 $ + * + * 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..efc56433270f --- /dev/null +++ b/autodoc/source/ary/idl/it_builtin.cxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: it_builtin.cxx,v $ + * $Revision: 1.8 $ + * + * 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..747af8d70bca --- /dev/null +++ b/autodoc/source/ary/idl/it_builtin.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: it_builtin.hxx,v $ + * $Revision: 1.5 $ + * + * 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..c01026c5940f --- /dev/null +++ b/autodoc/source/ary/idl/it_ce.cxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: it_ce.cxx,v $ + * $Revision: 1.8 $ + * + * 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..44258a584094 --- /dev/null +++ b/autodoc/source/ary/idl/it_ce.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: it_ce.hxx,v $ + * $Revision: 1.5 $ + * + * 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..da711a56cfa9 --- /dev/null +++ b/autodoc/source/ary/idl/it_explicit.cxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: it_explicit.cxx,v $ + * $Revision: 1.8 $ + * + * 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..9db991c012c7 --- /dev/null +++ b/autodoc/source/ary/idl/it_explicit.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: it_explicit.hxx,v $ + * $Revision: 1.5 $ + * + * 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..9c07f489e004 --- /dev/null +++ b/autodoc/source/ary/idl/it_named.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: it_named.hxx,v $ + * $Revision: 1.3 $ + * + * 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..cba5c4dc82e3 --- /dev/null +++ b/autodoc/source/ary/idl/it_sequence.cxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: it_sequence.cxx,v $ + * $Revision: 1.7 $ + * + * 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..3fc96de83ca2 --- /dev/null +++ b/autodoc/source/ary/idl/it_sequence.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: it_sequence.hxx,v $ + * $Revision: 1.4 $ + * + * 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..7ddf5973e6d5 --- /dev/null +++ b/autodoc/source/ary/idl/it_tplparam.cxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: it_tplparam.cxx,v $ + * $Revision: 1.8 $ + * + * 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..5d17f0668bb3 --- /dev/null +++ b/autodoc/source/ary/idl/it_tplparam.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: it_tplparam.hxx,v $ + * $Revision: 1.6 $ + * + * 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..17238d060066 --- /dev/null +++ b/autodoc/source/ary/idl/it_xnameroom.cxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: it_xnameroom.cxx,v $ + * $Revision: 1.7 $ + * + * 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..603016f5715d --- /dev/null +++ b/autodoc/source/ary/idl/it_xnameroom.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: it_xnameroom.hxx,v $ + * $Revision: 1.5 $ + * + * 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..a6c206bc0d37 --- /dev/null +++ b/autodoc/source/ary/idl/makefile.mk @@ -0,0 +1,91 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.7 $ +# +# 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..827814c955bd --- /dev/null +++ b/autodoc/source/ary/inc/cpp_internalgate.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cpp_internalgate.hxx,v $ + * $Revision: 1.3 $ + * + * 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..8be0f4b23763 --- /dev/null +++ b/autodoc/source/ary/inc/cross_refs.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cross_refs.hxx,v $ + * $Revision: 1.3 $ + * + * 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..22ce9bc0435b --- /dev/null +++ b/autodoc/source/ary/inc/idl_internalgate.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: idl_internalgate.hxx,v $ + * $Revision: 1.3 $ + * + * 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..c15cbc46b8cf --- /dev/null +++ b/autodoc/source/ary/inc/idsort.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: idsort.hxx,v $ + * $Revision: 1.3 $ + * + * 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..675d0a9702c2 --- /dev/null +++ b/autodoc/source/ary/inc/loc_internalgate.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: loc_internalgate.hxx,v $ + * $Revision: 1.3 $ + * + * 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..d5b1fc3faca8 --- /dev/null +++ b/autodoc/source/ary/inc/nametreenode.hxx @@ -0,0 +1,213 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: nametreenode.hxx,v $ + * $Revision: 1.7 $ + * + * 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..4ba0e20c55aa --- /dev/null +++ b/autodoc/source/ary/inc/reposy.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: reposy.hxx,v $ + * $Revision: 1.6 $ + * + * 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..b2b2590c0c1f --- /dev/null +++ b/autodoc/source/ary/inc/sci_impl.hxx @@ -0,0 +1,416 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sci_impl.hxx,v $ + * $Revision: 1.5 $ + * + * 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..0944024b49d3 --- /dev/null +++ b/autodoc/source/ary/inc/slots.hxx @@ -0,0 +1,166 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: slots.hxx,v $ + * $Revision: 1.4 $ + * + * 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..851267d281fc --- /dev/null +++ b/autodoc/source/ary/inc/sorted_idset.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sorted_idset.hxx,v $ + * $Revision: 1.3 $ + * + * 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..b9c0ab97ab33 --- /dev/null +++ b/autodoc/source/ary/inc/sortedids.hxx @@ -0,0 +1,240 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sortedids.hxx,v $ + * $Revision: 1.3 $ + * + * 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..8ce75e4b49c1 --- /dev/null +++ b/autodoc/source/ary/inc/store/s_base.hxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: s_base.hxx,v $ + * $Revision: 1.3 $ + * + * 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..9919f5b37382 --- /dev/null +++ b/autodoc/source/ary/inc/store/s_iterator.hxx @@ -0,0 +1,240 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: s_iterator.hxx,v $ + * $Revision: 1.5 $ + * + * 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..fb5c1121052e --- /dev/null +++ b/autodoc/source/ary/inc/store/s_storage.hxx @@ -0,0 +1,297 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: s_storage.hxx,v $ + * $Revision: 1.3 $ + * + * 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..29b42e5b8300 --- /dev/null +++ b/autodoc/source/ary/inc/traits_impl.hxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: traits_impl.hxx,v $ + * $Revision: 1.3 $ + * + * 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..c89dd1968cdd --- /dev/null +++ b/autodoc/source/ary/info/all_dts.cxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: all_dts.cxx,v $ + * $Revision: 1.5 $ + * + * 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..23e9895f1ef2 --- /dev/null +++ b/autodoc/source/ary/info/all_tags.cxx @@ -0,0 +1,572 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: all_tags.cxx,v $ + * $Revision: 1.9 $ + * + * 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..012e82826438 --- /dev/null +++ b/autodoc/source/ary/info/ci_attag.cxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ci_attag.cxx,v $ + * $Revision: 1.6 $ + * + * 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..5597b4b354e1 --- /dev/null +++ b/autodoc/source/ary/info/ci_text.cxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ci_text.cxx,v $ + * $Revision: 1.5 $ + * + * 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..e4395b5f309a --- /dev/null +++ b/autodoc/source/ary/info/makefile.mk @@ -0,0 +1,64 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.4 $ +# +# 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..57cb6d6e2086 --- /dev/null +++ b/autodoc/source/ary/kernel/ary_disp.cxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ary_disp.cxx,v $ + * $Revision: 1.7 $ + * + * 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..ad2ce968bafe --- /dev/null +++ b/autodoc/source/ary/kernel/cessentl.cxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cessentl.cxx,v $ + * $Revision: 1.9 $ + * + * 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..b3d99c90068b --- /dev/null +++ b/autodoc/source/ary/kernel/makefile.mk @@ -0,0 +1,67 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.5 $ +# +# 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..15037f94f61b --- /dev/null +++ b/autodoc/source/ary/kernel/namesort.cxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: namesort.cxx,v $ + * $Revision: 1.6 $ + * + * 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..1ead594d0221 --- /dev/null +++ b/autodoc/source/ary/kernel/qualiname.cxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: qualiname.cxx,v $ + * $Revision: 1.5 $ + * + * 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..490d95821acf --- /dev/null +++ b/autodoc/source/ary/kernel/reposy.cxx @@ -0,0 +1,221 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: reposy.cxx,v $ + * $Revision: 1.11 $ + * + * 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..78c0c8f89ba5 --- /dev/null +++ b/autodoc/source/ary/kernel/slots.cxx @@ -0,0 +1,167 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: slots.cxx,v $ + * $Revision: 1.6 $ + * + * 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..855c08e48643 --- /dev/null +++ b/autodoc/source/ary/loc/loc_dir.cxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: loc_dir.cxx,v $ + * $Revision: 1.6 $ + * + * 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..0deb40d6f771 --- /dev/null +++ b/autodoc/source/ary/loc/loc_file.cxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: loc_file.cxx,v $ + * $Revision: 1.6 $ + * + * 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..9e762f098386 --- /dev/null +++ b/autodoc/source/ary/loc/loc_filebase.cxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: loc_filebase.cxx,v $ + * $Revision: 1.3 $ + * + * 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..79fe0890c3d6 --- /dev/null +++ b/autodoc/source/ary/loc/loc_root.cxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: loc_root.cxx,v $ + * $Revision: 1.6 $ + * + * 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..3b8e0340e8c7 --- /dev/null +++ b/autodoc/source/ary/loc/loc_traits.cxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: loc_traits.cxx,v $ + * $Revision: 1.3 $ + * + * 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..6e1281426abf --- /dev/null +++ b/autodoc/source/ary/loc/loca_le.cxx @@ -0,0 +1,184 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: loca_le.cxx,v $ + * $Revision: 1.3 $ + * + * 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..0aecfedd9561 --- /dev/null +++ b/autodoc/source/ary/loc/loca_le.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: loca_le.hxx,v $ + * $Revision: 1.3 $ + * + * 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..3e61dd5ca4a9 --- /dev/null +++ b/autodoc/source/ary/loc/locs_le.cxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: locs_le.cxx,v $ + * $Revision: 1.3 $ + * + * 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..0cec1796f57a --- /dev/null +++ b/autodoc/source/ary/loc/locs_le.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: locs_le.hxx,v $ + * $Revision: 1.3 $ + * + * 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..d6c94d4ca713 --- /dev/null +++ b/autodoc/source/ary/loc/makefile.mk @@ -0,0 +1,65 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.4 $ +# +# 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 diff --git a/autodoc/source/ary_i/kernel/ci_atag2.cxx b/autodoc/source/ary_i/kernel/ci_atag2.cxx new file mode 100644 index 000000000000..38ffb404fc81 --- /dev/null +++ b/autodoc/source/ary_i/kernel/ci_atag2.cxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ci_atag2.cxx,v $ + * $Revision: 1.7 $ + * + * 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_i/ci_atag2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary_i/disdocum.hxx> + + +namespace ary +{ +namespace inf +{ + +void DocuTag_Display::Display_TextToken( + const csi::dsapi::DT_TextToken & ) {} +void DocuTag_Display::Display_White() {} +void DocuTag_Display::Display_MupType( + const csi::dsapi::DT_MupType & ) {} +void DocuTag_Display::Display_MupMember( + const csi::dsapi::DT_MupMember & ) {} +void DocuTag_Display::Display_MupConst( + const csi::dsapi::DT_MupConst & ) {} +void DocuTag_Display::Display_Style( + const csi::dsapi::DT_Style & ) {} +void DocuTag_Display::Display_EOL() {} + + +} // namespace inf +} // namespace ary + diff --git a/autodoc/source/ary_i/kernel/ci_text2.cxx b/autodoc/source/ary_i/kernel/ci_text2.cxx new file mode 100644 index 000000000000..19e979f76f2a --- /dev/null +++ b/autodoc/source/ary_i/kernel/ci_text2.cxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ci_text2.cxx,v $ + * $Revision: 1.10 $ + * + * 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_i/ci_text2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary_i/disdocum.hxx> +#include <ary_i/d_token.hxx> + + +namespace ary +{ +namespace inf +{ + +DocuTex2::DocuTex2() +{ +} + +DocuTex2::~DocuTex2() +{ + for ( TokenList::iterator iter = aTokens.begin(); + iter != aTokens.end(); + ++iter ) + { + delete (*iter); + } +} + +void +DocuTex2::DisplayAt( DocumentationDisplay & o_rDisplay ) const +{ + for ( ary::inf::DocuTex2::TokenList::const_iterator + iter = aTokens.begin(); + iter != aTokens.end(); + ++iter ) + { + (*iter)->DisplayAt(o_rDisplay); + } +} + +void +DocuTex2::AddToken( DYN DocuToken & let_drToken ) +{ + if (aTokens.empty()) + { + if (let_drToken.IsWhiteOnly()) + return; + } + aTokens.push_back(&let_drToken); +} + +bool +DocuTex2::IsEmpty() const +{ + for ( ary::inf::DocuTex2::TokenList::const_iterator + iter = aTokens.begin(); + iter != aTokens.end(); + ++iter ) + { + return false; + } + return true; +} + +using csi::dsapi::DT_TextToken; + +const String & +DocuTex2::TextOfFirstToken() const +{ + if (NOT aTokens.empty()) + { + const DT_TextToken * + pTok = dynamic_cast< const DT_TextToken* >(*aTokens.begin()); + + if (pTok != 0) + return pTok->GetTextStr(); + } + return String::Null_(); +} + +String & +DocuTex2::Access_TextOfFirstToken() +{ + if (NOT aTokens.empty()) + { + DT_TextToken * + pTok = dynamic_cast< DT_TextToken* >(*aTokens.begin()); + + if (pTok != 0) + return pTok->Access_Text(); + } + + static String sDummy_; + return sDummy_; +} + + + +void DocuText_Display::Display_StdAtTag( + const csi::dsapi::DT_StdAtTag & ) {} +void DocuText_Display::Display_SeeAlsoAtTag( + const csi::dsapi::DT_SeeAlsoAtTag & ) {} +void DocuText_Display::Display_ParameterAtTag( + const csi::dsapi::DT_ParameterAtTag & ) {} +void DocuText_Display::Display_SinceAtTag( + const csi::dsapi::DT_SinceAtTag & ) {} + + + +} // namespace inf +} // namespace ary + diff --git a/autodoc/source/ary_i/kernel/d_token.cxx b/autodoc/source/ary_i/kernel/d_token.cxx new file mode 100644 index 000000000000..b2b5b26c6253 --- /dev/null +++ b/autodoc/source/ary_i/kernel/d_token.cxx @@ -0,0 +1,190 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: d_token.cxx,v $ + * $Revision: 1.7 $ + * + * 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_i/d_token.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary_i/disdocum.hxx> + + + + +namespace csi +{ +namespace dsapi +{ + +bool +DT_Dsapi::IsWhiteOnly() const +{ + return false; +} + +DT_TextToken::~DT_TextToken() +{ +} + +void +DT_TextToken::DisplayAt( DocumentationDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_TextToken( *this ); +} + +bool +DT_TextToken::IsWhiteOnly() const +{ + for ( const char * it = sText.c_str(); + static_cast<UINT8>(*it) > 32; + ++it ) + { + return false; + } + return true; +} + +DT_White::~DT_White() +{ +} + +void +DT_White::DisplayAt( DocumentationDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_White(); +} + +bool +DT_White::IsWhiteOnly() const +{ + return true; +} + +DT_MupType::~DT_MupType() +{ +} + +void +DT_MupType::DisplayAt( DocumentationDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_MupType( *this ); +} + +DT_MupMember::~DT_MupMember() +{ +} + +void +DT_MupMember::DisplayAt( DocumentationDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_MupMember( *this ); +} + +DT_MupConst::~DT_MupConst() +{ +} + +void +DT_MupConst::DisplayAt( DocumentationDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_MupConst( *this ); +} + +DT_Style::~DT_Style() +{ +} + +void +DT_Style::DisplayAt( DocumentationDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_Style( *this ); +} + +DT_EOL::~DT_EOL() +{ +} + +void +DT_EOL::DisplayAt( DocumentationDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_EOL(); +} + +bool +DT_EOL::IsWhiteOnly() const +{ + return true; +} + +DT_StdAtTag::~DT_StdAtTag() +{ +} + +void +DT_StdAtTag::DisplayAt( DocumentationDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_StdAtTag( *this ); +} + +DT_SeeAlsoAtTag::~DT_SeeAlsoAtTag() +{ +} + +void +DT_SeeAlsoAtTag::DisplayAt( DocumentationDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_SeeAlsoAtTag( *this ); +} + +DT_ParameterAtTag::~DT_ParameterAtTag() +{ +} + +void +DT_ParameterAtTag::DisplayAt( DocumentationDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_ParameterAtTag( *this ); +} + +DT_SinceAtTag::~DT_SinceAtTag() +{ +} + +void +DT_SinceAtTag::DisplayAt( DocumentationDisplay & o_rDisplay ) const +{ + o_rDisplay.Display_SinceAtTag( *this ); +} + + + + +} // namespace dsapi +} // namespace csi diff --git a/autodoc/source/ary_i/kernel/makefile.mk b/autodoc/source/ary_i/kernel/makefile.mk new file mode 100644 index 000000000000..6d8dff18be5a --- /dev/null +++ b/autodoc/source/ary_i/kernel/makefile.mk @@ -0,0 +1,64 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.5 $ +# +# 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=ary2_cinfo + + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + + +OBJFILES= \ + $(OBJ)$/ci_atag2.obj \ + $(OBJ)$/ci_text2.obj \ + $(OBJ)$/d_token.obj + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/display/html/aryattrs.cxx b/autodoc/source/display/html/aryattrs.cxx new file mode 100644 index 000000000000..4a8ca3f6c44d --- /dev/null +++ b/autodoc/source/display/html/aryattrs.cxx @@ -0,0 +1,251 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: aryattrs.cxx,v $ + * $Revision: 1.8 $ + * + * 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 "aryattrs.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/getncast.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <ary/cpp/cp_type.hxx> +#include "strconst.hxx" + + + + +//******************** HtmlDisplay_Impl *********************// + +const char * +Get_ClassTypeKey( const ary::cpp::Class & i_rClass ) +{ + return i_rClass.ClassKey() == ary::cpp::CK_class + ? C_sHFTypeTitle_Class + : i_rClass.ClassKey() == ary::cpp::CK_struct + ? C_sHFTypeTitle_Struct + : C_sHFTypeTitle_Union; + +} + +const char * +Get_TypeKey( const ary::cpp::CodeEntity & i_rCe ) +{ + if ( ary::is_type<ary::cpp::Class>(i_rCe) ) + { + return Get_ClassTypeKey( + ary::ary_cast<ary::cpp::Class>(i_rCe) ); + } + if ( ary::is_type<ary::cpp::Enum>(i_rCe) ) + { + return "enum"; + } + return ""; +} + +bool +Ce_IsInternal( const ary::cpp::CodeEntity & i_rCe ) +{ + return NOT i_rCe.IsVisible(); +} + +const char * +SyntaxText_PreName( const ary::cpp::Function & i_rFunction, + const ary::cpp::Gate & i_rAryGate ) +{ + static StreamStr sResult( 150 ); + sResult.seekp(0); + + // write pre-name: + const ary::cpp::FunctionFlags & rFlags = i_rFunction.Flags(); + if ( rFlags.IsStaticLocal() OR rFlags.IsStaticMember() ) + sResult << "static "; + if ( rFlags.IsExplicit() ) + sResult << "explicit "; + if ( rFlags.IsMutable() ) + sResult << "mutable "; + if ( i_rFunction.Virtuality() != ary::cpp::VIRTUAL_none ) + sResult << "virtual "; + i_rAryGate.Types().Get_TypeText( sResult, i_rFunction.ReturnType() ); + sResult << " "; + + return sResult.c_str(); +} + +const char * +SyntaxText_PostName( const ary::cpp::Function & i_rFunction, + const ary::cpp::Gate & i_rAryGate ) +{ + static StreamStr sResult( 850 ); + sResult.seekp(0); + + // parameters and con_vol + i_rAryGate.Ces().Get_SignatureText( sResult, i_rFunction.Signature(), &i_rFunction.ParamInfos() ); + + // write Exceptions: + const std::vector< ary::cpp::Type_id > * + pThrow = i_rFunction.Exceptions(); + if ( pThrow) + { + + std::vector< ary::cpp::Type_id >::const_iterator + it = pThrow->begin(); + std::vector< ary::cpp::Type_id >::const_iterator + it_end = pThrow->end(); + + if (it != it_end) + { + sResult << " throw( "; + i_rAryGate.Types().Get_TypeText(sResult, *it); + + for ( ++it; it != it_end; ++it ) + { + sResult << ", "; + i_rAryGate.Types().Get_TypeText(sResult, *it); + } + sResult << " )"; + } + else + { + sResult << " throw( )"; + } + } // endif // pThrow + + // abstractness: + if ( i_rFunction.Virtuality() == ary::cpp::VIRTUAL_abstract ) + sResult << " = 0"; + + // finish: + sResult << ";"; + + return sResult.c_str(); +} + +bool +Get_TypeText( const char * & o_rPreName, + const char * & o_rName, + const char * & o_rPostName, + ary::cpp::Type_id i_nTypeid, + const ary::cpp::Gate & i_rAryGate ) +{ + static StreamStr sResult_PreName(250); + static StreamStr sResult_Name(250); + static StreamStr sResult_PostName(250); + + sResult_PreName.seekp(0); + sResult_Name.seekp(0); + sResult_PostName.seekp(0); + + bool ret = i_rAryGate.Types().Get_TypeText( + sResult_PreName, + sResult_Name, + sResult_PostName, + i_nTypeid ); + if ( sResult_PreName.tellp() > 0 ) + { + char cLast = *( sResult_PreName.c_str() + (sResult_PreName.tellp() - 1) ); + if (cLast != ':' AND cLast != ' ') + sResult_PreName << " "; + } + + + if (ret) + { + o_rPreName = sResult_PreName.c_str(); + o_rName = sResult_Name.c_str(); + o_rPostName = sResult_PostName.c_str(); + } + else + { + o_rPreName = o_rName = o_rPostName = ""; + } + return ret; +} + + + + +//********************* FunctionParam_Iterator *****************// + + +FunctionParam_Iterator::FunctionParam_Iterator() + : // itTypes + // itTypes_end + // itNames_andMore + // itNames_andMore_end + eConVol(ary::cpp::CONVOL_none) +{ + static std::vector<ary::cpp::Type_id> aTypesNull_; + static StringVector aNamesNull_; + + itTypes = itTypes_end = aTypesNull_.end(); + itNames_andMore = itNames_andMore_end = aNamesNull_.end(); +} + +FunctionParam_Iterator::~FunctionParam_Iterator() +{ +} + +FunctionParam_Iterator & +FunctionParam_Iterator::operator++() +{ + if ( IsValid() ) + { + ++itTypes; + ++itNames_andMore; + } + return *this; +} + +void +FunctionParam_Iterator::Assign( const ary::cpp::Function & i_rFunction ) +{ + const ary::cpp::OperationSignature & + rSigna = i_rFunction.Signature(); + + const std::vector<ary::cpp::Type_id> & + rTypes = rSigna.Parameters(); + const StringVector & + rNames = i_rFunction.ParamInfos(); + + if ( rTypes.size() != rNames.size() OR rTypes.size() == 0 ) + return; + + itTypes = rTypes.begin(); + itTypes_end = rTypes.end(); + itNames_andMore = rNames.begin(); + itNames_andMore_end = rNames.end(); + + eConVol = rSigna.ConVol(); +} diff --git a/autodoc/source/display/html/aryattrs.hxx b/autodoc/source/display/html/aryattrs.hxx new file mode 100644 index 000000000000..a1cb7a6d0ea4 --- /dev/null +++ b/autodoc/source/display/html/aryattrs.hxx @@ -0,0 +1,157 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: aryattrs.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_ARYATTRS_HXX +#define ADC_DISPLAY_ARYATTRS_HXX + +// USED SERVICES +#include <ary/cpp/c_types4cpp.hxx> +#include <ary/doc/d_docu.hxx> +#include <ary/doc/d_oldcppdocu.hxx> + +namespace ary +{ + namespace cpp + { + class CodeEntity; + class Class; + class DisplayGate; + class Function; + class Namespace; + } +} + + + + +const char * Get_ClassTypeKey( + const ary::cpp::Class & i_rClass ); +const char * Get_TypeKey( + const ary::cpp::CodeEntity & + i_rCe ); +bool Ce_IsInternal( + const ary::cpp::CodeEntity & + i_rCe ); +const char * SyntaxText_PreName( + const ary::cpp::Function & + i_rFunction, + const ary::cpp::Gate & i_rAryGate ); +const char * SyntaxText_PostName( + const ary::cpp::Function & + i_rFunction, + const ary::cpp::Gate & i_rAryGate ); + +bool Get_TypeText( + const char * & o_rPreName, + const char * & o_rName, + const char * & o_rPostName, + ary::cpp::Type_id i_nTypeid, + const ary::cpp::Gate & i_rAryGate ); + + +inline const ary::doc::OldCppDocu * +Get_CppDocu(const ary::doc::Documentation & i_doc) +{ + return dynamic_cast< const ary::doc::OldCppDocu* >(i_doc.Data()); +} + + +class FunctionParam_Iterator +{ + public: + FunctionParam_Iterator(); + ~FunctionParam_Iterator(); + + operator bool() const; + FunctionParam_Iterator & + operator++(); + + void Assign( + const ary::cpp::Function & + i_rFunction ); + + ary::cpp::Type_id + CurType() const; + const String & CurName() const; + + bool IsFunctionConst() const; + bool IsFunctionVolatile() const; + + private: + typedef std::vector<ary::cpp::Type_id>::const_iterator Type_Iterator; + typedef StringVector::const_iterator Name_Iterator; + + bool IsValid() const; + + // Forbidden + FunctionParam_Iterator & + operator++(int); + // DATA + Type_Iterator itTypes; + Type_Iterator itTypes_end; + Name_Iterator itNames_andMore; /// Name, init-value. + Name_Iterator itNames_andMore_end; + + ary::cpp::E_ConVol eConVol; +}; + + + + +// IMPLEMENTATION +inline +FunctionParam_Iterator::operator bool() const + { return IsValid(); } + +inline bool +FunctionParam_Iterator::IsValid() const +{ + // By C'tor and Assign(), it is assured, that + // both iterators are valid, if one is valid. + return itTypes != itTypes_end; +} + +inline ary::cpp::Type_id +FunctionParam_Iterator::CurType() const + { return IsValid() ? *itTypes : ary::cpp::Type_id(0); } +inline const String & +FunctionParam_Iterator::CurName() const + { return IsValid() ? *itNames_andMore : String::Null_(); } +inline bool +FunctionParam_Iterator::IsFunctionConst() const + { return (eConVol & ary::cpp::CONVOL_const) != 0; } +inline bool +FunctionParam_Iterator::IsFunctionVolatile() const + { return (eConVol & ary::cpp::CONVOL_volatile) != 0; } + + + + +#endif diff --git a/autodoc/source/display/html/cfrstd.cxx b/autodoc/source/display/html/cfrstd.cxx new file mode 100644 index 000000000000..3a01b1ba890b --- /dev/null +++ b/autodoc/source/display/html/cfrstd.cxx @@ -0,0 +1,350 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cfrstd.cxx,v $ + * $Revision: 1.17 $ + * + * 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 <cfrstd.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <time.h> + + +/* CSS Styles + ---------- + +Colors: +- light background color #eeeeff +- dark background color #ccccff +- self in navibar background color #2222ad + + +Fonts: +- page title 20, bold, Arial +- navibar main 12, bold, Arial +- navibar sub 8, Arial, kapitlchen +- attrtable title line 8, bold, Arial, kapitlchen +- attrtable value line 8, Arial kapitlchen + +- namespace chain 13, bold +- table title 13, bold +- template line 13 + +- member paragraph title 12, bold + +- docu paragraph title 11, bold +- standard text 11 + +- hierarchy 11, monospace + + +classes: + + td.title page title + h3 table title + h4 member paragraph title + + td.nmain navigation main bar + td.nsub navigation sub bar + a.nmain links in navigation main bar + a.nsub links in navigation sub bar + + td.attr1 attribute table head line + td.attr2 attribute table value line + + p.namechain namespace chain in head of pages + p.tpl template line in head of pages + + pre.doc preformatted docu + pre.hierarchy class bases hierarchy graphic + + dl.syntax function- or variable-declaration field + a.syntax link in function- or variable-declaration field + + p.dt docu paragraph title + dl.dt docu paragraph title + + p standard text + dl standard text + dd standard text +*/ + + +#define CRLF "\n" + +namespace +{ + +bool bUse_OOoFrameDiv = true; + + +//*************** These are used for IDL currently only! ******************** + +const char * const C_sStdStyle = + "/*See bottom of file for explanations.*/"CRLF + CRLF + "body { background-color:#ffffff; }"CRLF + CRLF + "h3 { font-size:13pt; font-weight:bold;"CRLF + " margin-top:3pt; margin-bottom:1pt; }"CRLF + "p, dt, dd, pre { font-size:11pt;"CRLF + " margin-top:3pt; margin-bottom:1pt; }"CRLF + "pre { font-family:monospace; }"CRLF + CRLF + "table.navimain { background-color:#eeeeff; }"CRLF + "table.subtitle { margin-top:6pt; margin-bottom:6pt; }"CRLF + CRLF + "td { font-size:11pt; }"CRLF + "td.title { font-family: Arial; font-size:19pt; font-weight:bold;"CRLF + " line-height:30pt; background-color:#ccccff; text-align:center; }"CRLF + "td.subtitle { font-family: Arial; font-size:13pt;"CRLF + " line-height:20pt; background-color:#ccccff; }"CRLF + "td.crosstitle { font-size:12pt; font-weight:bold;"CRLF + " line-height:15pt; background-color:#eeeeff; }"CRLF + "td.imdetail { width:100%; background-color:#eeeeff; }"CRLF + CRLF + "td.imsum_left { width:30%; }"CRLF + "td.imsum_right { width:70%; }"CRLF + CRLF + "td.navimain, a.navimain"CRLF + " { text-align:center; font-family: Arial; font-size:12pt; font-weight:bold; }"CRLF + "td.navimainself { text-align:center; font-family: Arial; font-size:12pt; font-weight:bold;"CRLF + " color:#ffffff; background-color:#2222ad; }"CRLF + "td.navimainnone { text-align:center; font-family: Arial; font-size:12pt; }"CRLF + "td.navisub, a.navisub"CRLF + " { text-align:center; font-family: Arial; font-size:9pt; font-variant:small-caps; }"CRLF + "td.navimain, td.navisub"CRLF + " { padding-left:7pt; padding-right:7pt; }"CRLF + CRLF + "a.membertitle { font-size:12pt; font-weight:bold; line-height:18pt; }"CRLF + "a.navimain, a.navisub { color:#000000; }"CRLF + ".dt { font-weight:bold; }"CRLF + ".namechain { font-size:13pt; font-weight:bold;"CRLF + " margin-top:3pt; margin-bottom:6pt; }"CRLF + ".title2 { font-size:13pt; font-style:italic; font-weight:bold; text-align:left; }"CRLF + ; + + +const char * const C_sCssExplanations = + "/* Explanation of CSS classes:"CRLF + CRLF + ".navimain Text in main navigation bar."CRLF + ".navisub Text in lower navigation bar."CRLF + "td.navimainself Cell in main navigation bar with \"selected\" shadow: You are here."CRLF + "td.navimainnone Cell in main navigation bar with no link."CRLF + CRLF + ".namechain Line with current module path."CRLF + CRLF + "td.crosstitle Comment box for bases (base interfaces etc.)"CRLF + "td.imsum_left Left part of such boxes."CRLF + "td.imsum_right Right part of such boxes."CRLF + CRLF + "td.title Main title of the page like \"interface XYz\""CRLF + ".subtitle Tables, and head cells of those, which list members"CRLF + " like \"method summary\" and \"method details\"."CRLF + CRLF + "td.imdetail Background table of method's detail description."CRLF + "a.membertitle Method name (as jump label) in method's detail"CRLF + " description."CRLF + ".title2 smaller font prefixes to page titles"CRLF + "*/"CRLF + ; + +const char * const C_sStdStyle_withDivFrame = + "/*See bottom of file for explanations.*/"CRLF + CRLF + "body { background-color:#ffffff; }"CRLF + CRLF + "#adc-idlref h3 { font-size:13pt; font-weight:bold;"CRLF + " margin-top:3pt; margin-bottom:1pt; }"CRLF + "#adc-idlref p, #adc-idlref dt, #adc-idlref dd, #adc-idlref pre"CRLF + " { font-size:11pt;"CRLF + " margin-top:3pt; margin-bottom:1pt; }"CRLF + "#adc-idlref pre { font-family:monospace; }"CRLF + CRLF + "#adc-idlref table.navimain { background-color:#eeeeff; }"CRLF + "#adc-idlref table.subtitle { margin-top:6pt; margin-bottom:6pt; }"CRLF + CRLF + "#adc-idlref td { font-size:11pt; }"CRLF + "#adc-idlref td.title { font-family: Arial; font-size:19pt; font-weight:bold;"CRLF + " line-height:30pt; background-color:#ccccff; text-align:center; }"CRLF + "#adc-idlref td.subtitle { font-family: Arial; font-size:13pt;"CRLF + " line-height:20pt; background-color:#ccccff; }"CRLF + "#adc-idlref td.crosstitle { font-size:12pt; font-weight:bold;"CRLF + " line-height:15pt; background-color:#eeeeff; }"CRLF + "#adc-idlref td.imdetail { width:100%; background-color:#eeeeff; }"CRLF + CRLF + "#adc-idlref td.imsum_left { width:30%; }"CRLF + "#adc-idlref td.imsum_right { width:70%; }"CRLF + CRLF + "#adc-idlref td.navimain, #adc-idlref a.navimain"CRLF + " { text-align:center; font-family: Arial; font-size:12pt; font-weight:bold; }"CRLF + "#adc-idlref td.navimainself { text-align:center; font-family: Arial; font-size:12pt; font-weight:bold;"CRLF + " color:#ffffff; background-color:#2222ad; }"CRLF + "#adc-idlref td.navimainnone { text-align:center; font-family: Arial; font-size:12pt; }"CRLF + "#adc-idlref td.navisub, #adc-idlref a.navisub"CRLF + " { text-align:center; font-family: Arial; font-size:9pt; font-variant:small-caps; }"CRLF + "#adc-idlref td.navimain, #adc-idlref td.navisub"CRLF + " { padding-left:7pt; padding-right:7pt; }"CRLF + CRLF + "#adc-idlref a.membertitle { font-size:12pt; font-weight:bold; line-height:18pt; }"CRLF + "#adc-idlref a.navimain, #adc-idlref a.navisub { color:#000000; }"CRLF + "#adc-idlref .dt { font-weight:bold; }"CRLF + "#adc-idlref .namechain { font-size:13pt; font-weight:bold;"CRLF + " margin-top:3pt; margin-bottom:6pt; }"CRLF + "#adc-idlref .title2 { font-size:13pt; font-style:italic; font-weight:bold; text-align:left; }"CRLF + ""CRLF + "#adc-idlref table { empty-cells:show; }"CRLF + ""CRLF + "#adc-idlref .childlist td, "CRLF + "#adc-idlref .commentedlinks td, "CRLF + "#adc-idlref .memberlist td, "CRLF + "#adc-idlref .subtitle td, "CRLF + "#adc-idlref .crosstitle td { border: .1pt solid #000000; }"CRLF + ""CRLF + "#adc-idlref .flag-table td { border: .1pt solid #cccccc; } "CRLF + ""CRLF + "#adc-idlref .title-table td, "CRLF + "#adc-idlref .table-in-method td, "CRLF + "#adc-idlref .table-in-data td, "CRLF + "#adc-idlref .navimain td, "CRLF + "#adc-idlref .navisub td, "CRLF + "#adc-idlref .expl-table td, "CRLF + "#adc-idlref .param-table td { border: none; }"CRLF + ; + + +} // anonymous namespace + + +StdFrame::StdFrame() + : sDevelopersGuideHtmlRoot(), + bSimpleLinks(false) +{ +} + +DYN Html_Image * +StdFrame::LogoSrc() const +{ + return 0; + +// return new Html_Image( "logodot-blu.gif", +// "109", +// "54", +// "RIGHT", +// "0", +// "OpenOffice" ); + +} + +const char * +StdFrame::LogoLink() const +{ + return ""; +// return "http://www.sun.com"; +// return "http://www.openoffice.org"; +} + + +String MakeCopyRight(); + +const char * +StdFrame::CopyrightText() const +{ + static String sCopyRight_( MakeCopyRight() ); + return sCopyRight_.c_str(); +} + +const char * +StdFrame::CssStyle() const +{ + if (bUse_OOoFrameDiv) + return C_sStdStyle_withDivFrame; + else + return C_sStdStyle; +} + +const char * +StdFrame::CssStylesExplanation() const +{ + return C_sCssExplanations; +} + +const char * +StdFrame::DevelopersGuideHtmlRoot() const +{ + return sDevelopersGuideHtmlRoot; +} + +bool +StdFrame::SimpleLinks() const +{ + return bSimpleLinks; +} + +void +StdFrame::Set_DevelopersGuideHtmlRoot( const String & i_directory ) +{ + if (NOT i_directory.empty()) + { + if (i_directory.char_at(i_directory.length()-1) == '/') + { + sDevelopersGuideHtmlRoot.assign(i_directory,i_directory.length()-1); + return; + } + } + sDevelopersGuideHtmlRoot = i_directory; +} + +void +StdFrame::Set_SimpleLinks() +{ + bSimpleLinks = true; +} + +String +MakeCopyRight() +{ + StreamStr cr(700); + time_t + gt; + time(>); + tm * + plt = localtime(>); + int year = 1900 + plt->tm_year; + + cr << "Copyright © " + << year + << " Sun Microsystems, Inc."; + return String(cr.c_str()); + +// return "Copyright © 2003 Sun Microsystems, Inc."; +// return "Copyright © 2002 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303 USA."; +// return "Copyright 2001 OpenOffice.org Foundation. All Rights Reserved."; +} diff --git a/autodoc/source/display/html/chd_udk2.cxx b/autodoc/source/display/html/chd_udk2.cxx new file mode 100644 index 000000000000..8df223640f44 --- /dev/null +++ b/autodoc/source/display/html/chd_udk2.cxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: chd_udk2.cxx,v $ + * $Revision: 1.7 $ + * + * 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 <html/chd_udk2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/ary_disp.hxx> +#include <ary/ceslot.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/cp_ce.hxx> + +#include "dsply_cl.hxx" +#include "dsply_da.hxx" +#include "dsply_op.hxx" +#include "opageenv.hxx" +#include "outfile.hxx" +#include "pagemake.hxx" + + + +//******************** CppHtmlDisplay_Udk2 ********************// + + +CppHtmlDisplay_Udk2::CppHtmlDisplay_Udk2() + : pCurPageEnv(0) +{ +} + +CppHtmlDisplay_Udk2::~CppHtmlDisplay_Udk2() +{ +} + +void +CppHtmlDisplay_Udk2::do_Run( const char * i_sOutputDirectory, + const ary::cpp::Gate & i_rAryGate, + const display::CorporateFrame & i_rLayout ) +{ + SetRunData( i_sOutputDirectory, i_rAryGate, i_rLayout ); + + Create_Css_File(); + Create_Overview_File(); + Create_Help_File(); + Create_AllDefs_File(); + + CreateFiles_InSubTree_Namespaces(); + CreateFiles_InSubTree_Index(); +} + +void +CppHtmlDisplay_Udk2::SetRunData( const char * i_sOutputDirectory, + const ary::cpp::Gate & i_rAryGate, + const display::CorporateFrame & i_rLayout ) +{ + csv::ploc::Path aOutputDir( i_sOutputDirectory, true ); + pCurPageEnv = new OuputPage_Environment( aOutputDir, i_rAryGate, i_rLayout ); +} + +void +CppHtmlDisplay_Udk2::Create_Css_File() +{ + pCurPageEnv->MoveDir_2Root(); + pCurPageEnv->SetFile_Css(); + HtmlDocuFile::WriteCssFile(pCurPageEnv->CurPath()); +} + +void +CppHtmlDisplay_Udk2::Create_Overview_File() +{ + pCurPageEnv->MoveDir_2Root(); + PageDisplay aPageMaker( *pCurPageEnv ); + aPageMaker.Create_OverviewFile(); +} + +void +CppHtmlDisplay_Udk2::Create_Help_File() +{ + PageDisplay aPageMaker( *pCurPageEnv ); + aPageMaker.Create_HelpFile(); +} + +void +CppHtmlDisplay_Udk2::Create_AllDefs_File() +{ + PageDisplay aPageMaker( *pCurPageEnv ); + aPageMaker.Create_AllDefsFile(); +} + +void +CppHtmlDisplay_Udk2::CreateFiles_InSubTree_Namespaces() +{ + Cout() << "\nCreate files in subtree namespaces" << Endl(); + + const ary::cpp::Namespace & + rGlobalNsp = Gate().Ces().GlobalNamespace(); + + RecursiveDisplay_Namespace(rGlobalNsp); + Cout() << Endl(); +} + +void +CppHtmlDisplay_Udk2::CreateFiles_InSubTree_Index() +{ + Cout() << "\nCreate files in subtree index" << Endl(); + Cout() << Endl(); + + PageDisplay aPageMaker( *pCurPageEnv ); + aPageMaker.Create_IndexFiles(); +} + +void +CppHtmlDisplay_Udk2::RecursiveDisplay_Namespace( const ary::cpp::Namespace & i_rNsp ) +{ + if (i_rNsp.Owner().IsValid()) + pCurPageEnv->MoveDir_Down2( i_rNsp ); + else + pCurPageEnv->MoveDir_2Names(); + DisplayFiles_InNamespace( i_rNsp ); + + typedef std::vector< const ary::cpp::Namespace* > NspList; + NspList aSubNspList; + i_rNsp.Get_SubNamespaces( aSubNspList ); + for ( NspList::const_iterator it = aSubNspList.begin(); + it != aSubNspList.end(); + ++it ) + { + RecursiveDisplay_Namespace( *(*it) ); + } // end for + + pCurPageEnv->MoveDir_Up(); +} + +void +CppHtmlDisplay_Udk2::DisplayFiles_InNamespace( const ary::cpp::Namespace & i_rNsp ) +{ + PageDisplay aPageMaker( *pCurPageEnv ); + + ary::Slot_AutoPtr pSlot; + + // Namespace + aPageMaker.Create_NamespaceFile(); + + // Classes + ClassDisplayer aClassDisplayer( *pCurPageEnv ); + DisplaySlot( aClassDisplayer, i_rNsp, ary::cpp::Namespace::SLOT_Classes ); + + // Enums + DisplaySlot( aPageMaker, i_rNsp, ary::cpp::Namespace::SLOT_Enums ); + + // Typedefs + DisplaySlot( aPageMaker, i_rNsp, ary::cpp::Namespace::SLOT_Typedefs ); + + // Operations + OperationsDisplay aOperationsDisplayer( *pCurPageEnv ); + DisplaySlot( aOperationsDisplayer, i_rNsp, ary::cpp::Namespace::SLOT_Operations ); + aOperationsDisplayer.Create_Files(); + + // Data + DataDisplay aDataDisplayer( *pCurPageEnv ); + + aDataDisplayer.PrepareForConstants(); + DisplaySlot( aDataDisplayer, i_rNsp, ary::cpp::Namespace::SLOT_Constants ); + + aDataDisplayer.PrepareForVariables(); + DisplaySlot( aDataDisplayer, i_rNsp, ary::cpp::Namespace::SLOT_Variables ); + + aDataDisplayer.Create_Files(); +} + +const ary::cpp::Gate & +CppHtmlDisplay_Udk2::Gate() const +{ + return pCurPageEnv->Gate(); +} diff --git a/autodoc/source/display/html/cre_link.cxx b/autodoc/source/display/html/cre_link.cxx new file mode 100644 index 000000000000..1b9e7a61424a --- /dev/null +++ b/autodoc/source/display/html/cre_link.cxx @@ -0,0 +1,272 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cre_link.cxx,v $ + * $Revision: 1.7 $ + * + * 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 "cre_link.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_class.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_gate.hxx> +#include <ary/cpp/c_macro.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/c_vari.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <ary/loc/loc_file.hxx> +#include <ary/loc/locp_le.hxx> +#include "hdimpl.hxx" +#include "opageenv.hxx" +#include "strconst.hxx" + + + + + +LinkCreator::LinkCreator( char * o_rOutput, + uintt i_nOutputSize ) + : pOut(o_rOutput), + nOutMaxSize(i_nOutputSize), + pEnv(0) +{ +} + +LinkCreator::~LinkCreator() +{ +} + +void +LinkCreator::do_Process( const ary::cpp::Namespace & i_rData ) +{ + Create_PrePath( i_rData ); + strcat( pOut, "index.html" ); // KORR_FUTURE // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::Class & i_rData ) +{ + Create_PrePath( i_rData ); + strcat( pOut, ClassFileName(i_rData.LocalName().c_str()) ); // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::Enum & i_rData ) +{ + Create_PrePath( i_rData ); + strcat( pOut, EnumFileName(i_rData.LocalName().c_str()) ); // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::Typedef & i_rData ) +{ + Create_PrePath( i_rData ); + strcat( pOut, TypedefFileName(i_rData.LocalName().c_str()) ); // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::Function & i_rData ) +{ + Create_PrePath( i_rData ); + + if ( i_rData.Protection() != ary::cpp::PROTECT_global ) + { + strcat( pOut, "o.html" ); // SAFE STRCAT (#100211# - checked) + } + else + { + csv_assert(i_rData.Location().IsValid()); + const ary::loc::File & + rFile = pEnv->Gate().Locations().Find_File(i_rData.Location()); + strcat( pOut, HtmlFileName("o-", rFile.LocalName().c_str()) ); // SAFE STRCAT (#100211# - checked) + } + + csv_assert(pEnv != 0); + strcat( pOut, OperationLink(pEnv->Gate(), i_rData.LocalName(), i_rData.CeId()) ); // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::Variable & i_rData ) +{ + Create_PrePath( i_rData ); + + if ( i_rData.Protection() != ary::cpp::PROTECT_global ) + { + strcat( pOut, "d.html" ); // SAFE STRCAT (#100211# - checked) + } + else + { + csv_assert(i_rData.Location().IsValid()); + const ary::loc::File & + rFile = pEnv->Gate().Locations().Find_File(i_rData.Location()); + strcat( pOut, HtmlFileName("d-", rFile.LocalName().c_str()) ); // SAFE STRCAT (#100211# - checked) + } + + strcat( pOut, DataLink(i_rData.LocalName()) ); // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::EnumValue & i_rData ) +{ + const ary::cpp::CodeEntity * + pEnum = pEnv->Gate().Ces().Search_Ce(i_rData.Owner()); + if (pEnum == 0) + return; + + pEnum->Accept(*this); + strcat(pOut, "#"); // SAFE STRCAT (#100211# - checked) + strcat(pOut, i_rData.LocalName().c_str()); // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::Define & i_rData ) +{ + // KORR_FUTURE + // Only valid from Index: + + *pOut = '\0'; + strcat(pOut, "../def-all.html#"); // SAFE STRCAT (#100211# - checked) + strcat(pOut, i_rData.LocalName().c_str()); // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::Macro & i_rData ) +{ + // KORR_FUTURE + // Only valid from Index: + + *pOut = '\0'; + strcat(pOut, "../def-all.html#"); // SAFE STRCAT (#100211# - checked) + strcat(pOut, i_rData.LocalName().c_str()); // SAFE STRCAT (#100211# - checked) +} + + +namespace +{ + +class NameScope_const_iterator +{ + public: + NameScope_const_iterator( + ary::cpp::Ce_id i_nId, + const ary::cpp::Gate & + i_rGate ); + + operator bool() const { return pCe != 0; } + const String & operator*() const; + + void go_up(); + + private: + const ary::cpp::CodeEntity * + pCe; + const ary::cpp::Gate * + pGate; +}; + + +NameScope_const_iterator::NameScope_const_iterator( + ary::cpp::Ce_id i_nId, + const ary::cpp::Gate & i_rGate ) + : pCe(i_rGate.Ces().Search_Ce(i_nId)), + pGate(&i_rGate) +{ +} + +const String & +NameScope_const_iterator::operator*() const +{ + return pCe ? pCe->LocalName() + : String::Null_(); +} + +void +NameScope_const_iterator::go_up() +{ + if (pCe == 0) + return; + pCe = pGate->Ces().Search_Ce(pCe->Owner()); +} + + +void Recursive_CreatePath( + char * o_pOut, + const NameScope_const_iterator & + i_it ); + +void +Recursive_CreatePath( char * o_pOut, + const NameScope_const_iterator & i_it ) +{ + if (NOT i_it) + return; + + NameScope_const_iterator it( i_it ); + it.go_up(); + if (NOT it) + return; // Global Namespace + Recursive_CreatePath( o_pOut, it ); + + strcat( o_pOut, (*i_it).c_str() ); // SAFE STRCAT (#100211# - checked) + strcat( o_pOut, "/" ); // SAFE STRCAT (#100211# - checked) +} + + +} // anonymous namespace + + + + + +void +LinkCreator::Create_PrePath( const ary::cpp::CodeEntity & i_rData ) +{ + *pOut = NULCH; + + if ( pEnv->CurNamespace() != 0 ) + { + if ( pEnv->CurClass() + ? pEnv->CurClass()->CeId() == i_rData.Owner() + : pEnv->CurNamespace()->CeId() == i_rData.Owner() ) + return; + + strcat( pOut, PathUp(pEnv->Depth() - 1) ); // SAFE STRCAT (#100211# - checked) + } + else + { // Within Index + strcat( pOut, "../names/" ); // SAFE STRCAT (#100211# - checked) + } + + NameScope_const_iterator it( i_rData.Owner(), pEnv->Gate() ); + Recursive_CreatePath( pOut, it ); +} diff --git a/autodoc/source/display/html/cre_link.hxx b/autodoc/source/display/html/cre_link.hxx new file mode 100644 index 000000000000..27ac5c77ccae --- /dev/null +++ b/autodoc/source/display/html/cre_link.hxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cre_link.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_CRE_LINK_HXX +#define ADC_DISPLAY_CRE_LINK_HXX + + +// USED SERVICES + // BASE CLASSES +#include <cosv/tpl/processor.hxx> + // COMPONENTS + // PARAMETERS + +namespace ary +{ +namespace cpp +{ + class CodeEntity; + class Namespace; + class Class; + class Enum; + class Typedef; + class Function; + class Variable; + class EnumValue; + class Define; + class Macro; +} +} + + +class OuputPage_Environment; + + + +/** Displays links to ->{ary::cpp::CodeEntity CodeEntites}. +*/ +class LinkCreator : public csv::ProcessorIfc, + public csv::ConstProcessor<ary::cpp::Namespace>, + public csv::ConstProcessor<ary::cpp::Class>, + public csv::ConstProcessor<ary::cpp::Enum>, + public csv::ConstProcessor<ary::cpp::Typedef>, + public csv::ConstProcessor<ary::cpp::Function>, + public csv::ConstProcessor<ary::cpp::Variable>, + public csv::ConstProcessor<ary::cpp::EnumValue>, + public csv::ConstProcessor<ary::cpp::Define>, + public csv::ConstProcessor<ary::cpp::Macro> +{ + public: + LinkCreator( + char * o_rOutput, + uintt i_nOutputSize ); + ~LinkCreator(); + + + void SetEnv( + const OuputPage_Environment & + i_rEnv ); + private: + void Create_PrePath( + const ary::cpp::CodeEntity & + i_rData ); + // Interface csv::ConstProcessor<> + virtual void do_Process( + const ary::cpp::Namespace & + i_rData ); + virtual void do_Process( + const ary::cpp::Class & + i_rData ); + virtual void do_Process( + const ary::cpp::Enum & + i_rData ); + virtual void do_Process( + const ary::cpp::Typedef & + i_rData ); + virtual void do_Process( + const ary::cpp::Function & + i_rData ); + virtual void do_Process( + const ary::cpp::Variable & + i_rData ); + virtual void do_Process( + const ary::cpp::EnumValue & + i_rData ); + virtual void do_Process( + const ary::cpp::Define & + i_rData ); + virtual void do_Process( + const ary::cpp::Macro & + i_rData ); + // DATA + char * pOut; + uintt nOutMaxSize; + const OuputPage_Environment * + pEnv; +}; + + + + +// IMPLEMENTATION +inline void +LinkCreator::SetEnv( const OuputPage_Environment & i_rEnv ) + { pEnv = &i_rEnv; } + + + + +#endif diff --git a/autodoc/source/display/html/dsply_cl.cxx b/autodoc/source/display/html/dsply_cl.cxx new file mode 100644 index 000000000000..6484f1836e99 --- /dev/null +++ b/autodoc/source/display/html/dsply_cl.cxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dsply_cl.cxx,v $ + * $Revision: 1.6 $ + * + * 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 "dsply_cl.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_gate.hxx> +#include "dsply_da.hxx" +#include "dsply_op.hxx" +#include "hdimpl.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" + + + + +ClassDisplayer::ClassDisplayer( OuputPage_Environment & io_rEnv ) + : pEnv(&io_rEnv) +{ +} + +ClassDisplayer::~ClassDisplayer() +{ +} + +void +ClassDisplayer::DisplayFiles_InClass( const ary::cpp::Class & i_rData, + PageDisplay & io_rPageMaker ) +{ + // Classes + ClassDisplayer aClassDisplayer( Env() ); + DisplaySlot( aClassDisplayer, i_rData, ary::cpp::Class::SLOT_NestedClasses ); + + // Enums + DisplaySlot( io_rPageMaker, i_rData, ary::cpp::Class::SLOT_Enums ); + + // Typedefs + DisplaySlot( io_rPageMaker, i_rData, ary::cpp::Class::SLOT_Typedefs ); + + // Operations + OperationsDisplay aOperationsDisplayer( Env() ); + + aOperationsDisplayer.PrepareForStdMembers(); + DisplaySlot( aOperationsDisplayer, i_rData, ary::cpp::Class::SLOT_Operations ); + + aOperationsDisplayer.PrepareForStaticMembers(); + DisplaySlot( aOperationsDisplayer, i_rData, ary::cpp::Class::SLOT_StaticOperations ); + + aOperationsDisplayer.Create_Files(); + + // Data + DataDisplay aDataDisplayer( Env() ); + + aDataDisplayer.PrepareForStdMembers(); + DisplaySlot( aDataDisplayer, i_rData, ary::cpp::Class::SLOT_Data ); + + aDataDisplayer.PrepareForStaticMembers(); + DisplaySlot( aDataDisplayer, i_rData, ary::cpp::Class::SLOT_StaticData ); + + aDataDisplayer.Create_Files(); +} + +void +ClassDisplayer::do_Process( const ary::cpp::Class & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + PageDisplay aPageMaker( Env() ); + aPageMaker.Process(i_rData); + + Env().MoveDir_Down2( i_rData ); + DisplayFiles_InClass( i_rData, aPageMaker ); + Env().MoveDir_Up(); +} + +const ary::cpp::Gate * +ClassDisplayer::inq_Get_ReFinder() const +{ + return & pEnv->Gate(); +} diff --git a/autodoc/source/display/html/dsply_cl.hxx b/autodoc/source/display/html/dsply_cl.hxx new file mode 100644 index 000000000000..c06f4881a943 --- /dev/null +++ b/autodoc/source/display/html/dsply_cl.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dsply_cl.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HTML_HD_PAGE_HXX +#define ADC_DISPLAY_HTML_HD_PAGE_HXX + +// BASE CLASSES +#include <ary/ary_disp.hxx> +#include <cosv/tpl/processor.hxx> +// USED SERVICES +#include <ary/types.hxx> + +class OuputPage_Environment; + +namespace ary +{ +namespace cpp +{ + class Class; +} +} + +class PageDisplay; + + + + +class ClassDisplayer : public ary::Display, + public csv::ConstProcessor<ary::cpp::Class> +{ + public: + ClassDisplayer( // TODO + OuputPage_Environment & + io_rEnv ); + virtual ~ClassDisplayer(); + + private: + // Interface csv::ConstProcessor<>: + virtual void do_Process( + const ary::cpp::Class & + i_data ); + // Interface ary::Display: + virtual const ary::cpp::Gate * + inq_Get_ReFinder() const; + + // Locals + void DisplayFiles_InClass( + const ary::cpp::Class & + i_rData, + PageDisplay & io_rPageMaker ); + + OuputPage_Environment & + Env() { return *pEnv; } + + // DATA + OuputPage_Environment * + pEnv; +}; + + + + +#endif diff --git a/autodoc/source/display/html/dsply_da.cxx b/autodoc/source/display/html/dsply_da.cxx new file mode 100644 index 000000000000..801e548bfa1e --- /dev/null +++ b/autodoc/source/display/html/dsply_da.cxx @@ -0,0 +1,202 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dsply_da.cxx,v $ + * $Revision: 1.6 $ + * + * 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 "dsply_da.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_vari.hxx> +#include <ary/doc/d_docu.hxx> +#include <ary/loc/loc_file.hxx> +#include <ary/loc/locp_le.hxx> +#include <udm/html/htmlitem.hxx> +#include "hd_docu.hxx" +#include "hdimpl.hxx" +#include "html_kit.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" + + +using namespace csi; + + + +DataDisplay::DataDisplay( OuputPage_Environment & io_rEnv ) + : aMap_GlobalDataDisplay(), + pClassMembersDisplay(0), + pEnv( &io_rEnv ), + pDocuShow( new Docu_Display(io_rEnv) ) +{ +} + +DataDisplay::~DataDisplay() +{ + csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay ); +} + +void +DataDisplay::PrepareForConstants() +{ + if (pClassMembersDisplay) + pClassMembersDisplay = 0; + + csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay ); +} + +void +DataDisplay::PrepareForVariables() +{ + // Doesn't need to do anything yet. +} + +void +DataDisplay::PrepareForStdMembers() +{ + csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay ); + + pClassMembersDisplay = new PageDisplay(*pEnv); + const ary::cpp::Class * pClass = pEnv->CurClass(); + csv_assert( pClass != 0 ); + pClassMembersDisplay->Setup_DataFile_for(*pClass); +} + +void +DataDisplay::PrepareForStaticMembers() +{ + // Doesn't need to do anything yet. +} + +void +DataDisplay::Create_Files() +{ + if (pClassMembersDisplay) + { + pClassMembersDisplay->Create_File(); + pClassMembersDisplay = 0; + } + else + { + for ( Map_FileId2PagePtr::const_iterator it = aMap_GlobalDataDisplay.begin(); + it != aMap_GlobalDataDisplay.end(); + ++it ) + { + (*it).second->Create_File(); + } + csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay ); + } +} + +void +DataDisplay::do_Process( const ary::cpp::Variable & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + PageDisplay & rPage = FindPage_for( i_rData ); + + csi::xml::Element & rOut = rPage.CurOut(); + Display_SglDatum( rOut, i_rData ); +} + +const ary::cpp::Gate * +DataDisplay::inq_Get_ReFinder() const +{ + return & pEnv->Gate(); +} + +PageDisplay & +DataDisplay::FindPage_for( const ary::cpp::Variable & i_rData ) +{ + if ( pClassMembersDisplay ) + return *pClassMembersDisplay; + + SourceFileId + nSourceFile = i_rData.Location(); + PageDisplay * + pFound = csv::value_from_map( aMap_GlobalDataDisplay, nSourceFile, (PageDisplay*)0 ); + if ( pFound == 0 ) + { + pFound = new PageDisplay( *pEnv ); + const ary::loc::File & + rFile = pEnv->Gate().Locations().Find_File( nSourceFile ); + pFound->Setup_DataFile_for(rFile); + aMap_GlobalDataDisplay[nSourceFile] = pFound; + } + + return *pFound; +} + +void +DataDisplay::Display_SglDatum( csi::xml::Element & rOut, + const ary::cpp::Variable & i_rData ) +{ + adcdisp::ExplanationList aDocu(rOut, true); + aDocu.AddEntry( 0 ); + + aDocu.Term() + >> *new html::Label( DataLabel(i_rData.LocalName()) ) + << " "; + aDocu.Term() + << i_rData.LocalName(); + + dshelp::Get_LinkedTypeText( aDocu.Def(), *pEnv, i_rData.Type() ); + aDocu.Def() + << " " + >> *new html::Strong + << i_rData.LocalName(); + if ( i_rData.ArraySize().length() > 0 ) + { + aDocu.Def() + << "[" + << i_rData.ArraySize() + << "]"; + } + if ( i_rData.Initialisation().length() > 0 ) + { + aDocu.Def() + << " = " + << i_rData.Initialisation(); + } + aDocu.Def() + << ";" + << new html::LineBreak + << new html::LineBreak; + + aDocu.AddEntry_NoTerm(); + + pDocuShow->Assign_Out(aDocu.Def()); + pDocuShow->Process(i_rData.Docu()); + pDocuShow->Unassign_Out(); + + rOut << new html::HorizontalLine; +} diff --git a/autodoc/source/display/html/dsply_da.hxx b/autodoc/source/display/html/dsply_da.hxx new file mode 100644 index 000000000000..3f8b3a9a86c1 --- /dev/null +++ b/autodoc/source/display/html/dsply_da.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dsply_da.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HTML_DSPLY_DA_HXX +#define ADC_DISPLAY_HTML_DSPLY_DA_HXX + +// BASE CLASSES +#include <ary/ary_disp.hxx> +#include <cosv/tpl/processor.hxx> +// USED SERVICES +#include <ary/cpp/c_ce.hxx> + +namespace ary +{ + namespace cpp + { + class Variable; + } +} +namespace csi +{ + namespace xml + { + class Element; + } +} + + + + +class OuputPage_Environment; +class PageDisplay; +class Docu_Display; + +class DataDisplay : public ary::Display, + public csv::ConstProcessor<ary::cpp::Variable> +{ + public: + DataDisplay( + OuputPage_Environment & + io_rInfo ); + virtual ~DataDisplay(); + + void PrepareForConstants(); + void PrepareForVariables(); + void PrepareForStdMembers(); + void PrepareForStaticMembers(); + + void Create_Files(); + + private: + // Interface csv::ConstProcessor<>: + virtual void do_Process( + const ary::cpp::Variable & + i_rData ); + // Interface ary::cpp::Display: + virtual const ary::cpp::Gate * + inq_Get_ReFinder() const; + + // Locals + typedef ary::cpp::Lid SourceFileId; + typedef std::map< SourceFileId, DYN PageDisplay* > Map_FileId2PagePtr; + + PageDisplay & FindPage_for( + const ary::cpp::Variable & + i_rData ); + void Display_SglDatum( + csi::xml::Element & rOut, + const ary::cpp::Variable & + i_rData ); + // DATA + Map_FileId2PagePtr aMap_GlobalDataDisplay; + Dyn<PageDisplay> pClassMembersDisplay; + + OuputPage_Environment * + pEnv; + Dyn<Docu_Display> pDocuShow; +}; + + + + +#endif diff --git a/autodoc/source/display/html/dsply_op.cxx b/autodoc/source/display/html/dsply_op.cxx new file mode 100644 index 000000000000..9c460f74f4eb --- /dev/null +++ b/autodoc/source/display/html/dsply_op.cxx @@ -0,0 +1,210 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dsply_op.cxx,v $ + * $Revision: 1.6 $ + * + * 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 "dsply_op.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/loc/locp_le.hxx> +#include <udm/html/htmlitem.hxx> +#include "hd_docu.hxx" +#include "hdimpl.hxx" +#include "html_kit.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" + +using namespace csi; +using namespace adcdisp; + + + + +OperationsDisplay::OperationsDisplay( OuputPage_Environment & io_rEnv ) + : // aMap_GlobalFunctionsDisplay, + // pClassMembersDisplay, + pEnv( &io_rEnv ), + pDocuShow( new Docu_Display(io_rEnv) ) +{ +} + +OperationsDisplay::~OperationsDisplay() +{ + csv::erase_map_of_heap_ptrs( aMap_GlobalFunctionsDisplay ); +} + +void +OperationsDisplay::PrepareForStdMembers() +{ + csv::erase_map_of_heap_ptrs( aMap_GlobalFunctionsDisplay ); + + pClassMembersDisplay = new PageDisplay(*pEnv); + const ary::cpp::Class * pClass = pEnv->CurClass(); + csv_assert( pClass != 0 ); + pClassMembersDisplay->Setup_OperationsFile_for(*pClass); +} + +void +OperationsDisplay::PrepareForStaticMembers() +{ + // Doesn't need to do anything yet. +} + +void +OperationsDisplay::Create_Files() +{ + if (pClassMembersDisplay) + pClassMembersDisplay->Create_File(); + else + { + for ( Map_FileId2PagePtr::const_iterator it = aMap_GlobalFunctionsDisplay.begin(); + it != aMap_GlobalFunctionsDisplay.end(); + ++it ) + { + (*it).second->Create_File(); + } + } +} + +void +OperationsDisplay::do_Process( const ary::cpp::Function & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + PageDisplay & rPage = FindPage_for( i_rData ); + + csi::xml::Element & rOut = rPage.CurOut(); + Display_SglOperation( rOut, i_rData ); +} + +const ary::cpp::Gate * +OperationsDisplay::inq_Get_ReFinder() const +{ + return & pEnv->Gate(); +} + +PageDisplay & +OperationsDisplay::FindPage_for( const ary::cpp::Function & i_rData ) +{ + if ( pClassMembersDisplay ) + return *pClassMembersDisplay; + + SourceFileId + nSourceFile = i_rData.Location(); + PageDisplay * + pFound = csv::value_from_map( aMap_GlobalFunctionsDisplay, nSourceFile, (PageDisplay*)0 ); + if ( pFound == 0 ) + { + pFound = new PageDisplay( *pEnv ); + const ary::loc::File & + rFile = pEnv->Gate().Locations().Find_File( nSourceFile ); + pFound->Setup_OperationsFile_for(rFile); + aMap_GlobalFunctionsDisplay[nSourceFile] = pFound; + } + + return *pFound; +} + +void +OperationsDisplay::Display_SglOperation( csi::xml::Element & rOut, + const ary::cpp::Function & i_rData ) +{ + adcdisp::ExplanationList aDocu(rOut, true); + aDocu.AddEntry( 0 ); + + + adcdisp::OperationTitle fTitle; + fTitle( aDocu.Term(), + i_rData.LocalName(), + i_rData.CeId(), + pEnv->Gate() ); + + // Syntax + adcdisp::ExplanationList aSyntaxHeader(aDocu.Def()); + aSyntaxHeader.AddEntry( 0, "simple" ); + csi::xml::Element & rHeader = aSyntaxHeader.Term(); + + adcdisp::ParameterTable + aParams( aSyntaxHeader.Def() ); + + if (i_rData.TemplateParameters().size() > 0) + { + TemplateClause fTemplateClause; + fTemplateClause( rHeader, i_rData.TemplateParameters() ); + rHeader << new html::LineBreak; + } + if ( i_rData.Flags().IsExternC() ) + { + rHeader + << "extern \"C\"" + << new html::LineBreak; + } + + bool bConst = false; + bool bVolatile = false; + WriteOut_LinkedFunctionText( rHeader, aParams, i_rData, *pEnv, + &bConst, &bVolatile ); + aDocu.Def() << new html::LineBreak; + + // Flags + aDocu.AddEntry_NoTerm(); + adcdisp::FlagTable + aFlags( aDocu.Def(), 8 ); + + const ary::cpp::FunctionFlags & + rFFlags = i_rData.Flags(); + aFlags.SetColumn( 0, "virtual", + i_rData.Virtuality() != ary::cpp::VIRTUAL_none ); + aFlags.SetColumn( 1, "abstract", + i_rData.Virtuality() == ary::cpp::VIRTUAL_abstract ); + aFlags.SetColumn( 2, "const", bConst ); + aFlags.SetColumn( 3, "volatile", bVolatile ); + aFlags.SetColumn( 4, "template", + i_rData.TemplateParameters().size() > 0 ); + aFlags.SetColumn( 5, "static", + rFFlags.IsStaticLocal() OR rFFlags.IsStaticMember() ); + aFlags.SetColumn( 6, "inline", + rFFlags.IsInline() ); + aFlags.SetColumn( 7, "C-linkage", + rFFlags.IsExternC() ); + aDocu.Def() << new html::LineBreak; + + // Docu + aDocu.AddEntry_NoTerm(); + pDocuShow->Assign_Out(aDocu.Def()); + pDocuShow->Process(i_rData.Docu()); + pDocuShow->Unassign_Out(); + + rOut << new html::HorizontalLine; +} diff --git a/autodoc/source/display/html/dsply_op.hxx b/autodoc/source/display/html/dsply_op.hxx new file mode 100644 index 000000000000..2ef609cadc9e --- /dev/null +++ b/autodoc/source/display/html/dsply_op.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dsply_op.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HTML_DSPLY_OP_HXX +#define ADC_DISPLAY_HTML_DSPLY_OP_HXX + +// BASE CLASSES +#include <ary/ary_disp.hxx> +#include <cosv/tpl/processor.hxx> +// USED SERVICES +#include <ary/cpp/c_ce.hxx> + +namespace ary +{ + namespace cpp + { + class Function; + } +} +namespace csi +{ + namespace xml + { + class Element; + } +} + +class OuputPage_Environment; +class PageDisplay; +class Docu_Display; + + + + +class OperationsDisplay : public ary::Display, + public csv::ConstProcessor<ary::cpp::Function> +{ + public: + OperationsDisplay( + OuputPage_Environment & + io_rInfo ); + virtual ~OperationsDisplay(); + + void PrepareForStdMembers(); + void PrepareForStaticMembers(); + void Create_Files(); + + private: + // Interface csv::ConstProcessor<>: + virtual void do_Process( + const ary::cpp::Function & + i_rData ); + // Interface ary::Display: + virtual const ary::cpp::Gate * + inq_Get_ReFinder() const; + + // Locals + typedef ary::cpp::Lid SourceFileId; + typedef std::map< SourceFileId, DYN PageDisplay* > Map_FileId2PagePtr; + + PageDisplay & FindPage_for( + const ary::cpp::Function & + i_rData ); + void Display_SglOperation( + csi::xml::Element & rOut, + const ary::cpp::Function & + i_rData ); + // DATA + Map_FileId2PagePtr aMap_GlobalFunctionsDisplay; + Dyn<PageDisplay> pClassMembersDisplay; + + OuputPage_Environment * + pEnv; + Dyn<Docu_Display> pDocuShow; +}; + + + + +#endif diff --git a/autodoc/source/display/html/easywri.cxx b/autodoc/source/display/html/easywri.cxx new file mode 100644 index 000000000000..7fe416539cd6 --- /dev/null +++ b/autodoc/source/display/html/easywri.cxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: easywri.cxx,v $ + * $Revision: 1.7 $ + * + * 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 "easywri.hxx" + + +// NOT FULLY DEFINED SERVICES + + +using namespace csi::html; + + +EasyWriter::EasyWriter() +{ +} + +EasyWriter::~EasyWriter() +{ +} + +void +EasyWriter::Open_OutputNode( csi::xml::Element & io_rDestination ) +{ + aCurDestination.push(&io_rDestination); +} + +void +EasyWriter::Finish_OutputNode() +{ + csv_assert( NOT aCurDestination.empty() ); + aCurDestination.pop(); +} + +csi::xml::Element & +EasyWriter::Out() +{ + csv_assert( aCurDestination.size() > 0); + return *aCurDestination.top(); +} + diff --git a/autodoc/source/display/html/easywri.hxx b/autodoc/source/display/html/easywri.hxx new file mode 100644 index 000000000000..22b5338b4aa7 --- /dev/null +++ b/autodoc/source/display/html/easywri.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: easywri.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_DISPLAY_HTML_EASYWRI_HXX +#define ADC_DISPLAY_HTML_EASYWRI_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <estack.hxx> + // PARAMETERS +#include <udm/html/htmlitem.hxx> + + +class EasyWriter +{ + public: + // LIFECYCLE + EasyWriter(); + ~EasyWriter(); + + // OPERATIONS + /// Pushes csi::xml::Element on stack. + void Open_OutputNode( + csi::xml::Element & io_rDestination ); + /// Pops front csi::xml::Element from stack. + void Finish_OutputNode(); + + void Enter( + csi::xml::Element & io_rDestination ) + { Open_OutputNode(io_rDestination); } + void Leave() { Finish_OutputNode(); } + + // ACCESS + csi::xml::Element & Out(); // CurOutputNode + + private: + EStack< csi::xml::Element * > + aCurDestination; // The front element is the currently used. + // The later ones are the parents. +}; + +/* +inline csi::xml::Element & +EasyWriter::Out() + { csv_assert( aCurDestination.size() > 0 ); + return *aCurDestination.top(); } +*/ + +// IMPLEMENTATION + + +#endif + + diff --git a/autodoc/source/display/html/hd_chlst.cxx b/autodoc/source/display/html/hd_chlst.cxx new file mode 100644 index 000000000000..89c759d1ccbc --- /dev/null +++ b/autodoc/source/display/html/hd_chlst.cxx @@ -0,0 +1,592 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hd_chlst.cxx,v $ + * $Revision: 1.7 $ + * + * 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 "hd_chlst.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/ceslot.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_vari.hxx> +#include <ary/cpp/c_enuval.hxx> +#include <ary/loc/loc_file.hxx> +#include <ary/loc/locp_le.hxx> +#include <ary/doc/d_oldcppdocu.hxx> +#include <ary/info/ci_attag.hxx> +#include <ary/info/ci_text.hxx> +#include <ary/info/all_dts.hxx> +#include "hd_docu.hxx" +#include "opageenv.hxx" +#include "protarea.hxx" +#include "strconst.hxx" + + +using namespace csi; +using html::Table; +using html::TableRow; +using html::TableCell; +using html::Font; +using html::SizeAttr; +using html::BgColorAttr; +using html::WidthAttr; + + +const int ixPublic = 0; +const int ixProtected = 1; +const int ixPrivate = 2; + +struct ChildList_Display::S_AreaCo +{ + public: + ProtectionArea aArea; + Area_Result * pResult; + + S_AreaCo( + Area_Result & o_rResult, + const char * i_sLabel, + const char * i_sTitle ); + ~S_AreaCo(); + + void PerformResult(); + + private: + csi::xml::Element & Out() { return pResult->rOut; } +}; + + +const ary::info::DocuText & +ShortDocu( const ary::cpp::CodeEntity & i_rCe ) +{ + static const ary::info::DocuText + aNull_; + + const ary::doc::OldCppDocu * + pInfo = dynamic_cast< const ary::doc::OldCppDocu* >( i_rCe.Docu().Data() ); + if (pInfo == 0) + return aNull_; + + return pInfo->Short().CText(); +} + + +ChildList_Display::ChildList_Display( OuputPage_Environment & io_rEnv ) + : HtmlDisplay_Impl( io_rEnv ), + pShortDocu_Display( new Docu_Display(io_rEnv) ), + pActiveParentClass(0), + pActiveParentEnum(0), + // pSglArea, + // aMemberAreas, + peClassesFilter(0) +{ +} + +ChildList_Display::ChildList_Display( OuputPage_Environment & io_rEnv, + const ary::cpp::Class & i_rClass ) + : HtmlDisplay_Impl( io_rEnv ), + pShortDocu_Display( new Docu_Display(io_rEnv) ), + pActiveParentClass(&i_rClass), + pActiveParentEnum(0), + // pSglArea, + // aMemberAreas, + peClassesFilter(0) +{ +} + +ChildList_Display::ChildList_Display( OuputPage_Environment & io_rEnv, + const ary::cpp::Enum & i_rEnum ) + : HtmlDisplay_Impl( io_rEnv ), + pShortDocu_Display( new Docu_Display(io_rEnv) ), + pActiveParentClass(0), + pActiveParentEnum(&i_rEnum), + // pSglArea, + // aMemberAreas, + peClassesFilter(0) +{ +} + +ChildList_Display::~ChildList_Display() +{ +} + +void +ChildList_Display::Run_Simple( Area_Result & o_rResult, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel, + const char * i_sListTitle ) +{ + ary::Slot_AutoPtr + pSlot( ActiveParent().Create_Slot( i_nSlot ) ); + if ( pSlot->Size() == 0 ) + return; + + pSglArea = new S_AreaCo( o_rResult, + i_sListLabel, + i_sListTitle ); + + pSlot->StoreAt(*this); + + pSglArea->PerformResult(); + pSglArea = 0; +} + +void +ChildList_Display::Run_GlobalClasses( Area_Result & o_rResult, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel, + const char * i_sListTitle, + ary::cpp::E_ClassKey i_eFilter ) +{ + ary::Slot_AutoPtr + pSlot( ActiveParent().Create_Slot( i_nSlot ) ); + if ( pSlot->Size() == 0 ) + return; + + pSglArea = new S_AreaCo( o_rResult, + i_sListLabel, + i_sListTitle ); + + SetClassesFilter(i_eFilter); + pSlot->StoreAt(*this); + UnsetClassesFilter(); + + pSglArea->PerformResult(); + pSglArea = 0; +} + +void +ChildList_Display::Run_Members( Area_Result & o_rResult_public, + Area_Result & o_rResult_protected, + Area_Result & o_rResult_private, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel_public, + const char * i_sListLabel_protected, + const char * i_sListLabel_private, + const char * i_sListTitle ) +{ + ary::Slot_AutoPtr + pSlot( ActiveParent().Create_Slot(i_nSlot) ); + if ( pSlot->Size() == 0 ) + return; + + aMemberAreas[ixPublic] = new S_AreaCo( o_rResult_public, + i_sListLabel_public, + i_sListTitle ); + aMemberAreas[ixProtected] = new S_AreaCo( o_rResult_protected, + i_sListLabel_protected, + i_sListTitle ); + aMemberAreas[ixPrivate] = new S_AreaCo( o_rResult_private, + i_sListLabel_private, + i_sListTitle ); + + pSlot->StoreAt(*this); + + aMemberAreas[ixPublic]->PerformResult(); + aMemberAreas[ixProtected]->PerformResult(); + aMemberAreas[ixPrivate]->PerformResult(); + + aMemberAreas[ixPublic] = 0; + aMemberAreas[ixProtected] = 0; + aMemberAreas[ixPrivate] = 0; +} + +void +ChildList_Display::Run_MemberClasses( Area_Result & o_rResult_public, + Area_Result & o_rResult_protected, + Area_Result & o_rResult_private, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel_public, + const char * i_sListLabel_protected, + const char * i_sListLabel_private, + const char * i_sListTitle, + ary::cpp::E_ClassKey i_eFilter ) +{ + ary::Slot_AutoPtr + pSlot( ActiveParent().Create_Slot(i_nSlot) ); + if ( pSlot->Size() == 0 ) + return; + + aMemberAreas[ixPublic] = new S_AreaCo( o_rResult_public, + i_sListLabel_public, + i_sListTitle ); + aMemberAreas[ixProtected] = new S_AreaCo( o_rResult_protected, + i_sListLabel_protected, + i_sListTitle ); + aMemberAreas[ixPrivate] = new S_AreaCo( o_rResult_private, + i_sListLabel_private, + i_sListTitle ); + + SetClassesFilter(i_eFilter); + pSlot->StoreAt(*this); + UnsetClassesFilter(); + + aMemberAreas[ixPublic]->PerformResult(); + aMemberAreas[ixProtected]->PerformResult(); + aMemberAreas[ixPrivate]->PerformResult(); + + aMemberAreas[ixPublic] = 0; + aMemberAreas[ixProtected] = 0; + aMemberAreas[ixPrivate] = 0; +} + +void +ChildList_Display::do_Process( const ary::cpp::Namespace & i_rData ) +{ + Write_ListItem( i_rData.LocalName(), + Path2ChildNamespace(i_rData.LocalName()), + ShortDocu( i_rData ), + GetArea().GetTable() ); +} + +void +ChildList_Display::do_Process( const ary::cpp::Class & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + if (peClassesFilter) + { + if (*peClassesFilter != i_rData.ClassKey() ) + return; + } + + String sLink; + if ( i_rData.Protection() == ary::cpp::PROTECT_global ) + { + sLink = ClassFileName(i_rData.LocalName()); + + } + else + { + csv_assert( pActiveParentClass != 0 ); + sLink = Path2Child( ClassFileName(i_rData.LocalName()), pActiveParentClass->LocalName() ); + } + + if (peClassesFilter) + { + Write_ListItem( i_rData.LocalName(), + sLink, + ShortDocu( i_rData ), + GetArea(i_rData.Protection()) + .GetTable() ); + } + else + { + Write_ListItem( i_rData.LocalName(), + sLink, + ShortDocu( i_rData ), + GetArea(i_rData.Protection()) + .GetTable(i_rData.ClassKey()) ); + } +} + +void +ChildList_Display::do_Process( const ary::cpp::Enum & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + String sLink; + if ( i_rData.Protection() == ary::cpp::PROTECT_global ) + { + sLink = EnumFileName(i_rData.LocalName()); + } + else + { + csv_assert( pActiveParentClass != 0 ); + sLink = Path2Child( EnumFileName(i_rData.LocalName()), + pActiveParentClass->LocalName() ); + } + + Write_ListItem( i_rData.LocalName(), + sLink, + ShortDocu( i_rData ), + GetArea(i_rData.Protection()).GetTable() ); +} + +void +ChildList_Display::do_Process( const ary::cpp::Typedef & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + String sLink; + if ( i_rData.Protection() == ary::cpp::PROTECT_global ) + { + sLink = TypedefFileName(i_rData.LocalName()); + } + else + { + csv_assert( pActiveParentClass != 0 ); + sLink = Path2Child( TypedefFileName(i_rData.LocalName()), + pActiveParentClass->LocalName() ); + } + + Write_ListItem( i_rData.LocalName(), + sLink, + ShortDocu( i_rData ), + GetArea(i_rData.Protection()).GetTable() ); +} + +void +ChildList_Display::do_Process( const ary::cpp::Function & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + String sLinkPrePath; + if ( i_rData.Protection() == ary::cpp::PROTECT_global ) + { + const ary::loc::File & + rFile = Env().Gate().Locations().Find_File( i_rData.Location() ); + sLinkPrePath = HtmlFileName( "o-", rFile.LocalName() ); + } + else + { + csv_assert( pActiveParentClass != 0 ); + sLinkPrePath = Path2Child( HtmlFileName( "o", "" ), + pActiveParentClass->LocalName() ); + } + + // Out + Table & rOut = GetArea(i_rData.Protection()).GetTable(); + TableRow * dpRow = new TableRow; + rOut << dpRow; + TableCell & rCell1 = dpRow->AddCell(); + + rCell1 + << SyntaxText_PreName( i_rData, Env().Gate() ) + << new html::LineBreak; + rCell1 + >> *new html::Link( OperationLink( + Env().Gate(), + i_rData.LocalName(), + i_rData.CeId(), + sLinkPrePath) ) + << i_rData.LocalName(); + rCell1 + << SyntaxText_PostName( i_rData, Env().Gate() ); + TableCell & + rCell2 = dpRow->AddCell(); + rCell2 + << new WidthAttr("50%") + << " "; + + pShortDocu_Display->Assign_Out( rCell2 ); + ShortDocu( i_rData ).StoreAt( *pShortDocu_Display ); + pShortDocu_Display->Unassign_Out(); +} + +void +ChildList_Display::do_Process( const ary::cpp::Variable & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + String sLinkPrePath; + if ( i_rData.Protection() == ary::cpp::PROTECT_global ) + { + const ary::loc::File & + rFile = Env().Gate().Locations().Find_File( i_rData.Location() ); + sLinkPrePath = HtmlFileName( "d-", rFile.LocalName() ); + } + else + { + csv_assert( pActiveParentClass != 0 ); + sLinkPrePath = Path2Child( HtmlFileName( "d", "" ), + pActiveParentClass->LocalName() ); + } + + TableRow * dpRow = new TableRow; + GetArea(i_rData.Protection()).GetTable() << dpRow; + + *dpRow << new html::BgColorAttr("white"); + csi::xml::Element & + rCell1 = dpRow->AddCell(); + + dshelp::Get_LinkedTypeText( rCell1, Env(), i_rData.Type() ); + rCell1 + << " " + >> *new html::Link( DataLink(i_rData.LocalName(), sLinkPrePath.c_str()) ) + >> *new html::Strong + << i_rData.LocalName() + << ";"; + + TableCell & rShortDocu = dpRow->AddCell(); + pShortDocu_Display->Assign_Out( rShortDocu ); + ShortDocu( i_rData ).StoreAt( *pShortDocu_Display ); + pShortDocu_Display->Unassign_Out(); +} + +void +ChildList_Display::do_Process( const ary::cpp::EnumValue & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + Table & rOut = GetArea().GetTable(); + + TableRow * dpRow = new TableRow; + rOut << dpRow; + + *dpRow << new html::BgColorAttr("white"); + dpRow->AddCell() + << new WidthAttr("20%") + << new xml::AnAttribute("valign", "top") + >> *new html::Label(i_rData.LocalName()) + >> *new html::Bold + << i_rData.LocalName(); + + TableCell & rValueDocu = dpRow->AddCell(); + pShortDocu_Display->Assign_Out( rValueDocu ); + i_rData.Docu().Accept( *pShortDocu_Display ); + pShortDocu_Display->Unassign_Out(); +} + +void +ChildList_Display::do_StartSlot() +{ +} + +void +ChildList_Display::do_FinishSlot() +{ +} + +const ary::cpp::Gate * +ChildList_Display::inq_Get_ReFinder() const +{ + return & Env().Gate(); +} + +void +ChildList_Display::Write_ListItem( const String & i_sLeftText, + const char * i_sLink, + const ary::info::DocuText & i_rRightText, + csi::xml::Element & o_rOut ) +{ + TableRow * dpRow = new TableRow; + o_rOut << dpRow; + + *dpRow << new html::BgColorAttr("white"); + dpRow->AddCell() + << new WidthAttr("20%") + >> *new html::Link( i_sLink ) + >> *new html::Bold + << i_sLeftText; + + TableCell & rShortDocu = dpRow->AddCell(); + pShortDocu_Display->Assign_Out( rShortDocu ); + i_rRightText.StoreAt( *pShortDocu_Display ); + pShortDocu_Display->Unassign_Out(); +} + +const ary::AryGroup & +ChildList_Display::ActiveParent() +{ + return pActiveParentClass != 0 + ? static_cast< const ary::AryGroup& >(*pActiveParentClass) + : pActiveParentEnum != 0 + ? static_cast< const ary::AryGroup& >(*pActiveParentEnum) + : static_cast< const ary::AryGroup& >(*Env().CurNamespace()); +} + +ProtectionArea & +ChildList_Display::GetArea() +{ + return pSglArea->aArea; +} + +ProtectionArea & +ChildList_Display::GetArea( ary::cpp::E_Protection i_eProtection ) +{ + switch ( i_eProtection ) + { + case ary::cpp::PROTECT_public: + return aMemberAreas[ixPublic]->aArea; + case ary::cpp::PROTECT_protected: + return aMemberAreas[ixProtected]->aArea; + case ary::cpp::PROTECT_private: + return aMemberAreas[ixPrivate]->aArea; + default: + return pSglArea->aArea; + } +} + + +//******************* ********************// + +ChildList_Display:: +S_AreaCo::S_AreaCo( Area_Result & o_rResult, + const char * i_sLabel, + const char * i_sTitle ) + : aArea(i_sLabel, i_sTitle), + pResult(&o_rResult) +{ +} + +ChildList_Display:: +S_AreaCo::~S_AreaCo() +{ +} + +void +ChildList_Display:: +S_AreaCo::PerformResult() +{ + bool bUsed = aArea.WasUsed_Area(); + pResult->rChildrenExist = bUsed; + if ( bUsed ) + { + Create_ChildListLabel( Out(), aArea.Label() ); + + if ( aArea.Size() == 1 ) + { + Out() << aArea.ReleaseTable(); + } + else + { + Table * pTable = aArea.ReleaseTable( ary::cpp::CK_class ); + if (pTable != 0) + Out() << pTable; + pTable = aArea.ReleaseTable( ary::cpp::CK_struct ); + if (pTable != 0) + Out() << pTable; + pTable = aArea.ReleaseTable( ary::cpp::CK_union ); + if (pTable != 0) + Out() << pTable; + } + } +} diff --git a/autodoc/source/display/html/hd_chlst.hxx b/autodoc/source/display/html/hd_chlst.hxx new file mode 100644 index 000000000000..d3786fa1cf8d --- /dev/null +++ b/autodoc/source/display/html/hd_chlst.hxx @@ -0,0 +1,209 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hd_chlst.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HTML_HD_CHLST_HXX +#define ADC_DISPLAY_HTML_HD_CHLST_HXX + +// BASE CLASSES +#include <ary/ary_disp.hxx> +#include <cosv/tpl/processor.hxx> + +// USED SERVICES +#include <ary/cpp/c_types4cpp.hxx> +#include "hdimpl.hxx" + + + +namespace ary +{ + namespace cpp + { + class Namespace; + class Class; + class Enum; + class Typedef; + class Function; + class Variable; + class EnumValue; + } + namespace info + { + class DocuText; + } +} + +class Docu_Display; +class ProtectionArea; + +class ChildList_Display : public ary::Display, + public csv::ConstProcessor<ary::cpp::Namespace>, + public csv::ConstProcessor<ary::cpp::Class>, + public csv::ConstProcessor<ary::cpp::Enum>, + public csv::ConstProcessor<ary::cpp::Typedef>, + public csv::ConstProcessor<ary::cpp::Function>, + public csv::ConstProcessor<ary::cpp::Variable>, + public csv::ConstProcessor<ary::cpp::EnumValue>, + private HtmlDisplay_Impl +{ + public: + struct Area_Result + { + bool & rChildrenExist; + csi::xml::Element & rOut; + + Area_Result( + bool & o_rChildrenExist, + csi::xml::Element & o_rOut ) + : rChildrenExist(o_rChildrenExist), + rOut(o_rOut) {} + }; + + + ChildList_Display( + OuputPage_Environment & + io_rEnv ); + ChildList_Display( + OuputPage_Environment & + io_rEnv, + const ary::cpp::Class & + i_rClass ); + ChildList_Display( + OuputPage_Environment & + io_rEnv, + const ary::cpp::Enum & + i_rEnum ); + + virtual ~ChildList_Display(); + + void Run_Simple( + Area_Result & o_rResult, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel, + const char * i_sListTitle ); + void Run_GlobalClasses( + Area_Result & o_rResult, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel, + const char * i_sListTitle, + ary::cpp::E_ClassKey + i_eFilter ); + void Run_Members( + Area_Result & o_rResult_public, + Area_Result & o_rResult_protected, + Area_Result & o_rResult_private, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel_public, + const char * i_sListLabel_protected, + const char * i_sListLabel_private, + const char * i_sListTitle ); + void Run_MemberClasses( + Area_Result & o_rResult_public, + Area_Result & o_rResult_protected, + Area_Result & o_rResult_private, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel_public, + const char * i_sListLabel_protected, + const char * i_sListLabel_private, + const char * i_sListTitle, + ary::cpp::E_ClassKey + i_eFilter ); + private: + // Interface csv::ConstProcessor<>: + virtual void do_Process( + const ary::cpp::Namespace & + i_rData ); + /** i_rData is shown only, if it passes two filters: + it must have the right protection, checked with pFilter, + and the right class key (class,struct,union), checked with + pClassFilter. A not exsting filter allows i_rData to be + displayed. + */ + virtual void do_Process( + const ary::cpp::Class & + i_rData ); + virtual void do_Process( + const ary::cpp::Enum & + i_rData ); + virtual void do_Process( + const ary::cpp::Typedef & + i_rData ); + virtual void do_Process( + const ary::cpp::Function & + i_rData ); + virtual void do_Process( + const ary::cpp::Variable & + i_rData ); + virtual void do_Process( + const ary::cpp::EnumValue & + i_rData ); + private: + // Interface ary::Display: + virtual void do_StartSlot(); + virtual void do_FinishSlot(); + virtual const ary::cpp::Gate * + inq_Get_ReFinder() const; + // Locals + struct S_AreaCo; + void Write_ListItem( + const String & i_sLeftText, + const char * i_sLink, + const ary::info::DocuText & + i_rRightText, + csi::xml::Element & rOut ); + const ary::AryGroup & + ActiveParent(); + ProtectionArea & GetArea(); + ProtectionArea & GetArea( + ary::cpp::E_Protection + i_eProtection ); + void SetClassesFilter( + ary::cpp::E_ClassKey + i_eFilter ) + { peClassesFilter = new ary::cpp::E_ClassKey(i_eFilter); } + void UnsetClassesFilter() { peClassesFilter = 0; } + + // DATA + Dyn<Docu_Display> pShortDocu_Display; + const ary::cpp::Class * + pActiveParentClass; + const ary::cpp::Enum * + pActiveParentEnum; + + Dyn<S_AreaCo> pSglArea; + Dyn<S_AreaCo> aMemberAreas[3]; + + Dyn<ary::cpp::E_ClassKey> + peClassesFilter; +}; + + + + +#endif diff --git a/autodoc/source/display/html/hd_docu.cxx b/autodoc/source/display/html/hd_docu.cxx new file mode 100644 index 000000000000..3f444370b8a7 --- /dev/null +++ b/autodoc/source/display/html/hd_docu.cxx @@ -0,0 +1,489 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hd_docu.cxx,v $ + * $Revision: 1.12 $ + * + * 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 "hd_docu.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_vari.hxx> +#include <ary/cpp/c_enuval.hxx> +#include <ary/doc/d_oldcppdocu.hxx> +#include <ary/info/all_tags.hxx> +#include <ary/info/all_dts.hxx> +#include <adc_cl.hxx> +#include "html_kit.hxx" +#include "opageenv.hxx" + + + +using namespace ary::info; +using namespace csi; + +using html::DefList; +using html::DefListTerm; +using html::DefListDefinition; +using html::Headline; +using html::Link; + + +const char * +C_sTagHeadlines[ ary::info::C_eAtTag_NrOfClasses ] = + { + "ATTENTION!", "Author", "Changes", "Collaborators", + "Contact", // Contact may be unused + "Copyright", "Deprecated", "Description", "Date of Documentation", + "How to Derive from this Class", + "Heap object - owner is responsible for deletion.", + "Important Instances", + "Interface Only", + "Invariant", "Lifecycle", + "Multiplicity", "On Error", "Persistency", "Postcondition", + "Precondition", + "Responsibilities", + "Return", "Summary", "Todos", "Version", + "Base Classes", "Exceptions", "Implements", "Keywords", "Parameters", + "See Also", "Template Parameters", + "", "Since " + }; + + + +Docu_Display::Docu_Display( OuputPage_Environment & io_rEnv ) + : HtmlDisplay_Impl(io_rEnv), + bUseHtmlInDocuTokens(false), + pCurClassOverwrite(0) +{ +} + +Docu_Display::~Docu_Display() +{ +} + +void +Docu_Display::Assign_Out( csi::xml::Element & o_rOut ) +{ + Easy().Enter(o_rOut); +} + +void +Docu_Display::Unassign_Out() +{ + Easy().Leave(); +} + +void +Docu_Display::do_Process( const ary::cpp::Namespace & i_rData ) +{ + Process(i_rData.Docu()); +} + +void +Docu_Display::do_Process( const ary::cpp::Class & i_rData ) +{ + pCurClassOverwrite = &i_rData; + Process(i_rData.Docu()); + pCurClassOverwrite = 0; +} + +void +Docu_Display::do_Process( const ary::cpp::Enum & i_rData ) +{ + Process(i_rData.Docu()); +} + +void +Docu_Display::do_Process( const ary::cpp::Typedef & i_rData ) +{ + Process(i_rData.Docu()); +} + +void +Docu_Display::do_Process( const ary::cpp::Function & i_rData ) +{ + Process(i_rData.Docu()); +} + +void +Docu_Display::do_Process( const ary::cpp::Variable & i_rData ) +{ + Process(i_rData.Docu()); +} + + + +// -------------- Interface ary::info::DocuDisplay ------------------ // + + +void +Docu_Display::do_Process(const ary::doc::Documentation & i_rData) +{ + if (i_rData.Data() == 0) + return; + + const ary::doc::OldCppDocu * + docdata = dynamic_cast< const ary::doc::OldCppDocu* >(i_rData.Data()); + csv_assert(docdata != 0); + + Start_DocuBlock(); + + if ( docdata->IsObsolete() ) + { + CurOut() + >> *new html::DefListTerm + >> *new html::Strong + << "D E P R E C A T E D"; + + } + + ary::doc::OldCppDocu::TagList::const_iterator + itEnd = docdata->Tags().end(); + for ( ary::doc::OldCppDocu::TagList::const_iterator it = docdata->Tags().begin(); + it != itEnd; + ++it ) + { + (*it)->StoreAt( *this ); + } + + Finish_DocuBlock(); +} + +void +Docu_Display::Display_StdTag( const StdTag & i_rData ) +{ + csv_assert( uintt(i_rData.Std_Id()) < uintt(ary::info::C_eAtTag_NrOfClasses) ); + + const ary::info::DocuText::TokenList & + rText = i_rData.CText().Tokens(); + typedef ary::info::DocuText::TokenList::const_iterator TokenIterator; + + if ( rText.empty() ) + return; + else if ( rText.size() < 3 ) + { + bool bIsWhite = true; + for ( TokenIterator it = rText.begin(); + it != rText.end(); + ++it ) + { + if (bIsWhite) + bIsWhite = (*it)->IsWhite(); + } + if (bIsWhite) + return; + } + + Write_TagTitle( C_sTagHeadlines[i_rData.Std_Id()] ); + Write_TagContents( i_rData.CText() ); +} + +void +Docu_Display::Display_BaseTag( const BaseTag & ) +{ +} + +void +Docu_Display::Display_ExceptionTag( const ExceptionTag & ) +{ +} + +void +Docu_Display::Display_ImplementsTag( const ImplementsTag & ) +{ +} + +void +Docu_Display::Display_KeywordTag( const KeywordTag & ) +{ +} + +void +Docu_Display::Display_ParameterTag( const ParameterTag & i_rData ) +{ + Write_TagTitle( "Parameters" ); + + adcdisp::ExplanationTable + aParams( CurOut() >> *new DefListDefinition ); + + for ( const ParameterTag * pParam = &i_rData; + pParam != 0; + pParam = pParam->GetNext() ) // KORR_FUTURE + { + aParams.AddEntry( pParam->ParamName().c_str() ); + + Easy().Enter( aParams.Def() ); + Write_Text( pParam->CText() ); + Easy().Leave(); + } // end for +} + +void +Docu_Display::Display_SeeTag( const SeeTag & i_rData ) +{ + Write_TagTitle( "See Also" ); + + DefListDefinition * dpDef = new DefListDefinition; + CurOut() << dpDef; + Easy().Enter(*dpDef); + + for ( std::vector< ary::QualifiedName >::const_iterator + it = i_rData.References().begin(); + it != i_rData.References().end(); + ++it ) + { + Write_LinkableText( (*it) ); + CurOut() << new html::LineBreak; + } + + Easy().Leave(); +} + +void +Docu_Display::Display_TemplateTag( const TemplateTag & i_rData ) +{ + Write_TagTitle( "Template Parameters" ); + + adcdisp::ExplanationTable + aTplParams( CurOut() >> *new DefListDefinition ); + + for ( const TemplateTag * pTplParam = &i_rData; + pTplParam != 0; + pTplParam = pTplParam->GetNext() ) + { + aTplParams.AddEntry( pTplParam->TplParamName().c_str() ); + + Easy().Enter( aTplParams.Def() ); + Write_Text( pTplParam->CText() ); + Easy().Leave(); + } // end for +} + +void +Docu_Display::Display_LabelTag( const LabelTag & ) +{ +} + +void +Docu_Display::Display_SinceTag( const ary::info::SinceTag & i_rData ) +{ + if ( i_rData.Version().empty() ) + { + return; + } + + // Transform the value of the @since tag into the text to be displayed. + String sDisplay; + if ( autodoc::CommandLine::Get_().DoesTransform_SinceTag() ) + { + sDisplay = autodoc::CommandLine::Get_() + .DisplayOf_SinceTagValue( i_rData.Version() ); + } + else + { + sDisplay = i_rData.Version(); + } + + if (sDisplay.empty()) + return; + + Write_TagTitle( "Since " ); + + DefListDefinition * dpDef = new DefListDefinition; + CurOut() << dpDef; + + Easy().Enter(*dpDef); + CurOut() << sDisplay; + Easy().Leave(); +} + +void +Docu_Display::Display_DT_Text( const DT_Text & i_rData ) +{ + Write_TextToken( i_rData.Text() ); +} + +void +Docu_Display::Display_DT_MaybeLink( const DT_MaybeLink & i_rData ) +{ + // KORR_FUTURE + Write_TextToken( i_rData.Text() ); +} + +void +Docu_Display::Display_DT_Whitespace( const DT_Whitespace & i_rData ) +{ + static char sSpace[300] = + " " + " " + " " + " " + " " + " "; + UINT8 nLength = i_rData.Length(); + sSpace[nLength] = NULCH; + CurOut() << sSpace; + sSpace[nLength] = ' '; +} + +void +Docu_Display::Display_DT_Eol( const DT_Eol & ) +{ + CurOut() << new html::Sbr; +} + +void +Docu_Display::Display_DT_Xml( const ary::info::DT_Xml & i_rData ) +{ + CurOut() << new xml::XmlCode( i_rData.Text() ); +} + +const ary::cpp::Gate * +Docu_Display::inq_Get_ReFinder() const +{ + return &Env().Gate(); +} + +void +Docu_Display::Start_DocuBlock() +{ + DYN DefList * dpDefList = new DefList; + CurOut() << dpDefList; + Easy().Enter( *dpDefList ); +} + +void +Docu_Display::Finish_DocuBlock() +{ + Easy().Leave(); +} + +void +Docu_Display::Write_TagTitle( const char * i_sText, + const char * ) +{ + if ( strcmp(i_sText,"ATTENTION!") == 0 ) + { + CurOut() + >> *new html::DefListTerm + << new html::ClassAttr("attention") + << i_sText; + } + else + { + CurOut() + >> *new html::DefListTerm + << i_sText; + } +} + +void +Docu_Display::Write_TagContents( const DocuText & i_rDocuText ) +{ + DefListDefinition * dpDef = new DefListDefinition; + CurOut() << dpDef; + + Easy().Enter(*dpDef); + Write_Text(i_rDocuText); + Easy().Leave(); +} + +void +Docu_Display::Write_Text( const ary::info::DocuText & i_rDocuText ) +{ + if ( i_rDocuText.IsNoHtml() ) + { + CurOut() + << new xml::XmlCode("<pre>"); + bUseHtmlInDocuTokens = false; + } + else + { + bUseHtmlInDocuTokens = true; + } + i_rDocuText.StoreAt( *this ); + if ( i_rDocuText.IsNoHtml() ) + { + CurOut() + << new xml::XmlCode("</pre>"); + } +} + +void +Docu_Display::Write_TextToken( const String & i_sText ) +{ + if ( bUseHtmlInDocuTokens ) + CurOut() << new xml::XmlCode(i_sText); + else + CurOut() << i_sText; +} + +void +Docu_Display::Write_LinkableText( const ary::QualifiedName & i_sQuName ) +{ + const ary::cpp::CodeEntity * + pCe = FindUnambiguousCe( Env(), i_sQuName, pCurClassOverwrite ); + if ( pCe != 0 ) + { + csi::xml::Element * + pLink = new csi::html::Link( Link2Ce(Env(), *pCe) ); + CurOut() << pLink; + Easy().Enter(*pLink); + Write_QualifiedName(i_sQuName); + Easy().Leave(); + } + else + { + Write_QualifiedName(i_sQuName); + } + CurOut() << " "; +} + +void +Docu_Display::Write_QualifiedName( const ary::QualifiedName & i_sQuName ) +{ + if ( i_sQuName.IsAbsolute() ) + CurOut() << "::"; + for ( ary::QualifiedName::namespace_iterator it = i_sQuName.first_namespace(); + it != i_sQuName.end_namespace(); + ++it ) + { + CurOut() << (*it) << "::"; + } + CurOut() << i_sQuName.LocalName(); + if ( i_sQuName.IsFunction() ) + CurOut() << "()"; +} + diff --git a/autodoc/source/display/html/hd_docu.hxx b/autodoc/source/display/html/hd_docu.hxx new file mode 100644 index 000000000000..2bcf14e34b67 --- /dev/null +++ b/autodoc/source/display/html/hd_docu.hxx @@ -0,0 +1,199 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hd_docu.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_DISPLAY_HTML_HD_DOCU_HXX +#define ADC_DISPLAY_HTML_HD_DOCU_HXX + +// BASE CLASSES +#include <ary/ary_disp.hxx> +#include <ary/info/infodisp.hxx> +#include <cosv/tpl/processor.hxx> +#include "hdimpl.hxx" + +namespace ary +{ + namespace cpp + { + class Namespace; + class Class; + class Enum; + class Typedef; + class Function; + class Variable; + } + + namespace doc + { + class Documentation; + } + namespace info + { + class DocuText; + } + + class QualifiedName; +} + +class OuputPage_Environment; + + +class Docu_Display : public ary::Display, + public csv::ConstProcessor<ary::cpp::Namespace>, + public csv::ConstProcessor<ary::cpp::Class>, + public csv::ConstProcessor<ary::cpp::Enum>, + public csv::ConstProcessor<ary::cpp::Typedef>, + public csv::ConstProcessor<ary::cpp::Function>, + public csv::ConstProcessor<ary::cpp::Variable>, + public csv::ConstProcessor<ary::doc::Documentation>, + public ary::info::DocuDisplay, + private HtmlDisplay_Impl +{ + public: + Docu_Display( + OuputPage_Environment & + io_rEnv ); + virtual ~Docu_Display(); + + void Assign_Out( + csi::xml::Element & o_rOut ); + void Unassign_Out(); + + virtual void Display_StdTag( + const ary::info::StdTag & + i_rData ); + virtual void Display_BaseTag( + const ary::info::BaseTag & + i_rData ); + virtual void Display_ExceptionTag( + const ary::info::ExceptionTag & + i_rData ); + virtual void Display_ImplementsTag( + const ary::info::ImplementsTag & + i_rData ); + virtual void Display_KeywordTag( + const ary::info::KeywordTag & + i_rData ); + virtual void Display_ParameterTag( + const ary::info::ParameterTag & + i_rData ); + virtual void Display_SeeTag( + const ary::info::SeeTag & + i_rData ); + virtual void Display_TemplateTag( + const ary::info::TemplateTag & + i_rData ); + virtual void Display_LabelTag( + const ary::info::LabelTag & + i_rData ); + virtual void Display_SinceTag( + const ary::info::SinceTag & + i_rData ); + + virtual void Display_DT_Text( + const ary::info::DT_Text & + i_rData ); + virtual void Display_DT_MaybeLink( + const ary::info::DT_MaybeLink & + i_rData ); + virtual void Display_DT_Whitespace( + const ary::info::DT_Whitespace & + i_rData ); + virtual void Display_DT_Eol( + const ary::info::DT_Eol & + i_rData ); + virtual void Display_DT_Xml( + const ary::info::DT_Xml & + i_rData ); + + using csv::ConstProcessor<ary::doc::Documentation>::Process; + + private: + // Interface csv::ConstProcessor<>: + virtual void do_Process( + const ary::cpp::Namespace & + i_rData ); + virtual void do_Process( + const ary::cpp::Class & + i_rData ); + virtual void do_Process( + const ary::cpp::Enum & + i_rData ); + virtual void do_Process( + const ary::cpp::Typedef & + i_rData ); + virtual void do_Process( + const ary::cpp::Function & + i_rData ); + virtual void do_Process( + const ary::cpp::Variable & + i_rData ); + virtual void do_Process( + const ary::doc::Documentation & + i_rData ); + // Interface ary::Display: + virtual const ary::cpp::Gate * + inq_Get_ReFinder() const; + // Locals + void Start_DocuBlock(); + void Finish_DocuBlock(); + + void Write_TagTitle( + const char * i_sText, + const char * i_nFontSize = "+0" ); + void Write_TagContents( + const ary::info::DocuText & + i_rDocuText ); + void Write_Text( + const ary::info::DocuText & + i_rDocuText ); + void Write_TextToken( + const String & i_sText ); + void Write_LinkableText( + const ary::QualifiedName & + i_sQuName ); + void Write_QualifiedName( + const ary::QualifiedName & + i_sQuName ); + + // DATA + bool bUseHtmlInDocuTokens; + + /** This is used, if a class documentation is displayed, + because for links to members then the "current class" + is not the parent, but this class itself. + */ + const ary::cpp::Class * + pCurClassOverwrite; +}; + + + + +#endif diff --git a/autodoc/source/display/html/hdimpl.cxx b/autodoc/source/display/html/hdimpl.cxx new file mode 100644 index 000000000000..f4a6a8bf14c5 --- /dev/null +++ b/autodoc/source/display/html/hdimpl.cxx @@ -0,0 +1,549 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hdimpl.cxx,v $ + * $Revision: 1.12 $ + * + * 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 "hdimpl.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <stdlib.h> +#include <stdio.h> +#include <ary/ceslot.hxx> +#include <ary/qualiname.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_de.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <udm/html/htmlitem.hxx> +#include "cre_link.hxx" +#include "hd_docu.hxx" +#include "html_kit.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" +#include "strconst.hxx" + + +using namespace csi; + + +//******************** HtmlDisplay_Impl *********************// + +HtmlDisplay_Impl::~HtmlDisplay_Impl() +{ +} + +HtmlDisplay_Impl::HtmlDisplay_Impl( OuputPage_Environment & io_rEnv ) + : pEnv(&io_rEnv) + // aWriteHelper +{ +} + + +//******************** Free Functions *********************// + + + +namespace dshelp +{ + +void +DisplaySlot( ary::Display & o_rDisplay, + const ary::AryGroup & i_rGroup, + ary::SlotAccessId i_nSlot ) +{ + ary::Slot_AutoPtr pSlot( i_rGroup.Create_Slot(i_nSlot) ); + pSlot->StoreAt( o_rDisplay ); +} + + +const char * +PathUp( uintt i_nLevels ) +{ + static char sResult[300]; + + sResult[0] = NULCH; + for ( uintt lev = 0; lev < i_nLevels; ++lev ) + { + strcat( sResult, "../"); // SAFE STRCAT (#100211# - checked) + } + return sResult; +} + +const char * +PathPerLevelsUp( uintt i_nLevels, + const char * i_nPathBelowDestinationLevel ) +{ + static char sResult[500]; + strcpy( sResult, PathUp(i_nLevels) ); // SAFE STRCPY (#100211# - checked) + // KORR_FUTURE: Make it still safer here: + strcat( sResult, i_nPathBelowDestinationLevel ); // SAFE STRCAT (#100211# - checked) + return sResult; +} + + +const char * +PathPerRoot( const OuputPage_Environment & i_rEnv, + const char * i_sPathFromRootDir ) +{ + return PathPerLevelsUp( i_rEnv.Depth(), i_sPathFromRootDir ); +} + +const char * +PathPerNamespace( const OuputPage_Environment & i_rEnv, + const char * i_sPathFromNamespaceDir ) +{ + const ary::cpp::Namespace * pNsp = i_rEnv.CurNamespace(); + if ( pNsp == 0 ) + return ""; + + uintt nCount = i_rEnv.Depth() - (pNsp->Depth() + 1) ; + csv_assert( nCount < 100 ); + return PathPerLevelsUp( nCount, i_sPathFromNamespaceDir ); +} + +const char * +HtmlFileName( const char * i_sPrefix, + const char * i_sEntityName ) +{ + // KORR_FUTURE: Make it still safer here: + static char sResult[300]; + strcpy( sResult, i_sPrefix ); // SAFE STRCPY (#100211# - checked) + strcat( sResult, i_sEntityName ); // SAFE STRCAT (#100211# - checked) + strcat( sResult, ".html" ); // SAFE STRCAT (#100211# - checked) + return sResult; +} + +const char * +Path2Class( uintt i_nLevelsUp, + const char * i_sClassLocalName ) +{ + return PathPerLevelsUp( i_nLevelsUp, ClassFileName(i_sClassLocalName) ); +} + +const char * +Path2Child( const char * i_sFileName, + const char * i_sSubDir ) +{ + static char sResult[400]; + if ( i_sSubDir != 0 ) + { + // KORR_FUTURE: Make it still safer here: + strcpy( sResult, i_sSubDir ); // SAFE STRCPY (#100211# - checked) + strcat( sResult, "/" ); // SAFE STRCAT (#100211# - checked) + } + else + { + sResult[0] = NULCH; + } + + strcat( sResult, i_sFileName ); // SAFE STRCAT (#100211# - checked) + return sResult; +} + +const char * +Path2ChildNamespace( const char * i_sLocalName ) +{ + return Path2Child( C_sHFN_Namespace, i_sLocalName ); +} + +String +OperationLink( const ary::cpp::Gate & , + const String & i_sOpName, + ary::cpp::Ce_id i_nOpId, + const char * i_sPrePath ) +{ + StreamLock + slResult(3000); + StreamStr & + sResult = slResult(); + + sResult + << i_sPrePath + << "#" + << i_sOpName + << "-" + << i_nOpId.Value(); + + + + return sResult.c_str(); +} + +const char * +DataLink( const String & i_sLocalName, + const char * i_sPrePath ) +{ + StreamLock + slResult(3000); + StreamStr & + sResult = slResult(); + + sResult + << i_sPrePath + << "#" + << i_sLocalName; + + return sResult.c_str(); +} + +void +Get_LinkedTypeText( csi::xml::Element & o_rOut, + const OuputPage_Environment & i_rEnv, + ary::cpp::Type_id i_nId, + bool i_bWithAbsolutifier ) +{ + if (NOT i_nId.IsValid()) + return; + + const char * sPreName = ""; + const char * sName = ""; + const char * sPostName = ""; + + bool bTypeExists = Get_TypeText( sPreName, + sName, + sPostName, + i_nId, + i_rEnv.Gate() ); + if ( NOT bTypeExists ) + return; + + if ( NOT i_bWithAbsolutifier AND strncmp(sPreName,"::",2) == 0 ) + sPreName+=2; + + const ary::cpp::CodeEntity * + pCe = i_rEnv.Gate().Search_RelatedCe(i_nId); + + String sLink; + if ( pCe != 0 ) + { + sLink = Link2Ce(i_rEnv,*pCe); + } + else + { + if ( strstr(sPreName,"com::sun::star") != 0 ) + { + static StreamStr aLink(400); + aLink.seekp(0); + aLink << PathPerRoot(i_rEnv, "../../common/ref"); + if ( *sPreName != ':' ) + aLink << '/'; + for ( const char * s = sPreName; + *s != 0; + ++s ) + { + if ( *s == ':' ) + { + aLink << '/'; + ++s; + } + else + { + aLink << *s; + } + } // end for + aLink << sName + << ".html"; + sLink = aLink.c_str(); + } + } // endif( pCe != 0 ) + + o_rOut + << sPreName; + csi::xml::Element & + o_Goon = sLink.length() > 0 + ? o_rOut >> * new html::Link( sLink.c_str() ) + : o_rOut; + o_Goon + << sName; + o_rOut + << sPostName; +} + +void +Create_ChildListLabel( csi::xml::Element & o_rParentElement, + const char * i_sLabel ) +{ + if ( NOT csv::no_str(i_sLabel) ) + { + o_rParentElement + >> *new html::Label(i_sLabel) + << " "; + } +} + +DYN csi::html::Table & +Create_ChildListTable( const char * i_sTitle ) +{ + html::Table * + dpTable = new html::Table; + *dpTable + << new html::ClassAttr( "childlist") + << new xml::AnAttribute( "border", "1" ) + << new xml::AnAttribute( "cellpadding", "5" ) + << new xml::AnAttribute( "cellspacing", "0" ) + << new html::WidthAttr( "100%" ); + + html::TableRow & + rRow = dpTable->AddRow(); + rRow + << new html::ClassAttr("subtitle") + >> *new html::TableCell + << new xml::AnAttribute( "colspan","2" ) + >> *new html::Headline(4) + << i_sTitle; + return *dpTable; +} + +const char * +Link2Ce( const OuputPage_Environment & i_rEnv, + const ary::cpp::CodeEntity & i_rCe ) +{ + const uintt nMaxSize + = 3000; + static char sLink[nMaxSize]; + static LinkCreator aLinkCreator( &sLink[0], nMaxSize ); + sLink[0] = NULCH; + + aLinkCreator.SetEnv(i_rEnv); + i_rCe.Accept(aLinkCreator); + + return sLink; +} + +const char * +Link2CppDefinition( const OuputPage_Environment & i_rEnv, + const ary::cpp::DefineEntity & i_rDef ) +{ + const uintt nMaxSize + = 1000; + static char sLink[nMaxSize]; + static LinkCreator aLinkCreator( &sLink[0], nMaxSize ); + sLink[0] = NULCH; + + aLinkCreator.SetEnv(i_rEnv); + i_rDef.Accept(aLinkCreator); + + return sLink; +} + +const ary::cpp::CodeEntity * +FindUnambiguousCe( const OuputPage_Environment & i_rEnv, + const ary::QualifiedName & i_rQuName, + const ary::cpp::Class * i_pJustDocumentedClass ) +{ + if ( i_rEnv.CurNamespace() == 0 ) + return 0; + + const ary::cpp::CodeEntity * ret = 0; + + if ( NOT i_rQuName.IsQualified() ) + { + if ( i_pJustDocumentedClass != 0 ) + ret = i_rEnv.Gate().Ces().Search_CeLocal( i_rQuName.LocalName(), + i_rQuName.IsFunction(), + *i_rEnv.CurNamespace(), + i_pJustDocumentedClass ); + if (ret != 0) + return ret; + + ret = i_rEnv.Gate().Ces().Search_CeLocal( i_rQuName.LocalName(), + i_rQuName.IsFunction(), + *i_rEnv.CurNamespace(), + i_rEnv.CurClass() ); + } + if (ret != 0) + return ret; + + return i_rEnv.Gate().Ces().Search_CeAbsolute( *i_rEnv.CurNamespace(), + i_rQuName ); +} + +void +ShowDocu_On( csi::xml::Element & o_rOut, + Docu_Display & io_rDisplay, + const ary::cpp::CppEntity & i_rRE ) +{ + if (i_rRE.Docu().Data() != 0) + { + io_rDisplay.Assign_Out( o_rOut ); + io_rDisplay.Process(i_rRE.Docu()); + io_rDisplay.Unassign_Out(); + } +} + +void +WriteOut_TokenList( csi::xml::Element & o_rOut, + const StringVector & i_rTokens, + const char * i_sSeparator ) +{ + if ( i_rTokens.size() > 0 ) + { + StringVector::const_iterator + it = i_rTokens.begin(); + StringVector::const_iterator + itEnd = i_rTokens.end(); + + o_rOut << *it; + for ( ++it; it != itEnd; ++it ) + { + o_rOut << i_sSeparator << *it; + } + }; + +} + +void +EraseLeadingSpace( String & io_rStr ) +{ + if ( *io_rStr.c_str() < 33 AND io_rStr.length() > 0 ) + { + const unsigned char * pNew; + for ( pNew = (const unsigned char * ) io_rStr.c_str(); + *pNew < 33 AND *pNew != 0; + ++pNew ) {} + String sNew( (const char*)pNew ); + io_rStr = sNew; + } +} + +void +WriteOut_LinkedFunctionText( csi::xml::Element & o_rTitleOut, + adcdisp::ParameterTable & o_rParameters, + const ary::cpp::Function & i_rFunction, + const OuputPage_Environment & i_rEnv, + bool * o_bIsConst, + bool * o_bIsVirtual ) +{ + // write pre-name: + const ary::cpp::FunctionFlags & rFlags = i_rFunction.Flags(); + if ( rFlags.IsStaticLocal() OR rFlags.IsStaticMember() ) + o_rTitleOut << "static "; + if ( rFlags.IsExplicit() ) + o_rTitleOut << "explicit "; + if ( rFlags.IsMutable() ) + o_rTitleOut << "mutable "; + if ( i_rFunction.Virtuality() != ary::cpp::VIRTUAL_none ) + o_rTitleOut << "virtual "; +// o_rTitleOut << new html::LineBreak; + + Get_LinkedTypeText( o_rTitleOut, i_rEnv, i_rFunction.ReturnType() ); + + // write name: + o_rTitleOut + << " " + >> *new html::Strong + << i_rFunction.LocalName(); + o_rTitleOut + << "("; + + + csi::xml::Element * pOutLast = &o_rTitleOut; + + // write post-name: + FunctionParam_Iterator fit; + fit.Assign(i_rFunction); + + if (fit) + { + o_rParameters.AddEntry(); + Get_LinkedTypeText( o_rParameters.Type(), i_rEnv, fit.CurType() ); + o_rParameters.Type() << " "; + o_rParameters.Name() << " " << fit.CurName(); + + for ( ++fit; fit; ++fit ) + { + o_rParameters.Name() << ","; + o_rParameters.AddEntry(); + Get_LinkedTypeText( o_rParameters.Type(), i_rEnv, fit.CurType() ); + o_rParameters.Name() << fit.CurName(); + } + + pOutLast = &o_rParameters.Name(); + o_rParameters.Name() << " "; + } + + *pOutLast << ")"; + if ( fit.IsFunctionConst() ) + { + *pOutLast << " const"; + if ( o_bIsConst != 0 ) + *o_bIsConst = true; + } + if ( fit.IsFunctionVolatile() ) + { + *pOutLast << " volatile"; + if ( o_bIsVirtual != 0 ) + *o_bIsVirtual = true; + } + + // write Exceptions: + const std::vector< ary::cpp::Type_id > * + pThrow = i_rFunction.Exceptions(); + if ( pThrow) + { + std::vector< ary::cpp::Type_id >::const_iterator + it = pThrow->begin(); + std::vector< ary::cpp::Type_id >::const_iterator + it_end = pThrow->end(); + + if (it != it_end) + { + o_rParameters.AddEntry(); + pOutLast = &o_rParameters.Name(); + + o_rParameters.Name() << " throw( "; + Get_LinkedTypeText(o_rParameters.Name(), i_rEnv, *it); + + for ( ++it; it != it_end; ++it ) + { + o_rParameters.Name() << ", "; + Get_LinkedTypeText(o_rParameters.Name(), i_rEnv, *it); + } + o_rParameters.Name() << " )"; + } + else + { + *pOutLast << " throw()"; + } + } // endif // pThrow + + // abstractness: + if ( i_rFunction.Virtuality() == ary::cpp::VIRTUAL_abstract ) + *pOutLast << " = 0"; + + // finish: + *pOutLast << ";"; +} + + + +} // namespace dshelp diff --git a/autodoc/source/display/html/hdimpl.hxx b/autodoc/source/display/html/hdimpl.hxx new file mode 100644 index 000000000000..6b3c195d845d --- /dev/null +++ b/autodoc/source/display/html/hdimpl.hxx @@ -0,0 +1,250 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hdimpl.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HDIMPL_HXX +#define ADC_DISPLAY_HDIMPL_HXX + +// BASE CLASSES +#include <udm/html/htmlitem.hxx> +// USED SERVICES +#include "easywri.hxx" +#include <cosv/bstream.hxx> +#include <ary/ary_disp.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_ce.hxx> +#include "aryattrs.hxx" // For compatibility with earlier times, when those funtions were in this header. + + +namespace ary +{ + namespace cpp + { + class CodeEntity; + class Class; + class DisplayGate; + class Function; + class DefineEntity; + class OperationSignature; + } + + class QualifiedName; +} +namespace csi +{ + namespace xml + { + class Element; + } + namespace html + { + class Table; + } +} + +namespace adcdisp +{ + class ParameterTable; +} + +class OuputPage_Environment; +class Docu_Display; + +class HtmlDisplay_Impl +{ + public: + ~HtmlDisplay_Impl(); + + const OuputPage_Environment & + Env() const { return *pEnv; } + + // ACCESS + OuputPage_Environment & + Env() { return *pEnv; } + EasyWriter & Easy() { return aWriteHelper; } + csi::xml::Element & CurOut() { return aWriteHelper.Out(); } + + protected: + HtmlDisplay_Impl( + OuputPage_Environment & + io_rEnv ); + private: + // DATA + OuputPage_Environment * + pEnv; + EasyWriter aWriteHelper; +}; + + +namespace dshelp +{ + +void DisplaySlot( + ary::Display & o_rDisplay, + const ary::AryGroup & + i_rGroup, + ary::SlotAccessId i_nSlot ); + + +const char * PathUp( + uintt i_nLevels ); +const char * PathPerLevelsUp( + uintt i_nLevels, + const char * i_nPathBelowDestinationLevel ); + +const char * PathPerRoot( + const OuputPage_Environment & + i_rEnv, + const char * i_sPathFromRootDir ); +const char * PathPerNamespace( + const OuputPage_Environment & + i_rEnv, + const char * i_sPathFromNamespaceDir ); + +void Create_ChildListLabel( + csi::xml::Element & o_rParentElement, + const char * i_sLabel ); +DYN csi::html::Table & + Create_ChildListTable( + const char * i_sTitle ); + +const char * HtmlFileName( + const char * i_sPrefix, + const char * i_sEntityName ); + +inline const char * +ClassFileName( const char * i_sClassLocalName ) + { return HtmlFileName( "c-", i_sClassLocalName); } +inline const char * +EnumFileName( const char * i_sEnumLocalName ) + { return HtmlFileName( "e-", i_sEnumLocalName); } +inline const char * +TypedefFileName( const char * i_sTypedefLocalName ) + { return HtmlFileName( "t-", i_sTypedefLocalName); } +inline const char * +FileFileName( const char * i_sFileLocalName ) + { return HtmlFileName( "f-", i_sFileLocalName); } + +const char * Path2Class( + uintt i_nLevelsUp, + const char * i_sClassLocalName ); + +const char * Path2Child( + const char * i_sFileName, + const char * i_sSubDir = 0 ); + +const char * Path2ChildNamespace( + const char * i_sLocalName ); + +String OperationLink( + const ary::cpp::Gate & i_gate, + const String & i_sOpName, + ary::cpp::Ce_id i_nOpId, + const char * i_sPrePath = "" ); +const char * DataLink( + const String & i_sLocalName, + const char * i_sPrePath = "" ); + +inline String +OperationLabel( const String & i_sOpName, + ary::cpp::Ce_id i_nOpId, + const ary::cpp::Gate & i_gate ) + { return String(OperationLink(i_gate, i_sOpName, i_nOpId) + 1); } // Skip '#' in front. +inline const char * +DataLabel( const String & i_sLocalName ) + { return DataLink(i_sLocalName) + 1; } // Skip '#' in front. + + +void Get_LinkedTypeText( + csi::xml::Element & o_rOut, + const OuputPage_Environment & + i_rEnv, + ary::cpp::Type_id i_nId, + bool i_bWithAbsolutifier = true ); + + +const char * Link2Ce( + const OuputPage_Environment & + i_rEnv, + const ary::cpp::CodeEntity & + i_rCe ); + +const char * Link2CppDefinition( + const OuputPage_Environment & + i_rEnv, + const ary::cpp::DefineEntity & + i_rDef ); + +const ary::cpp::CodeEntity * + FindUnambiguousCe( + const OuputPage_Environment & + i_rEnv, + const ary::QualifiedName & + i_rQuName, + const ary::cpp::Class * i_pJustDocumentedClass ); + +void ShowDocu_On( + csi::xml::Element & o_rOut, + Docu_Display & io_rDisplay, + const ary::cpp::CppEntity & + i_rRE ); + +void WriteOut_TokenList( + csi::xml::Element & o_rOut, + const StringVector & i_rTokens, + const char * i_sSeparator ); + +void EraseLeadingSpace( + String & io_rStr ); + +/** @param o_bIsConst + *o_bIsConst will be set to true, if o_bIsConst != 0 and function is const. + If the function is not const, *o_bIsConst remains unchanged! + + @param o_bIsVirtual + The same as o_bIsConst. +*/ +void WriteOut_LinkedFunctionText( + csi::xml::Element & o_rTitleOut, + adcdisp::ParameterTable & + o_rParameters, + const ary::cpp::Function & + i_rFunction, + const OuputPage_Environment & + i_rEnv, + bool * o_bIsConst = 0, + bool * o_bIsVirtual = 0 ); + + + +} // namespace dshelp + +using namespace dshelp; + +#endif diff --git a/autodoc/source/display/html/html_kit.cxx b/autodoc/source/display/html/html_kit.cxx new file mode 100644 index 000000000000..7d6bf1a2e3e6 --- /dev/null +++ b/autodoc/source/display/html/html_kit.cxx @@ -0,0 +1,308 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: html_kit.cxx,v $ + * $Revision: 1.10 $ + * + * 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 "html_kit.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <stdio.h> +#include <ary/cpp/c_slntry.hxx> +#include "hdimpl.hxx" + + +namespace adcdisp +{ + + +using namespace csi::xml; +using namespace csi::html; + + +void +PageTitle_Left::operator()( XmlElement & o_rOwner, + const char * i_sTypeTitle, + const String & i_sLocalName ) +{ + o_rOwner + >> *new Headline(2) + << i_sTypeTitle + << " " + << i_sLocalName; +} + +void +PageTitle_Std::operator()( XmlElement & o_rOwner, + const char * i_sTypeTitle, + const String & i_sLocalName ) +{ + o_rOwner + >> *new AnElement("div") + << new ClassAttr("title") + >> *new Headline(2) + << i_sTypeTitle + << " " + << i_sLocalName; +} + +XmlElement & +PageTitle_Std::operator()( XmlElement & o_rOwner ) +{ + XmlElement & ret = + o_rOwner + >> *new AnElement("div") + << new ClassAttr("title") + >> *new Headline(2); + return ret; +} + +void +OperationTitle::operator()( XmlElement & o_owner, + const char * i_itemName, + ary::cpp::Ce_id i_id, + const ::ary::cpp::Gate & i_gate ) +{ + o_owner + >> *new Label( OperationLabel(i_itemName, i_id, i_gate) ) + << " "; + o_owner + << i_itemName; +} + + +void +TemplateClause::operator()( XmlElement & o_rOwner, + const List_TplParams & i_rTplParams ) +{ + if ( i_rTplParams.size() == 0 ) + return; + + Element & rOut = + o_rOwner + << new LineBreak + >> *new Paragraph + >> *new Strong + << "template< "; + + List_TplParams::const_iterator + it = i_rTplParams.begin(); + List_TplParams::const_iterator + itEnd = i_rTplParams.end(); + + rOut + << (*it).Name(); + for ( ++it; it != itEnd; ++it ) + { + rOut + << ", " + << (*it).Name(); + } // end for + rOut << " >"; +} + +ExplanationList::ExplanationList( XmlElement & o_rOwner, + bool i_bMemberStyle ) + : pList( new DefList), + pTerm(0), + pDefinition(0), + bMemberStyle(i_bMemberStyle) +{ + if (bMemberStyle) + *pList << new ClassAttr("member"); + + o_rOwner << pList; +} + +void +ExplanationList::AddEntry( const char * i_sTerm, + const char * i_sDifferentClass ) +{ + DefListTerm & rNewTerm = pList->AddTerm(); + if ( i_sDifferentClass != 0 ) + { + rNewTerm << new ClassAttr(i_sDifferentClass); + } + else if (bMemberStyle) + { + rNewTerm << new ClassAttr("member"); + } + if ( i_sTerm != 0 ) + rNewTerm << i_sTerm; + + pTerm = &rNewTerm; + pDefinition = &pList->AddDefinition(); + if (bMemberStyle) + *pDefinition << new ClassAttr("member"); +} + +void +ExplanationList::AddEntry_NoTerm() +{ + pTerm = 0; + pDefinition = &pList->AddDefinition(); + if (bMemberStyle) + *pDefinition << new ClassAttr("member"); +} + +ExplanationTable::ExplanationTable( XmlElement & o_rOwner ) + : pTable(0), + pTerm(0), + pDefinition(0) +{ + pTable = new Table("0", "100%", "3", "0"); + *pTable << new AnAttribute("class", "expl-table"); + o_rOwner << pTable; +} + +void +ExplanationTable::AddEntry( const char * i_sTerm, + const char * i_sDifferentStyle ) +{ + TableRow & + rNewRow = pTable->AddRow(); + TableCell & + rNewTerm = rNewRow.AddCell(); + TableCell & + rNewDefinition = rNewRow.AddCell(); + + if ( i_sDifferentStyle == 0 ) + { + rNewTerm << new WidthAttr("15%") + << new StyleAttr("vertical-align:top; font-weight:bold"); + } + else + { + rNewTerm << new StyleAttr(i_sDifferentStyle); + } + if ( i_sTerm != 0 ) + rNewTerm << i_sTerm; + + pTerm = &rNewTerm; + pDefinition = & (rNewDefinition >> *new APureElement("pre")); +} + +ParameterTable::ParameterTable( XmlElement & o_rOwner ) + : pTable(0), + pTerm(0), + pDefinition(0) +{ + pTable = new Table; + *pTable << new AnAttribute("class", "param-table"); + o_rOwner << pTable; +} + +void +ParameterTable::AddEntry() +{ + TableRow & + rNewRow = pTable->AddRow(); + TableCell & + rNewTerm = rNewRow.AddCell(); + TableCell & + rNewDefinition = rNewRow.AddCell(); + + pTerm = &rNewTerm; + pDefinition = &rNewDefinition; +} + +FlagTable::FlagTable( XmlElement & o_rOwner, + uintt i_nNrOfColumns ) +{ + pTable = new Table; + *pTable << new AnAttribute("class", "flag-table"); + *pTable << new AnAttribute("border", "1"); + *pTable << new AnAttribute("cellspacing", "0"); + o_rOwner << pTable; + + TableRow & rRow1 = pTable->AddRow(); + TableRow & rRow2 = pTable->AddRow(); + + for ( uintt c = 0; c < i_nNrOfColumns; ++c ) + { + TableCell & rCell1 = rRow1.AddCell(); + int nWidth = 100 / i_nNrOfColumns; + static char sWidth[20]; + sprintf( sWidth, "%d%%", nWidth ); // SAFE SPRINTF (#100211# - checked) + + rCell1 + << new WidthAttr( sWidth ) + << new ClassAttr( "flagname" ); + TableCell & rCell2 = rRow2.AddCell(); + aCells.push_back( CellPair(&rCell1, &rCell2) ); + } // end for +} + +void +FlagTable::SetColumn( uintt i_nColumnPosition, + const char * i_sColumnName, + bool i_bValue ) +{ + csv_assert( i_nColumnPosition < aCells.size() ); + + TableCell & + rCell1 = *aCells[i_nColumnPosition].first; + TableCell & + rCell2 = *aCells[i_nColumnPosition].second; + rCell1 + << i_sColumnName; + if (i_bValue) + { + rCell2 + << new ClassAttr("flagyes") + << "YES"; + } + else // + { + rCell2 + << new ClassAttr("flagno") + << "NO"; + } // endif +} + +IndexList::IndexList( XmlElement & o_rOwner ) + : pList( new DefList ), + pTerm(0), + pDefinition(0) +{ + o_rOwner << pList; +} + +void +IndexList::AddEntry() +{ + pTerm = &pList->AddTerm(); + pDefinition = &pList->AddDefinition(); +} + + +} // namespace adcdisp + + + diff --git a/autodoc/source/display/html/html_kit.hxx b/autodoc/source/display/html/html_kit.hxx new file mode 100644 index 000000000000..aa082200f80c --- /dev/null +++ b/autodoc/source/display/html/html_kit.hxx @@ -0,0 +1,201 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: html_kit.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HTML_KIT_HXX +#define ADC_DISPLAY_HTML_KIT_HXX + +// BASE CLASSES +#include <udm/xml/xmlitem.hxx> +#include <udm/html/htmlitem.hxx> +// USED SERVICES +#include <ary/cpp/c_types4cpp.hxx> + +namespace ary +{ + namespace cpp + { + struct S_TplParam; + class OperationSignature; + class Gate; + } +} + + + + +namespace adcdisp +{ + +typedef csi::xml::Element XmlElement; + +class PageTitle_Left +{ + public: + void operator()( + XmlElement & o_rOwner, + const char * i_sTypeTitle, + const String & i_sLocalName ); +}; + +class PageTitle_Std +{ + public: + void operator()( + XmlElement & o_rOwner, + const char * i_sTypeTitle, + const String & i_sLocalName ); + XmlElement & operator()( + XmlElement & o_rOwner ); +}; + +class OperationTitle +{ + public: + void operator()( + XmlElement & o_rOwner, + const char * i_sItemName, + ary::cpp::Ce_id i_nId, + const ::ary::cpp::Gate & + i_gate ); +}; + + +class TemplateClause +{ + public: + typedef std::vector< ary::cpp::S_TplParam> List_TplParams; + + void operator()( + XmlElement & o_rOwner, + const List_TplParams & + i_rTplParams ); +}; + + +class ExplanationList +{ + public: + ExplanationList( + XmlElement & o_rOwner, + bool i_bMemberStyle = false ); + + void AddEntry( + const char * i_sTerm = 0, + const char * i_sDifferentClass = 0 ); + void AddEntry_NoTerm(); + + XmlElement & Term() { return *pTerm; } + XmlElement & Def() { return *pDefinition; } + + private: + csi::html::DefList* pList; + XmlElement * pTerm; + XmlElement * pDefinition; + bool bMemberStyle; +}; + +class ExplanationTable +{ + public: + ExplanationTable( + XmlElement & o_rOwner ); + + void AddEntry( + const char * i_sTerm = 0, + const char * i_sDifferentStyle = 0 ); + + XmlElement & Term() { return *pTerm; } + XmlElement & Def() { return *pDefinition; } + + private: + csi::html::Table* pTable; + XmlElement * pTerm; + XmlElement * pDefinition; +}; + +class ParameterTable +{ + public: + ParameterTable( + XmlElement & o_rOwner ); + + void AddEntry(); + + XmlElement & Type() { return *pTerm; } + XmlElement & Name() { return *pDefinition; } + + private: + csi::html::Table* pTable; + XmlElement * pTerm; + XmlElement * pDefinition; +}; + +class FlagTable +{ + public: + FlagTable( + XmlElement & o_rOwner, + uintt i_nNrOfColumns ); + + void SetColumn( + uintt i_nColumnPosition, /// Starting with 0. + const char * i_sColumnName, + bool i_bValue ); /// "YES" or "NO" + private: + typedef std::pair< csi::html::TableCell*, csi::html::TableCell* > CellPair; + + // DATA + csi::html::Table* pTable; + std::vector<CellPair> + aCells; +}; + +class IndexList +{ + public: + IndexList( + XmlElement & o_rOwner ); + + void AddEntry(); + + XmlElement & Term() { return *pTerm; } + XmlElement & Def() { return *pDefinition; } + + private: + csi::html::DefList* pList; + XmlElement * pTerm; + XmlElement * pDefinition; +}; + + + + +} // namespace adcdisp +#endif diff --git a/autodoc/source/display/html/makefile.mk b/autodoc/source/display/html/makefile.mk new file mode 100644 index 000000000000..9071425c41e8 --- /dev/null +++ b/autodoc/source/display/html/makefile.mk @@ -0,0 +1,82 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# 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=display_html + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/aryattrs.obj \ + $(OBJ)$/cfrstd.obj \ + $(OBJ)$/chd_udk2.obj \ + $(OBJ)$/cre_link.obj \ + $(OBJ)$/dsply_cl.obj \ + $(OBJ)$/dsply_da.obj \ + $(OBJ)$/dsply_op.obj \ + $(OBJ)$/easywri.obj \ + $(OBJ)$/hd_chlst.obj \ + $(OBJ)$/hd_docu.obj \ + $(OBJ)$/hdimpl.obj \ + $(OBJ)$/html_kit.obj \ + $(OBJ)$/nav_main.obj \ + $(OBJ)$/navibar.obj \ + $(OBJ)$/outfile.obj \ + $(OBJ)$/opageenv.obj \ + $(OBJ)$/pagemake.obj \ + $(OBJ)$/pm_aldef.obj \ + $(OBJ)$/pm_base.obj \ + $(OBJ)$/pm_class.obj \ + $(OBJ)$/pm_help.obj \ + $(OBJ)$/pm_index.obj \ + $(OBJ)$/pm_namsp.obj \ + $(OBJ)$/pm_start.obj \ + $(OBJ)$/protarea.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/display/html/nav_main.cxx b/autodoc/source/display/html/nav_main.cxx new file mode 100644 index 000000000000..8e484f602fa7 --- /dev/null +++ b/autodoc/source/display/html/nav_main.cxx @@ -0,0 +1,380 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: nav_main.cxx,v $ + * $Revision: 1.9 $ + * + * 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 "nav_main.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_ce.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/loc/loc_file.hxx> +#include <udm/html/htmlitem.hxx> +#include "hdimpl.hxx" +#include "opageenv.hxx" +#include "strconst.hxx" + + +using namespace ::csi::html; +using namespace ::csi::xml; + + +const String sOverview("Overview"); +const String sNamespace("Namespace"); +const String sClass("Class"); +const String sTree("Tree"); +const String sProject("Project"); +const String sFile("File"); +const String sIndex("Index"); +const String sHelp("Help"); + + + +//******************** MainItem and derived ones ***************// +class MainItem +{ + public: + virtual ~MainItem() {} + void Write2( + TableRow & o_rOut ); + private: + virtual void do_Write2( + TableRow & o_rOut ) = 0; +}; + +inline void +MainItem::Write2( TableRow & o_rOut ) + { do_Write2(o_rOut); } + + +namespace +{ + +class MainRowItem : public MainItem +{ + public: + MainRowItem( + const String & i_sText, + const char * i_sLink, + const char * i_sTip ); + ~MainRowItem(); + private: + enum E_Style { eSelf, eNo, eStd }; + + virtual void do_Write2( + TableRow & o_rOut ); + String sText; + String sLink; + String sTip; +}; + +MainRowItem::MainRowItem( const String & i_sText, + const char * i_sLink, + const char * i_sTip ) + : sText(i_sText), + sLink(i_sLink), + sTip(i_sTip) +{ +} + +MainRowItem::~MainRowItem() +{ +} + +void +MainRowItem::do_Write2( TableRow & o_rOut ) +{ + TableCell & rCell = o_rOut.AddCell(); + + rCell + << new ClassAttr( "navimain" ) + << new XmlCode(" ") + >> *new Link(sLink.c_str()) + << sText.c_str(); + rCell + << new XmlCode(" "); +} + + +class SelectedItem : public MainItem +{ + public: + SelectedItem( + const String & i_sText ) + : sText(i_sText) {} + private: + virtual void do_Write2( + TableRow & o_rOut ); + String sText; +}; + +void +SelectedItem::do_Write2( TableRow & o_rOut ) +{ + TableCell & rCell = o_rOut.AddCell(); + + rCell + << new ClassAttr( "navimainself" ) + << new XmlCode(" ") + << sText.c_str() + << new XmlCode(" "); +} + +class UnavailableItem : public MainItem +{ + public: + UnavailableItem( + const String & i_sText ) + : sText(i_sText) {} + private: + virtual void do_Write2( + TableRow & o_rOut ); + String sText; +}; + +void +UnavailableItem::do_Write2( TableRow & o_rOut ) +{ + TableCell & rCell = o_rOut.AddCell(); + + rCell + << new ClassAttr( "navimainnone" ) + << new XmlCode(" ") + << sText.c_str() + << new XmlCode(" "); +} + +} // anonymous namespace + +//************************ MainRow ***************************// + +MainRow::MainRow( const OuputPage_Environment & i_rEnv ) + : // aItems, + pEnv(&i_rEnv) +{ +} + +MainRow::~MainRow() +{ + csv::erase_container_of_heap_ptrs(aItems); +} + +void +MainRow::SetupItems_Overview() +{ + Create_ItemList_Global( eSelf, eStd, eStd ); +} + +void +MainRow::SetupItems_AllDefs() +{ + Create_ItemList_Global( eStd, eStd, eStd ); +} + +void +MainRow::SetupItems_Index() +{ + Create_ItemList_Global( eStd, eSelf, eStd ); +} + +void +MainRow::SetupItems_Help() +{ + Create_ItemList_Global( eStd, eStd, eSelf ); +} + +void +MainRow::SetupItems_Ce( const ary::cpp::CodeEntity & i_rCe ) +{ + csv_assert( pEnv->CurNamespace() != 0 ); + bool bIsNamespace = i_rCe.Id() == pEnv->CurNamespace()->Id(); + bool bHasClass = pEnv->CurClass() != 0; + bool bIsClass = dynamic_cast< const ary::cpp::Class * >(&i_rCe) != 0; + + Create_ItemList_InDirTree_Cpp( + ( bIsNamespace ? eSelf : eStd ), + ( bIsClass ? eSelf : bHasClass ? eStd : eNo ), + eNo, 0 ); +} + +void +MainRow::SetupItems_FunctionGroup() +{ + Create_ItemList_InDirTree_Cpp( + eStd, + (pEnv->CurClass() != 0 ? eStd : eNo), + eNo, 0 ); +} + +void +MainRow::SetupItems_DataGroup() +{ + SetupItems_FunctionGroup(); +} + +void +MainRow::Write2( csi::xml::Element & o_rOut ) const +{ + Table * pTable = new Table; + o_rOut + >> *pTable + << new AnAttribute( "class", "navimain" ) + << new AnAttribute( "border", "0" ) + << new AnAttribute( "cellpadding", "1" ) + << new AnAttribute( "cellspacing", "0" ); + TableRow & rRow = pTable->AddRow(); + rRow + << new AnAttribute( "align", "center" ) + << new AnAttribute( "valign", "top" ); + for ( ItemList::const_iterator it = aItems.begin(); + it != aItems.end(); + ++it ) + { + (*it)->Write2( rRow ); + } +} + +void +MainRow::Create_ItemList_Global( E_Style i_eOverview, + E_Style i_eIndex, + E_Style i_eHelp ) +{ + if ( i_eOverview == eStd ) + { + String sLinkOverview = ( i_eIndex == eSelf + ? dshelp::PathPerLevelsUp( + 1, + C_sHFN_Overview ) + : C_sHFN_Overview ); + Add_Item( i_eOverview, sOverview, sLinkOverview.c_str(), "" ); + } + else + { + Add_Item( i_eOverview, sOverview, "", "" ); + } + + if ( i_eIndex == eSelf ) + Add_Item( eStd, sNamespace, "../names/index.html", "" ); + else + Add_Item( eStd, sNamespace, "names/index.html", "" ); + + Add_Item( eNo, sClass, "", "" ); + + if ( i_eIndex == eStd ) + { + Add_Item( i_eIndex, sIndex, C_sPath_Index, "" ); + } + else + { + Add_Item( i_eIndex, sIndex, "", "" ); + } + + if ( i_eHelp == eStd ) + { + String sLinkHelp = ( i_eIndex == eSelf + ? PathPerLevelsUp(1,C_sHFN_Help) + : C_sHFN_Help ); + Add_Item( i_eHelp, sHelp, sLinkHelp.c_str(), "" ); + } + else + { + Add_Item( i_eHelp, sHelp, "", "" ); + } +} + +void +MainRow::Create_ItemList_InDirTree_Cpp( E_Style i_eNsp, + E_Style i_eClass, + E_Style , + const char * ) +{ + String + sLinkOverview = PathPerRoot(*pEnv, C_sHFN_Overview); + Add_Item( eStd, sOverview, sLinkOverview.c_str(), "" ); + + if (i_eNsp == eStd) + { + String sLinkNamespace = PathPerNamespace(*pEnv, "index.html"); + Add_Item( i_eNsp, sNamespace, sLinkNamespace.c_str(), "" ); + } + else + { + Add_Item( i_eNsp, sNamespace, "", "" ); + } + + if (i_eClass == eStd) + { + csv_assert( pEnv->CurClass() != 0 ); + + StreamLock sLinkClass(300); + sLinkClass() << PathPerNamespace(*pEnv, "c-") + << pEnv->CurClass()->LocalName() + << ".html"; + StreamLock sTipClass(300); + sTipClass() << "Class " + << pEnv->CurClass()->LocalName(); + Add_Item( i_eClass, sClass, sLinkClass().c_str(), sTipClass().c_str() ); + } + else + { + Add_Item( i_eClass, sClass, "", "" ); + } + + + Add_Item( eStd, sIndex, PathPerRoot(*pEnv, C_sPath_Index), "" ); + String + sLinkHelp = PathPerRoot(*pEnv, "help.html"); + Add_Item( eStd, sHelp, sLinkHelp.c_str(), "" ); +} + +void +MainRow::Add_Item( E_Style i_eStyle, + const String & i_sText, + const char * i_sLink, + const char * i_sTip ) +{ + switch (i_eStyle) + { + case eStd: aItems.push_back( new MainRowItem(i_sText, i_sLink, i_sTip) ); + break; + case eNo: aItems.push_back( new UnavailableItem(i_sText) ); + break; + case eSelf: aItems.push_back( new SelectedItem(i_sText) ); + break; + default: + csv_assert(false); + } +} + + + diff --git a/autodoc/source/display/html/nav_main.hxx b/autodoc/source/display/html/nav_main.hxx new file mode 100644 index 000000000000..85a82ac8c1cc --- /dev/null +++ b/autodoc/source/display/html/nav_main.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: nav_main.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HTML_NAV_MAIN_HXX +#define ADC_DISPLAY_HTML_NAV_MAIN_HXX + +// USED SERVICES + +namespace ary +{ +namespace cpp +{ + class CodeEntity; +} +namespace loc +{ + class File; +} +} +namespace csi +{ +namespace xml +{ + class Element; +} +} + +class OuputPage_Environment; +class MainItem; + + + + +class MainRow +{ + public: + MainRow( + const OuputPage_Environment & + i_rEnv ); + ~MainRow(); + + void SetupItems_Overview(); + void SetupItems_AllDefs(); + void SetupItems_Index(); + void SetupItems_Help(); + + void SetupItems_Ce( + const ary::cpp::CodeEntity & + i_rCe ); + void SetupItems_FunctionGroup(); /// For class member methods. + void SetupItems_DataGroup(); /// For class member data. + + void Write2( + csi::xml::Element & o_rOut ) const; + private: + // Local + enum E_Style + { + eSelf, + eNo, + eStd + }; + + /** @precond + Only combinations of 1 eSelf and 2 eStd are allowed + as arguments, here. + */ + void Create_ItemList_Global( + E_Style i_eOverview, + E_Style i_eIndex, + E_Style i_eHelp ); + void Create_ItemList_InDirTree_Cpp( + E_Style i_eNsp, + E_Style i_eClass, + E_Style i_eTree, + const char * i_sTreeLink ); + void Add_Item( + E_Style i_eStyle, + const String & i_sText, + const char * i_sLink, + const char * i_sTip ); + // DATA + typedef std::vector< DYN MainItem* > ItemList; + + + ItemList aItems; + const OuputPage_Environment * + pEnv; +}; + + + + +#endif diff --git a/autodoc/source/display/html/navibar.cxx b/autodoc/source/display/html/navibar.cxx new file mode 100644 index 000000000000..d6046d99d8c7 --- /dev/null +++ b/autodoc/source/display/html/navibar.cxx @@ -0,0 +1,318 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: navibar.cxx,v $ + * $Revision: 1.7 $ + * + * 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 "navibar.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include "nav_main.hxx" +#include "opageenv.hxx" + + +using namespace csi::xml; +using namespace csi::html; + + +namespace +{ + +//************************ SubRowItem ***************************// + +class SubRowItem +{ + public: + SubRowItem( + const char * i_sText, + const char * i_sLink, + bool i_bActive, + bool i_bFirstOfRow = false ); + ~SubRowItem(); + + void Write2( + Element & o_rOut ) const; + private: + String sText; + String sLink; + bool bIsActive; + bool bFirstOfRow; +}; + +SubRowItem::SubRowItem( const char * i_sText, + const char * i_sLink, + bool i_bActive, + bool i_bFirstOfRow ) + : sText(i_sText), + sLink(i_sLink), + bIsActive(i_bActive), + bFirstOfRow(i_bFirstOfRow) +{ + csv_assert( NOT csv::no_str(i_sLink) ); +} + +SubRowItem::~SubRowItem() +{ +} + +void +SubRowItem::Write2( Element & o_rOut ) const +{ + o_rOut << new Sbr; + if ( NOT bFirstOfRow ) + o_rOut << new XmlCode( "| " ); + else + o_rOut << new XmlCode( " " ); + + if ( bIsActive ) + { + o_rOut + >> *new Link( sLink.c_str() ) + >> *new AnElement( "font" ) + << new AnAttribute("size","-2") + >> *new Bold + << sText.c_str(); + } + else + { + o_rOut + >> *new AnElement( "font" ) + << new AnAttribute("size","-2") + << sText.c_str(); + } +} + + + +//************************ SubRow ***************************// + +class SubRow +{ + public: + SubRow( + const char * i_sTitle ); + ~SubRow(); + + void AddItem( + const char * i_sText, + const char * i_sLink, + bool i_bActive ); + void Write2( + Table & o_rOut ) const; + private: + typedef std::vector< DYN SubRowItem * > List_Items; + + List_Items aItemList; + String sTitle; +}; + +SubRow::SubRow( const char * i_sTitle ) +// : // aItemList, + // sTitle +{ + StreamStr sUp(i_sTitle,0); + sUp.to_upper(); + sTitle = sUp.c_str(); +} + +SubRow::~SubRow() +{ + for ( List_Items::iterator it = aItemList.begin(); + it != aItemList.end(); + ++it ) + { + delete (*it); + } +} + +inline void +SubRow::AddItem( const char * i_sText, + const char * i_sLink, + bool i_bActive ) +{ + aItemList.push_back( new SubRowItem(i_sText, i_sLink, i_bActive, aItemList.empty()) ); +} + +void +SubRow::Write2( Table & o_rOut ) const +{ + TableRow * pRow = new TableRow; + o_rOut << pRow; + + if (sTitle.length() > 0) + { + Element & rCell1 = pRow->AddCell(); + rCell1 + << new WidthAttr("20%") + >> *new AnElement( "font" ) + << new AnAttribute("size","-2") + << sTitle + << ":"; + } + + Element & rCell2 = pRow->AddCell(); + for ( List_Items::const_iterator it = aItemList.begin(); + it != aItemList.end(); + ++it ) + { + (*it)->Write2( rCell2 ); + } +} + + +} // anonymous namespace + + + +//************************* CheshireCat ***********************// + + +typedef std::vector< DYN SubRow * > List_SubRows; + +struct NavigationBar::CheshireCat +{ + MainRow aMainRow; + List_SubRows aSubRows; + const OuputPage_Environment * + pEnv; + + + CheshireCat( + const OuputPage_Environment & + i_rEnv ); + ~CheshireCat(); +}; + +NavigationBar:: +CheshireCat::CheshireCat( const OuputPage_Environment & i_rEnv ) + : aMainRow( i_rEnv ), + pEnv( & i_rEnv ) +{ +} + +NavigationBar:: +CheshireCat::~CheshireCat() +{ + csv::erase_container_of_heap_ptrs( aSubRows ); +} + + +//************************ NavigationBar *******************// + +NavigationBar::NavigationBar( const OuputPage_Environment & i_rEnv, + E_GlobalLocation i_eLocation ) + : pi( new CheshireCat(i_rEnv) ) +{ + switch (i_eLocation) + { + case LOC_Overview: pi->aMainRow.SetupItems_Overview(); break; + case LOC_AllDefs: pi->aMainRow.SetupItems_AllDefs(); break; + case LOC_Index: pi->aMainRow.SetupItems_Index(); break; + case LOC_Help: pi->aMainRow.SetupItems_Help(); break; + default: + csv_assert(false); + } +} + +NavigationBar::NavigationBar( const OuputPage_Environment & i_rEnv, + const ary::cpp::CodeEntity & i_rCe ) + : pi( new CheshireCat(i_rEnv) ) +{ + pi->aMainRow.SetupItems_Ce( i_rCe ); +} + +NavigationBar::NavigationBar( const OuputPage_Environment & i_rEnv, + E_CeGatheringType i_eCeGatheringType ) + : pi( new CheshireCat(i_rEnv) ) +{ + switch (i_eCeGatheringType) + { + case CEGT_operations: pi->aMainRow.SetupItems_FunctionGroup(); break; + case CEGT_data: pi->aMainRow.SetupItems_DataGroup(); break; + default: + csv_assert(false); + } +} + +NavigationBar::~NavigationBar() +{ + csv::erase_container_of_heap_ptrs( pi->aSubRows ); +} + +void +NavigationBar::MakeSubRow( const char * i_sTitle ) +{ + pi->aSubRows.push_back( new SubRow(i_sTitle) ); +} + +void +NavigationBar::AddItem( const char * i_sName, + const char * i_sLink, + bool i_bValid ) +{ + csv_assert( pi->aSubRows.size() > 0 ); + StreamStr sName(i_sName, 0); + sName.to_upper(); + + StreamLock aSum(100); + pi->aSubRows.back()->AddItem( sName.c_str(), + aSum() << "#" << i_sLink << c_str, + i_bValid ); +} + +void +NavigationBar::Write( Element & o_rOut, + bool i_bWithSubRows ) const +{ + pi->aMainRow.Write2( o_rOut ); + + const_cast< NavigationBar* >(this)->pSubRowsTable = new Table; + o_rOut << pSubRowsTable; + *pSubRowsTable + << new AnAttribute( "class", "navisub" ) + << new AnAttribute( "cellpadding", "0" ) + << new AnAttribute( "cellspacing", "3" ); + + if (i_bWithSubRows) + { + Write_SubRows(); + } +} + +void +NavigationBar::Write_SubRows() const +{ + for ( List_SubRows::const_iterator it = pi->aSubRows.begin(); + it != pi->aSubRows.end(); + ++it ) + { + (*it)->Write2( *pSubRowsTable ); + } +} diff --git a/autodoc/source/display/html/navibar.hxx b/autodoc/source/display/html/navibar.hxx new file mode 100644 index 000000000000..f254bcc198ee --- /dev/null +++ b/autodoc/source/display/html/navibar.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: navibar.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HTML_NAVIBAR_HXX +#define ADC_DISPLAY_HTML_NAVIBAR_HXX + +// BASE CLASSES +#include "hdimpl.hxx" + +namespace ary +{ +namespace cpp +{ + class CodeEntity; +} +namespace loc +{ + class File; +} +} + + + + +/** Creates a HTML navigation bar wth the following parts: + + A main bar with fixed items. + Zero to several subbars with user defined items, depending of + the contents of the page. + + The main bar contains those items: + + Overview | Namespace | Class | Tree | Project | File | Index | Help +*/ +class NavigationBar +{ + public: + enum E_GlobalLocation + { + LOC_Overview, + LOC_AllDefs, + LOC_Index, + LOC_Help + }; + enum E_CeGatheringType + { + CEGT_operations, + CEGT_data + }; + + /// Used for Overview, Index and Help. + NavigationBar( + const OuputPage_Environment & + i_rEnv, + E_GlobalLocation i_eLocation ); + /// Used for all Ces except operations and data. + NavigationBar( + const OuputPage_Environment & + i_rEnv, + const ary::cpp::CodeEntity & + i_rCe ); + /** Used for operations and data. + */ + NavigationBar( + const OuputPage_Environment & + i_rEnv, + E_CeGatheringType i_eCeGatheringType ); + ~NavigationBar(); + + void MakeSubRow( + const char * i_sTitle ); + void AddItem( /// Items are added to last made sub-row. + const char * i_sName, + const char * i_sLink, + bool i_bValid ); + /** This writes the main bar and the pSubRowTable to o_rOut. + The pSubRowsTable stays in memory and can be filled later, + when all SubRow items are known. + */ + void Write( + csi::xml::Element & o_rOut, + bool i_bWithSubRows = false ) const; + void Write_SubRows() const; + + private: + struct CheshireCat; + Dyn<CheshireCat> pi; + csi::html::Table * pSubRowsTable; +}; + + + + +#endif diff --git a/autodoc/source/display/html/opageenv.cxx b/autodoc/source/display/html/opageenv.cxx new file mode 100644 index 000000000000..657dc49839f5 --- /dev/null +++ b/autodoc/source/display/html/opageenv.cxx @@ -0,0 +1,492 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: opageenv.cxx,v $ + * $Revision: 1.8 $ + * + * 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 "opageenv.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/ploc_dir.hxx> +#include <ary/cpp/c_ce.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <ary/loc/loc_file.hxx> +#include <udm/html/htmlitem.hxx> +#include <estack.hxx> +#include "hdimpl.hxx" +#include "strconst.hxx" + + +const String C_sCppDir( "names" ); +const String C_sIndexDir( "ix" ); + + +//************************ Implementation ********************// + +namespace +{ + +void CreateDirectory( const csv::ploc::Path & i_rPath ); + +void +CreateDirectory( const csv::ploc::Path & i_rPath ) +{ + csv::ploc::Directory aDirectory(i_rPath); + if (NOT aDirectory.Exists()) + aDirectory.PhysicalCreate(); +} + +//************************ CheshireCat ********************// + +struct InNamespaceTree +{ + enum E_Type + { + t_unknown, + t_namespace, + t_type, + t_operations, + t_data + }; + + EStack< const ary::cpp::Namespace * > + aNamespaces; /// never empty. + EStack< const ary::cpp::Class * > + aClasses; /// maybe empty. + const ary::cpp::CodeEntity * + pCe; /// CurFileCe, maybe 0 + E_Type eType; + + InNamespaceTree( + const ary::cpp::Namespace & + i_rNsp ); + ~InNamespaceTree(); + void GoDown( + const ary::cpp::Namespace & + i_rNsp ); + void GoDown( + const ary::cpp::Class & + i_rClass ); + void GoUp(); +}; + +InNamespaceTree::InNamespaceTree( const ary::cpp::Namespace & i_rNsp ) + : // aNamespaces, + // aClasses, + pCe(0), + eType(t_unknown) +{ + aNamespaces.push( &i_rNsp ); +} + +InNamespaceTree::~InNamespaceTree() +{ +} + +void +InNamespaceTree::GoDown( const ary::cpp::Namespace & i_rNsp ) +{ + aNamespaces.push(&i_rNsp); + aClasses.erase_all(); + pCe = 0; + eType = t_unknown; +} + +void +InNamespaceTree::GoDown( const ary::cpp::Class & i_rClass ) +{ + aClasses.push(&i_rClass); + pCe = 0; + eType = t_unknown; +} + +void +InNamespaceTree::GoUp() +{ + if ( NOT aClasses.empty() ) + aClasses.pop(); + else + aNamespaces.pop(); + pCe = 0; + eType = t_unknown; +} + +struct InIndex +{ + char cLetter; + + InIndex() : cLetter('A') {} +}; + + +} // anonymous namespace + + + + + +struct OuputPage_Environment::CheshireCat +{ + csv::ploc::Path aOutputRoot; + csv::ploc::Path aMyPath; + csv::StreamStr aFileName; + + const ary::cpp::Gate * + pGate; + const display::CorporateFrame * + pLayout; + intt nDepth; + + Dyn<InNamespaceTree> + pInNamespace; + Dyn<InIndex> pInIndex; + + CheshireCat( + const csv::ploc::Path & + io_rOutputDir, + const ary::cpp::Gate & + i_rGate, + const display::CorporateFrame & + i_rLayout ); + ~CheshireCat(); + void AddQualifiedName2Path( + const ary::cpp::CodeEntity & + i_rCe, + bool i_bIncludeLocalName ); + + const Dyn<InNamespaceTree> & + NspEnv() const { return pInNamespace; } + Dyn<InNamespaceTree> & + NspEnv() { return pInNamespace; } + const ary::cpp::Namespace * + Namespace() const { return pInNamespace ? pInNamespace->aNamespaces.top() : 0; } + const ary::cpp::Class * + Class() const { return pInNamespace ? (pInNamespace->aClasses.empty() ? 0 : pInNamespace->aClasses.top()) : 0; } +}; + +OuputPage_Environment:: +CheshireCat::CheshireCat( const csv::ploc::Path & io_rOutputDir, + const ary::cpp::Gate & i_rGate, + const display::CorporateFrame & i_rLayout ) + : aOutputRoot(io_rOutputDir), + aMyPath(io_rOutputDir), + aFileName(500), + pGate(&i_rGate), + pLayout(&i_rLayout), + nDepth(0), + pInNamespace(), + pInIndex() +{ +} + +OuputPage_Environment:: +CheshireCat::~CheshireCat() +{ +} + +void +OuputPage_Environment:: +CheshireCat::AddQualifiedName2Path( const ary::cpp::CodeEntity & i_rCe, + bool i_bIncludeLocalName ) +{ + if (NOT i_rCe.Owner().IsValid()) + { + aMyPath.DirChain().PushBack( C_sCppDir ); + return; + } + + const ary::cpp::CodeEntity & + rParent = pGate->Ces().Find_Ce( i_rCe.Owner() ); + AddQualifiedName2Path( rParent, true ); + + if ( i_bIncludeLocalName ) + aMyPath.DirChain().PushBack( i_rCe.LocalName() ); +} + + + +//************************ OuputPage_Environment ********************// + +OuputPage_Environment::OuputPage_Environment( const csv::ploc::Path & io_rOutputDir, + const ary::cpp::Gate & i_rGate, + const display::CorporateFrame & i_rLayout ) + : pi( new CheshireCat(io_rOutputDir, i_rGate, i_rLayout) ) +{ +} + +OuputPage_Environment::~OuputPage_Environment() +{ +} + +void +OuputPage_Environment::MoveDir_2Root() +{ + pi->NspEnv() = 0; + pi->pInIndex = 0; + pi->nDepth = 0; + while ( pi->aMyPath.DirChain().Size() > pi->aOutputRoot.DirChain().Size() ) + pi->aMyPath.DirChain().PopBack(); + pi->aMyPath.SetFile(String ::Null_()); +} + +void +OuputPage_Environment::MoveDir_2Names() +{ + pi->NspEnv() = new InNamespaceTree( Gate().Ces().GlobalNamespace() ); + pi->aMyPath.DirChain().PushBack( C_sCppDir ); + pi->aMyPath.SetFile(String ::Null_()); + ++pi->nDepth; + + CreateDirectory( pi->aMyPath ); +} + +void +OuputPage_Environment::MoveDir_Down2( const ary::cpp::Namespace & i_rNsp ) +{ + csv_assert(i_rNsp.Depth() > 0); + csv_assert( pi->NspEnv() ); + csv_assert( pi->Namespace()->CeId() == i_rNsp.Owner() ); + + pi->NspEnv()->GoDown( i_rNsp ); + pi->aMyPath.DirChain().PushBack(i_rNsp.LocalName()); + ++pi->nDepth; + pi->aMyPath.SetFile(String ::Null_()); + + CreateDirectory( pi->aMyPath ); +} + +void +OuputPage_Environment::MoveDir_Down2( const ary::cpp::Class & i_rClass ) +{ + csv_assert( pi->NspEnv() ); + if ( i_rClass.Protection() == ary::cpp::PROTECT_global ) + { + csv_assert( pi->Namespace()->CeId() == i_rClass.Owner() ); + } + else + { + csv_assert( pi->Class() != 0 ); + csv_assert( pi->Class()->CeId() == i_rClass.Owner() ); + } + + pi->NspEnv()->GoDown(i_rClass); + pi->aMyPath.DirChain().PushBack(i_rClass.LocalName()); + pi->aMyPath.SetFile(String ::Null_()); + ++pi->nDepth; + + CreateDirectory( pi->aMyPath ); +} + +void +OuputPage_Environment::MoveDir_2Index() +{ + MoveDir_2Root(); + pi->pInIndex = new InIndex; + pi->aMyPath.DirChain().PushBack( String (C_sDIR_Index) ); + pi->aMyPath.SetFile(String ::Null_()); + pi->nDepth = 1; + + CreateDirectory( pi->aMyPath ); +} + +void +OuputPage_Environment::MoveDir_Up() +{ + if ( pi->nDepth == 1 ) + { + MoveDir_2Root(); + return; + } + else if ( pi->NspEnv() ) + { + pi->NspEnv()->GoUp(); + pi->aMyPath.DirChain().PopBack(); + pi->aMyPath.SetFile(String ::Null_()); + --pi->nDepth; + } +} + +void +OuputPage_Environment::SetFile_Css() +{ + pi->aMyPath.SetFile( C_sHFN_Css ); +} + +void +OuputPage_Environment::SetFile_Overview() +{ + pi->aMyPath.SetFile( C_sHFN_Overview ); +} + +void +OuputPage_Environment::SetFile_AllDefs() +{ + // Provisorium + pi->aMyPath.SetFile("def-all.html"); +} + +void +OuputPage_Environment::SetFile_Index( char i_cLetter ) +{ + csv_assert( 'A' <= i_cLetter AND i_cLetter <= 'Z' OR i_cLetter == '_' ); + + static StreamStr sIndexFileName(40); + sIndexFileName.seekp(0); + sIndexFileName << "index-"; + if ( i_cLetter == '_' ) + { + sIndexFileName << "27"; + } + else + { + sIndexFileName << int(i_cLetter -'A' + 1); + } + sIndexFileName << ".html"; + + pi->aMyPath.SetFile( sIndexFileName.c_str() ); +} + +void +OuputPage_Environment::SetFile_Help() +{ + pi->aMyPath.SetFile( C_sHFN_Help ); +} + +void +OuputPage_Environment::SetFile_CurNamespace() +{ + csv_assert( pi->NspEnv() ); + pi->aMyPath.SetFile("index.html"); + pi->NspEnv()->pCe = pi->Namespace(); + pi->NspEnv()->eType = InNamespaceTree::t_namespace; +} + +void +OuputPage_Environment::SetFile_Class( const ary::cpp::Class & i_rClass ) +{ + csv_assert( pi->NspEnv() ); + pi->aMyPath.SetFile( ClassFileName(i_rClass.LocalName()) ); + pi->NspEnv()->pCe = &i_rClass; + pi->NspEnv()->eType = InNamespaceTree::t_type; +} + +void +OuputPage_Environment::SetFile_Enum( const ary::cpp::Enum & i_rEnum ) +{ + csv_assert( pi->NspEnv() ); + pi->aMyPath.SetFile( EnumFileName(i_rEnum.LocalName()) ); + pi->NspEnv()->pCe = &i_rEnum; + pi->NspEnv()->eType = InNamespaceTree::t_type; +} + +void +OuputPage_Environment::SetFile_Typedef( const ary::cpp::Typedef & i_rTypedef ) +{ + csv_assert( pi->NspEnv() ); + pi->aMyPath.SetFile( TypedefFileName(i_rTypedef.LocalName()) ); + pi->NspEnv()->pCe = &i_rTypedef; + pi->NspEnv()->eType = InNamespaceTree::t_type; +} + +void +OuputPage_Environment::SetFile_Operations( const ary::loc::File * i_pFile ) +{ + csv_assert( pi->NspEnv() ); + if ( CurClass() != 0 ) + pi->aMyPath.SetFile( "o.html" ); + else + { + csv_assert( i_pFile != 0 ); + pi->aMyPath.SetFile( HtmlFileName("o-", i_pFile->LocalName()) ); + } + pi->NspEnv()->pCe = 0; + pi->NspEnv()->eType = InNamespaceTree::t_operations; +} + +void +OuputPage_Environment::SetFile_Data( const ary::loc::File * i_pFile ) +{ + csv_assert( pi->NspEnv() ); + if ( CurClass() != 0 ) + pi->aMyPath.SetFile( "d.html" ); + else + { + csv_assert( i_pFile != 0 ); + pi->aMyPath.SetFile( HtmlFileName("d-", i_pFile->LocalName()) ); + } + pi->NspEnv()->pCe = 0; + pi->NspEnv()->eType = InNamespaceTree::t_data; +} + +const ary::cpp::Namespace * +OuputPage_Environment::CurNamespace() const +{ + return pi->Namespace(); +} + +const ary::cpp::Class * +OuputPage_Environment::CurClass() const +{ + return pi->Class(); +} + +const csv::ploc::Path & +OuputPage_Environment::CurPath() const +{ + return pi->aMyPath; +} + +const ary::cpp::Gate & +OuputPage_Environment::Gate() const +{ + return *pi->pGate; +} + +const display::CorporateFrame & +OuputPage_Environment::Layout() const +{ + return *pi->pLayout; +} + +uintt +OuputPage_Environment::Depth() const +{ + return static_cast<uintt>(pi->nDepth); +} + +const String & +OuputPage_Environment::RepositoryTitle() const +{ + return Gate().RepositoryTitle(); +} diff --git a/autodoc/source/display/html/opageenv.hxx b/autodoc/source/display/html/opageenv.hxx new file mode 100644 index 000000000000..735f17ee98c4 --- /dev/null +++ b/autodoc/source/display/html/opageenv.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: opageenv.hxx,v $ + * $Revision: 1.6 $ + * + * 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 ADC_DISPLAY_HTML_OPAGEENV_HXX +#define ADC_DISPLAY_HTML_OPAGEENV_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <cosv/ploc.hxx> + // PARAMETERS + +namespace ary +{ + namespace cpp + { + class Gate; + + class Namespace; + class Class; + class Enum; + class Typedef; + } + namespace loc + { + class File; + } +} +namespace display +{ + class CorporateFrame; +} + +class OuputPage_Environment +{ + public: + // LIFECYCLE + OuputPage_Environment( + const csv::ploc::Path & + io_rOutputDir, + const ary::cpp::Gate & + i_rGate, + const display::CorporateFrame & + i_rLayout ); + ~OuputPage_Environment(); + + // OPERATIONS + void MoveDir_2Root(); + void MoveDir_2Names(); + void MoveDir_Down2( /// Only one level. + const ary::cpp::Namespace & + i_rNsp ); + void MoveDir_Down2( /// Only one level. + const ary::cpp::Class & + i_rClass ); + void MoveDir_2Index(); + void MoveDir_Up(); + + void SetFile_Css(); + void SetFile_Overview(); + void SetFile_AllDefs(); + void SetFile_Index( + char i_cLetter ); + void SetFile_Help(); + void SetFile_CurNamespace(); + void SetFile_Class( + const ary::cpp::Class & + i_rClass ); + void SetFile_Enum( + const ary::cpp::Enum & + i_rEnum ); + void SetFile_Typedef( + const ary::cpp::Typedef & + i_typedef ); + void SetFile_Operations( + const ary::loc::File * + i_pFile = 0 ); /// Only needed for global functions. + void SetFile_Data( + const ary::loc::File * + i_pFile = 0 ); /// Only needed for global variables. + // INQUIRY + const ary::cpp::Namespace * + CurNamespace() const; + const ary::cpp::Class * + CurClass() const; + const csv::ploc::Path & + CurPath() const; + const ary::cpp::Gate & + Gate() const; + const display::CorporateFrame & + Layout() const; + uintt Depth() const; + const String & RepositoryTitle() const; + + private: + struct CheshireCat; + Dyn<CheshireCat> pi; +}; + + + + +#endif diff --git a/autodoc/source/display/html/outfile.cxx b/autodoc/source/display/html/outfile.cxx new file mode 100644 index 000000000000..f6fe8ab9b613 --- /dev/null +++ b/autodoc/source/display/html/outfile.cxx @@ -0,0 +1,395 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: outfile.cxx,v $ + * $Revision: 1.11 $ + * + * 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 "outfile.hxx" + +// NOT FULLY DECLARED SERVICES +#include <cosv/file.hxx> +#include <udm/html/htmlitem.hxx> +#include <toolkit/out_position.hxx> +#include "strconst.hxx" + + +namespace +{ +bool bUse_OOoFrameDiv = true; +const String C_sOOoFrameDiv_CppId("adc-cppref"); +} + + +using namespace csi; +using csi::xml::AnAttribute; + + + +#define CRLF "\n" + +const char * const + C_sStdStyle = + "body { background-color:#ffffff; }"CRLF + "h1 { font-size:20pt; margin-top:3pt; margin-bottom:7pt; }"CRLF + "h2 { font-family:Arial; font-size:16pt; margin-top:3pt; margin-bottom:5pt; }"CRLF + "h3 { font-size:13pt; margin-top:2pt; margin-bottom:3pt; }"CRLF + "h4 { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF + "dl { margin-top:1pt; margin-bottom:1pt; }"CRLF + "dl.member { margin-top:1pt; margin-bottom:1pt; background-color:#eeeeff; }"CRLF + "dt { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF + "dt.member { font-size:13pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF + "dt.simple { font-size:10pt; font-weight:normal; margin-top:2pt; margin-bottom:1pt; }"CRLF + "dd { font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF + "dd.member { font-size:10pt; margin-top:1pt; margin-bottom:1pt; background-color:#ffffff; }"CRLF + "p { font-size:10pt; margin-top:3pt; margin-bottom:1pt; }"CRLF + "pre { font-family:monospace; font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF + "tr { font-size:10pt; }"CRLF + "td { font-size:10pt; }"CRLF + CRLF + "dt.attention { color:#dd0000; }"CRLF + CRLF + "div.title { text-align:center; line-height:26pt; background-color:#ccccff; }"CRLF + ".subtitle { background-color:#ccccff; }"CRLF + CRLF + "td.flagname { background-color:#eeeeff; font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF + "td.flagyes { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF + "td.flagno { font-family:Arial; font-size:8pt; }"CRLF + "td.flagtext { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF + CRLF + "td.navimain, td.navimain a"CRLF + " { background-color:#eeeeff; color:#000000;"CRLF + " font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF + "td.navimainself"CRLF + " { background-color:#2222ad; color:#ffffff;"CRLF + " font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF + "td.navimainnone"CRLF + " { background-color:#eeeeff; color:#000000;"CRLF + " font-family:Arial; font-size:12pt; }"CRLF + CRLF + "div.define { font-family:Arial; background-color:#ccccff; }"CRLF + CRLF + ".nqclass { color:#008800; }"CRLF + CRLF + "h3.help { background-color:#eeeeff; margin-top:12pt; }"CRLF + CRLF + ".btpubl { color:#33ff33; }"CRLF + ".btprot { color:#cc9933; }"CRLF + ".btpriv { color:#ff6666; }"CRLF + ".btvpubl { color:#33ff33; font-style:italic; }"CRLF + ".btvprot { color:#cc9933; font-style:italic; }"CRLF + ".btvpriv { color:#ff6666; font-style:italic; }"CRLF + ".btself { font-weight:bold; }"CRLF + ; + + +const char * const + C_sCssExplanations = + "/* Explanation of CSS classes:"CRLF + CRLF + "dl.member provides coloured frame for function descriptions."CRLF + "dd.member makes the content of this frame white"CRLF + CRLF + "dt.attention special colour for @attention remarks"CRLF + CRLF + "div.title HTML page headline"CRLF + ".subtitle headline of lists of members and similar"CRLF + CRLF + " These are for the flagtables in classes:"CRLF + "td.flagname Flag name."CRLF + "td.flagyes flag value \"yes\""CRLF + "td.flagno flag value \"no\""CRLF + "td.flagtext other flag value"CRLF + CRLF + CRLF + " These are for the main navigationbar:"CRLF + "td.navimain, td.navimain a"CRLF + " Links in navibar."CRLF + "td.navimainself Text in navibar which refers to current page."CRLF + "td.navimainnone Text which links to nothing."CRLF + CRLF + CRLF + "div.define Subtitles on the #define/macro descriptions page"CRLF + CRLF + ".nqclass special color for classes in the qualification"CRLF + " on top of type pages like in:"CRLF + " ::nsp1::nsp2::_ClassXY_::"CRLF + CRLF + "h3.help Subtitles on the help page"CRLF + CRLF + " These are for the base class tree on class pages:"CRLF + ".btpubl public base class"CRLF + ".btprot protected"CRLF + ".btpriv private"CRLF + ".btvpubl virtual public"CRLF + ".btvprot virtual protected"CRLF + ".btvpriv virtual private"CRLF + ".btself placeholder for currently displayed class"CRLF + CRLF + "*/"CRLF + ; + + +const char * const + C_sStdStyle_withDivFrame = + "body { background-color:#ffffff; }"CRLF + "#adc-cppref h1 { font-size:20pt; margin-top:3pt; margin-bottom:7pt; }"CRLF + "#adc-cppref h2 { font-family:Arial; font-size:16pt; margin-top:3pt; margin-bottom:5pt; }"CRLF + "#adc-cppref h3 { font-size:13pt; margin-top:2pt; margin-bottom:3pt; }"CRLF + "#adc-cppref h4 { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF + "#adc-cppref dl { margin-top:1pt; margin-bottom:1pt; }"CRLF + "#adc-cppref dl.member { margin-top:1pt; margin-bottom:1pt; background-color:#eeeeff; }"CRLF + "#adc-cppref dt { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF + "#adc-cppref dt.member { font-size:13pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF + "#adc-cppref dt.simple { font-size:10pt; font-weight:normal; margin-top:2pt; margin-bottom:1pt; }"CRLF + "#adc-cppref dd { font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF + "#adc-cppref dd.member { font-size:10pt; margin-top:1pt; margin-bottom:1pt; background-color:#ffffff; }"CRLF + "#adc-cppref p { font-size:10pt; margin-top:3pt; margin-bottom:1pt; }"CRLF + "#adc-cppref pre { font-family:monospace; font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF + "#adc-cppref tr { font-size:10pt; }"CRLF + "#adc-cppref td { font-size:10pt; }"CRLF + CRLF + "#adc-cppref dt.attention { color:#dd0000; }"CRLF + CRLF + "#adc-cppref div.title { text-align:center; line-height:26pt; background-color:#ccccff; }"CRLF + "#adc-cppref .subtitle { background-color:#ccccff; }"CRLF + CRLF + "#adc-cppref td.flagname { background-color:#eeeeff; font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF + "#adc-cppref td.flagyes { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF + "#adc-cppref td.flagno { font-family:Arial; font-size:8pt; }"CRLF + "#adc-cppref td.flagtext { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF + CRLF + "#adc-cppref td.navimain, #adc-cppref td.navimain a"CRLF + " { background-color:#eeeeff; color:#000000;"CRLF + " font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF + "#adc-cppref td.navimainself"CRLF + " { background-color:#2222ad; color:#ffffff;"CRLF + " font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF + "#adc-cppref td.navimainnone"CRLF + " { background-color:#eeeeff; color:#000000;"CRLF + " font-family:Arial; font-size:12pt; }"CRLF + CRLF + "#adc-cppref div.define { font-family:Arial; background-color:#ccccff; }"CRLF + CRLF + "#adc-cppref .nqclass { color:#008800; }"CRLF + CRLF + "#adc-cppref h3.help { background-color:#eeeeff; margin-top:12pt; }"CRLF + CRLF + "#adc-cppref .btpubl { color:#33ff33; }"CRLF + "#adc-cppref .btprot { color:#cc9933; }"CRLF + "#adc-cppref .btpriv { color:#ff6666; }"CRLF + "#adc-cppref .btvpubl { color:#33ff33; font-style:italic; }"CRLF + "#adc-cppref .btvprot { color:#cc9933; font-style:italic; }"CRLF + "#adc-cppref .btvpriv { color:#ff6666; font-style:italic; }"CRLF + "#adc-cppref .btself { font-weight:bold; }"CRLF + ""CRLF + "#adc-cppref table { empty-cells:show; }"CRLF + ""CRLF + "#adc-cppref .childlist td, "CRLF + "#adc-cppref .commentedlinks td, "CRLF + "#adc-cppref .memberlist td, "CRLF + "#adc-cppref .subtitle td, "CRLF + "#adc-cppref .crosstitle td { border: .1pt solid #000000; }"CRLF + ""CRLF + "#adc-cppref .flag-table td { border: .1pt solid #cccccc; } "CRLF + ""CRLF + "#adc-cppref .title-table td, "CRLF + "#adc-cppref .table-in-method td, "CRLF + "#adc-cppref .table-in-data td, "CRLF + "#adc-cppref .navimain td, "CRLF + "#adc-cppref .navisub td, "CRLF + "#adc-cppref .expl-table td, "CRLF + "#adc-cppref .param-table td { border: none; }"CRLF + ; + + + +HtmlDocuFile::HtmlDocuFile() + : sFilePath(), + sTitle(), + sLocation(), + sCopyright(), + nDepthInOutputTree(0), + aBodyData(), + aBuffer(60000) // Grows dynamically when necessary. +{ +} + +void +HtmlDocuFile::SetLocation( const csv::ploc::Path & i_rFilePath, + uintt i_depthInOutputTree ) +{ + static StreamStr sPath_(1000); + sPath_.seekp(0); + i_rFilePath.Get( sPath_ ); + + sFilePath = sPath_.c_str(); + nDepthInOutputTree = i_depthInOutputTree; +} + +void +HtmlDocuFile::SetTitle( const char * i_sTitle ) +{ + sTitle = i_sTitle; +} + +void +HtmlDocuFile::SetCopyright( const char * i_sCopyright ) +{ + sCopyright = i_sCopyright; +} + +void +HtmlDocuFile::EmptyBody() +{ + aBodyData.SetContent(0); + + if (bUse_OOoFrameDiv) + { + // Insert <div> tag to allow better formatting for OOo. + aBodyData + << new xml::XmlCode("<div id=\"") + << new xml::XmlCode(C_sOOoFrameDiv_CppId) + << new xml::XmlCode("\">\n\n"); + } + + aBodyData + >> *new html::Label( "_top_" ) + << " "; +} + +bool +HtmlDocuFile::CreateFile() +{ + csv::File aFile(sFilePath, csv::CFM_CREATE); + if (NOT aFile.open()) + { + Cerr() << "Can't create file " << sFilePath << "." << Endl(); + return false; + } + + WriteHeader(aFile); + WriteBody(aFile); + + // Write end + static const char sCompletion[] = "\n</html>\n"; + aFile.write( sCompletion ); + + aFile.close(); + Cout() << '.' << Flush(); + return true; +} + +void +HtmlDocuFile::WriteCssFile( const csv::ploc::Path & i_rFilePath ) +{ + Cout() << "\nCreate css file ..." << Endl(); + + csv::File + aCssFile(i_rFilePath, csv::CFM_CREATE); + csv::OpenCloseGuard + aOpenGuard(aCssFile); + if (NOT aOpenGuard) + { + Cerr() << "Can't create file " << "cpp.css" << "." << Endl(); + return; + } + + aCssFile.write("/* Autodoc css file for C++ documentation */\n\n\n"); + + if (bUse_OOoFrameDiv) + aCssFile.write(C_sStdStyle_withDivFrame); + else + aCssFile.write(C_sStdStyle); + + aCssFile.write("\n\n\n"); + aCssFile.write(C_sCssExplanations); +} + +void +HtmlDocuFile::WriteHeader( csv::File & io_aFile ) +{ + aBuffer.reset(); + + static const char s1[] = + "<html>\n<head>\n" + "<title>"; + static const char s2[] = + "</title>\n" + "<link rel=\"stylesheet\" type=\"text/css\" href=\""; + static const char s3[] = + "\">\n</head>\n"; + + aBuffer.write( s1 ); + aBuffer.write( sTitle ); + aBuffer.write( s2 ); + aBuffer.write( output::get_UpLink(nDepthInOutputTree) ); + aBuffer.write( C_sHFN_Css ); + aBuffer.write( s3 ); + + io_aFile.write(aBuffer.c_str(), aBuffer.size()); +} + +void +HtmlDocuFile::WriteBody( csv::File & io_aFile ) +{ + aBuffer.reset(); + + aBodyData + >> *new html::Link( "#_top_" ) + << new html::ClassAttr( "objchapter" ) + << "Top of Page"; + + if ( sCopyright.length() > 0 ) + { + aBodyData +#ifndef COMPATIBLE_NETSCAPE_47 + >> *new html::HorizontalLine + << new html::SizeAttr( "3" ); +#else + << new xml::XmlCode("<hr size=\"3\">"); +#endif + + aBodyData + >> *new html::Paragraph + << new html::ClassAttr( "copyright" ) + << new xml::AnAttribute( "align", "center" ) + << new xml::XmlCode(sCopyright); + } + + if (bUse_OOoFrameDiv) + { + // Insert <div> tag to allow better formatting for OOo. + aBodyData + << new xml::XmlCode("\n</div> <!-- id=\"") + << new xml::XmlCode(C_sOOoFrameDiv_CppId) + << new xml::XmlCode("\" -->\n"); + } + + aBodyData.WriteOut(aBuffer); + io_aFile.write(aBuffer.c_str(), aBuffer.size()); +} diff --git a/autodoc/source/display/html/outfile.hxx b/autodoc/source/display/html/outfile.hxx new file mode 100644 index 000000000000..535147332efb --- /dev/null +++ b/autodoc/source/display/html/outfile.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: outfile.hxx,v $ + * $Revision: 1.6 $ + * + * 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 ADC_DISPLAY_HTML_OUTFILE_HXX +#define ADC_DISPLAY_HTML_OUTFILE_HXX + +// USED SERVICES +#include <udm/html/htmlitem.hxx> +#include <cosv/ploc.hxx> + + +namespace csv +{ + class File; +} + + + + +class HtmlDocuFile +{ + public: + // LIFECYCLE + HtmlDocuFile(); + + void SetLocation( + const csv::ploc::Path & + i_rFilePath, + uintt i_depthInOutputTree ); + void SetTitle( + const char * i_sTitle ); + void SetCopyright( + const char * i_sCopyright ); + void EmptyBody(); + + Html::Body & Body() { return aBodyData; } + bool CreateFile(); + + static void WriteCssFile( + const csv::ploc::Path & + i_rFilePath ); + private: + void WriteHeader( + csv::File & io_aFile ); + void WriteBody( + csv::File & io_aFile ); + + // DATA + String sFilePath; + String sTitle; + String sLocation; + String sCopyright; + uintt nDepthInOutputTree; + + Html::Body aBodyData; + StreamStr aBuffer; // Output buffer, should be transfered into csv::File. +}; + + + + +#endif diff --git a/autodoc/source/display/html/pagemake.cxx b/autodoc/source/display/html/pagemake.cxx new file mode 100644 index 000000000000..7497ce782e80 --- /dev/null +++ b/autodoc/source/display/html/pagemake.cxx @@ -0,0 +1,579 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pagemake.cxx,v $ + * $Revision: 1.7 $ + * + * 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 "pagemake.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <ary/loc/loc_file.hxx> +#include <display/corframe.hxx> +#include "hd_chlst.hxx" +#include "hd_docu.hxx" +#include "hdimpl.hxx" +#include "html_kit.hxx" +#include "navibar.hxx" +#include "opageenv.hxx" +#include "outfile.hxx" +#include "pm_aldef.hxx" +#include "pm_class.hxx" +#include "pm_help.hxx" +#include "pm_index.hxx" +#include "pm_namsp.hxx" +#include "pm_start.hxx" +#include "strconst.hxx" + + +using namespace csi; +using csi::html::Link; +using csi::html::HorizontalLine; + + +const int C_nNrOfIndexLetters = 27; + + +template <class SPECIAL_MAKER> +inline void +Make_SpecialPage( DYN SPECIAL_MAKER * let_dpMaker ) +{ + Dyn< SPECIAL_MAKER > pMaker( let_dpMaker ); + pMaker->MakePage(); + pMaker = 0; +} + + +PageDisplay::PageDisplay( OuputPage_Environment & io_rEnv ) + : HtmlDisplay_Impl( io_rEnv ), + pMyFile( new HtmlDocuFile ) +{ +} + +PageDisplay::~PageDisplay() +{ + +} + +void +PageDisplay::Create_OverviewFile() +{ + Env().SetFile_Overview(); + File().SetLocation( Env().CurPath(), 0 ); + + SetupFileOnCurEnv( C_sHFTitle_Overview ); + Make_SpecialPage( new PageMaker_Overview(*this) ); + Create_File(); +} + +void +PageDisplay::Create_AllDefsFile() +{ + // This method is a provisorium, because later this will + // be spreaded over the files. + + Env().MoveDir_2Root(); + Env().SetFile_AllDefs(); + File().SetLocation( Env().CurPath(), 0 ); + + SetupFileOnCurEnv( "Defines and Macros" ); + Make_SpecialPage( new PageMaker_AllDefs(*this) ); + Create_File(); +} + +void +PageDisplay::Create_IndexFiles() +{ + Env().MoveDir_2Index(); + + for ( int i = 0; i < C_nNrOfIndexLetters; ++i ) + Create_IndexFile(i); +} + +void +PageDisplay::Create_HelpFile() +{ + Env().SetFile_Help(); + File().SetLocation( Env().CurPath(), 0 ); + + SetupFileOnCurEnv( C_sHFTitle_Help ); + Make_SpecialPage( new PageMaker_Help(*this) ); + Create_File(); +} + +void +PageDisplay::Create_NamespaceFile() +{ + csv_assert( Env().CurNamespace() != 0 ); + Env().SetFile_CurNamespace(); + File().SetLocation( Env().CurPath(), Env().Depth() ); + if (Env().CurNamespace()->Owner().IsValid()) + { + StreamLock sNsp(100); + SetupFileOnCurEnv( sNsp() << C_sHFTypeTitle_Namespace + << " " + << Env().CurNamespace()->LocalName() + << c_str ); + } + else + { + SetupFileOnCurEnv( C_sHFTitle_GlobalNamespaceCpp ); + } + + Make_SpecialPage( new PageMaker_Namespace(*this) ); + + Create_File(); +} + +void +PageDisplay::Setup_OperationsFile_for( const ary::loc::File & i_rFile ) +{ + csv_assert( Env().CurNamespace() != 0 ); + Env().SetFile_Operations(&i_rFile); + File().SetLocation( Env().CurPath(), Env().Depth() ); + + StreamLock sOpFile(100); + SetupFileOnCurEnv( sOpFile() << "Global Functions in Namespace " + << Env().CurNamespace()->LocalName() + << " in Sourcefile " + << i_rFile.LocalName() + << c_str ); + NavigationBar + aNavi( Env(), + NavigationBar::CEGT_operations ); + aNavi.Write( CurOut() ); + CurOut() << new HorizontalLine; + + adcdisp::PageTitle_Std fTitle; + csi::xml::Element & rTitle = fTitle( CurOut() ); + if (Env().CurNamespace()->Owner().IsValid()) + { + rTitle << "Global Functions in Namespace " + << Env().CurNamespace()->LocalName(); + } + else + { + rTitle << "Global Functions in Global Namespace C++"; + } + + rTitle << new html::LineBreak + << "in Sourcefile " + << i_rFile.LocalName(); + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Setup_OperationsFile_for( const ary::cpp::Class & i_rClass ) +{ + csv_assert( Env().CurNamespace() != 0 ); + Env().SetFile_Operations(0); + File().SetLocation( Env().CurPath(), Env().Depth() ); + + StreamLock sOpFile(100); + SetupFileOnCurEnv( sOpFile() << "Methods of Class " + << i_rClass.LocalName() + << c_str ); + NavigationBar + aNavi( Env(), + NavigationBar::CEGT_operations ); + aNavi.Write( CurOut() ); + CurOut() << new HorizontalLine; + + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), "Methods of Class", i_rClass.LocalName() ); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Setup_DataFile_for( const ary::loc::File & i_rFile ) +{ + csv_assert( Env().CurNamespace() != 0 ); + Env().SetFile_Data(&i_rFile); + File().SetLocation( Env().CurPath(), Env().Depth() ); + + StreamLock sDataFile(100); + SetupFileOnCurEnv( sDataFile() << "Global Data in Namespace " + << Env().CurNamespace()->LocalName() + << " in Sourcefile " + << i_rFile.LocalName() + << c_str ); + NavigationBar + aNavi( Env(), + NavigationBar::CEGT_data ); + aNavi.Write( CurOut() ); + CurOut() << new HorizontalLine; + + adcdisp::PageTitle_Std fTitle; + csi::xml::Element & rTitle = fTitle( CurOut() ); + if ( Env().CurNamespace()->Owner().IsValid() ) + { + rTitle << "Global Data in Namespace " + << Env().CurNamespace()->LocalName(); + } + else + { + rTitle << "Global Data in Global Namespace C++"; + } + + rTitle + << new html::LineBreak + << "in Sourcefile " + << i_rFile.LocalName(); + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Setup_DataFile_for( const ary::cpp::Class & i_rClass ) +{ + csv_assert( Env().CurNamespace() != 0 ); + Env().SetFile_Data(0); + File().SetLocation( Env().CurPath(), Env().Depth() ); + + StreamLock sDataFile(100); + SetupFileOnCurEnv( sDataFile() << "Data of Class " + << i_rClass.LocalName() + << c_str ); + + NavigationBar + aNavi( Env(), + NavigationBar::CEGT_data ); + aNavi.Write( CurOut() ); + CurOut() << new HorizontalLine; + + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), "Data of Class", i_rClass.LocalName() ); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Create_File() +{ + Easy().Leave(); + File().CreateFile(); +} + +void +PageDisplay::do_Process(const ary::cpp::Class & i_rData) +{ + Env().SetFile_Class(i_rData); + File().SetLocation( Env().CurPath(), Env().Depth() ); + + const char * + sTypeTitle = i_rData.ClassKey() == ary::cpp::CK_class + ? C_sHFTypeTitle_Class + : i_rData.ClassKey() == ary::cpp::CK_struct + ? C_sHFTypeTitle_Struct + : C_sHFTypeTitle_Union; + StreamLock sClassFile(60); + SetupFileOnCurEnv( sClassFile() << sTypeTitle + << " " + << i_rData.LocalName() + << c_str ); + + Make_SpecialPage( new PageMaker_Class(*this, i_rData) ); + + Create_File(); +} + +void +PageDisplay::do_Process(const ary::cpp::Enum & i_rData) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + Env().SetFile_Enum(i_rData); + File().SetLocation( Env().CurPath(), Env().Depth() ); + + StreamLock sEnumFile(100); + SetupFileOnCurEnv( sEnumFile() << C_sHFTypeTitle_Enum + << " " + << i_rData.LocalName() + << c_str ); + Write_NavBar_Enum(i_rData); + Write_TopArea_Enum(i_rData); + Write_DocuArea_Enum(i_rData); + Write_ChildList_Enum(i_rData); + + Create_File(); +} + +void +PageDisplay::do_Process(const ary::cpp::Typedef & i_rData) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + Env().SetFile_Typedef(i_rData); + File().SetLocation( Env().CurPath(), Env().Depth() ); + + StreamLock sTypedefFile(100); + SetupFileOnCurEnv( sTypedefFile() << C_sHFTypeTitle_Typedef + << " " + << i_rData.LocalName() + << c_str ); + Write_NavBar_Typedef(i_rData); + Write_TopArea_Typedef(i_rData); + Write_DocuArea_Typedef(i_rData); + + + Create_File(); +} + +void +PageDisplay::Write_NameChainWithLinks( const ary::cpp::CodeEntity & i_rCe ) +{ + if ( Env().CurNamespace()->Id() != i_rCe.Id() ) + { + RecursiveWrite_NamespaceLink( Env().CurNamespace() ); + if ( Env().CurClass() != 0 ) + { + CurOut() << new html::Sbr; + RecursiveWrite_ClassLink( Env().CurClass(), 1 ); + } + } + else + { + RecursiveWrite_NamespaceLink( Env().CurNamespace()->Parent() ); + } +} + +const ary::cpp::Gate * +PageDisplay::inq_Get_ReFinder() const +{ + return &Env().Gate(); +} + +void +PageDisplay::RecursiveWrite_NamespaceLink( const ary::cpp::Namespace * i_pNamespace ) +{ + if ( i_pNamespace == 0 ) + { + return; + } + else if (NOT i_pNamespace->Owner().IsValid()) + { // Global namespace: + StreamLock sNspDir(50); + CurOut() + >> *new Link( PathPerRoot(Env(), + sNspDir() << C_sDIR_NamespacesCpp + << "/" + << C_sHFN_Namespace + << c_str) ) + << new xml::AnAttribute( "alt", C_sHFTitle_GlobalNamespaceCpp ) + >> *new html::Font + << new html::SizeAttr("+1") + >> *new html::Bold + << "::"; + CurOut() + << " "; + return; + } + else + { + RecursiveWrite_NamespaceLink( i_pNamespace->Parent() ); + } + + uintt nLevelDistance = Env().Depth() - ( i_pNamespace->Depth() + 1 ); + csv_assert( nLevelDistance < 100 ); + CurOut() + >> *new Link( PathPerLevelsUp(nLevelDistance, C_sHFN_Namespace) ) + << new xml::AnAttribute( "alt", C_sHFTypeTitle_Namespace) + >> *new html::Font + << new html::SizeAttr("+1") + >> *new html::Bold + << i_pNamespace->LocalName(); + CurOut() + >> *new html::Font + << new html::SizeAttr("+1") + << " :: "; +} + +void +PageDisplay::RecursiveWrite_ClassLink( const ary::cpp::Class * i_pClass, + uintt i_nLevelDistance ) +{ + if ( i_pClass == 0 ) + return; + + if ( i_pClass->Protection() != ary::cpp::PROTECT_global ) + { + RecursiveWrite_ClassLink( + dynamic_cast< const ary::cpp::Class* >( + Env().Gate().Ces().Search_Ce(i_pClass->Owner())), + i_nLevelDistance + 1 ); + } + + CurOut() + >> *new Link( Path2Class(i_nLevelDistance, i_pClass->LocalName()) ) + << new html::ClassAttr("nqclass") + << i_pClass->LocalName() + << " :: "; +} + +void +PageDisplay::SetupFileOnCurEnv( const char * i_sTitle ) +{ + File().SetLocation( Env().CurPath(), Env().Depth() ); + File().SetTitle( i_sTitle ); + File().SetCopyright( Env().Layout().CopyrightText() ); + File().EmptyBody(); + + // This sets CurOut() to the contents of <body></body> + // in File() : + Easy().Enter( File().Body() ); +} + +void +PageDisplay::Write_NavBar_Enum( const ary::cpp::Enum & i_rData ) +{ + NavigationBar aNavi( Env(), i_rData ); + aNavi.MakeSubRow("List of"); + aNavi.AddItem( C_sTitle_EnumValues, C_sLabel_EnumValues, true ); + aNavi.Write( CurOut(), true ); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Write_TopArea_Enum( const ary::cpp::Enum & i_rData ) +{ + Write_NameChainWithLinks( i_rData ); + + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), C_sHFTypeTitle_Enum, i_rData.LocalName() ); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Write_DocuArea_Enum( const ary::cpp::Enum & i_rData ) +{ + Docu_Display aDocuShow( Env() ); + + aDocuShow.Assign_Out(CurOut()); + aDocuShow.Process(i_rData.Docu()); + aDocuShow.Unassign_Out(); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Write_ChildList_Enum( const ary::cpp::Enum & i_rData ) +{ + bool bChildrenExist = false; + ChildList_Display::Area_Result + aResult( bChildrenExist, CurOut() ); + + ChildList_Display aDisplay(Env(), i_rData); + aDisplay.Run_Simple( aResult, + ary::cpp::Enum::SLOT_Values, + C_sLabel_EnumValues, + C_sTitle_EnumValues ); + + if (NOT bChildrenExist) + CurOut() >> *new html::Headline(4) << "This enum has no values."; + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Write_NavBar_Typedef( const ary::cpp::Typedef & i_rData ) +{ + NavigationBar aNavi( Env(), i_rData ); + aNavi.Write( CurOut(), true ); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Write_TopArea_Typedef( const ary::cpp::Typedef & i_rData ) +{ + Write_NameChainWithLinks( i_rData ); + + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), C_sHFTypeTitle_Typedef, i_rData.LocalName() ); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Write_DocuArea_Typedef( const ary::cpp::Typedef & i_rData ) +{ + adcdisp::ExplanationList aDef( CurOut() ); + aDef.AddEntry("Definition:"); + xml::Element & rDef = aDef.Def(); + + ary::cpp::Type_id + nDefiningType = i_rData.DescribingType(); + + const ary::cpp::CodeEntity * + pRelatedCe = Env().Gate().Search_RelatedCe(nDefiningType); + if ( pRelatedCe != 0 ) + { + const char * sTypeKey = Get_TypeKey(*pRelatedCe); + if ( NOT csv::no_str(sTypeKey) ) + rDef << sTypeKey << " "; + } + + dshelp::Get_LinkedTypeText( rDef, Env(), nDefiningType ); + + Docu_Display aDocuShow( Env() ); + + aDocuShow.Assign_Out(CurOut()); + aDocuShow.Process(i_rData.Docu()); + aDocuShow.Unassign_Out(); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Create_IndexFile( int i_nLetter ) +{ + static char aLetters[C_nNrOfIndexLetters+1] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_"; + csv_assert( 0 <= i_nLetter AND i_nLetter < C_nNrOfIndexLetters ); + + char cCurLetter = aLetters[i_nLetter]; + Env().SetFile_Index( cCurLetter ); + + static char sIndexFileTitle[] = "Global Index X"; + const int nPositionOfLetterInTitle = 13; + sIndexFileTitle[nPositionOfLetterInTitle] = cCurLetter; + SetupFileOnCurEnv( sIndexFileTitle ); + + Make_SpecialPage( new PageMaker_Index(*this, cCurLetter ) ); + + Create_File(); +} + diff --git a/autodoc/source/display/html/pagemake.hxx b/autodoc/source/display/html/pagemake.hxx new file mode 100644 index 000000000000..08e42361b47c --- /dev/null +++ b/autodoc/source/display/html/pagemake.hxx @@ -0,0 +1,167 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pagemake.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HTML_PAGEMAKE_HXX +#define ADC_DISPLAY_HTML_PAGEMAKE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <ary/ary_disp.hxx> +#include <cosv/tpl/processor.hxx> +#include "hdimpl.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/cpp/c_namesp.hxx> + +namespace ary +{ + namespace cpp + { + class Namespace; + class Class; + class Enum; + class Typedef; + } + namespace loc + { + class File; + } +} + + +class OuputPage_Environment; +class HtmlDocuFile; + + + +class PageDisplay : public ary::Display, + public csv::ConstProcessor<ary::cpp::Class>, + public csv::ConstProcessor<ary::cpp::Enum>, + public csv::ConstProcessor<ary::cpp::Typedef>, + public HtmlDisplay_Impl +{ + public: + PageDisplay( + OuputPage_Environment & + io_rEnv ); + virtual ~PageDisplay(); + + void Create_OverviewFile(); + void Create_AllDefsFile(); + void Create_IndexFiles(); + void Create_HelpFile(); + + void Create_NamespaceFile(); + + void Setup_OperationsFile_for( + const ary::loc::File & + i_rFile ); + void Setup_OperationsFile_for( + const ary::cpp::Class & + i_rClass ); + void Setup_DataFile_for( + const ary::loc::File & + i_rFile ); + void Setup_DataFile_for( + const ary::cpp::Class & + i_rClass ); + /// Used with Setup_OperatonsFile_for(). + void Create_File(); + + + // Interface for Children of SpecializedPageMaker: + void Write_NameChainWithLinks( + const ary::cpp::CodeEntity & + i_rCe ); + + // Necessary, to call Process() on this class. + using csv::ConstProcessor<ary::cpp::Class>::Process; + using csv::ConstProcessor<ary::cpp::Enum>::Process; + using csv::ConstProcessor<ary::cpp::Typedef>::Process; + + private: + // Interface csv::ConstProcessor<>: + virtual void do_Process( + const ary::cpp::Class & + i_rData ); + virtual void do_Process( + const ary::cpp::Enum & + i_rData ); + virtual void do_Process( + const ary::cpp::Typedef & + i_rData ); + // Interface ary::cpp::Display: + virtual const ary::cpp::Gate * + inq_Get_ReFinder() const; + // Locals + HtmlDocuFile & File() { return *pMyFile; } + void RecursiveWrite_NamespaceLink( + const ary::cpp::Namespace * + i_pNamespace ); + void RecursiveWrite_ClassLink( + const ary::cpp::Class * + i_pClass, + uintt i_nLevelDistance ); + void SetupFileOnCurEnv( + const char * i_sTitle ); + void Write_NavBar_Enum( + const ary::cpp::Enum & + i_rData ); + void Write_TopArea_Enum( + const ary::cpp::Enum & + i_rData ); + void Write_DocuArea_Enum( + const ary::cpp::Enum & + i_rData ); + void Write_ChildList_Enum( + const ary::cpp::Enum & + i_rData ); + void Write_NavBar_Typedef( + const ary::cpp::Typedef & + i_rData ); + void Write_TopArea_Typedef( + const ary::cpp::Typedef & + i_rData ); + void Write_DocuArea_Typedef( + const ary::cpp::Typedef & + i_rData ); + void Create_IndexFile( + int i_nLetter ); + + // DATA + Dyn<HtmlDocuFile> pMyFile; +}; + + + + +#endif diff --git a/autodoc/source/display/html/pm_aldef.cxx b/autodoc/source/display/html/pm_aldef.cxx new file mode 100644 index 000000000000..291b544d8219 --- /dev/null +++ b/autodoc/source/display/html/pm_aldef.cxx @@ -0,0 +1,248 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pm_aldef.cxx,v $ + * $Revision: 1.7 $ + * + * 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 "pm_aldef.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_define.hxx> +#include <ary/cpp/c_macro.hxx> +#include <ary/cpp/cp_def.hxx> +#include <ary/loc/loc_file.hxx> +#include <ary/loc/locp_le.hxx> +#include <ary/getncast.hxx> +#include "hd_docu.hxx" +#include "html_kit.hxx" +#include "navibar.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" +#include "strconst.hxx" + + +using namespace csi; +using csi::html::HorizontalLine; +using csi::html::Link; +using csi::html::Label; +using csi::html::AlignAttr; + + + +PageMaker_AllDefs::PageMaker_AllDefs( PageDisplay & io_rPage ) + : SpecializedPageMaker(io_rPage), + pDocuDisplay( new Docu_Display(io_rPage.Env()) ), + pNavi(0) +{ +} + +PageMaker_AllDefs::~PageMaker_AllDefs() +{ +} + +void +PageMaker_AllDefs::MakePage() +{ + pNavi = new NavigationBar( Env(), NavigationBar::LOC_AllDefs ); + Write_NavBar(); + + Write_TopArea(); + + Write_DefinesList(); + Write_MacrosList(); + + pNavi->Write_SubRows(); +} + +void +PageMaker_AllDefs::Write_NavBar() +{ + pNavi->MakeSubRow( "" ); + pNavi->AddItem( "Defines", "defines", true ); + pNavi->AddItem( "Macros", "macros", true ); + pNavi->Write( CurOut() ); + CurOut() << new HorizontalLine; +} + +void +PageMaker_AllDefs::Write_TopArea() +{ + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), "Defines and ", "Macros" ); + + CurOut() << new HorizontalLine; +} + +void +PageMaker_AllDefs::Write_DocuArea() +{ + // Not needed. +} + +void +PageMaker_AllDefs::Write_DefinesList() +{ + CurOut() + << new html::LineBreak + << new html::LineBreak + >> *new xml::AnElement("div") + << new html::ClassAttr("define") + >> *new html::Label("defines") + >> *new html::Headline(3) + << "Defines"; + + ary::cpp::DefsResultList + aAllDefines = Env().Gate().Defs().AllDefines(); + ary::cpp::DefsConstIterator + itEnd = aAllDefines.end(); + + if (aAllDefines.begin() != itEnd) + { + for ( ary::cpp::DefsConstIterator it = aAllDefines.begin(); + it != itEnd; + ++it ) + { + Write_Define(*it); + } + } + else + { + CurOut() << "None."; + } + + CurOut() << new HorizontalLine; +} + +void +PageMaker_AllDefs::Write_MacrosList() + +{ + CurOut() + << new html::LineBreak + << new html::LineBreak + >> *new xml::AnElement("div") + << new html::ClassAttr("define") + >> *new html::Label("macros") + >> *new html::Headline(3) + << "Macros"; + + ary::cpp::DefsResultList + aAllMacros = Env().Gate().Defs().AllMacros(); + ary::cpp::DefsConstIterator + itEnd = aAllMacros.end(); + + if (aAllMacros.begin() != itEnd) + { + for ( ary::cpp::DefsConstIterator it = aAllMacros.begin(); + it != itEnd; + ++it ) + { + Write_Macro(*it); + } + } + else + { + CurOut() << "None."; + } + + CurOut() << new HorizontalLine; +} + +void +PageMaker_AllDefs::Write_Define(De_id i_nId) +{ + csv_assert( ary::is_type<ary::cpp::Define>( Env().Gate().Defs().Find_Def(i_nId)) ); + const ary::cpp::Define & + rDef = static_cast< const ary::cpp::Define& >( Env().Gate().Defs().Find_Def(i_nId) ); + + CurOut() << new html::HorizontalLine; + + adcdisp::ExplanationList aDocu( CurOut(), true ); + aDocu.AddEntry(); + + aDocu.Term() + >> *new html::Label( rDef.LocalName() ) + << " "; + aDocu.Term() + << rDef.LocalName(); + + Write_DefsDocu( aDocu.Def(), rDef ); +} + +void +PageMaker_AllDefs::Write_Macro(De_id i_nId) +{ + csv_assert( Env().Gate().Defs().Find_Def(i_nId).AryClass() == ary::cpp::Macro::class_id ); + const ary::cpp::Macro & + rDef = static_cast< const ary::cpp::Macro& >( Env().Gate().Defs().Find_Def(i_nId) ); + + CurOut() << new html::HorizontalLine; + + adcdisp::ExplanationList aDocu( CurOut(), true ); + aDocu.AddEntry(); + + aDocu.Term() + >> *new html::Label( rDef.LocalName() ) + << " "; + aDocu.Term() + << rDef.LocalName() + << "("; + WriteOut_TokenList( aDocu.Term(), rDef.Params(), ", " ); + aDocu.Term() + << ")"; + + Write_DefsDocu( aDocu.Def(), rDef ); +} + + +void +PageMaker_AllDefs::Write_DefsDocu( csi::xml::Element & o_rOut, + const ary::cpp::DefineEntity & i_rTextReplacement ) +{ + if ( i_rTextReplacement.DefinitionText().size() > 0 ) + { + EraseLeadingSpace( *const_cast< String * >( + &(*i_rTextReplacement.DefinitionText().begin()) + ) ); + } + + adcdisp::ExplanationTable rList( o_rOut ); + + rList.AddEntry( "Defined As" ); + WriteOut_TokenList( rList.Def(), i_rTextReplacement.DefinitionText(), " " ); + + const ary::loc::File & + rFile = Env().Gate().Locations().Find_File( i_rTextReplacement.Location() ); + rList.AddEntry( "In File" ); + rList.Def() << rFile.LocalName(); + + ShowDocu_On( o_rOut, *pDocuDisplay, i_rTextReplacement ); +} diff --git a/autodoc/source/display/html/pm_aldef.hxx b/autodoc/source/display/html/pm_aldef.hxx new file mode 100644 index 000000000000..ad12127a87a6 --- /dev/null +++ b/autodoc/source/display/html/pm_aldef.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pm_aldef.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HTML_PM_ALDEF_HXX +#define ADC_DISPLAY_HTML_PM_ALDEF_HXX + +// BASE CLASSES +#include "pm_base.hxx" +// USED SERVICES +#include <ary/cpp/c_types4cpp.hxx> +using ary::cpp::De_id; + +namespace ary +{ + namespace cpp + { + class DefineEntity; + } +} + +class Docu_Display; +class NavigationBar; + + + + + +class PageMaker_AllDefs : public SpecializedPageMaker +{ + public: + PageMaker_AllDefs( + PageDisplay & io_rPage ); + + virtual ~PageMaker_AllDefs(); + + virtual void MakePage(); + + private: + typedef std::vector<De_id> List_Ids; + typedef List_Ids::const_iterator ids_iterator; + + virtual void Write_NavBar(); + virtual void Write_TopArea(); + virtual void Write_DocuArea(); + virtual void Write_DefinesList(); + virtual void Write_MacrosList(); + void Write_Define( + De_id i_nId ); + void Write_Macro( + De_id i_nId ); + void Write_DefsDocu( + csi::xml::Element & o_rOut, + const ary::cpp::DefineEntity & + i_rTextReplacement ); + + // DATA + Dyn<Docu_Display> pDocuDisplay; + Dyn<NavigationBar> pNavi; +}; + + + + +#endif diff --git a/autodoc/source/display/html/pm_base.cxx b/autodoc/source/display/html/pm_base.cxx new file mode 100644 index 000000000000..8771d03433b0 --- /dev/null +++ b/autodoc/source/display/html/pm_base.cxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pm_base.cxx,v $ + * $Revision: 1.6 $ + * + * 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 "pm_base.hxx" + + +// NOT FULLY DEFINED SERVICES +#include "opageenv.hxx" +#include "pagemake.hxx" + + +//******************** SpecializedPageMaker *********************// + +SpecializedPageMaker::SpecializedPageMaker( PageDisplay & io_rPage ) + : pEnv( &io_rPage.Env() ), + pCurOut( &io_rPage.CurOut() ), + pPage( &io_rPage ) +{ +} + +void +SpecializedPageMaker::Write_NavBar() +{ + // Dummy +} + +void +SpecializedPageMaker::Write_TopArea() +{ + // Dummy +} + +void +SpecializedPageMaker::Write_DocuArea() +{ + // Dummy +} + +//void +//SpecializedPageMaker::Write_ChildList( ary::SlotAccessId , +// const char * , +// const char * ) +//{ +// // Dummy +//} + +csi::xml::Element & +SpecializedPageMaker::CurOut() +{ + return Page().CurOut(); +} + diff --git a/autodoc/source/display/html/pm_base.hxx b/autodoc/source/display/html/pm_base.hxx new file mode 100644 index 000000000000..156ccd7fcf24 --- /dev/null +++ b/autodoc/source/display/html/pm_base.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pm_base.hxx,v $ + * $Revision: 1.5.18.1 $ + * + * 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 ADC_DISPLAY_PM_BASE_HXX +#define ADC_DISPLAY_PM_BASE_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +#include "hdimpl.hxx" + + + +class OuputPage_Environment; +namespace csi +{ + namespace xml + { + class Element; + } +} +class PageDisplay; + + +/** Interface for making a special kind of HTML-Page +*/ +class SpecializedPageMaker +{ + public: + virtual ~SpecializedPageMaker() {} + + virtual void MakePage() = 0; + + virtual void Write_NavBar(); + virtual void Write_TopArea(); + virtual void Write_DocuArea(); +// virtual void Write_ChildList( +// ary::SlotAccessId i_nSlot, +// const char * i_nListTitle, +// const char * i_nLabel ); + + protected: + SpecializedPageMaker( + PageDisplay & io_rPage ); + + OuputPage_Environment & + Env() const { return *pEnv; } + csi::xml::Element & CurOut(); + PageDisplay & Page() { return *pPage; } + + private: + OuputPage_Environment * + pEnv; + csi::xml::Element * pCurOut; + PageDisplay * pPage; +}; + + + +#endif + diff --git a/autodoc/source/display/html/pm_class.cxx b/autodoc/source/display/html/pm_class.cxx new file mode 100644 index 000000000000..08bdc63f4a1d --- /dev/null +++ b/autodoc/source/display/html/pm_class.cxx @@ -0,0 +1,814 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pm_class.cxx,v $ + * $Revision: 1.11 $ + * + * 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 "pm_class.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <ary/loc/loc_file.hxx> +#include <ary/loc/locp_le.hxx> +#include <ary/getncast.hxx> +#include "hd_chlst.hxx" +#include "hd_docu.hxx" +#include "hdimpl.hxx" +#include "html_kit.hxx" +#include "navibar.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" +#include "strconst.hxx" + +using namespace adcdisp; + +using namespace csi; +using csi::html::HorizontalLine; +using csi::html::LineBreak; +using csi::html::Link; +using csi::html::Table; +using csi::html::TableRow; +using csi::html::TableCell; + +using ary::cpp::CesConstIterator; +using ary::doc::OldCppDocu; + +const char * const C_sTitle_InnerClasses = "Classes"; +const char * const C_sTitle_InnerStructs = "Structs"; +const char * const C_sTitle_InnerUnions = "Unions"; +const char * const C_sTitle_Methods = "Methods"; +const char * const C_sTitle_StaticMethods = "Static Methods"; +const char * const C_sTitle_Data = "Data"; +const char * const C_sTitle_StaticData = "Static Data"; + +const char * const C_sLabel_StaticOperations = "static_ops"; +const char * const C_sLabel_StaticVariables = "static_vars"; + +const char * const C_sTitlePublic = "Public Members"; +const char * const C_sTitleProtected = "Protected Members"; +const char * const C_sTitlePrivate = "Private Members"; +const char * const C_sMprTitles[3] = { C_sTitlePublic, + C_sTitleProtected, + C_sTitlePrivate + }; +const char * const C_sSummaryTitlePublic = "Public Members"; +const char * const C_sSummaryTitleProtected = "Protected Members"; +const char * const C_sSummaryTitlePrivate = "Private Members"; +const char * + C_sMprSummaryTitles[3] = + { C_sSummaryTitlePublic, C_sSummaryTitleProtected, C_sSummaryTitlePrivate }; +const char * + C_sMprPrefixes[3] = + { "publ_", "prot_", "priv_" }; +const char * + C_sSummaryItems_Titles[PageMaker_Class::cl_MAX] = + { C_sTitle_InnerClasses, C_sTitle_InnerStructs, C_sTitle_InnerUnions, + C_sTitle_Enums, C_sTitle_Typedefs, + C_sTitle_Methods, C_sTitle_StaticMethods, C_sTitle_Data, C_sTitle_StaticData }; +const char * + C_sSummaryItems_Labels[PageMaker_Class::cl_MAX] = + { C_sLabel_Classes, C_sLabel_Structs, C_sLabel_Unions, + C_sLabel_Enums, C_sLabel_Typedefs, + C_sLabel_Operations, C_sLabel_StaticOperations, + C_sLabel_Variables, C_sLabel_StaticVariables }; + + +const ary::cpp::E_Protection + aProt[3] = { ary::cpp::PROTECT_public, + ary::cpp::PROTECT_protected, + ary::cpp::PROTECT_private }; + + +PageMaker_Class::PageMaker_Class( PageDisplay & io_rPage, + const ary::cpp::Class & i_rClass ) + : SpecializedPageMaker(io_rPage), + pMe( &i_rClass ), + pChildDisplay( new ChildList_Display(io_rPage.Env(), i_rClass) ), + pNavi(0) + // pProtectionArea, + // bChildLists_Exist +{ + int i_max = 3 * cl_MAX; + for (int i = 0; i < i_max; i++) + { + bChildLists_Exist[i] = false; + } // end for +} + +PageMaker_Class::~PageMaker_Class() +{ +} + +void +PageMaker_Class::MakePage() +{ + pNavi = new NavigationBar( Env(), Me() ); + + Write_NavBar(); + Write_TopArea(); + Write_DocuArea(); + Write_ChildLists(); + + pNavi->Write_SubRows(); + pNavi = 0; +} + +void +PageMaker_Class::Write_NavBar() +{ + NavigationBar aNavi( Env(), Me() ); + pNavi->Write( CurOut() ); + CurOut() << new HorizontalLine; +} + +inline bool +IsInterface(const ary::doc::Documentation & i_doc) +{ + const OldCppDocu * + doc = Get_CppDocu(i_doc); + return doc != 0 + ? doc->IsInterface() + : false; +} + +void +PageMaker_Class::Write_TopArea() +{ + TemplateClause fTemplateClause; + PageTitle_Std fTitle; + + Page().Write_NameChainWithLinks( Me() ); + + fTemplateClause( CurOut(), Me().TemplateParameters() ); + fTitle( CurOut(), Get_ClassTypeKey(Me()), Me().LocalName() ); + + CurOut() << new HorizontalLine; + + Write_BaseHierarchy(); + Write_DerivedList(); + + CurOut() << new LineBreak; + + adcdisp::FlagTable + aFlags( CurOut(), 4 ); + aFlags.SetColumn( 0, "virtual", + Me().Virtuality() != ary::cpp::VIRTUAL_none ); + aFlags.SetColumn( 1, "abstract", + Me().Virtuality() == ary::cpp::VIRTUAL_abstract ); + aFlags.SetColumn( 2, "interface", + IsInterface(Me().Docu()) + OR Me().Virtuality() == ary::cpp::VIRTUAL_abstract ); + aFlags.SetColumn( 3, "template", + Me().TemplateParameters().size() > 0 ); +} + +void +PageMaker_Class::Write_DocuArea() +{ + Docu_Display aDocuShow( Env() ); + + aDocuShow.Assign_Out(CurOut()); + Me().Accept( aDocuShow ); + aDocuShow.Unassign_Out(); + + ary::loc::File & + rFile = Env().Gate().Locations().Find_File( Me().Location() ); + + adcdisp::ExplanationList + aFileText( CurOut() ); + aFileText.AddEntry("File"); + aFileText.Def() + << rFile.LocalName(); + + CurOut() << new HorizontalLine; +} + +void +PageMaker_Class::Write_ChildLists() +{ + int i_max = 3 * cl_MAX; + for (int i = 0; i < i_max; i++) + { + bChildLists_Exist[i] = false; + } // end for + + csi::html::DefListDefinition & + rPublic = Setup_MemberSegment_Out( mp_public ); + csi::html::DefListDefinition & + rProtected = Setup_MemberSegment_Out( mp_protected ); + csi::html::DefListDefinition & + rPrivate = Setup_MemberSegment_Out( mp_private ); + + Write_ChildList_forClasses( rPublic, + rProtected, + rPrivate, + C_sLabel_Classes, + C_sTitle_InnerClasses, + ary::cpp::CK_class ); + Write_ChildList_forClasses( rPublic, + rProtected, + rPrivate, + C_sLabel_Structs, + C_sTitle_InnerStructs, + ary::cpp::CK_struct ); + Write_ChildList_forClasses( rPublic, + rProtected, + rPrivate, + C_sLabel_Unions, + C_sTitle_InnerUnions, + ary::cpp::CK_union ); + + Write_ChildList( ary::cpp::Class::SLOT_Enums, + cl_Enums, + C_sLabel_Enums, + C_sTitle_Enums, + rPublic, + rProtected, + rPrivate ); + Write_ChildList( ary::cpp::Class::SLOT_Typedefs, + cl_Typedefs, + C_sLabel_Typedefs, + C_sTitle_Typedefs, + rPublic, + rProtected, + rPrivate ); + + Write_ChildList( ary::cpp::Class::SLOT_Operations, + cl_Operations, + C_sLabel_Operations, + C_sTitle_Methods, + rPublic, + rProtected, + rPrivate ); + Write_ChildList( ary::cpp::Class::SLOT_StaticOperations, + cl_StaticOperations, + C_sLabel_StaticOperations, + C_sTitle_StaticMethods, + rPublic, + rProtected, + rPrivate ); + Write_ChildList( ary::cpp::Class::SLOT_Data, + cl_Data, + C_sLabel_Variables, + C_sTitle_Data, + rPublic, + rProtected, + rPrivate ); + Write_ChildList( ary::cpp::Class::SLOT_StaticData, + cl_StaticData, + C_sLabel_StaticVariables, + C_sTitle_StaticData, + rPublic, + rProtected, + rPrivate ); + + Create_NaviSubRow(mp_public); // Also puts out or deletes pPublic. + Create_NaviSubRow(mp_protected); // Also puts out or deletes pProtected. + Create_NaviSubRow(mp_private); // Also puts out or deletes pPrivate. +} + +void +PageMaker_Class::Write_ChildList( ary::SlotAccessId i_nSlot, + E_ChidList i_eChildListIndex, + const char * i_sLabel, + const char * i_sListTitle, + csi::xml::Element & o_rPublic, + csi::xml::Element & o_rProtected, + csi::xml::Element & o_rPrivate ) + +{ + bool bPublic_ChildrenExist = false; + bool bProtected_ChildrenExist = false; + bool bPrivate_ChildrenExist = false; + + ChildList_Display::Area_Result + aPublic_Result( bPublic_ChildrenExist, o_rPublic ); + ChildList_Display::Area_Result + aProtected_Result( bProtected_ChildrenExist, o_rProtected ); + ChildList_Display::Area_Result + aPrivate_Result( bPrivate_ChildrenExist, o_rPrivate ); + + String sLabelPublic = ChildListLabel(i_sLabel, mp_public); + String sLabelProtected = ChildListLabel(i_sLabel, mp_protected); + String sLabelPrivate = ChildListLabel(i_sLabel, mp_private); + + pChildDisplay->Run_Members( aPublic_Result, + aProtected_Result, + aPrivate_Result, + i_nSlot, + sLabelPublic, + sLabelProtected, + sLabelPrivate, + i_sListTitle ); + + bChildLists_Exist[i_eChildListIndex] + = bPublic_ChildrenExist; + bChildLists_Exist[i_eChildListIndex + cl_MAX] + = bProtected_ChildrenExist; + bChildLists_Exist[i_eChildListIndex + 2*cl_MAX] + = bPrivate_ChildrenExist; + + if (bPublic_ChildrenExist) + o_rPublic << new HorizontalLine; + if (bProtected_ChildrenExist) + o_rProtected << new HorizontalLine; + if (bPrivate_ChildrenExist) + o_rPrivate << new HorizontalLine; +} + +void +PageMaker_Class::Write_ChildList_forClasses( csi::xml::Element & o_rPublic, + csi::xml::Element & o_rProtected, + csi::xml::Element & o_rPrivate, + const char * i_sLabel, + const char * i_sListTitle, + ary::cpp::E_ClassKey i_eFilter ) +{ + bool bPublic_ChildrenExist = false; + bool bProtected_ChildrenExist = false; + bool bPrivate_ChildrenExist = false; + + ChildList_Display::Area_Result + aPublic_Result( bPublic_ChildrenExist, o_rPublic ); + ChildList_Display::Area_Result + aProtected_Result( bProtected_ChildrenExist, o_rProtected ); + ChildList_Display::Area_Result + aPrivate_Result( bPrivate_ChildrenExist, o_rPrivate ); + + String sLabelPublic = ChildListLabel(i_sLabel, mp_public); + String sLabelProtected = ChildListLabel(i_sLabel, mp_protected); + String sLabelPrivate = ChildListLabel(i_sLabel, mp_private); + + pChildDisplay->Run_MemberClasses( aPublic_Result, + aProtected_Result, + aPrivate_Result, + ary::cpp::Class::SLOT_NestedClasses, + sLabelPublic, + sLabelProtected, + sLabelPrivate, + i_sListTitle, + i_eFilter ); + + bChildLists_Exist[int(cl_NestedClasses)+int(i_eFilter)] + = bPublic_ChildrenExist; + bChildLists_Exist[int(cl_NestedClasses)+int(i_eFilter) + cl_MAX] + = bProtected_ChildrenExist; + bChildLists_Exist[int(cl_NestedClasses)+int(i_eFilter) + 2*cl_MAX] + = bPrivate_ChildrenExist; + + if (bPublic_ChildrenExist) + o_rPublic << new HorizontalLine; + if (bProtected_ChildrenExist) + o_rProtected << new HorizontalLine; + if (bPrivate_ChildrenExist) + o_rPrivate << new HorizontalLine; +} + +const char * +PageMaker_Class::ChildListLabel( const char * i_sLabel, E_MemberProtection i_eMpr ) +{ + static char sResult[100]; + strcpy( sResult, C_sMprPrefixes[i_eMpr] ); // SAFE STRCPY (#100211# - checked) + strcat( sResult, i_sLabel ); // SAFE STRCAT (#100211# - checked) + return sResult; +} + +csi::html::DefListDefinition & +PageMaker_Class::Setup_MemberSegment_Out( E_MemberProtection i_eMpr ) +{ + html::DefList * pDefList = new html::DefList; + pProtectionArea[i_eMpr] = pDefList; + + pDefList->AddTerm() + << new html::ClassAttr("subtitle") + >> *new html::Label( C_sMprPrefixes[i_eMpr] ) + >> *new html::Headline(3) + << C_sMprTitles[i_eMpr]; + return pDefList->AddDefinition(); +} + +void +PageMaker_Class::Create_NaviSubRow( E_MemberProtection i_eMpr ) +{ + int nIndexAdd = int(cl_MAX) * int(i_eMpr); + + bool bEmpty = true; + for (int e = 0; e < cl_MAX; e++) + { + if ( bChildLists_Exist[e + nIndexAdd] ) + { + bEmpty = false; + break; + } + } // end for + if (bEmpty) + { + pProtectionArea[i_eMpr] = 0; + return; + } + else // + { + CurOut() << pProtectionArea[i_eMpr].Release(); + } // endif + + pNavi->MakeSubRow( C_sMprSummaryTitles[i_eMpr] ); + for (int i = 0; i < cl_MAX; i++) + { + pNavi->AddItem( C_sSummaryItems_Titles[i], + ChildListLabel( C_sSummaryItems_Labels[i], i_eMpr ), + bChildLists_Exist[i+nIndexAdd] ); + } // end for +} + +void +PageMaker_Class::Write_DerivedList() +{ + adcdisp::ExplanationList + aDeriveds( CurOut() ); + aDeriveds.AddEntry( "Known Derived Classes" ); + + if ( Me().KnownDerivatives().Size() == 0 ) + { + aDeriveds.Def() << "None."; + return; + } + + typedef ary::List_Rid RidList; + + CesConstIterator + itEnd = Me().KnownDerivatives().End(); + for ( CesConstIterator it = Me().KnownDerivatives().Begin(); + it != itEnd; + ++it ) + { + const ary::cpp::CodeEntity & + rCe = Env().Gate().Ces().Find_Ce(*it); + + aDeriveds.Def() + >> *new html::Link( Link2Ce(Env(),rCe) ) + << rCe.LocalName(); + aDeriveds.Def() + << new html::LineBreak; + } // end for +} + + +// ============== Creating a classes base hierarchy ====================== // + + +namespace +{ + +class Node +{ + public: + Node( + const ary::cpp::Class & + i_rClass, + ary::cpp::Type_id i_nClassType, + const ary::cpp::Gate & + i_rGate, + intt i_nPositionOffset, + Node * io_pDerived = 0, + ary::cpp::E_Protection + i_eProtection = ary::cpp::PROTECT_global, + bool i_bVirtual = false ); + ~Node(); + + void FillPositionList( + std::vector< const Node* > & + o_rPositionList ) const; + void Write2( + csi::xml::Element & o_rOut, + const OuputPage_Environment & + i_rEnv ) const; + + intt BaseCount() const { return nCountBases; } + intt Position() const { return nPosition; } + int Xpos() const { return 3*Position(); } + int Ypos() const { return 2*Position(); } + const Node * Derived() const { return pDerived; } + + private: + typedef std::vector< DYN Node* > BaseList; + + void IncrBaseCount(); + + // DATA + BaseList aBases; + intt nCountBases; + Node * pDerived; + + String sName; + const ary::cpp::Class * + pClass; + ary::cpp::Type_id nClassType; + ary::cpp::E_Protection + eProtection; + bool bVirtual; + + intt nPosition; +}; + +void WriteNodeHierarchy( + csi::xml::Element & o_rOut, + const OuputPage_Environment & + i_rEnv, + const Node & i_rClass ); + +const ary::cpp::Class * + HereFind_Class( + const ary::cpp::Gate & + i_rGate, + ary::cpp::Type_id i_nReferingTypeId ); + +} // anonymous namespace + +void +PageMaker_Class::Write_BaseHierarchy() +{ + adcdisp::ExplanationList aBases( CurOut() ); + aBases.AddEntry( "Base Classes" ); + + if ( Me().BaseClasses().size() == 0 ) + { + aBases.Def() << "None."; + } + else + { + Dyn< Node > + pBaseGraph( new Node(Me(), ary::cpp::Type_id(0), Env().Gate(), 0) ); + WriteNodeHierarchy( aBases.Def(), Env(), *pBaseGraph ); + } +} + + + +namespace +{ + +void +WriteNodeHierarchy( csi::xml::Element & o_rOut, + const OuputPage_Environment & i_rEnv, + const Node & i_rClass ) +{ + typedef const Node * NodePtr; + typedef std::vector<NodePtr> NodeList; + + NodeList aPositionList; + intt nSize = i_rClass.Position()+1; + aPositionList.reserve(nSize); + i_rClass.FillPositionList( aPositionList ); + + xml::Element & + rPre = o_rOut + >> *new xml::AnElement("pre") + << new html::StyleAttr("font-family:monospace;"); + + for ( int line = 0; line < nSize; ++line ) + { + char * sLine1 = new char[2 + line*5]; + char * sLine2 = new char[1 + line*5]; + *sLine1 = '\0'; + *sLine2 = '\0'; + + bool bBaseForThisLineReached = false; + for ( int col = 0; col < line; ++col ) + { + intt nDerivPos = aPositionList[col]->Derived()->Position(); + + if ( nDerivPos >= line ) + strcat(sLine1, " | "); + else + strcat(sLine1, " "); + + if ( nDerivPos > line ) + { + strcat(sLine2, " | "); + } + else if ( nDerivPos == line ) + { + if (bBaseForThisLineReached) + strcat(sLine2, "--+--"); + else + { + bBaseForThisLineReached = true; + strcat(sLine2, " +--"); + } + } + else // nDerivPos < line + { + if (bBaseForThisLineReached) + strcat(sLine2, "-----"); + else + strcat(sLine2, " "); + } + } // end for (col) + strcat(sLine1,"\n"); + rPre + << sLine1 + << sLine2; + delete [] sLine1; + delete [] sLine2; + + aPositionList[line]->Write2( rPre, i_rEnv ); + rPre << "\n"; + } // end for (line) +} + +const ary::cpp::Class * +HereFind_Class( const ary::cpp::Gate & i_rGate, + ary::cpp::Type_id i_nReferingTypeId ) +{ + const ary::cpp::CodeEntity * + pCe = i_rGate.Search_RelatedCe( i_nReferingTypeId ); + + if ( pCe != 0 ) + { + if ( ary::is_type<ary::cpp::Class>(*pCe) ) + { + return ary::ary_cast<ary::cpp::Class>(pCe); + } + else if ( ary::is_type<ary::cpp::Typedef>(*pCe) ) + { + const ary::cpp::Typedef * + pTydef = ary::ary_cast<ary::cpp::Typedef>(pCe); + return HereFind_Class( i_rGate, pTydef->DescribingType() ); + } + } + + static const ary::cpp::Class aClassNull_( "Base class not found", + ary::cpp::Ce_id(0), + ary::cpp::PROTECT_global, + ary::loc::Le_id(0), + ary::cpp::CK_class ); + return &aClassNull_; +} + + + +//********************* Node ***********************// + +Node::Node( const ary::cpp::Class & i_rClass, + ary::cpp::Type_id i_nClassType, + const ary::cpp::Gate & i_rGate, + intt i_nPositionOffset, + Node * io_pDerived, + ary::cpp::E_Protection i_eProtection, + bool i_bVirtual ) + : aBases(), + nCountBases(0), + pDerived(io_pDerived), + pClass(&i_rClass), + nClassType(i_nClassType), + eProtection(i_eProtection), + bVirtual(i_bVirtual), + nPosition(i_nPositionOffset) +{ + typedef ary::cpp::List_Bases BList; + + for ( BList::const_iterator it = i_rClass.BaseClasses().begin(); + it != i_rClass.BaseClasses().end(); + ++it ) + { + const ary::cpp::Class * + pBaseClass = HereFind_Class( i_rGate, (*it).nId ); + + Dyn<Node> + pBase( new Node(*pBaseClass, + (*it).nId, + i_rGate, + nPosition, + this, + (*it).eProtection, + (*it).eVirtuality == ary::cpp::VIRTUAL_virtual) + ); + IncrBaseCount(); + nPosition += pBase->BaseCount() + 1; + aBases.push_back( pBase.Release() ); + } // end for +} + +Node::~Node() +{ +} + +void +Node::FillPositionList( std::vector< const Node* > & o_rPositionList ) const +{ + for ( BaseList::const_iterator it = aBases.begin(); + it != aBases.end(); + ++it ) + { + (*it)->FillPositionList(o_rPositionList); + } // end for + + if( o_rPositionList.size() != uintt(Position()) ) + { + csv_assert(false); + } + o_rPositionList.push_back(this); +} + +void +Node::Write2( csi::xml::Element & o_rOut, + const OuputPage_Environment & i_rEnv ) const +{ + if ( Derived() == 0 ) + { + o_rOut + >> *new xml::AnElement("span") + << new html::ClassAttr("btself") + << pClass->LocalName(); + return; + } + + csi::xml::Element * + pOut = & ( o_rOut >> *new xml::AnElement("span") ); + switch ( eProtection ) + { + case ary::cpp::PROTECT_public: + if (bVirtual) + *pOut << new html::ClassAttr("btvpubl"); + else + *pOut << new html::ClassAttr("btpubl"); + break; + case ary::cpp::PROTECT_protected: + if (bVirtual) + *pOut << new html::ClassAttr("btvprot"); + else + *pOut << new html::ClassAttr("btprot"); + break; + case ary::cpp::PROTECT_private: + if (bVirtual) + *pOut << new html::ClassAttr("btvpriv"); + else + *pOut << new html::ClassAttr("btpriv"); + break; + default: // do nothing. + ; + } // end switch + + csi::xml::Element & rOut = *pOut; + + Get_LinkedTypeText( rOut, i_rEnv, nClassType, false ); + rOut << " ("; + if ( bVirtual ) + rOut << "virtual "; + switch ( eProtection ) + { + case ary::cpp::PROTECT_public: + rOut << "public)"; + break; + case ary::cpp::PROTECT_protected: + rOut << "protected)"; + break; + case ary::cpp::PROTECT_private: + rOut << "private)"; + break; + default: // do nothing. + ; + } // end switch +} + +void +Node::IncrBaseCount() +{ + ++nCountBases; + if (pDerived != 0) + pDerived->IncrBaseCount(); +} + + +} // anonymous namespace + + diff --git a/autodoc/source/display/html/pm_class.hxx b/autodoc/source/display/html/pm_class.hxx new file mode 100644 index 000000000000..ab4006c4679c --- /dev/null +++ b/autodoc/source/display/html/pm_class.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pm_class.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_DISPLAY_HTML_PM_CLASS_HXX +#define ADC_DISPLAY_HTML_PM_CLASS_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "pm_base.hxx" + // COMPONENTS + // PARAMETERS + + +namespace ary +{ + namespace cpp + { + class Class; + } +} + +class ChildList_Display; +class NavigationBar; + + +class PageMaker_Class : public SpecializedPageMaker +{ + public: + enum E_ChidList + { + cl_NestedClasses = 0, + cl_NestedStructs, + cl_NestedUnions, + cl_Enums, + cl_Typedefs, + cl_Operations, + cl_StaticOperations, + cl_Data, + cl_StaticData, + cl_MAX + }; + PageMaker_Class( + PageDisplay & io_rPage, + const ary::cpp::Class & + i_rClass ); + + virtual ~PageMaker_Class(); + + virtual void MakePage(); + + private: + enum E_MemberProtection { mp_public = 0, mp_protected, mp_private, mp_MAX }; + + virtual void Write_NavBar(); + virtual void Write_TopArea(); + virtual void Write_DocuArea(); + virtual void Write_ChildList( + ary::SlotAccessId i_nSlot, + E_ChidList i_eChildListIndex, + const char * i_sLabel, + const char * i_sListTitle, + csi::xml::Element & o_rPublic, + csi::xml::Element & o_rProtected, + csi::xml::Element & o_rPrivate ); + void Write_ChildList_forClasses( + csi::xml::Element & o_rPublic, + csi::xml::Element & o_rProtected, + csi::xml::Element & o_rPrivate, + const char * i_sLabel, + const char * i_sListTitle, + ary::cpp::E_ClassKey + i_eFilter ); + void Write_ChildLists(); + static const char * ChildListLabel( + const char * i_sLabel, + E_MemberProtection i_eMpr ); + csi::html::DefListDefinition & + Setup_MemberSegment_Out( + E_MemberProtection i_eMpr ); + void Create_NaviSubRow( + E_MemberProtection i_eMpr ); + void Write_BaseHierarchy(); + void Write_DerivedList(); + + const ary::cpp::Class & + Me() const { return *pMe; } + // DATA + const ary::cpp::Class * + pMe; + Dyn<ChildList_Display> + pChildDisplay; + Dyn<NavigationBar> pNavi; + + Dyn<csi::xml::Element> + pProtectionArea[mp_MAX]; + + bool bChildLists_Exist[3*cl_MAX]; +}; + + + + + +#endif + diff --git a/autodoc/source/display/html/pm_help.cxx b/autodoc/source/display/html/pm_help.cxx new file mode 100644 index 000000000000..f7287b89fd33 --- /dev/null +++ b/autodoc/source/display/html/pm_help.cxx @@ -0,0 +1,235 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pm_help.cxx,v $ + * $Revision: 1.7 $ + * + * 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 "pm_help.hxx" + + +// NOT FULLY DEFINED SERVICES +#include "navibar.hxx" +#include "html_kit.hxx" + +using namespace csi; +using csi::html::Paragraph; +using csi::html::HorizontalLine; +using csi::html::Headline; +using csi::html::AlignAttr; +using csi::html::Bold; +using csi::html::Link; +using csi::html::Sbr; +using csi::html::LineBreak; +using csi::xml::Element; + + + +const String C_sHelpText( +"<div style=\"font-size:10pt;\">\n" +"<h3 class=\"help\">The Main Navigationbar</h3>\n" +"<p> On top of every page, there is a main navigationbar on a lightly coloured\n" +"background with the following items:<br>\n" +"</p>\n" +"<ul>\n" +" <li>Overview - the start page for this document,</li>\n" +" <li>Namespace - the lowest/deepest namespace of the language objects, described\n" +"on the current page,</li>\n" +" <li>Class - the class, struct or union, which owns the methods or data,\n" +"described on the current page,</li>\n" +" <li>Index - the global alphabetical index,</li>\n" +" <li>Help - this page.</li>\n" +"</ul>\n" +" Each item in this bar can be in three different states:<br>\n" +"<ul>\n" +" <li>Link - the item is valid and you can get there,</li>\n" +" <li>Simple - the item does not apply (if this page described a namespace,\n" +"there would be no owning class),</li>\n" +" <li>Reversed (white text on dark background) - this is the current page.</li>\n" +"</ul>\n" +"<h3 class=\"help\">Lower Navigationbars</h3>\n" +" Just below the main navigation bar, there may be zero to three lower navigationbars\n" +"on white background.<br>\n" +"<br>\n" +"Their items are dependent of the context, but they always link to paragraphs\n" +"on the same, current page.<br>\n" +"Available items appear as links. Unavailable items appear as simple text.<br>\n" +"\n" +"\n" +"<h3 class=\"help\">Namespace Descriptions</h3>\n" +"\n" +"<dl>\n" +"<dt class=\"simple\">Parent namespaces</dt>\n" +" </dl>\n" +" <dl>\n" +" <dd>In front of the namespace title, there is a linked list of the parent\n" +"namespaces. The global namespace is linked with the first \"::\",</dd>\n" +" <dd>the namespaces between the global and the current one are linked\n" +"by their names.<br>\n" +" </dd>\n" +" <dd> </dd>\n" +" </dl>\n" +"After the title, the documentation of the namespace follows (which is often\n" +"missing, because the namespace name may be self-explaining).<br>\n" +" <br>\n" +"Below are the lists of nested namspaces and of the classes, functions and\n" +"other program objects, that belong within this namespace.<br>\n" +"Each of this lists is accessible by the lower navigationbar on top of the\n" +"page.<br>\n" +"\n" +"<h3 class=\"help\">Class Descriptions</h3>\n" +"\n" +" <dl>\n" +" <dt class=\"simple\">Parent namespaces and classes</dt>\n" +" </dl>\n" +" <dl>\n" +" <dd>In front of the class title, there is a linked list of the\n" +"parent namespaces or classes. The global namespace is linked with the first\n" +"\"::\",</dd>\n" +" <dd>the namespaces between the global and the current one are\n" +"linked by their names. Enclosing classes are linked as well, but appear in\n" +"<span class=\"nqclass\">green</font> color. </dd>\n" +" <dd>So you see on the first glance, that this is a parent class,\n" +"no namespace.<br>\n" +" </dd>\n" +" <dd><br>\n" +" </dd>\n" +" </dl>\n" +"After the title, the bases and derivations of the class follow. <br>\n" +"Base classes are displayed as a graph. The text around base classes can appear\n" +"in different styles and colours:<br>\n" +"<ul>\n" +" <li><span class=\"btpubl\">Green</span> - public inherited,</li>\n" +" <li><span class=\"btprot\">Orange</span> - protected inherited,</li>\n" +" <li><span class=\"btpriv\">Red</span> - private inherited,</li>\n" +" <li><span class=\"btvpubl\">italic</span> - a (public inherited) virtual base class.</li>\n" +" <li><span class=\"btself\">Bold and black</span> without a link - the placeholder\n" +"for the currently described class.<br>\n" +" </li>\n" +"</ul>\n" +"There may be many derivations of a class, but only the known ones, which\n" +"are described within this document also, are listed.<br>\n" +"<br>\n" +"Below the derivations is a little table with some properties of the class:<br>\n" +"<ul>\n" +" <li>virtual - the class owns at least one virtual method,</li>\n" +" <li>abstract - the class owns at least one abstract method,</li>\n" +" <li>interface - the class may or may be not abstract,\n" +"but it is intended by its author to be used only as an interface and never\n" +"to be instantiated,</li>\n" +" <li>template - the class is a template class.<br>\n" +" </li>\n" +"</ul>\n" +"Next comes further documentation of the class itself.<br>\n" +"<br>\n" +"Lastly, there are listed all members of the class. Public members come first,\n" +"then protected, at last the private ones.<br>\n" +"All member lists are accessible by the lower navigationbars on top of the\n" +"page.<br>\n" +"\n" +"<h3 class=\"help\">Macros and Defines</h3>\n" +"In C++ and C, there are also program constructs, which do not fit into the\n" +"name tree, because they are #define'd: macros and definitions.<br>\n" +"These may be documented, too. Those comments you find <a href=\"def-all.html\">\n" +"here</a>\n" +" or from the \"Overview\" start page.\n" +"<h3 class=\"help\">Links to IDL-Documentation</h3>\n" +"Some types, which appear as links, may refer to classes, enums or other\n" +"entities, which are direct mappings of UNO-IDL entities.<br>\n" +"In those cases the link doesn't lead to the C++ class, enum or whatever,\n" +"but to the description of the IDL entity.\n" +"<h3 class=\"help\">How to Link From Extern Documents</h3>\n" +"If you wish to write an extern html document, which links to types within\n" +"this C++ reference, you can do so, if your links have the following format:<br>\n" +"<br>\n" +"<RootDirectory-of-this-Document>/names/<Namespace-A>/<Namespace-XY>/EnclosingClass-nn>/<TypePreFix>-<MyTypeName>.html<br>\n" +"<br>\n" +"<TypePreFix> can have the following values:<br>\n" +"<ul>\n" +"<li>c - class, struct or union</li>\n" +"<li>e - enum</li>\n" +"<li>t - typedef</li>\n" +"</ul>\n" +"If this document would be located in directory \"/doc/cpp/ref\", examples\n" +"would look like this:<br>\n" +"<br>\n" +"<a href=\"/doc/cpp/ref/names/osl/c-File.html\">class File</a><br>\n" +"<a href=\"/doc/cpp/ref/names/osl/FileBase/e-RC.html\">enum FileBase::RC</a><br>\n" +"<a href=\"/doc/cpp/ref/names/t-oslMutex.html\">typedef oslMutex</a><br>\n" +"<br>\n" +"Namespaces are described in the index.html file within their directory:<br>\n" +"<br>\n" +"<a href=\"/doc/cpp/ref/names/cppu/index.html\">namespace cppu</a><br>\n" +"</div>" ); + + + + +PageMaker_Help::PageMaker_Help( PageDisplay & io_rPage ) + : SpecializedPageMaker(io_rPage), + pNavi(0) +{ +} + +PageMaker_Help::~PageMaker_Help() +{ +} + +void +PageMaker_Help::MakePage() +{ + pNavi = new NavigationBar( Env(), NavigationBar::LOC_Help ); + Write_NavBar(); + + Write_TopArea(); + Write_DocuArea(); +} + +void +PageMaker_Help::Write_NavBar() +{ + pNavi->Write( CurOut() ); + CurOut() << new HorizontalLine; +} + +void +PageMaker_Help::Write_TopArea() +{ + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), "How to Use", "this Reference Document" ); + + CurOut() << new xml::XmlCode(C_sHelpText); +} + +void +PageMaker_Help::Write_DocuArea() +{ + CurOut() << new HorizontalLine; +} + + + diff --git a/autodoc/source/display/html/pm_help.hxx b/autodoc/source/display/html/pm_help.hxx new file mode 100644 index 000000000000..f3fb03ad4584 --- /dev/null +++ b/autodoc/source/display/html/pm_help.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pm_help.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_DISPLAY_HTML_PM_HELP_HXX +#define ADC_DISPLAY_HTML_PM_HELP_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "pm_base.hxx" + // COMPONENTS + // PARAMETERS + +class NavigationBar; + +class PageMaker_Help : public SpecializedPageMaker +{ + public: + PageMaker_Help( + PageDisplay & io_rPage ); + + virtual ~PageMaker_Help(); + + virtual void MakePage(); + + private: + virtual void Write_NavBar(); + virtual void Write_TopArea(); + virtual void Write_DocuArea(); + + // DATA + Dyn<NavigationBar> pNavi; +}; + + + +#endif + diff --git a/autodoc/source/display/html/pm_index.cxx b/autodoc/source/display/html/pm_index.cxx new file mode 100644 index 000000000000..a34f6c58ea2c --- /dev/null +++ b/autodoc/source/display/html/pm_index.cxx @@ -0,0 +1,320 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pm_index.cxx,v $ + * $Revision: 1.9 $ + * + * 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 "pm_index.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_class.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_vari.hxx> +#include <ary/cpp/cp_ce.hxx> +#include "aryattrs.hxx" +#include "hd_chlst.hxx" +#include "hd_docu.hxx" +#include "html_kit.hxx" +#include "navibar.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" +#include "strconst.hxx" + +using namespace csi; +using ary::GlobalId; + + + + +namespace +{ + +inline const char * +F_CK_Text( ary::cpp::E_ClassKey i_eCK ) +{ + switch (i_eCK) + { + case ary::cpp::CK_class: return "class"; + case ary::cpp::CK_struct: return "struct"; + case ary::cpp::CK_union: return "union"; + } // end switch + return ""; +} + +template <class CE> +inline const char * +F_OwnerType( const CE & i_rData, const ary::cpp::Gate & i_rGate ) +{ + if ( i_rData.Protection() == ary::cpp::PROTECT_global ) + return "namespace "; + + const ary::cpp::Class * + pClass = dynamic_cast< const ary::cpp::Class* >( + i_rGate.Ces().Search_Ce(i_rData.Owner()) ); + if (pClass != 0) + return F_CK_Text(pClass->ClassKey()); + return ""; +} + +} // anonymous namespace + +PageMaker_Index::PageMaker_Index( PageDisplay & io_rPage, + char i_c ) + : SpecializedPageMaker(io_rPage), + pNavi(0), + c(i_c), + pCurIndex(0) +{ +} + +PageMaker_Index::~PageMaker_Index() +{ +} + +void +PageMaker_Index::MakePage() +{ + pNavi = new NavigationBar( Env(), NavigationBar::LOC_Index ); + + Write_NavBar(); + Write_TopArea(); + Write_CompleteAlphabeticalList(); +} + +void +PageMaker_Index::do_Process( const ary::cpp::Namespace & i_rData ) +{ + Write_CeIndexEntry( i_rData, "namespace", "namespace" ); +} + +void +PageMaker_Index::do_Process( const ary::cpp::Class & i_rData ) +{ + // KORR_FUTURE + // Really throw out all anonymous classes from index? + + if ( strncmp(i_rData.LocalName().c_str()+1,"_Anonymous",10) == 0 ) + return; + + Write_CeIndexEntry( i_rData, + F_CK_Text(i_rData.ClassKey()), + F_OwnerType(i_rData, Env().Gate()) ); +} + +void +PageMaker_Index::do_Process( const ary::cpp::Enum & i_rData ) +{ + Write_CeIndexEntry( i_rData, "enum", F_OwnerType(i_rData, Env().Gate()) ); +} + +void +PageMaker_Index::do_Process( const ary::cpp::Typedef & i_rData ) +{ + Write_CeIndexEntry( i_rData, "typedef", F_OwnerType(i_rData, Env().Gate()) ); +} + +void +PageMaker_Index::do_Process( const ary::cpp::Function & i_rData ) +{ + Write_CeIndexEntry( i_rData, "function", F_OwnerType(i_rData, Env().Gate()) ); +} + +void +PageMaker_Index::do_Process( const ary::cpp::Variable & i_rData ) +{ + Write_CeIndexEntry( i_rData, "variable", F_OwnerType(i_rData, Env().Gate()) ); +} + +void +PageMaker_Index::do_Process( const ary::cpp::EnumValue & i_rData ) +{ + Write_CeIndexEntry( i_rData, "enum value", "" ); +} + +void +PageMaker_Index::do_Process( const ary::cpp::Define & i_rData ) +{ + String sFileName; + + pCurIndex->AddEntry(); + pCurIndex->Term() + >> *new html::Link( Link2CppDefinition(Env(), i_rData) ) + >> *new html::Bold + << i_rData.LocalName(); + pCurIndex->Term() + << " - define"; + pCurIndex->Def() << " "; +} + +void +PageMaker_Index::do_Process( const ary::cpp::Macro & i_rData ) +{ + String sFileName; + + pCurIndex->AddEntry(); + pCurIndex->Term() + >> *new html::Link( Link2CppDefinition(Env(), i_rData) ) + >> *new html::Bold + << i_rData.LocalName(); + pCurIndex->Term() + << " - macro"; + + pCurIndex->Def() << " "; +} + +const ary::cpp::Gate * +PageMaker_Index::inq_Get_ReFinder() const +{ + return &Env().Gate(); +} + +void +PageMaker_Index::Write_NavBar() +{ + pNavi->Write( CurOut() ); + CurOut() << new html::HorizontalLine; +} + + +const String C_sAlphabet( +"<a href=\"index-1.html\"><B>A</B></a> <a href=\"index-2.html\"><B>B</B></a> <a href=\"index-3.html\"><B>C</B></a> <a href=\"index-4.html\"><B>D</B></a> <a href=\"index-5.html\"><B>E</B></a> " +"<a href=\"index-6.html\"><B>F</B></a> <a href=\"index-7.html\"><B>G</B></a> <a href=\"index-8.html\"><B>H</B></a> <a href=\"index-9.html\"><B>I</B></a> <a href=\"index-10.html\"><B>J</B></a> " +"<a href=\"index-11.html\"><B>K</B></a> <a href=\"index-12.html\"><B>L</B></a> <a href=\"index-13.html\"><B>M</B></a> <a href=\"index-14.html\"><B>N</B></a> <a href=\"index-15.html\"><B>O</B></a> " +"<a href=\"index-16.html\"><B>P</B></a> <a href=\"index-17.html\"><B>Q</B></a> <a href=\"index-18.html\"><B>R</B></a> <a href=\"index-19.html\"><B>S</B></a> <a href=\"index-20.html\"><B>T</B></a> " +"<a href=\"index-21.html\"><B>U</B></a> <a href=\"index-22.html\"><B>V</B></a> <a href=\"index-23.html\"><B>W</B></a> <a href=\"index-24.html\"><B>X</B></a> <a href=\"index-25.html\"><B>Y</B></a> " +"<a href=\"index-26.html\"><B>Z</B></a> <a href=\"index-27.html\"><B>_</B></a>" ); + +void +PageMaker_Index::Write_TopArea() +{ + String sLetter(&c, 1); + + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), "Global Index", sLetter ); + + CurOut() >>* new html::Paragraph + << new html::AlignAttr("center") + << new xml::XmlCode(C_sAlphabet); + + CurOut() << new html::HorizontalLine; +} + +void +PageMaker_Index::Write_CompleteAlphabeticalList() +{ + std::vector<GlobalId> + aThisPagesItems; + const ary::cpp::Gate & + rGate = Env().Gate(); + + static char sBegin[] = "X"; + static char sEnd[] = "Y"; + + switch ( c ) + { + case 'Z': sBegin[0] = 'Z'; + sEnd[0] = '_'; + break; + case '_': sBegin[0] = '_'; + sEnd[0] = '0'; + break; + default: sBegin[0] = c; + sEnd[0] = char(c + 1); + break; + } + + uintt + nCount = rGate.Get_AlphabeticalList( aThisPagesItems, sBegin, sEnd ); + if (nCount > 0 ) + { + adcdisp::IndexList + aIndex(CurOut()); + pCurIndex = &aIndex; + + std::vector<GlobalId>::const_iterator itEnd = aThisPagesItems.end(); + for ( std::vector<GlobalId>::const_iterator it = aThisPagesItems.begin(); + it != itEnd; + ++it ) + { + const ary::Entity * + pRe = rGate.Search_Entity( *it ); + if ( pRe != 0 ) + pRe->Accept(*this); + } // end for + + pCurIndex = 0; + } // endif (nCount > 0) +} + +void +PageMaker_Index::Write_CeIndexEntry( const ary::cpp::CodeEntity & + i_rCe, + const char * i_sType, + const char * i_sOwnerType ) +{ + if ( Ce_IsInternal(i_rCe) ) + return; + + static csv::StreamStr aQualification(500); + + const ary::cpp::CodeEntity & + rOwner = Env().Gate().Ces().Find_Ce(i_rCe.Owner()); + + pCurIndex->AddEntry(); + pCurIndex->Term() + >> *new html::Link( Link2Ce(Env(), i_rCe) ) + >> *new html::Bold + << i_rCe.LocalName(); + pCurIndex->Term() + << " - " + << i_sType; + + if ( rOwner.Owner().IsValid() ) + { + aQualification.seekp(0); + Env().Gate().Ces().Get_QualifiedName( aQualification, + rOwner.LocalName(), + rOwner.Owner() ); + + pCurIndex->Term() + << " in " + << i_sOwnerType + << " " + << aQualification.c_str(); + } + + pCurIndex->Def() << " "; +} diff --git a/autodoc/source/display/html/pm_index.hxx b/autodoc/source/display/html/pm_index.hxx new file mode 100644 index 000000000000..23d4aafc3884 --- /dev/null +++ b/autodoc/source/display/html/pm_index.hxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pm_index.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_DISPLAY_HTML_PM_INDEX_HXX +#define ADC_DISPLAY_HTML_PM_INDEX_HXX + +// BASE CLASSES +#include "pm_base.hxx" +#include <ary/ary_disp.hxx> +#include <cosv/tpl/processor.hxx> +// USED SERVICES +namespace adcdisp +{ + class IndexList; +} +namespace ary +{ + namespace cpp + { + class Namespace; + class Class; + class Enum; + class Typedef; + class Function; + class Variable; + class EnumValue; + class Define; + class Macro; + } +} + +class NavigationBar; + + + + +class PageMaker_Index : public SpecializedPageMaker, + public ary::Display, + public csv::ConstProcessor<ary::cpp::Namespace>, + public csv::ConstProcessor<ary::cpp::Class>, + public csv::ConstProcessor<ary::cpp::Enum>, + public csv::ConstProcessor<ary::cpp::Typedef>, + public csv::ConstProcessor<ary::cpp::Function>, + public csv::ConstProcessor<ary::cpp::Variable>, + public csv::ConstProcessor<ary::cpp::EnumValue>, + public csv::ConstProcessor<ary::cpp::Define>, + public csv::ConstProcessor<ary::cpp::Macro> +{ + public: + PageMaker_Index( + PageDisplay & io_rPage, + char i_c ); + + virtual ~PageMaker_Index(); + + virtual void MakePage(); + + private: + // Interface csv::ConstProcessor<> + virtual void do_Process( + const ary::cpp::Namespace & + i_rData ); + virtual void do_Process( + const ary::cpp::Class & + i_rData ); + virtual void do_Process( + const ary::cpp::Enum & + i_rData ); + virtual void do_Process( + const ary::cpp::Typedef & + i_rData ); + virtual void do_Process( + const ary::cpp::Function & + i_rData ); + virtual void do_Process( + const ary::cpp::Variable & + i_rData ); + virtual void do_Process( + const ary::cpp::EnumValue & + i_rData ); + virtual void do_Process( + const ary::cpp::Define & + i_rData ); + virtual void do_Process( + const ary::cpp::Macro & + i_rData ); + // Interface ary::cpp::Display: + virtual const ary::cpp::Gate * + inq_Get_ReFinder() const; + // Locals + virtual void Write_NavBar(); + virtual void Write_TopArea(); + virtual void Write_CompleteAlphabeticalList(); + + void Write_CeIndexEntry( + const ary::cpp::CodeEntity & + i_rCe, + const char * i_sType, + const char * i_sOwnerType ); + + // DATA + Dyn<NavigationBar> pNavi; + char c; + adcdisp::IndexList * + pCurIndex; +}; + + + + +#endif diff --git a/autodoc/source/display/html/pm_namsp.cxx b/autodoc/source/display/html/pm_namsp.cxx new file mode 100644 index 000000000000..6810b26b11fa --- /dev/null +++ b/autodoc/source/display/html/pm_namsp.cxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pm_namsp.cxx,v $ + * $Revision: 1.6 $ + * + * 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 "pm_namsp.hxx" + + +// NOT FULLY DEFINED SERVICES +#include "hd_chlst.hxx" +#include "hd_docu.hxx" +#include "html_kit.hxx" +#include "navibar.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" +#include "strconst.hxx" + + +using namespace csi; +using csi::html::HorizontalLine; +using csi::html::Link; +using csi::html::Table; +using csi::html::TableRow; +using csi::html::TableCell; + + + +PageMaker_Namespace::PageMaker_Namespace( PageDisplay & io_rPage ) + : SpecializedPageMaker(io_rPage), + pMe( io_rPage.Env().CurNamespace() ), + pChildDisplay( new ChildList_Display(io_rPage.Env()) ), + pNavi(0) +{ + csv_assert( pMe != 0 ); +} + +PageMaker_Namespace::~PageMaker_Namespace() +{ +} + +void +PageMaker_Namespace::MakePage() +{ + pNavi = new NavigationBar( Env(), Me() ); + + Write_NavBar(); + Write_TopArea(); + Write_DocuArea(); + + pNavi->MakeSubRow(""); + Write_ChildList( ary::cpp::Namespace::SLOT_SubNamespaces, C_sTitle_SubNamespaces, C_sLabel_SubNamespaces ); + + Write_ChildLists_forClasses( C_sTitle_Classes, + C_sLabel_Classes, + ary::cpp::CK_class ); + Write_ChildLists_forClasses( C_sTitle_Structs, + C_sLabel_Structs, + ary::cpp::CK_struct ); + Write_ChildLists_forClasses( C_sTitle_Unions, + C_sLabel_Unions, + ary::cpp::CK_union ); + + Write_ChildList( ary::cpp::Namespace::SLOT_Enums, C_sTitle_Enums, C_sLabel_Enums ); + Write_ChildList( ary::cpp::Namespace::SLOT_Typedefs, C_sTitle_Typedefs, C_sLabel_Typedefs ); + Write_ChildList( ary::cpp::Namespace::SLOT_Operations, C_sTitle_Operations, C_sLabel_Operations ); + Write_ChildList( ary::cpp::Namespace::SLOT_Constants, C_sTitle_Constants, C_sLabel_Constants ); + Write_ChildList( ary::cpp::Namespace::SLOT_Variables, C_sTitle_Variables, C_sLabel_Variables ); + + pNavi->Write_SubRows(); +} + +void +PageMaker_Namespace::Write_NavBar() +{ + pNavi->Write( CurOut() ); + CurOut() << new HorizontalLine; +} + +void +PageMaker_Namespace::Write_TopArea() +{ + Page().Write_NameChainWithLinks( Me() ); + + adcdisp::PageTitle_Std fTitle; + xml::Element & rH3 = fTitle( CurOut() ); + if ( Env().CurNamespace()->Owner().IsValid() ) + { + rH3 << C_sHFTypeTitle_Namespace + << " " + << Env().CurNamespace()->LocalName(); + } + else + { + rH3 << C_sHFTitle_GlobalNamespaceCpp; + } + CurOut() << new HorizontalLine; +} + +void +PageMaker_Namespace::Write_DocuArea() +{ + Docu_Display aDocuShow( Env() ); + + aDocuShow.Assign_Out(CurOut()); + aDocuShow.Process(Me().Docu()); + aDocuShow.Unassign_Out(); + + CurOut() << new HorizontalLine; +} + +void +PageMaker_Namespace::Write_ChildList( ary::SlotAccessId i_nSlot, + const char * i_sListTitle, + const char * i_sLabel ) + +{ + bool bChildrenExist = false; + ChildList_Display::Area_Result + aResult( bChildrenExist, CurOut() ); + + pChildDisplay->Run_Simple( aResult, + i_nSlot, + i_sLabel, + i_sListTitle ); + + pNavi->AddItem(i_sListTitle, i_sLabel, bChildrenExist); + if (bChildrenExist) + CurOut() << new HorizontalLine; +} + +void +PageMaker_Namespace::Write_ChildLists_forClasses( const char * i_sListTitle, + const char * i_sLabel, + ary::cpp::E_ClassKey i_eFilter ) + +{ + bool bChildrenExist = false; + ChildList_Display::Area_Result + aResult( bChildrenExist, CurOut() ); + + pChildDisplay->Run_GlobalClasses( aResult, + ary::cpp::Namespace::SLOT_Classes, + i_sLabel, + i_sListTitle, + i_eFilter ); + + pNavi->AddItem(i_sListTitle, i_sLabel, bChildrenExist); + if ( bChildrenExist ) + CurOut() << new HorizontalLine; +} diff --git a/autodoc/source/display/html/pm_namsp.hxx b/autodoc/source/display/html/pm_namsp.hxx new file mode 100644 index 000000000000..5088cc412304 --- /dev/null +++ b/autodoc/source/display/html/pm_namsp.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pm_namsp.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_DISPLAY_HTML_PM_NAMSP_HXX +#define ADC_DISPLAY_HTML_PM_NAMSP_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "pm_base.hxx" + // COMPONENTS + // PARAMETERS + +class ChildList_Display; +class NavigationBar; + +class PageMaker_Namespace : public SpecializedPageMaker +{ + public: + PageMaker_Namespace( + PageDisplay & io_rPage ); + + virtual ~PageMaker_Namespace(); + + virtual void MakePage(); + + private: + virtual void Write_NavBar(); + virtual void Write_TopArea(); + virtual void Write_DocuArea(); + virtual void Write_ChildList( + ary::SlotAccessId i_nSlot, + const char * i_nListTitle, + const char * i_nLabel ); + void Write_ChildLists_forClasses( + const char * i_sListTitle, + const char * i_sLabel, + ary::cpp::E_ClassKey i_eFilter ); + + const ary::cpp::Namespace & + Me() const { return *pMe; } + // DATA + const ary::cpp::Namespace * + pMe; + Dyn<ChildList_Display> + pChildDisplay; + Dyn<NavigationBar> pNavi; +}; + + + +#endif + diff --git a/autodoc/source/display/html/pm_start.cxx b/autodoc/source/display/html/pm_start.cxx new file mode 100644 index 000000000000..4d1518bd8825 --- /dev/null +++ b/autodoc/source/display/html/pm_start.cxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pm_start.cxx,v $ + * $Revision: 1.6 $ + * + * 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 "pm_start.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/ary.hxx> +#include "hd_chlst.hxx" +#include "hd_docu.hxx" +#include "navibar.hxx" +#include "html_kit.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" +#include "strconst.hxx" + + +using namespace csi; +using csi::html::Paragraph; +using csi::html::HorizontalLine; +using csi::html::AlignAttr; +using csi::html::Bold; +using csi::html::Link; +using csi::html::Sbr; +using csi::html::LineBreak; + + + +PageMaker_Overview::PageMaker_Overview( PageDisplay & io_rPage ) + : SpecializedPageMaker(io_rPage), + pNavi(0) +{ +} + +PageMaker_Overview::~PageMaker_Overview() +{ +} + +void +PageMaker_Overview::MakePage() +{ + pNavi = new NavigationBar( Env(), NavigationBar::LOC_Overview ); + Write_NavBar(); + + Write_TopArea(); + Write_DocuArea(); +} + +void +PageMaker_Overview::Write_NavBar() +{ + pNavi->Write( CurOut() ); + CurOut() << new HorizontalLine; +} + +void +PageMaker_Overview::Write_TopArea() +{ + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), Env().RepositoryTitle(), "" ); + + CurOut() + >> *new Paragraph + << new html::StyleAttr("font-size:14pt;") + << "This is a reference documentation for the C++ source code." + << new LineBreak + << new LineBreak + << "Points to start:"; + + html::SimpleList & + rList = *new html::SimpleList; + CurOut() >> rList; + + html::ListItem & rNamedObjsItem = + rList.AddItem(); + + StreamLock sNspDir(50); + rNamedObjsItem + << new html::StyleAttr("font-size:14pt;") + >> *new Link( sNspDir() << C_sDIR_NamespacesCpp + << "/" + << C_sHFN_Namespace + << c_str ) + >> *new Bold + << "Named Objects"; + rNamedObjsItem << " (classes, functions, namespaces, etc.)" + << new html::LineBreak; + rList.AddItem() + << new html::StyleAttr("font-size:14pt;") + >> *new Link( "def-all.html" ) + >> *new Bold + << "Defines and Macros" + << new html::LineBreak; + StreamLock sIndexDir(50); + rList.AddItem() + << new html::StyleAttr("font-size:14pt;") + >> *new Link( sIndexDir() << C_sDIR_Index + << "/index-1.html" + << c_str ) + >> *new Bold + << "Global Index" + << new html::LineBreak; +} + +void +PageMaker_Overview::Write_DocuArea() +{ + CurOut() << new HorizontalLine; +} + + + diff --git a/autodoc/source/display/html/pm_start.hxx b/autodoc/source/display/html/pm_start.hxx new file mode 100644 index 000000000000..f85dce0a21be --- /dev/null +++ b/autodoc/source/display/html/pm_start.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pm_start.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_DISPLAY_HTML_PM_START_HXX +#define ADC_DISPLAY_HTML_PM_START_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "pm_base.hxx" + // COMPONENTS + // PARAMETERS + +class NavigationBar; + +class PageMaker_Overview : public SpecializedPageMaker +{ + public: + PageMaker_Overview( + PageDisplay & io_rPage ); + + virtual ~PageMaker_Overview(); + + virtual void MakePage(); + + private: + virtual void Write_NavBar(); + virtual void Write_TopArea(); + virtual void Write_DocuArea(); + + // DATA + Dyn<NavigationBar> pNavi; +}; + + + +#endif + diff --git a/autodoc/source/display/html/protarea.cxx b/autodoc/source/display/html/protarea.cxx new file mode 100644 index 000000000000..a41e81e03933 --- /dev/null +++ b/autodoc/source/display/html/protarea.cxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: protarea.cxx,v $ + * $Revision: 1.6 $ + * + * 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 "protarea.hxx" + + +// NOT FULLY DEFINED SERVICES +#include "hdimpl.hxx" + + +inline UINT8 +ProtectionArea::Index( ary::cpp::E_ClassKey i_eClassKey ) const +{ + return i_eClassKey == ary::cpp::CK_class + ? 0 + : i_eClassKey == ary::cpp::CK_struct + ? 1 + : 2; +} + + + +ProtectionArea::ProtectionArea( const char * i_sLabel, + const char * i_sTitle ) + : pSglTable( new S_Slot_Table(i_sTitle) ), + aClassesTables(), + sLabel(i_sLabel) +{ +} + +ProtectionArea::~ProtectionArea() +{ + +} + +csi::html::Table & +ProtectionArea::GetTable() +{ + csv_assert(pSglTable); + + return pSglTable->GetTable(); +} + +csi::html::Table & +ProtectionArea::GetTable( ary::cpp::E_ClassKey i_eClassKey ) +{ + csv_assert(aClassesTables[Index(i_eClassKey)]); + return aClassesTables[Index(i_eClassKey)]->GetTable(); +} + +DYN csi::html::Table * +ProtectionArea::ReleaseTable() +{ + csv_assert(pSglTable); + return pSglTable->ReleaseTable(); +} + +DYN csi::html::Table * +ProtectionArea::ReleaseTable( ary::cpp::E_ClassKey i_eClassKey ) +{ + csv_assert(aClassesTables[Index(i_eClassKey)]); + return aClassesTables[Index(i_eClassKey)]->ReleaseTable(); +} + +const char * +ProtectionArea::Label() const +{ + return sLabel; +} + + +bool +ProtectionArea::WasUsed_Area() const +{ + if ( pSglTable ) + { + return pSglTable->WasUsed(); + } + + typedef const Dyn<ProtectionArea::S_Slot_Table> cdyntab; + + // Workaround a maybe compiler bug in Solaris5-CC ? + // should normally work without the cast, + // because that is exactly the genuine type, given: + return static_cast< cdyntab& >(aClassesTables[0])->WasUsed() + OR static_cast< cdyntab& >(aClassesTables[1])->WasUsed() + OR static_cast< cdyntab& >(aClassesTables[2])->WasUsed(); +} + +//******************* S_Slot_Table **********************// + +ProtectionArea:: +S_Slot_Table::S_Slot_Table(const char * i_sTitle) + : sTableTitle(i_sTitle) +{ +} + +ProtectionArea:: +S_Slot_Table::~S_Slot_Table() +{ +} + +csi::html::Table & +ProtectionArea:: +S_Slot_Table::GetTable() +{ + return pTable + ? *pTable + : *( pTable = &Create_ChildListTable(sTableTitle) ); +} + + + diff --git a/autodoc/source/display/html/protarea.hxx b/autodoc/source/display/html/protarea.hxx new file mode 100644 index 000000000000..c60731d33758 --- /dev/null +++ b/autodoc/source/display/html/protarea.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: protarea.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HTML_PROTAREA_HXX +#define ADC_DISPLAY_HTML_PROTAREA_HXX + +// USED SERVICES +#include <ary/cpp/c_types4cpp.hxx> + +namespace csi +{ +namespace html +{ + class Table; +} +} + + + + +class ProtectionArea +{ + public: + ProtectionArea( + const char * i_sLabel, + const char * i_sTitle ); + ~ProtectionArea(); + + csi::html::Table & GetTable(); + csi::html::Table & GetTable( + ary::cpp::E_ClassKey + i_eClassKey ); + DYN csi::html::Table * ReleaseTable(); + DYN csi::html::Table * ReleaseTable( + ary::cpp::E_ClassKey + i_eClassKey ); + const char * Label() const; + + int Size() const { return pSglTable ? 1 : 3; } + + bool WasUsed_Area() const; + private: + struct S_Slot_Table + { + const char * sTableTitle; + Dyn< csi::html::Table > + pTable; + + S_Slot_Table( + const char * i_sTitle ); + ~S_Slot_Table(); + csi::html::Table & GetTable(); + DYN csi::html::Table * + ReleaseTable() { return pTable.Release(); } + bool WasUsed() const { return pTable; } + }; + + UINT8 Index( + ary::cpp::E_ClassKey + i_eClassKey ) const; + // DATA + Dyn<S_Slot_Table> pSglTable; + Dyn<S_Slot_Table> aClassesTables[3]; + const char * sLabel; +}; + + + +#endif + diff --git a/autodoc/source/display/html/strconst.hxx b/autodoc/source/display/html/strconst.hxx new file mode 100644 index 000000000000..62ccf7c2fd56 --- /dev/null +++ b/autodoc/source/display/html/strconst.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: strconst.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_DISPLAY_HTML_STRCONST_HXX +#define ADC_DISPLAY_HTML_STRCONST_HXX + + +const char * const C_sDIR_NamespacesCpp = "names"; +const char * const C_sDIR_Index = "index-files"; // Convention recognised by Javadoc + +const char * const C_sPath_Index = "index-files/index-1.html"; // Convention recognised by Javadoc + +const char * const C_sHFN_Css = "cpp.css"; +const char * const C_sHFN_Overview = "index.html"; +const char * const C_sHFN_Help = "help.html"; + +const char * const C_sHFN_Namespace = "index.html"; + +const char * const C_sTitle_SubNamespaces = "Nested Namespaces"; +const char * const C_sTitle_Classes = "Classes"; +const char * const C_sTitle_Structs = "Structs"; +const char * const C_sTitle_Unions = "Unions"; +const char * const C_sTitle_Enums = "Enums"; +const char * const C_sTitle_Typedefs = "Typedefs"; +const char * const C_sTitle_Operations = "Functions"; +const char * const C_sTitle_Constants = "Constants"; +const char * const C_sTitle_Variables = "Variables"; +const char * const C_sTitle_EnumValues = "Values"; + +const char * const C_sLabel_SubNamespaces = "subnsps"; +const char * const C_sLabel_Classes = "classes"; +const char * const C_sLabel_Structs = "structs"; +const char * const C_sLabel_Unions = "unions"; +const char * const C_sLabel_Enums = "enums"; +const char * const C_sLabel_Typedefs = "tydefs"; +const char * const C_sLabel_Operations = "ops"; +const char * const C_sLabel_Constants = "consts"; +const char * const C_sLabel_Variables = "vars"; +const char * const C_sLabel_EnumValues = "envals"; + +const char * const C_sHFTitle_Overview = "C++ Reference Documentation Overview"; +const char * const C_sHFTitle_Help = "How This Reference Document Is Organized"; + +const char * const C_sHFTitle_GlobalNamespaceCpp = "Global Namespace in C++"; +const char * const C_sHFTypeTitle_Namespace = "namespace"; +const char * const C_sHFTypeTitle_Class = "class"; +const char * const C_sHFTypeTitle_Struct = "struct"; +const char * const C_sHFTypeTitle_Union = "union"; +const char * const C_sHFTypeTitle_Enum = "enum"; +const char * const C_sHFTypeTitle_Typedef = "typedef"; + + +#endif + diff --git a/autodoc/source/display/idl/hfi_constgroup.cxx b/autodoc/source/display/idl/hfi_constgroup.cxx new file mode 100644 index 000000000000..769e04b1d40e --- /dev/null +++ b/autodoc/source/display/idl/hfi_constgroup.cxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_constgroup.cxx,v $ + * $Revision: 1.10 $ + * + * 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 "hfi_constgroup.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_constgroup.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_navibar.hxx" +#include "hfi_property.hxx" +#include "hi_linkhelper.hxx" + + +extern const String + C_sCePrefix_Constants("constants group"); + + +namespace +{ + +const String + C_sList_Constants("Constants"); +const String + C_sList_Constants_Label("Constants"); +const String + C_sList_ConstantDetails("Constants' Details"); +const String + C_sList_ConstantDetails_Label("ConstantDetails"); + +enum E_SubListIndices +{ + sli_ConstantsSummary = 0, + sli_ConstantDetails = 1 +}; + + +} // anonymous namespace + + + +HF_IdlConstGroup::HF_IdlConstGroup( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlConstGroup::~HF_IdlConstGroup() +{ +} + +void +HF_IdlConstGroup::Produce_byData( const client & i_ce ) const +{ + Dyn<HF_NaviSubRow> + pNaviSubRow( &make_Navibar(i_ce) ); + + HF_TitleTable + aTitle(CurOut()); + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + produce_Title(aTitle, C_sCePrefix_Constants, i_ce); + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); + + dyn_ce_list + dpConstants; + ary::idl::ifc_constgroup::attr::Get_Constants(dpConstants, i_ce); + + if ( (*dpConstants).operator bool() ) + { + produce_Members( *dpConstants, + C_sList_Constants, + C_sList_Constants_Label, + C_sList_ConstantDetails, + C_sList_ConstantDetails_Label ); + pNaviSubRow->SwitchOn(sli_ConstantsSummary); + pNaviSubRow->SwitchOn(sli_ConstantDetails); + } + pNaviSubRow->Produce_Row(); +} + +HF_NaviSubRow & +HF_IdlConstGroup::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce,true); // true := avoid link to Use-page. + + DYN HF_NaviSubRow & + ret = aNaviBar.Add_SubRow(); + ret.AddItem(C_sList_Constants, C_sList_Constants_Label, false); + ret.AddItem(C_sList_ConstantDetails, C_sList_ConstantDetails_Label, false); + + CurOut() << new Html::HorizontalLine(); + return ret; +} + +void +HF_IdlConstGroup::produce_MemberDetails( HF_SubTitleTable & o_table, + const client & i_ce ) const +{ + HF_IdlConstant + aElement( Env(), o_table ); + aElement.Produce_byData(i_ce); +} + diff --git a/autodoc/source/display/idl/hfi_constgroup.hxx b/autodoc/source/display/idl/hfi_constgroup.hxx new file mode 100644 index 000000000000..9b870632608e --- /dev/null +++ b/autodoc/source/display/idl/hfi_constgroup.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_constgroup.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_DISPLAY_HFI_CONSTGROUP_HXX +#define ADC_DISPLAY_HFI_CONSTGROUP_HXX + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + +class HF_IdlConstGroup : public HtmlFactory_Idl +{ + public: + HF_IdlConstGroup( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlConstGroup(); + + void Produce_byData( + const client & ce ) const; + private: + HF_NaviSubRow & make_Navibar( + const client & ce ) const; + virtual void produce_MemberDetails( + HF_SubTitleTable & o_table, + const client & ce ) const; +}; + + + +// IMPLEMENTATION + + +extern const String + C_sCePrefix_Constants; + +#endif + + diff --git a/autodoc/source/display/idl/hfi_doc.cxx b/autodoc/source/display/idl/hfi_doc.cxx new file mode 100644 index 000000000000..278859f76acb --- /dev/null +++ b/autodoc/source/display/idl/hfi_doc.cxx @@ -0,0 +1,194 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_doc.cxx,v $ + * $Revision: 1.10 $ + * + * 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 "hfi_doc.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <ary_i/d_token.hxx> +#include <toolkit/hf_docentry.hxx> +#include "hfi_tag.hxx" +#include "hi_ary.hxx" + + + + +HF_IdlDocu::HF_IdlDocu( Environment & io_rEnv, + HF_DocEntryList & o_rOut ) + : HtmlFactory_Idl( io_rEnv, &o_rOut.CurOut() ), + rOut(o_rOut) +{ +} + +HF_IdlDocu::~HF_IdlDocu() +{ +} + +void +HF_IdlDocu::Produce_fromCodeEntity( const client & i_ce ) const +{ + const ce_info * + i_pDocu = Get_IdlDocu(i_ce.Docu()); + if (i_pDocu != 0) + Produce_byDocuAndScope(*i_pDocu, &i_ce, i_ce); +} + +void +HF_IdlDocu::Produce_fromReference( const ce_info & i_rDocuForReference, + const client & i_rScopeGivingCe ) const +{ + Produce_byDocuAndScope(i_rDocuForReference, 0, i_rScopeGivingCe ); +} + +void +HF_IdlDocu::Produce_byDocuAndScope( const ce_info & i_rDocu, + const client * i_pClient, + const client & i_rScopeGivingCe ) const +{ + bool bShort = NOT i_rDocu.Short().IsEmpty(); + bool bDescr = NOT i_rDocu.Description().IsEmpty(); + + if ( i_rDocu.IsDeprecated() + OR ( + (i_pClient != 0 ? i_pClient->SightLevel() == ary::idl::sl_File : false) + AND NOT i_rDocu.IsPublished() + ) + OR i_rDocu.IsOptional() ) + { // any usage restriction + rOut.Produce_Term("Usage Restrictions"); + + if ( i_rDocu.IsDeprecated() ) + rOut.Produce_Definition() >> *new Html::Italic << "deprecated"; + if ( (i_pClient != 0 ? i_pClient->SightLevel() == ary::idl::sl_File : false) + AND NOT i_rDocu.IsPublished() ) + rOut.Produce_Definition() >> *new Html::Italic << "not published"; + if ( i_rDocu.IsOptional() ) + rOut.Produce_Definition() >> *new Html::Italic << "optional"; + + if ( i_rDocu.IsDeprecated() AND + // KORR_FUTURE + // Workaround, because DocuTex2::IsEmpty() does not + // calculate whitespace tokens only as empty. + i_rDocu.DeprecatedText().Tokens().size() > 1 ) + { + rOut.Produce_Term("Deprecation Info"); + + HF_IdlDocuTextDisplay + aDescription( Env(), 0, i_rScopeGivingCe); + aDescription.Out().Enter( rOut.Produce_Definition() ); + i_rDocu.DeprecatedText().DisplayAt( aDescription ); + aDescription.Out().Leave(); + } + } // end if (<any usage restriction>) + + if ( bShort OR bDescr ) + { + rOut.Produce_Term("Description"); + HF_IdlDocuTextDisplay + aDescription( Env(), 0, i_rScopeGivingCe); + if (bShort) + { + aDescription.Out().Enter( rOut.Produce_Definition() ); + i_rDocu.Short().DisplayAt( aDescription ); + aDescription.Out().Leave(); + } + if (bDescr) + { + aDescription.Out().Enter( rOut.Produce_Definition() ); + i_rDocu.Description().DisplayAt( aDescription ); + aDescription.Out().Leave(); + } + } + + std::vector< csi::dsapi::DT_SeeAlsoAtTag* > + aSeeAlsosWithoutText; + std::vector< csi::dsapi::DT_SeeAlsoAtTag* > + aSeeAlsosWithText; + + for ( std::vector< ary::inf::AtTag2* >::const_iterator + iter = i_rDocu.Tags().begin(); + iter != i_rDocu.Tags().end(); + ++iter ) + { + csi::dsapi::DT_SeeAlsoAtTag* + pSeeAlso = dynamic_cast< csi::dsapi::DT_SeeAlsoAtTag * >(*iter); + if (pSeeAlso != 0 ) + { + if ( pSeeAlso->Text().IsEmpty() ) + { + aSeeAlsosWithoutText.push_back(pSeeAlso); + } + else + { + aSeeAlsosWithText.push_back(pSeeAlso); + } + continue; + } + + if ( strlen( (*iter)->Title() ) > 0 ) + { + HF_IdlTag + aTag(Env(), i_rScopeGivingCe); + Xml::Element & + rTerm = rOut.Produce_Term(); + aTag.Produce_byData( rTerm, + rOut.Produce_Definition(), + *(*iter) ); + } + } // end for + + if (aSeeAlsosWithoutText.size() > 0) + { + HF_IdlTag + aSeeAlsoTag(Env(), i_rScopeGivingCe); + Xml::Element & + rTerm = rOut.Produce_Term(); + aSeeAlsoTag.Produce_byData( rTerm, + rOut.Produce_Definition(), + aSeeAlsosWithoutText ); + } + + for ( std::vector< csi::dsapi::DT_SeeAlsoAtTag* >::const_iterator + itSee2 = aSeeAlsosWithText.begin(); + itSee2 != aSeeAlsosWithText.end(); + ++itSee2 ) + { + HF_IdlTag + aTag(Env(), i_rScopeGivingCe); + Xml::Element & + rTerm = rOut.Produce_Term(); + aTag.Produce_byData( rTerm, + rOut.Produce_Definition(), + *(*itSee2) ); + } // end for +} diff --git a/autodoc/source/display/idl/hfi_doc.hxx b/autodoc/source/display/idl/hfi_doc.hxx new file mode 100644 index 000000000000..9064bba3fee8 --- /dev/null +++ b/autodoc/source/display/idl/hfi_doc.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_doc.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HFI_DOC_HXX +#define ADC_DISPLAY_HFI_DOC_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + + +class HF_DocEntryList; + + +class HF_IdlDocu : public HtmlFactory_Idl +{ + public: + HF_IdlDocu( + Environment & io_rEnv, + HF_DocEntryList & o_rOut ); + virtual ~HF_IdlDocu(); + + + /** Produces documentation by the CodeInfo accompanying + ->i_ce. + */ + void Produce_fromCodeEntity( + const client & i_ce ) const; + + /** Produces documentation by the CodeInfo accompanying + a link or reference to a CodeEntity. + + @param i_rScopeGivingCe + Gives the scope from which links are to be calculated. + */ + void Produce_fromReference( + const ce_info & i_rDocuForReference, + const client & i_rScopeGivingCe ) const; + + private: + // Locals + /** Produces documentation. + + @param i_rScopeGivingCe + Gives the scope from which links are to be calculated. + */ + void Produce_byDocuAndScope( + const ce_info & i_rDocu, + const client * i_pClient, /// May be 0. + const client & i_rScopeGivingCe ) const; + + // DATA + HF_DocEntryList & rOut; +}; + + +#endif diff --git a/autodoc/source/display/idl/hfi_enum.cxx b/autodoc/source/display/idl/hfi_enum.cxx new file mode 100644 index 000000000000..6d131da33594 --- /dev/null +++ b/autodoc/source/display/idl/hfi_enum.cxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_enum.cxx,v $ + * $Revision: 1.8 $ + * + * 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 "hfi_enum.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_enum.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_navibar.hxx" +#include "hfi_property.hxx" +#include "hi_linkhelper.hxx" + + +extern const String + C_sCePrefix_Enum("enum"); + +namespace +{ + +const String + C_sList_Values("Values"); +const String + C_sList_Values_Label("Values"); +const String + C_sList_ValueDetails("Values' Details"); +const String + C_sList_ValueDetails_Label("ValueDetails"); + +enum E_SubListIndices +{ + sli_ValuesSummary = 0, + sli_ValueDetails = 1 +}; + +} // anonymous namespace + +HF_IdlEnum::HF_IdlEnum( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlEnum::~HF_IdlEnum() +{ +} + +void +HF_IdlEnum::Produce_byData( const client & i_ce ) const +{ + Dyn<HF_NaviSubRow> + pNaviSubRow( &make_Navibar(i_ce) ); + + HF_TitleTable + aTitle(CurOut()); + + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + produce_Title(aTitle, C_sCePrefix_Enum, i_ce); + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); + + dyn_ce_list + dpValues; + ary::idl::ifc_enum::attr::Get_Values(dpValues, i_ce); + if ( (*dpValues).operator bool() ) + { + produce_Members( *dpValues, + C_sList_Values, + C_sList_Values_Label, + C_sList_ValueDetails, + C_sList_ValueDetails_Label ); + pNaviSubRow->SwitchOn(sli_ValuesSummary); + pNaviSubRow->SwitchOn(sli_ValueDetails); + } + pNaviSubRow->Produce_Row(); +} + +HF_NaviSubRow & +HF_IdlEnum::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce); + + DYN HF_NaviSubRow & + ret = aNaviBar.Add_SubRow(); + ret.AddItem(C_sList_Values, C_sList_Values_Label, false); + ret.AddItem(C_sList_ValueDetails, C_sList_ValueDetails_Label, false); + + CurOut() << new Html::HorizontalLine(); + return ret; +} + +void +HF_IdlEnum::produce_MemberDetails( HF_SubTitleTable & o_table, + const client & i_ce) const +{ + HF_IdlEnumValue + aElement( Env(), o_table ); + aElement.Produce_byData(i_ce); +} diff --git a/autodoc/source/display/idl/hfi_enum.hxx b/autodoc/source/display/idl/hfi_enum.hxx new file mode 100644 index 000000000000..0499bb0e107c --- /dev/null +++ b/autodoc/source/display/idl/hfi_enum.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_enum.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_DISPLAY_HFI_ENUM_HXX +#define ADC_DISPLAY_HFI_ENUM_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + + +class HF_IdlEnum : public HtmlFactory_Idl +{ + public: + HF_IdlEnum( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlEnum(); + + void Produce_byData( + const client & ce ) const; + private: + HF_NaviSubRow & make_Navibar( + const client & ce ) const; + virtual void produce_MemberDetails( + HF_SubTitleTable & o_table, + const client & ce ) const; +}; + + + +// IMPLEMENTATION + + +extern const String + C_sCePrefix_Enum; + +#endif + + diff --git a/autodoc/source/display/idl/hfi_globalindex.cxx b/autodoc/source/display/idl/hfi_globalindex.cxx new file mode 100644 index 000000000000..93abe9d99fcd --- /dev/null +++ b/autodoc/source/display/idl/hfi_globalindex.cxx @@ -0,0 +1,278 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_globalindex.cxx,v $ + * $Revision: 1.13 $ + * + * 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 "hfi_globalindex.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_types4idl.hxx> +#include <ary/idl/i_module.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_navibar.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + + + +namespace +{ + +/** +*/ +enum E_Types +{ + t_service = 0, + t_interface = 1, + t_struct = 2, + t_exception = 3, + t_enum = 4, + t_typedef = 5, + t_constantsgroup = 6, + t_property = 7, + t_function = 8, + t_structelement = 9, + t_enumvalue = 10, + t_constant = 11, + t_module = 12, + t_singleton = 13, + t_attribute = 14, + t_siservice = 15, + t_sisingleton = 16, + t_MAX +}; + +String G_sDummy; + + +/* RC-Ids for IDL types (see reposy.cxx): + + 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 +*/ +const int C_nNumberOfIdlTypes = 17; +const char * C_sTypeNames[C_nNumberOfIdlTypes] = + { "module ", "interface ", "function ", "service ", "property ", + "enum ", "value ", "typedef ", "struct ", "field ", + "exception ", "constants group ", "constant ","singleton ", "attribute ", + "service", "singleton" + }; +const char * C_sOwnerNames[C_nNumberOfIdlTypes] = + { "module ", "module ", "interface ", "module ", "service ", + "module ", "enum ", "module ", "module ", "", // could be struct or exception + "module ", "module ", "constants group ", "module ", "interface ", + "module", "module" + }; +const intt C_nNamesArrayOffset = intt(ary::idl::Module::class_id); +const int C_nIxField = 9; + + + + +const char C_cAlphabet[] = +"<a class=\"inverse\" href=\"index-1.html\"><B>A</B></a> <a class=\"inverse\" href=\"index-2.html\"><B>B</B></a> <a class=\"inverse\" href=\"index-3.html\"><B>C</B></a> <a class=\"inverse\" href=\"index-4.html\"><B>D</B></a> <a class=\"inverse\" href=\"index-5.html\"><B>E</B></a> " +"<a class=\"inverse\" href=\"index-6.html\"><B>F</B></a> <a class=\"inverse\" href=\"index-7.html\"><B>G</B></a> <a class=\"inverse\" href=\"index-8.html\"><B>H</B></a> <a class=\"inverse\" href=\"index-9.html\"><B>I</B></a> <a class=\"inverse\" href=\"index-10.html\"><B>J</B></a> " +"<a class=\"inverse\" href=\"index-11.html\"><B>K</B></a> <a class=\"inverse\" href=\"index-12.html\"><B>L</B></a> <a class=\"inverse\" href=\"index-13.html\"><B>M</B></a> <a class=\"inverse\" href=\"index-14.html\"><B>N</B></a> <a class=\"inverse\" href=\"index-15.html\"><B>O</B></a> " +"<a class=\"inverse\" href=\"index-16.html\"><B>P</B></a> <a class=\"inverse\" href=\"index-17.html\"><B>Q</B></a> <a class=\"inverse\" href=\"index-18.html\"><B>R</B></a> <a class=\"inverse\" href=\"index-19.html\"><B>S</B></a> <a class=\"inverse\" href=\"index-20.html\"><B>T</B></a> " +"<a class=\"inverse\" href=\"index-21.html\"><B>U</B></a> <a class=\"inverse\" href=\"index-22.html\"><B>V</B></a> <a class=\"inverse\" href=\"index-23.html\"><B>W</B></a> <a class=\"inverse\" href=\"index-24.html\"><B>X</B></a> <a class=\"inverse\" href=\"index-25.html\"><B>Y</B></a> " +"<a class=\"inverse\" href=\"index-26.html\"><B>Z</B></a>"; + + + +HF_IdlGlobalIndex::PageData G_PageData; + +} // end anonymous namespace + + +inline void +HF_IdlGlobalIndex::write_EntryItself( Xml::Element & o_destination, + const ary::idl::CodeEntity & i_ce, + const HF_IdlTypeText & i_typeLinkWriter ) const +{ + i_typeLinkWriter.Produce_IndexLink(o_destination, i_ce); + o_destination << " - "; +} + + +HF_IdlGlobalIndex::HF_IdlGlobalIndex( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlGlobalIndex::~HF_IdlGlobalIndex() +{ +} + +void +HF_IdlGlobalIndex::Produce_Page(ary::idl::alphabetical_index::E_Letter i_letter) const +{ + make_Navibar(); + + HF_TitleTable + aTitle(CurOut()); + StreamLock sl(100); + aTitle.Produce_Title( sl() + << "Global Index " + << ( i_letter != ary::idl::alphabetical_index::non_alpha + ? char(int(i_letter)-'a'+'A') + : '_' ) + << c_str ); + + // Letters Index + aTitle.Add_Row() + << new Xml::XmlCode( + "<p align=\"center\"><a href=\"index-1.html\"><b>A</b></a> <a href=\"index-2.html\"><b>B</b></a> <a href=\"index-3.html\"><b>C</b></a> <a href=\"index-4.html\"><b>D</b></a> <a href=\"index-5.html\"><b>E</b></a> <a href=\"index-6.html\"><b>F</b></a> <a href=\"index-7.html\"><b>G</b></a> <a href=\"index-8.html\"><b>H</b></a> <a href=\"index-9.html\"><b>I</b></a> <a href=\"index-10.html\"><b>J</b></a>" + " <a href=\"index-11.html\"><b>K</b></a> <a href=\"index-12.html\"><b>L</b></a> <a href=\"index-13.html\"><b>M</b></a> <a href=\"index-14.html\"><b>N</b></a> <a href=\"index-15.html\"><b>O</b></a> <a href=\"index-16.html\"><b>P</b></a> <a href=\"index-17.html\"><b>Q</b></a> <a href=\"index-18.html\"><b>R</b></a> <a href=\"index-19.html\"><b>S</b></a> <a href=\"index-20.html\"><b>T</b></a>" + " <a href=\"index-21.html\"><b>U</b></a> <a href=\"index-22.html\"><b>V</b></a> <a href=\"index-23.html\"><b>W</b></a> <a href=\"index-24.html\"><b>X</b></a> <a href=\"index-25.html\"><b>Y</b></a> <a href=\"index-26.html\"><b>Z</b></a> <a href=\"index-27.html\"><b>_</b></a></p>" ); + + Out().Enter(CurOut() >> *new Html::DefList); + + csv::erase_container(G_PageData); + Env().Data().Get_IndexData(G_PageData, i_letter); + + // Helper object to produce links to the index Entries. + HF_IdlTypeText aTypeLinkWriter(Env(),HF_IdlTypeText::use_for_javacompatible_index); + + PageData::const_iterator itEnd = G_PageData.end(); + for ( PageData::const_iterator iter = G_PageData.begin(); + iter != itEnd; + ++iter ) + { + produce_Line(iter, aTypeLinkWriter); + } // end for + + Out().Leave(); + CurOut() << new Html::HorizontalLine; +} + +void +HF_IdlGlobalIndex::make_Navibar() const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_IndexMainRow(); + + CurOut() << new Html::HorizontalLine(); +} + +void +HF_IdlGlobalIndex::produce_Line( PageData::const_iterator i_entry, + const HF_IdlTypeText & i_typeLinkWriter) const +{ + const client & + rCe = Env().Data().Find_Ce(*i_entry); + if (NOT rCe.Owner().IsValid()) + return; // Omit global namespace. + + // The destination for the created output: + Xml::Element & rDT = CurOut() >> *new Html::DefListTerm; + + /** The following code is intended to produce an output that + will be recognized by the context help system of Forte. + That is reached by making it similar to the indices, that + Javadoc produces. + If the link to the Entry contains a hashmark, the Forte-Help + requires following a link to the owner. + But if there is no hashmark, the following link must go to + the same Entry again. Doesn't make really sense :-(, but that's + like it is. + */ + write_EntryItself(rDT,rCe,i_typeLinkWriter); + if (rCe.SightLevel() == ary::idl::sl_Member) + write_OwnerOfEntry(rDT,rCe,i_typeLinkWriter); + else + write_EntrySecondTime(rDT,rCe,i_typeLinkWriter); + + // This produces an empty "<dd></dd>", which is also needed to reach + // similarity to the Javadoc index: + CurOut() << new Html::DefListDefinition; +} + +void +HF_IdlGlobalIndex::write_OwnerOfEntry( Xml::Element & o_destination, + const ary::idl::CodeEntity & i_ce, + const HF_IdlTypeText & i_typeLinkWriter ) const +{ + const client & + rOwner = Env().Data().Find_Ce(i_ce.Owner()); + + int nIx = int(i_ce.AryClass() - C_nNamesArrayOffset); + csv_assert(csv::in_range(0,nIx,C_nNumberOfIdlTypes)); + + o_destination << C_sTypeNames[nIx] + << "in "; + if (nIx != C_nIxField) + { + o_destination << C_sOwnerNames[nIx]; + } + else + { + uintt + nOwnerIx = rOwner.AryClass() - C_nNamesArrayOffset; + csv_assert( + nOwnerIx < static_cast< unsigned int >(C_nNumberOfIdlTypes)); + o_destination << C_sTypeNames[nOwnerIx]; + } + i_typeLinkWriter.Produce_IndexOwnerLink(o_destination, rOwner); +} + +void +HF_IdlGlobalIndex::write_EntrySecondTime( Xml::Element & o_destination, + const ary::idl::CodeEntity & i_ce, + const HF_IdlTypeText & i_typeLinkWriter ) const +{ + int nIx = int(i_ce.AryClass() - C_nNamesArrayOffset); + csv_assert(csv::in_range(0,nIx,C_nNumberOfIdlTypes)); + + o_destination << C_sTypeNames[nIx] + << " "; + i_typeLinkWriter.Produce_IndexSecondEntryLink(o_destination, i_ce); +} diff --git a/autodoc/source/display/idl/hfi_globalindex.hxx b/autodoc/source/display/idl/hfi_globalindex.hxx new file mode 100644 index 000000000000..42bcef5ec1f4 --- /dev/null +++ b/autodoc/source/display/idl/hfi_globalindex.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_globalindex.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_DISPLAY_HFI_GLOBALINDEX_HXX +#define ADC_DISPLAY_HFI_GLOBALINDEX_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_gate.hxx> + + +class HF_IdlTypeText; + +class HF_IdlGlobalIndex : public HtmlFactory_Idl +{ + public: + typedef std::vector<ary::idl::Ce_id> PageData; + + HF_IdlGlobalIndex( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlGlobalIndex(); + + void Produce_Page( + ary::idl::alphabetical_index::E_Letter + i_letter ) const; + private: + void make_Navibar() const; /// Called by @->Produce_Page() + void produce_Line( /// Called by @->Produce_Page() + PageData::const_iterator + i_entry, + const HF_IdlTypeText & + i_typeLinkWriter ) const; + + void write_EntryItself( /// Called by @->produceLine() + Xml::Element & o_destination, + const ary::idl::CodeEntity & + i_entry, + const HF_IdlTypeText & + i_typeLinkWriter ) const; + + void write_OwnerOfEntry( /// Called by @->produceLine() + Xml::Element & o_destination, + const ary::idl::CodeEntity & + i_entry, + const HF_IdlTypeText & + i_typeLinkWriter ) const; + + void write_EntrySecondTime( /// Called by @->produceLine() + Xml::Element & o_destination, + const ary::idl::CodeEntity & + i_entry, + const HF_IdlTypeText & + i_typeLinkWriter ) const; +}; + + + +#endif + diff --git a/autodoc/source/display/idl/hfi_hierarchy.cxx b/autodoc/source/display/idl/hfi_hierarchy.cxx new file mode 100644 index 000000000000..6ba2a439311e --- /dev/null +++ b/autodoc/source/display/idl/hfi_hierarchy.cxx @@ -0,0 +1,205 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_hierarchy.cxx,v $ + * $Revision: 1.8 $ + * + * 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 "hfi_hierarchy.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <udm/html/htmlitem.hxx> +#include <ary/stdconstiter.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_type.hxx> +#include <ary/idl/ik_interface.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/idl/ip_type.hxx> +#include "hfi_interface.hxx" +#include "hfi_typetext.hxx" +#include "hi_env.hxx" + + + +HF_IdlBaseNode::HF_IdlBaseNode( const TYPE & i_rType, + const GATE & i_rGate, + intt i_nPositionOffset, + HF_IdlBaseNode & io_rDerived ) + : nType(i_rType.TypeId()), + aBases(), + nCountBases(0), + nPosition(i_nPositionOffset), + pDerived(&io_rDerived) +{ + Ce_id nCe = i_rGate.Types().Search_CeRelatedTo(nType); + if (nCe.IsValid()) + { + GatherBases(i_rGate.Ces().Find_Ce(nCe), i_rGate); + } +} + +HF_IdlBaseNode::~HF_IdlBaseNode() +{ +} + +void +HF_IdlBaseNode::FillPositionList( std::vector< const HF_IdlBaseNode* > & o_rPositionList ) const +{ + for ( BaseList::const_iterator it = aBases.begin(); + it != aBases.end(); + ++it ) + { + (*it)->FillPositionList(o_rPositionList); + } // end for + + o_rPositionList.push_back(this); +} + +void +HF_IdlBaseNode::GatherBases( const CE & i_rCe, + const GATE & i_rGate ) +{ + ary::Dyn_StdConstIterator<ary::idl::CommentedRelation> + aHelp; + ary::idl::ifc_interface::attr::Get_Bases(aHelp,i_rCe); + + for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *aHelp; + it.operator bool(); + ++it ) + { + const TYPE & + rBaseType = i_rGate.Types().Find_Type((*it).Type()); + + Dyn<HF_IdlBaseNode> + pBaseNode( new HF_IdlBaseNode( rBaseType, + i_rGate, + nPosition, + *this ) + ); + + intt nAddedBases = pBaseNode->BaseCount() + 1; + nCountBases += nAddedBases; + nPosition += nAddedBases; + aBases.push_back( pBaseNode.Release() ); + } // end for +} + + +void +Write_BaseHierarchy( csi::xml::Element & o_rOut, + HtmlEnvironment_Idl & i_env, + const ary::idl::CodeEntity & i_ce ) +{ + csi::xml::Element & + rPre = o_rOut + >> *new csi::xml::AnElement("pre") + << new csi::html::StyleAttr("font-family:monospace;"); + + std::vector<uintt> + aSetColumns; + rPre + >> *new csi::html::Strong + << i_ce.LocalName(); + rPre + << "\n"; + Write_Bases( rPre, + i_env, + i_ce, + aSetColumns ); + rPre + << "\n"; + +} + + +void +Write_Bases( csi::xml::Element & o_out, + HtmlEnvironment_Idl & i_env, + const ary::idl::CodeEntity & i_rCe, + std::vector<uintt> & io_setColumns ) +{ + ary::Dyn_StdConstIterator<ary::idl::CommentedRelation> + aHelp; + ary::idl::ifc_interface::attr::Get_Bases(aHelp,i_rCe); + + for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *aHelp; + it.operator bool(); + // NO INCREMENT HERE, see below + ) + { + ary::idl::Type_id + nType = (*it).Type(); + ++it; + bool + bThereComesMore = it.operator bool(); + + ary::idl::Ce_id + nCe = i_env.Gate().Types().Search_CeRelatedTo(nType); + if (nCe.IsValid()) + { + // KORR_FUTURE + // Rather check for id(!) of com::sun::star::uno::XInterface. + if (i_env.Gate().Ces().Find_Ce(nCe).LocalName() == "XInterface") + continue; + } + + for (uintt i = 0; i < io_setColumns.size(); ++i) + { + if (io_setColumns[i] == 1) + o_out << new csi::xml::XmlCode("┃"); + else + o_out << " "; + o_out << " "; + } + + if (bThereComesMore) + o_out << new csi::xml::XmlCode("┣"); + else + o_out << new csi::xml::XmlCode("┗"); + o_out << " "; + + HF_IdlTypeText + aDisplay( i_env, o_out, true, i_env.CurPageCe()); + aDisplay.Produce_byData(nType); + o_out << "\n"; + + if (nCe.IsValid()) + { + io_setColumns.push_back(bThereComesMore ? 1 : 0); + + const ary::idl::CodeEntity & + rCe = i_env.Gate().Ces().Find_Ce(nCe); + Write_Bases( o_out, + i_env, + rCe, + io_setColumns ); + io_setColumns.pop_back(); + } + } // end for +} diff --git a/autodoc/source/display/idl/hfi_hierarchy.hxx b/autodoc/source/display/idl/hfi_hierarchy.hxx new file mode 100644 index 000000000000..556908b4869e --- /dev/null +++ b/autodoc/source/display/idl/hfi_hierarchy.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_hierarchy.hxx,v $ + * $Revision: 1.6 $ + * + * 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 ADC_DISPLAY_HFI_HIERARCHY_HXX +#define ADC_DISPLAY_HFI_HIERARCHY_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_comrela.hxx> +#include <ary/idl/i_types4idl.hxx> + + +namespace csi +{ +namespace xml +{ + class Element; +} +} + + +class HF_IdlInterface; +class HtmlEnvironment_Idl; + + + +/** Represents a node in an pyramidic inheritance hierarchy which shall be + displayed in text mode. +*/ +class HF_IdlBaseNode +{ + public: + typedef ary::idl::CodeEntity CE; + typedef ary::idl::Type TYPE; + typedef ary::idl::Gate GATE; + typedef ary::idl::Ce_id Ce_id; + typedef ary::idl::Type_id Type_id; + + /** @descr + The constructor recursively calls further constructors of + HF_IdlBaseNode for the bases of ->i_rType, if ->i_rType matches to a + ->CE. + So it builds up a complete hierarchy tree of all base classes + of ->i_pEntity. + */ + HF_IdlBaseNode( + const TYPE & i_rType, + const GATE & i_rGate, + intt i_nPositionOffset, + HF_IdlBaseNode & io_rDerived ); + ~HF_IdlBaseNode(); + + /** Recursively fills ->o_rPositionList with the instances of base + classes in the order in which they will be displayed. + */ + void FillPositionList( + std::vector< const HF_IdlBaseNode* > & + o_rPositionList ) const; + + Type_id Type() const { return nType; } + intt BaseCount() const { return nCountBases; } + intt Position() const { return nPosition; } + int Xpos() const { return 3*Position(); } + int Ypos() const { return 2*Position(); } + const HF_IdlBaseNode * Derived() const { return pDerived; } + + private: + typedef std::vector< DYN HF_IdlBaseNode* > BaseList; + + void GatherBases( + const CE & i_rCe, + const GATE & i_rGate ); + + // DATA + Type_id nType; + BaseList aBases; + intt nCountBases; + intt nPosition; + HF_IdlBaseNode * pDerived; +}; + +void Write_BaseHierarchy( + csi::xml::Element & o_rOut, + HtmlEnvironment_Idl & + i_env, + const ary::idl::CodeEntity & + i_rCe ); + +void Write_Bases( + csi::xml::Element & o_rOut, + HtmlEnvironment_Idl & + i_env, + const ary::idl::CodeEntity & + i_rCe, + std::vector<uintt> & + io_setColumns ); + +#endif diff --git a/autodoc/source/display/idl/hfi_interface.cxx b/autodoc/source/display/idl/hfi_interface.cxx new file mode 100644 index 000000000000..1c242f746b58 --- /dev/null +++ b/autodoc/source/display/idl/hfi_interface.cxx @@ -0,0 +1,360 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_interface.cxx,v $ + * $Revision: 1.11 $ + * + * 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 "hfi_interface.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ik_function.hxx> +#include <ary/idl/ik_interface.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/idl/ip_type.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_doc.hxx" +#include "hfi_hierarchy.hxx" +#include "hfi_method.hxx" +#include "hfi_navibar.hxx" +#include "hfi_property.hxx" +#include "hfi_tag.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + +extern const String + C_sCePrefix_Interface("interface"); + +namespace +{ + +const String + C_sBaseInterface("Base Interfaces"); +const String + C_sList_BaseComments("Comments on Base Interfaces"); +const String + C_sList_Methods("Methods' Summary"); +const String + C_sList_Methods_Label("MethodsSummary"); +const String + C_sDetails_Methods("Methods' Details"); +const String + C_sDetails_Methods_Label("MethodsDetails"); + +const String + C_sList_Attributes("Attributes' Summary"); +const String + C_sList_Attributes_Label("AttributesSummary"); +const String + C_sList_AttributesDetails("Attributes' Details"); +const String + C_sList_AttributesDetails_Label("AttributesDetails"); + + + +enum E_SubListIndices +{ + sli_MethodsSummay = 0, + sli_AttributesSummary = 1, + sli_MethodDetails = 2, + sli_AttributesDetails = 3 +}; + +} //anonymous namespace + + + + +HF_IdlInterface::HF_IdlInterface( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut), + eCurProducedMembers(mem_none) +{ +} + +HF_IdlInterface::~HF_IdlInterface() +{ +} + +void +HF_IdlInterface::Produce_byData( const client & i_ce ) const +{ + Dyn<HF_NaviSubRow> + pNaviSubRow( &make_Navibar(i_ce) ); + + HF_TitleTable + aTitle(CurOut()); + + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + + produce_Title(aTitle, C_sCePrefix_Interface, i_ce); + + produce_BaseHierarchy( aTitle.Add_Row(), + i_ce, + C_sBaseInterface ); + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); + + dyn_ce_list dpFunctions; + ary::idl::ifc_interface::attr::Get_Functions(dpFunctions, i_ce); + if ( (*dpFunctions).operator bool() ) + { + eCurProducedMembers = mem_Functions; + + produce_Members( *dpFunctions, + C_sList_Methods, + C_sList_Methods_Label, + C_sDetails_Methods, + C_sDetails_Methods_Label, + HtmlFactory_Idl::viewtype_summary ); + pNaviSubRow->SwitchOn(sli_MethodsSummay); + } + + dyn_ce_list + dpAttributes; + ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes, i_ce); + if ( (*dpAttributes).operator bool() ) + { + eCurProducedMembers = mem_Attributes; + + produce_Members( *dpAttributes, + C_sList_Attributes, + C_sList_Attributes_Label, + C_sList_AttributesDetails, + C_sList_AttributesDetails_Label, + HtmlFactory_Idl::viewtype_summary ); + pNaviSubRow->SwitchOn(sli_AttributesSummary); + } + + ary::idl::ifc_interface::attr::Get_Functions(dpFunctions, i_ce); + if ( (*dpFunctions).operator bool() ) + { + eCurProducedMembers = mem_Functions; + + produce_Members( *dpFunctions, + C_sList_Methods, + C_sList_Methods_Label, + C_sDetails_Methods, + C_sDetails_Methods_Label, + HtmlFactory_Idl::viewtype_details ); + pNaviSubRow->SwitchOn(sli_MethodDetails); + } + + ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes, i_ce); + if ( (*dpAttributes).operator bool() ) + { + eCurProducedMembers = mem_Attributes; + + produce_Members( *dpAttributes, + C_sList_Attributes, + C_sList_Attributes_Label, + C_sList_AttributesDetails, + C_sList_AttributesDetails_Label, + HtmlFactory_Idl::viewtype_details ); + pNaviSubRow->SwitchOn(sli_AttributesDetails); + } + + eCurProducedMembers = mem_none; + + pNaviSubRow->Produce_Row(); +} + +DYN HF_NaviSubRow & +HF_IdlInterface::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce); + + DYN HF_NaviSubRow & + ret = aNaviBar.Add_SubRow(); + ret.AddItem(C_sList_Methods, C_sList_Methods_Label, false); + ret.AddItem(C_sList_Attributes, C_sList_Attributes_Label, false); + ret.AddItem(C_sDetails_Methods, C_sDetails_Methods_Label, false); + ret.AddItem(C_sList_AttributesDetails, C_sList_AttributesDetails_Label, false); + + CurOut() << new Html::HorizontalLine(); + return ret; +} + +void +HF_IdlInterface::produce_MemberDetails( HF_SubTitleTable & o_table, + const client & i_ce ) const +{ + switch (eCurProducedMembers) + { + case mem_Functions: + break; + case mem_Attributes: + { + HF_IdlAttribute + aAttribute( Env(), o_table); + aAttribute.Produce_byData( i_ce ); + return; + }; + default: //Won't happen. + return; + } // end switch + + typedef ary::idl::ifc_function::attr funcAttr; + + HF_IdlMethod + aFunction( Env(), + o_table.Add_Row() + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_MDetail) ); + + ary::Dyn_StdConstIterator<ary::idl::Parameter> + pParameters; + funcAttr::Get_Parameters(pParameters, i_ce); + + ary::Dyn_StdConstIterator<ary::idl::Type_id> + pExceptions; + funcAttr::Get_Exceptions(pExceptions, i_ce); + + aFunction.Produce_byData( i_ce.LocalName(), + funcAttr::ReturnType(i_ce), + *pParameters, + *pExceptions, + funcAttr::IsOneway(i_ce), + funcAttr::HasEllipse(i_ce), + i_ce ); +} + +void +HF_IdlInterface::produce_BaseHierarchy( Xml::Element & o_screen, + const client & i_ce, + const String & i_sLabel ) const +{ + ary::Dyn_StdConstIterator<ary::idl::CommentedRelation> + pHelp; + ary::idl::ifc_interface::attr::Get_Bases(pHelp, i_ce); + if (NOT (*pHelp).operator bool()) + return; + + // Check for XInterface as only base: + ary::StdConstIterator<ary::idl::CommentedRelation> & + itTest = *pHelp; + ary::idl::Ce_id + nCe = Env().Gate().Types().Search_CeRelatedTo((*itTest).Type()); + if (nCe.IsValid()) + { + // KORR_FUTURE + // Rather check for id(!) of com::sun::star::uno::XInterface. + if (Env().Gate().Ces().Find_Ce(nCe).LocalName() == "XInterface") + { + ++itTest; + if (NOT itTest.operator bool()) + return; + } + } + + // Write hierarchy: + + HF_DocEntryList + aDocList( o_screen ); + aDocList.Produce_Term(i_sLabel); + Xml::Element & + rBaseList = aDocList.Produce_Definition(); + +// NEW + Write_BaseHierarchy(rBaseList, Env(), i_ce); + + // Write comments: + // KORR_FUTURE: Make sure, no empty table is constructed when comments list is empty. + HF_SubTitleTable + aBaseTable( aDocList.Produce_Definition(), + "", + C_sList_BaseComments, + 2, + HF_SubTitleTable::sublevel_3 ); + + ary::Dyn_StdConstIterator<ary::idl::CommentedRelation> + pBases; + ary::idl::ifc_interface::attr::Get_Bases(pBases, i_ce); + for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *pBases; + it.operator bool(); + ++it ) + { + Xml::Element & + rRow = aBaseTable.Add_Row(); + + Xml::Element & + rTerm = rRow + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_SummaryLeft); + HF_IdlTypeText + aTypeDisplay( Env(), rTerm, false, 0); + aTypeDisplay.Produce_byData((*it).Type()); + + Xml::Element & + rDocu = rRow + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_SummaryRight); + + HF_DocEntryList + aDocuList(rDocu); + + if ((*it).Info() != 0) + { +// aDocuList.Produce_Term("Comment on Base Reference"); + + HF_IdlDocu + aDocuDisplay(Env(), aDocuList); + aDocuDisplay.Produce_fromReference(*(*it).Info(), i_ce); + } + else + { + const client * + pCe = Env().Linker().Search_CeFromType((*it).Type()); + const ce_info * + pShort = pCe != 0 + ? Get_IdlDocu(pCe->Docu()) + : (const ce_info *)(0); + if ( pShort != 0 ) + { + aDocuList.Produce_NormalTerm("(referenced interface's summary:)"); + + Xml::Element & + rDef = aDocuList.Produce_Definition(); + HF_IdlDocuTextDisplay + aShortDisplay( Env(), &rDef, *pCe); + pShort->Short().DisplayAt(aShortDisplay); + } // end if (pShort != 0) + } // endif ( (*i_commentedRef).Info() != 0 ) else + } // end for +} diff --git a/autodoc/source/display/idl/hfi_interface.hxx b/autodoc/source/display/idl/hfi_interface.hxx new file mode 100644 index 000000000000..b737d26f7cbf --- /dev/null +++ b/autodoc/source/display/idl/hfi_interface.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_interface.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_DISPLAY_HFI_INTERFACE_HXX +#define ADC_DISPLAY_HFI_INTERFACE_HXX + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_types4idl.hxx> +#include <ary/doc/d_oldidldocu.hxx> + + +class HF_NaviSubRow; +class HF_SubTitleTable; +class HF_IdlBaseNode; + +class HF_IdlInterface : public HtmlFactory_Idl +{ + public: + HF_IdlInterface( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlInterface(); + + void Produce_byData( + const client & i_ce ) const; + private: + // Locals + DYN HF_NaviSubRow & make_Navibar( + const client & i_ce ) const; + + virtual void produce_MemberDetails( + HF_SubTitleTable & o_table, + const client & ce ) const; + void produce_BaseHierarchy( + Xml::Element & o_screen, + const client & i_ce, + const String & i_sLabel ) const; + + // Locals + enum E_CurProducedMembers + { + mem_none, + mem_Functions, + mem_Attributes + }; + + // DATA + mutable E_CurProducedMembers + eCurProducedMembers; +}; + + + +// IMPLEMENTATION + +extern const String + C_sCePrefix_Interface; + + + +#endif diff --git a/autodoc/source/display/idl/hfi_linklist.cxx b/autodoc/source/display/idl/hfi_linklist.cxx new file mode 100644 index 000000000000..935506be4a53 --- /dev/null +++ b/autodoc/source/display/idl/hfi_linklist.cxx @@ -0,0 +1,381 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_linklist.cxx,v $ + * $Revision: 1.8 $ + * + * 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 "hfi_linklist.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/idl/ip_type.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_doc.hxx" +#include "hfi_tag.hxx" +#include "hfi_typetext.hxx" +#include "hi_ary.hxx" +#include "hi_env.hxx" + + + + +//******************* HF_CommentedLink_Table **********************************// + +HF_CommentedLink_Table::HF_CommentedLink_Table( Environment & io_rEnv, + Xml::Element & o_rOut, + const String & i_sTitle, + const String & i_sLabel, + bool i_bBorder ) + : HtmlFactory_Idl(io_rEnv,&o_rOut), + pTable( new Html::Table( (i_bBorder ? "1" : "0"), "100%", "5", "0") ), + pCurLinkColumn(0), + pCurCommentColumn(0) +{ + *pTable + << new Html::ClassAttr("commentedlinks"); + + CurOut() + >> *new Html::Label(i_sLabel) + << new Html::LineBreak; + CurOut() + << pTable; +// HF_SubTitle aTitle(*pTable); +// aTitle.Produce_it(i_sTitle); +} + +HF_CommentedLink_Table::~HF_CommentedLink_Table() +{ +} + +void +HF_CommentedLink_Table::Add_Line() +{ + Html::TableRow & + rRow = pTable->AddRow(); + + pCurLinkColumn = & (rRow.AddCell() + << new Html::WidthAttr("30%") + << new Xml::AnAttribute("valign","top") ); + pCurCommentColumn = & rRow.AddCell(); +} + +Xml::Element & +HF_CommentedLink_Table::Cur_LinkColumn() +{ + csv_assert(pCurLinkColumn != 0); + return *pCurLinkColumn; +} + +Xml::Element & +HF_CommentedLink_Table::Cur_CommentColumn() +{ + csv_assert(pCurCommentColumn != 0); + return *pCurCommentColumn; +} + + +//******************* HF_MemberTable **********************************// + +HF_MemberTable::HF_MemberTable( Environment & io_rEnv, + Xml::Element & o_rOut, + const String & i_sTitle, + const String & i_sLabel, + bool i_bInline ) + : HtmlFactory_Idl(io_rEnv,&o_rOut), + pTable( new Html::Table("1", "100%", "5", "0") ), + pCurDeclaration(0), + pCurDescription(0), + bInline(i_bInline) +{ + *pTable + << new Html::ClassAttr("memberlist"); + + CurOut() + >> *new Html::Label(i_sLabel) + << new Html::LineBreak; + CurOut() + << pTable; +// HF_SubTitle aTitle(*pTable); +// aTitle.Produce_it(i_sTitle); +} + +HF_MemberTable::~HF_MemberTable() +{ +} + +void +HF_MemberTable::Add_Line() +{ + if (bInline) + { + Html::TableRow & rRow = pTable->AddRow(); + + pCurDeclaration = &( rRow.AddCell() + << new Xml::AnAttribute("valign","top") + << new Html::WidthAttr("30%") ); + pCurDescription = & rRow.AddCell(); + } + else + { + Html::DefList * + pMemberSpace = new Html::DefList; + *pMemberSpace + << new Html::ClassAttr("member"); + + pTable->AddRow().AddCell() << pMemberSpace; + + pCurDeclaration = + & ( *pMemberSpace + >> *new Html::DefListTerm + << new Html::ClassAttr("member") ); + pCurDescription = + & ( *pMemberSpace + >> *new Html::DefListDefinition() + << new Html::ClassAttr("member") ); + } +} + +Xml::Element & +HF_MemberTable::Cur_Declaration() +{ + csv_assert(pCurDeclaration != 0); + return *pCurDeclaration; +} + +Xml::Element & +HF_MemberTable::Cur_Description() +{ + csv_assert(pCurDescription != 0); + return *pCurDescription; +} + + + +//******************* HF_IdlLinkList **********************************// + +HF_IdlLinkList::HF_IdlLinkList( Environment & io_rEnv, + Xml::Element * o_pOut ) + : HtmlFactory_Idl(io_rEnv,o_pOut) +{ +} + +HF_IdlLinkList::~HF_IdlLinkList() +{ +} + +void +HF_IdlLinkList::Produce_NamespaceMembers( const String & i_sTitle, + const String & i_sLabel, + const std::vector<ary::idl::Ce_id> & i_rList, + bool i_bNestedNamespaces ) const +{ + HF_CommentedLink_Table + aTableMaker( Env(), CurOut(), + i_sTitle, i_sLabel, + true ); + + std::vector<ary::idl::Ce_id>::const_iterator itEnd = i_rList.end(); + for ( std::vector<ary::idl::Ce_id>::const_iterator it = i_rList.begin(); + it != itEnd; + ++it ) + { + static String sEntryName; + static String sEntryLink; + const ce_info * + pDocu = 0; + Get_EntryData_NamespaceMembers( sEntryName, sEntryLink, pDocu, *it, i_bNestedNamespaces ); + aTableMaker.Add_Line(); + + aTableMaker.Cur_LinkColumn() + >> *new Html::Link(sEntryLink) + << sEntryName; + + if ( pDocu != 0 ) + { + HF_IdlShortDocu + aTextDisplay(Env(), aTableMaker.Cur_CommentColumn() ); + aTextDisplay.Produce_byData( pDocu ); + } + } // end for +} + +void +HF_IdlLinkList::Produce_GlobalLinks( const String & i_sTitle, + const String & i_sLabel, + ce_list & i_rList ) const +{ + HF_CommentedLink_Table + aTableMaker( Env(), CurOut(), + i_sTitle, i_sLabel, + true ); + + for ( ; i_rList; ++i_rList ) + { + aTableMaker.Add_Line(); + HF_IdlTypeText + aLinkText( Env(), aTableMaker.Cur_LinkColumn(), true ); + aLinkText.Produce_byData(*i_rList); + + const ce_info * + pDocu = Get_EntryDocu(*i_rList); + if ( pDocu != 0 ) + { + HF_IdlShortDocu + aTextDisplay(Env(), aTableMaker.Cur_CommentColumn() ); + aTextDisplay.Produce_byData( pDocu, *i_rList ); + } + } +} + +void +HF_IdlLinkList::Produce_GlobalCommentedLinks( const String & i_sTitle, + const String & i_sLabel, + comref_list & i_rList ) const +{ + HF_CommentedLink_Table + aTableMaker( Env(), CurOut(), + i_sTitle, i_sLabel, + true ); +/* + for ( ; i_rList; ++i_rList ) + { + aTableMaker.Add_Line(); + HF_IdlTypeText + aLinkText( Env(), aTableMaker.Cur_LinkColumn(), true ); + aLinkText.Produce_byData( (*i_rList).first ); + + HF_DocEntryList + aDocList( aTableMaker.Cur_CommentColumn() ); + if ( (*i_rList).second != 0 ) + { + HF_IdlDocu + aDocuDisplay( Env(), aDocList ); + aDocuDisplay.Produce_byData( (*i_rList).second ); + } + else + { + const ce_info * + pShort = Get_EntryDocu( + Env().Gate().Types().Search_CeRelatedTo( + (*i_rList).first) ); + if ( pShort != 0 ) + { + if (pShort->IsDeprecated()) + { + aDocList.Produce_Term() + << "[ DEPRECATED ]"; + } + if (pShort->IsOptional()) + { + aDocList.Produce_Term() + << "[ OPTIONAL ]"; + } + + aDocList.Produce_Term() + << "Description"; + + HF_IdlDocuTextDisplay + aShortDisplay( Env(), &aDocList.Produce_Definition() ); + aShortDisplay.Set_CurScopeTo( + Env().Gate().Types().Search_CeRelatedTo((*i_rList).first) ); + pShort->Short().DisplayAt(aShortDisplay); + } + } + } +*/ +} + +void +HF_IdlLinkList::Produce_MemberLinks( const String & i_sTitle, + const String & i_sLabel, + ce_list & i_rList ) const +{ + HF_CommentedLink_Table + aTableMaker( Env(), CurOut(), + i_sTitle, i_sLabel, + true ); + +/* + for ( ; i_rList; ++i_rList ) + { + const ary::idl::CodeEntity & + rCe = Env().Gate().Ces().Find_Ce(*i_rList); + + aTableMaker.Add_Line(); + aTableMaker.Cur_LinkColumn() + >> *new Html::Link( + StreamLock(200)() << "#" << rCe.LocalName() << c_str) + << rCe.LocalName(); + + const ce_info * + pDocu = rCe.Docu(); + if ( pDocu != 0 ) + { + HF_IdlShortDocu + aTextDisplay(Env(), aTableMaker.Cur_CommentColumn() ); + aTextDisplay.Produce_byData( *pDocu ); + } + } // end for +*/ +} + +void +HF_IdlLinkList::Get_EntryData_NamespaceMembers( + String & o_sEntryName, + String & o_sEntryLink, + const ce_info * & o_pDocu, + ce_id i_nMemberId, + bool i_bIsNestedNamespace ) const +{ + const ary::idl::CodeEntity & + rCe = Env().Data().Find_Ce(i_nMemberId); + + o_sEntryName = rCe.LocalName(); + o_sEntryLink = StreamLock(200)() << rCe.LocalName() + << ( i_bIsNestedNamespace + ? "/module-ix" + : "" ) + << ".html" + << c_str; + o_pDocu = rCe.Docu(); +} + +const ary::doc::OldIdlDocu * +HF_IdlLinkList::Get_EntryDocu(ce_id i_nMemberId) const +{ + if (i_nMemberId.IsValid()) + return Env().Data().Find_Ce(i_nMemberId).Docu(); + else + return 0; +} + + diff --git a/autodoc/source/display/idl/hfi_linklist.hxx b/autodoc/source/display/idl/hfi_linklist.hxx new file mode 100644 index 000000000000..12a5e21d3b19 --- /dev/null +++ b/autodoc/source/display/idl/hfi_linklist.hxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_linklist.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_DISPLAY_HFI_LINKLIST_HXX +#define ADC_DISPLAY_HFI_LINKLIST_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_comrela.hxx> +#include <ary_i/ci_text2.hxx> +#include <ary/doc/d_oldidldocu.hxx> + + + + +class HF_CommentedLink_Table : public HtmlFactory_Idl +{ + public: + HF_CommentedLink_Table( + Environment & io_rEnv, + Xml::Element & o_rOut, + const String & i_sTitle, + const String & i_sLabel, + bool i_bBorder = false ); + virtual ~HF_CommentedLink_Table(); + + void Add_Line(); + Xml::Element & Cur_LinkColumn(); + Xml::Element & Cur_CommentColumn(); + + private: + // DATA + Html::Table * pTable; + Xml::Element * pCurLinkColumn; + Xml::Element * pCurCommentColumn; +}; + +class HF_MemberTable : public HtmlFactory_Idl +{ + public: + HF_MemberTable( + Environment & io_rEnv, + Xml::Element & o_rOut, + const String & i_sTitle, + const String & i_sLabel, + bool i_bInline = false ); + virtual ~HF_MemberTable(); + + void Add_Line(); + Xml::Element & Cur_Declaration(); + Xml::Element & Cur_Description(); + + private: + // DATA + Html::Table * pTable; + Xml::Element * pCurDeclaration; + Xml::Element * pCurDescription; + bool bInline; +}; + + + + +class HF_IdlLinkList : public HtmlFactory_Idl +{ + public: + typedef ary::StdConstIterator<ary::idl::CommentedRelation> + comref_list; + + HF_IdlLinkList( + Environment & io_rEnv, + Xml::Element * o_pOut ); + virtual ~HF_IdlLinkList(); + + void Produce_NamespaceMembers( + const String & i_sTitle, + const String & i_sLabel, + const std::vector<ary::idl::Ce_id> & + i_rList, + bool i_bNestedNamespaces = false ) const; + void Produce_GlobalLinks( + const String & i_sTitle, + const String & i_sLabel, + ce_list & i_rList ) const; + void Produce_GlobalCommentedLinks( + const String & i_sTitle, + const String & i_sLabel, + comref_list & i_rList ) const; + void Produce_MemberLinks( + const String & i_sTitle, + const String & i_sLabel, + ce_list & i_rList ) const; + private: + void Get_EntryData_NamespaceMembers( + String & o_sEntryName, + String & o_sEntryLink, + const ce_info * & o_pDocuText, + ce_id i_nMemberId, + bool i_bIsNestedNamespace ) const; + const ce_info * Get_EntryDocu( + ce_id i_nMemberId ) const; +}; + + + + + + + + +// IMPLEMENTATION + + +#endif + + diff --git a/autodoc/source/display/idl/hfi_method.cxx b/autodoc/source/display/idl/hfi_method.cxx new file mode 100644 index 000000000000..6b98a22aa38e --- /dev/null +++ b/autodoc/source/display/idl/hfi_method.cxx @@ -0,0 +1,360 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_method.cxx,v $ + * $Revision: 1.9 $ + * + * 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 "hfi_method.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_exception.hxx> +#include <ary/idl/i_param.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_funcdecl.hxx> +#include "hfi_doc.hxx" +#include "hfi_globalindex.hxx" +#include "hfi_typetext.hxx" + + + + + +HF_IdlMethod::HF_IdlMethod( Environment & io_rEnv, + Xml::Element & o_cell) + : HtmlFactory_Idl(io_rEnv,&o_cell) +{ +} + + +HF_IdlMethod::~HF_IdlMethod() +{ +} + + +void +HF_IdlMethod::Produce_byData( const String & i_sName, + type_id i_nReturnType, + param_list & i_rParams, + type_list & i_rExceptions, + bool i_bOneway, + bool i_bEllipse, + const client & i_ce ) const +{ + CurOut() + >> *new Html::Label(i_sName) + << new Html::ClassAttr(C_sMemberTitle) + << i_sName; + enter_ContentCell(); + write_Declaration( i_sName, + i_nReturnType, + i_rParams, + i_rExceptions, + i_bOneway, + i_bEllipse ); + CurOut() << new Html::HorizontalLine; + write_Docu(CurOut(), i_ce); + leave_ContentCell(); +} + +#if 0 // old +void +HF_IdlMethod::write_Declaration( const String & i_sName, + type_id i_nReturnType, + param_list & i_rParams, + type_list & i_rExceptions, + bool i_bOneway, + bool i_bEllipse ) const +{ + HF_FunctionDeclaration + aDecl(CurOut()) ; + Xml::Element & + front = aDecl.Add_ReturnLine(); + + // Front: + if (i_bOneway) + front << "[oneway] "; + if (i_nReturnType.IsValid()) + { // Normal function, but not constructors: + HF_IdlTypeText + aReturn(Env(), front, true); + aReturn.Produce_byData(i_nReturnType); + front + << new Html::LineBreak; + + } + front + >> *new Html::Bold + << i_sName; + + // Main line: + Xml::Element & + types = aDecl.Types(); + Xml::Element & + names = aDecl.Names(); + bool bParams = i_rParams.operator bool(); + if (bParams) + { + front + << "("; + HF_IdlTypeText + aType( Env(), types, true ); + + write_Param( aType, names, (*i_rParams) ); + + for (++i_rParams; i_rParams; ++i_rParams) + { + types + << new Html::LineBreak; + names + << "," + << new Html::LineBreak; + write_Param( aType, names, (*i_rParams) ); + } // end for + + if (i_bEllipse) + { + names + << " ..."; + } + names + << " )"; + } + else + front + << "()"; + + + if ( i_rExceptions.operator bool() ) + { + Xml::Element & + rExcOut = aDecl.Add_RaisesLine("raises", NOT bParams); + HF_IdlTypeText + aExc(Env(), rExcOut, true); + aExc.Produce_byData(*i_rExceptions); + + for (++i_rExceptions; i_rExceptions; ++i_rExceptions) + { + rExcOut + << "," + << new Html::LineBreak; + aExc.Produce_byData(*i_rExceptions); + } // end for + + rExcOut << " );"; + } + else + { + if (bParams) + aDecl.Names() << ";"; + else + aDecl.Front() << ";"; + } +} +#endif // 0 old + +void +HF_IdlMethod::write_Declaration( const String & i_sName, + type_id i_nReturnType, + param_list & i_rParams, + type_list & i_rExceptions, + bool i_bOneway, + bool i_bEllipse ) const +{ + HF_FunctionDeclaration + aDecl(CurOut(), "raises") ; + Xml::Element & + rReturnLine = aDecl.ReturnCell(); + + // Return line: + if (i_bOneway) + rReturnLine << "[oneway] "; + if (i_nReturnType.IsValid()) + { // Normal function, but not constructors: + HF_IdlTypeText + aReturn(Env(), rReturnLine, true); + aReturn.Produce_byData(i_nReturnType); + } + + // Main line: + Xml::Element & + rNameCell = aDecl.NameCell(); + rNameCell + >> *new Html::Bold + << i_sName; + + Xml::Element * + pParamEnd = 0; + + bool bParams = i_rParams.operator bool(); + if (bParams) + { + rNameCell + << "("; + + pParamEnd = write_Param( aDecl, *i_rParams ); + for (++i_rParams; i_rParams; ++i_rParams) + { + *pParamEnd << ","; + pParamEnd = write_Param( aDecl, *i_rParams ); + } // end for + + if (i_bEllipse) + { + Xml::Element & + rParamType = aDecl.NewParamTypeCell(); + rParamType + << " ..."; + pParamEnd = &rParamType; + } + *pParamEnd + << " )"; + } + else + { + rNameCell + << "()"; + } + + if ( i_rExceptions.operator bool() ) + { + Xml::Element & + rExcOut = aDecl.ExceptionCell(); + HF_IdlTypeText + aExc(Env(), rExcOut, true); + aExc.Produce_byData(*i_rExceptions); + + for (++i_rExceptions; i_rExceptions; ++i_rExceptions) + { + rExcOut + << "," + << new Html::LineBreak; + aExc.Produce_byData(*i_rExceptions); + } // end for + + rExcOut << " );"; + } + else if (bParams) + { + *pParamEnd << ";"; + } + else + { + rNameCell << ";"; + } +} + +#if 0 // old +void +HF_IdlMethod::write_Param( HF_IdlTypeText & o_type, + Xml::Element & o_names, + const ary::idl::Parameter & i_param ) const +{ + switch ( i_param.Direction() ) + { + case ary::idl::param_in: + o_type.CurOut() << "[in] "; + break; + case ary::idl::param_out: + o_type.CurOut() << "[out] "; + break; + case ary::idl::param_inout: + o_type.CurOut() << "[inout] "; + break; + } // end switch + + o_type.Produce_byData( i_param.Type() ); + o_names + << i_param.Name(); +} +#endif // 0 old + +Xml::Element * +HF_IdlMethod::write_Param( HF_FunctionDeclaration & o_decl, + const ary::idl::Parameter & i_param ) const +{ + Xml::Element & + rTypeCell = o_decl.NewParamTypeCell(); + Xml::Element & + rNameCell = o_decl.ParamNameCell(); + + switch ( i_param.Direction() ) + { + case ary::idl::param_in: + rTypeCell << "[in] "; + break; + case ary::idl::param_out: + rTypeCell << "[out] "; + break; + case ary::idl::param_inout: + rTypeCell << "[inout] "; + break; + } // end switch + + HF_IdlTypeText + aTypeWriter(Env(), rTypeCell, true); + aTypeWriter.Produce_byData( i_param.Type() ); + + rNameCell + << i_param.Name(); + return &rNameCell; +} + +const String sContentBorder("0"); +const String sContentWidth("96%"); +const String sContentPadding("5"); +const String sContentSpacing("0"); + +const String sBgWhite("#ffffff"); +const String sCenter("center"); + +void +HF_IdlMethod::enter_ContentCell() const +{ + + Xml::Element & + rContentCell = CurOut() + >> *new Html::Table( sContentBorder, + sContentWidth, + sContentPadding, + sContentSpacing ) + << new Html::ClassAttr("table-in-method") + << new Html::BgColorAttr(sBgWhite) + << new Html::AlignAttr(sCenter) + >> *new Html::TableRow + >> *new Html::TableCell; + Out().Enter(rContentCell); +} + + +void +HF_IdlMethod::leave_ContentCell() const +{ + Out().Leave(); +} + diff --git a/autodoc/source/display/idl/hfi_method.hxx b/autodoc/source/display/idl/hfi_method.hxx new file mode 100644 index 000000000000..f30a8087b8f6 --- /dev/null +++ b/autodoc/source/display/idl/hfi_method.hxx @@ -0,0 +1,107 @@ + /************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_method.hxx,v $ + * $Revision: 1.6 $ + * + * 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 ADC_DISPLAY_HFI_METHOD_HXX +#define ADC_DISPLAY_HFI_METHOD_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_param.hxx> +#include <ary/doc/d_oldidldocu.hxx> +typedef ary::doc::OldIdlDocu CodeInfo; +#include "hfi_linklist.hxx" + + + +namespace csi +{ + namespace idl + { + class Parameter; + } +} + +class HF_FunctionDeclaration; + +class HF_IdlMethod : public HtmlFactory_Idl +{ + public: + typedef ary::StdConstIterator<ary::idl::Parameter> param_list; + + HF_IdlMethod( + Environment & io_rEnv, + Xml::Element & o_cell ); + virtual ~HF_IdlMethod(); + + void Produce_byData( + const String & i_sName, + type_id i_nReturnType, + param_list & i_rParams, + type_list & i_rExceptions, + bool i_bOneway, + bool i_bEllipse, + const client & i_ce ) const; + private: + void write_Declaration( + const String & i_sName, + type_id i_nReturnType, + param_list & i_rParams, + type_list & i_rExceptions, + bool i_bOneway, + bool i_bEllipse ) const; +// void write_Param( +// HF_IdlTypeText & o_type, +// Xml::Element & o_names, +// const ary::idl::Parameter & +// i_param ) const; + + Xml::Element * write_Param( + HF_FunctionDeclaration & + o_decl, + const ary::idl::Parameter & + i_param ) const; + void enter_ContentCell() const; + void leave_ContentCell() const; +}; + + + +// IMPLEMENTATION + + + +#endif + + diff --git a/autodoc/source/display/idl/hfi_module.cxx b/autodoc/source/display/idl/hfi_module.cxx new file mode 100644 index 000000000000..2fdc07ea1719 --- /dev/null +++ b/autodoc/source/display/idl/hfi_module.cxx @@ -0,0 +1,302 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_module.cxx,v $ + * $Revision: 1.8 $ + * + * 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 "hfi_module.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/ik_module.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <ary/getncast.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_doc.hxx" +#include "hfi_navibar.hxx" +#include "hfi_tag.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + +extern const String + C_sCePrefix_Module("module"); + +namespace +{ + +const String + C_sList_NestedModules("Nested Modules"); +const String + C_sList_NestedModules_Label("NestedModules"); +const String + C_sList_Services("Services"); +const String + C_sList_Singletons("Singletons"); +const String + C_sList_Interfaces("Interfaces"); +const String + C_sList_Structs("Structs"); +const String + C_sList_Exceptions("Exceptions"); +const String + C_sList_Enums("Enums"); +const String + C_sList_Typedefs("Typedefs"); +const String + C_sList_ConstGroups("Constant Groups"); +const String + C_sList_ConstGroups_Label("ConstantGroups"); + + +enum E_SubListIndices +{ // In case of changes, also adapt make_Navibar() !! + sli_NestedModules = 0, + sli_Services = 1, + sli_Singletons = 2, + sli_Interfaces = 3, + sli_Structs = 4, + sli_Exceptions = 5, + sli_Enums = 6, + sli_Typedefs = 7, + sli_ConstGroups = 8 +}; + +} //anonymous namespace + + +HF_IdlModule::HF_IdlModule( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlModule::~HF_IdlModule() +{ +} + +typedef ary::idl::ifc_module::attr ModuleAttr; + + +void +HF_IdlModule::Produce_byData( const client & i_ce ) const +{ + Dyn<HF_NaviSubRow> + pNaviSubRow( &make_Navibar(i_ce) ); + + HF_TitleTable + aTitle(CurOut()); + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + if ( Env().CurPosition().Depth() > 0 ) + { + aNameChain.Produce_CompleteChain_forModule(Env().CurPosition(), nameChainLinker); + + StreamLock + sl(200); + aTitle.Produce_Title( sl() + << C_sCePrefix_Module + << " " + << i_ce.LocalName() + << c_str ); + } + else + { + aTitle.Produce_Title( "Global Module" ); + } + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); + + + // Write children lists: + ce_ptr_list aNestedModules; + ce_ptr_list aServices; + ce_ptr_list aInterfaces; + ce_ptr_list aStructs; + ce_ptr_list aExceptions; + ce_ptr_list aEnums; + ce_ptr_list aTypedefs; + ce_ptr_list aConstantGroups; + ce_ptr_list aSingletons; + + ModuleAttr::Get_AllChildrenSeparated( + aNestedModules, + aServices, + aInterfaces, + aStructs, + aExceptions, + aEnums, + aTypedefs, + aConstantGroups, + aSingletons, + Env().Data().Ces(), + i_ce ); + + // Has this to be in the order of enum E_SubListIndices ??? + if (produce_ChildList(C_sList_NestedModules, C_sList_NestedModules_Label, aNestedModules )) + pNaviSubRow->SwitchOn(sli_NestedModules); + if (produce_ChildList(C_sList_Services, C_sList_Services, aServices)) + pNaviSubRow->SwitchOn(sli_Services); + if (produce_ChildList(C_sList_Singletons, C_sList_Singletons, aSingletons)) + pNaviSubRow->SwitchOn(sli_Singletons); + if (produce_ChildList(C_sList_Interfaces, C_sList_Interfaces, aInterfaces)) + pNaviSubRow->SwitchOn(sli_Interfaces); + if (produce_ChildList(C_sList_Structs, C_sList_Structs, aStructs)) + pNaviSubRow->SwitchOn(sli_Structs); + if (produce_ChildList(C_sList_Exceptions, C_sList_Exceptions, aExceptions)) + pNaviSubRow->SwitchOn(sli_Exceptions); + if (produce_ChildList(C_sList_Enums, C_sList_Enums, aEnums)) + pNaviSubRow->SwitchOn(sli_Enums); + if (produce_ChildList(C_sList_Typedefs, C_sList_Typedefs, aTypedefs)) + pNaviSubRow->SwitchOn(sli_Typedefs); + if (produce_ChildList(C_sList_ConstGroups, C_sList_ConstGroups_Label, aConstantGroups)) + pNaviSubRow->SwitchOn(sli_ConstGroups); + pNaviSubRow->Produce_Row(); +} + +DYN HF_NaviSubRow & +HF_IdlModule::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_ModuleMainRow(i_ce); + + DYN HF_NaviSubRow & + ret = aNaviBar.Add_SubRow(); + + // Has to be in the order of E_SubListIndices: + ret.AddItem(C_sList_NestedModules, C_sList_NestedModules_Label, false); + ret.AddItem(C_sList_Services, C_sList_Services, false); + ret.AddItem(C_sList_Singletons, C_sList_Singletons, false); + ret.AddItem(C_sList_Interfaces, C_sList_Interfaces, false); + ret.AddItem(C_sList_Structs, C_sList_Structs, false); + ret.AddItem(C_sList_Exceptions, C_sList_Exceptions, false); + ret.AddItem(C_sList_Enums, C_sList_Enums, false); + ret.AddItem(C_sList_Typedefs, C_sList_Typedefs, false); + ret.AddItem(C_sList_ConstGroups, C_sList_ConstGroups_Label, false); + + CurOut() << new Html::HorizontalLine(); + return ret; +} + +bool +HF_IdlModule::produce_ChildList( const String & i_sName, + const String & i_sLabel, + const ce_ptr_list & i_list ) const +{ + if ( i_list.size() == 0 ) + return false; + + HF_SubTitleTable + aTable( CurOut(), + i_sLabel, + i_sName, + 2 ); + + ce_ptr_list::const_iterator + itEnd = i_list.end(); + for ( ce_ptr_list::const_iterator it = i_list.begin(); + it != itEnd; + ++it ) + { + Xml::Element & + rRow = aTable.Add_Row(); + produce_Link(rRow, *it); + produce_LinkDoc(rRow, *it); + } // end for + + return true; +} + +void +HF_IdlModule::produce_Link( Xml::Element & o_row, + const client * i_ce ) const +{ + csv_assert(i_ce != 0); + Xml::Element & + rCell = o_row + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_SummaryLeft); + + if ( NOT ary::is_type<ary::idl::Module>(*i_ce) ) + { + HF_IdlTypeText + aText(Env(), rCell, true); + aText.Produce_byData(i_ce->CeId()); + } + else + { + StreamLock slBuf(100); + rCell + >> *new Html::Link( slBuf() << i_ce->LocalName() + << "/module-ix.html" + << c_str ) + << i_ce->LocalName(); + } +} + +void +HF_IdlModule::produce_LinkDoc( Xml::Element & o_row, + const client * i_ce ) const +{ + csv_assert(i_ce != 0); + + // We need the cell in any case, because, the rendering may be hurt else. + Xml::Element & + rCell = o_row + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_SummaryRight); + + const client & + rCe = *i_ce; + const ce_info * + pShort = Get_IdlDocu(rCe.Docu()); + if ( pShort == 0 ) + return; + + + if (pShort->IsDeprecated()) + { + rCell << "[ DEPRECATED ]" << new Html::LineBreak; + } + if (pShort->IsOptional()) + { + rCell << "[ OPTIONAL ]" << new Html::LineBreak; + } + + HF_IdlDocuTextDisplay + aShortDisplay(Env(), &rCell, *i_ce); + pShort->Short().DisplayAt(aShortDisplay); +} diff --git a/autodoc/source/display/idl/hfi_module.hxx b/autodoc/source/display/idl/hfi_module.hxx new file mode 100644 index 000000000000..b234b7aa6f18 --- /dev/null +++ b/autodoc/source/display/idl/hfi_module.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_module.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HFI_MODULE_HXX +#define ADC_DISPLAY_HFI_MODULE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + + +class HF_NaviSubRow; + +class HF_IdlModule : public HtmlFactory_Idl +{ + public: + HF_IdlModule( + Environment & io_rEnv, // The CurDirectory() is the one of the here displayed Module. + Xml::Element & o_rOut ); + virtual ~HF_IdlModule(); + + void Produce_byData( + const client & i_ce ) const; + private: + typedef std::vector< const ary::idl::CodeEntity* > ce_ptr_list; + + DYN HF_NaviSubRow & make_Navibar( + const client & i_ce ) const; + bool produce_ChildList( + const String & i_sName, + const String & i_sLabel, + const ce_ptr_list & i_list ) const; + void produce_Link( + Xml::Element & o_row, + const client * i_ce ) const; + void produce_LinkDoc( + Xml::Element & o_row, + const client * i_ce ) const; +}; + + + +// IMPLEMENTATION + + +extern const String + C_sCePrefix_Module; + + + + + +#endif + + diff --git a/autodoc/source/display/idl/hfi_navibar.cxx b/autodoc/source/display/idl/hfi_navibar.cxx new file mode 100644 index 000000000000..efeb4a8bce32 --- /dev/null +++ b/autodoc/source/display/idl/hfi_navibar.cxx @@ -0,0 +1,228 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_navibar.cxx,v $ + * $Revision: 1.8 $ + * + * 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 "hfi_navibar.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <toolkit/hf_navi_main.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include "hfi_interface.hxx" +#include "hfi_module.hxx" +#include "hfi_service.hxx" +#include "hi_linkhelper.hxx" + + +extern const String + C_sLocalManualLinks("#devmanual"); + + +const String C_sTop = "Overview"; +const String C_sModule = "Module"; +const String C_sUse = "Use"; +const String C_sManual = "Devguide"; +const String C_sIndex = "Index"; + + + + +HF_IdlNavigationBar::HF_IdlNavigationBar( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlNavigationBar::~HF_IdlNavigationBar() +{ +} + +void +HF_IdlNavigationBar::Produce_CeMainRow( const client & i_ce, + bool i_bNoUsePage ) +{ + HF_NaviMainRow + aNaviMain( CurOut() ); + + StreamLock aLink(500); + StreamStr & rLink = aLink(); + + Env().Get_LinkTo( rLink.reset(), + Env().OutputTree().Overview() ); + aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); + + Env().Get_LinkTo( rLink.reset(), + Env().Linker().PositionOf_CurModule() ); + aNaviMain.Add_StdItem( C_sModule, rLink.c_str() ); + + if (i_bNoUsePage) + { + aNaviMain.Add_NoneItem( C_sUse ); + } + else + { + Env().Get_LinkTo( rLink.reset(), + Env().Linker().PositionOf_CurXRefs(i_ce.LocalName()) ); + aNaviMain.Add_StdItem( C_sUse, rLink.c_str() ); + } + + const StringVector & + rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual(); + if (rManualDescrs.size() == 2) + { + aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() )); + } + else if (rManualDescrs.size() > 2) + { + aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks); + } + else + { + aNaviMain.Add_NoneItem( C_sManual ); + } + + Env().Get_LinkTo( rLink.reset(), + Env().Linker().PositionOf_Index() ); + aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() ); + + aNaviMain.Produce_Row(); +} + +void +HF_IdlNavigationBar::Produce_CeXrefsMainRow( const client & i_ce ) +{ + HF_NaviMainRow + aNaviMain( CurOut() ); + + StreamLock aLink(500); + StreamStr & rLink = aLink(); + + Env().Get_LinkTo( rLink.reset(), + Env().OutputTree().Overview() ); + aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); + + Env().Get_LinkTo( rLink.reset(), + Env().Linker().PositionOf_CurModule() ); + aNaviMain.Add_StdItem( C_sModule, rLink.c_str() ); + + aNaviMain.Add_SelfItem( C_sUse ); + + const StringVector & + rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual(); + if (rManualDescrs.size() == 2) + { + aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() )); + } + else if (rManualDescrs.size() > 2) + { + aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks); + } + else + { + aNaviMain.Add_NoneItem( C_sManual ); + } + + Env().Get_LinkTo( rLink.reset(), + Env().Linker().PositionOf_Index() ); + aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() ); + + aNaviMain.Produce_Row(); +} + +void +HF_IdlNavigationBar::Produce_ModuleMainRow( const client & i_ce ) +{ + HF_NaviMainRow + aNaviMain( CurOut() ); + + StreamLock aLink(500); + StreamStr & rLink = aLink(); + + Env().Get_LinkTo( rLink.reset(), + Env().OutputTree().Overview() ); + aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); + + aNaviMain.Add_SelfItem( C_sModule ); + + aNaviMain.Add_NoneItem( C_sUse ); + + const StringVector & + rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual(); + if (rManualDescrs.size() == 1) + { + aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() )); + } + else if (rManualDescrs.size() > 1) + { + aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks); + } + else + { + aNaviMain.Add_NoneItem( C_sManual ); + } + + Env().Get_LinkTo( rLink.reset(), + Env().Linker().PositionOf_Index() ); + aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() ); + + aNaviMain.Produce_Row(); +} + +void +HF_IdlNavigationBar::Produce_IndexMainRow() +{ + HF_NaviMainRow + aNaviMain( CurOut() ); + + StreamLock aLink(500); + StreamStr & rLink = aLink(); + + Env().Get_LinkTo( rLink.reset(), + Env().OutputTree().Overview() ); + aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); + + aNaviMain.Add_NoneItem( C_sModule ); + aNaviMain.Add_NoneItem( C_sUse ); + aNaviMain.Add_NoneItem( C_sManual ); + + aNaviMain.Add_SelfItem( C_sIndex ); + + aNaviMain.Produce_Row(); + + CurOut() << new Html::HorizontalLine(); +} + +DYN HF_NaviSubRow & +HF_IdlNavigationBar::Add_SubRow() +{ + return *new HF_NaviSubRow( CurOut() ); +} + diff --git a/autodoc/source/display/idl/hfi_navibar.hxx b/autodoc/source/display/idl/hfi_navibar.hxx new file mode 100644 index 000000000000..9def07080244 --- /dev/null +++ b/autodoc/source/display/idl/hfi_navibar.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_navibar.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HFI_NAVIBAR_HXX +#define ADC_DISPLAY_HFI_NAVIBAR_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include "hi_factory.hxx" + // PARAMETERS + +namespace ary +{ +namespace idl +{ +class CodeEntity; +} +} + + +class HF_NaviSubRow; + +/** @resp + Creates a navigation bar for an IDL HTML documentation page. +*/ +class HF_IdlNavigationBar : public HtmlFactory_Idl +{ + public: + HF_IdlNavigationBar( + HtmlEnvironment_Idl & + io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlNavigationBar(); + + void Produce_CeMainRow( + const client & i_ce, + bool i_bNoUsePage = false ); + void Produce_CeXrefsMainRow( + const client & i_ce ); + void Produce_ModuleMainRow( + const client & i_ce ); + void Produce_IndexMainRow(); + + /** Adds the subrow to the o_rOut argument of the constructor. + */ + DYN HF_NaviSubRow & Add_SubRow(); + + private: + const ary::idl::CodeEntity * + pCe; +}; + +extern const String + C_sLocalManualLinks; + +#endif diff --git a/autodoc/source/display/idl/hfi_property.cxx b/autodoc/source/display/idl/hfi_property.cxx new file mode 100644 index 000000000000..8500a236c791 --- /dev/null +++ b/autodoc/source/display/idl/hfi_property.cxx @@ -0,0 +1,454 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_property.cxx,v $ + * $Revision: 1.7 $ + * + * 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 "hfi_property.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_attribute.hxx> +#include <ary/idl/ik_constant.hxx> +#include <ary/idl/ik_enumvalue.hxx> +#include <ary/idl/ik_property.hxx> +#include <ary/idl/ik_structelem.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_typetext.hxx" +#include "hfi_doc.hxx" +#include "hfi_tag.hxx" +#include "hi_env.hxx" +#include "hi_ary.hxx" +#include "hi_linkhelper.hxx" + +void +HF_IdlDataMember::Produce_byData( const client & ce ) const +{ + write_Title(ce); + enter_ContentCell(); + write_Declaration(ce); + write_Description(ce); + leave_ContentCell(); +} + +HF_IdlDataMember::HF_IdlDataMember( Environment & io_rEnv, + HF_SubTitleTable & o_table ) + : HtmlFactory_Idl( io_rEnv, + &(o_table.Add_Row() + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_MDetail)) + ) +{ +} + +const String sContentBorder("0"); +const String sContentWidth("96%"); +const String sContentPadding("5"); +const String sContentSpacing("0"); + +const String sBgWhite("#ffffff"); +const String sCenter("center"); + +void +HF_IdlDataMember::write_Title( const client & i_ce ) const +{ + CurOut() + >> *new Html::Label(i_ce.LocalName()) + << new Html::ClassAttr(C_sMemberTitle) + << i_ce.LocalName(); +} + +void +HF_IdlDataMember::write_Description( const client & i_ce ) const +{ + CurOut() << new Html::HorizontalLine; + write_Docu(CurOut(), i_ce); +} + +void +HF_IdlDataMember::enter_ContentCell() const +{ + + Xml::Element & + rContentCell = CurOut() + >> *new Html::Table( sContentBorder, + sContentWidth, + sContentPadding, + sContentSpacing ) + << new Html::ClassAttr("table-in-data") + << new Html::BgColorAttr(sBgWhite) + << new Html::AlignAttr(sCenter) + >> *new Html::TableRow + >> *new Html::TableCell; + Out().Enter(rContentCell); +} + + +void +HF_IdlDataMember::leave_ContentCell() const +{ + Out().Leave(); +} + + +HF_IdlProperty::~HF_IdlProperty() +{ +} + +typedef ary::idl::ifc_property::attr PropertyAttr; + +void +HF_IdlProperty::write_Declaration( const client & i_ce ) const +{ + if (PropertyAttr::HasAnyStereotype(i_ce)) + { + CurOut() << "[ "; + if (PropertyAttr::IsReadOnly(i_ce)) + CurOut() << "readonly "; + if (PropertyAttr::IsBound(i_ce)) + CurOut() << "bound "; + if (PropertyAttr::IsConstrained(i_ce)) + CurOut() << "constrained "; + if (PropertyAttr::IsMayBeAmbiguous(i_ce)) + CurOut() << "maybeambiguous "; + if (PropertyAttr::IsMayBeDefault(i_ce)) + CurOut() << "maybedefault "; + if (PropertyAttr::IsMayBeVoid(i_ce)) + CurOut() << "maybevoid "; + if (PropertyAttr::IsRemovable(i_ce)) + CurOut() << "removable "; + if (PropertyAttr::IsTransient(i_ce)) + CurOut() << "transient "; + CurOut() << "] "; + } // end if + + HF_IdlTypeText + aType( Env(), CurOut(), true ); + aType.Produce_byData( PropertyAttr::Type(i_ce) ); + + CurOut() << " " >> *new Html::Bold << i_ce.LocalName(); + CurOut() << ";"; +} + + + + +HF_IdlAttribute::~HF_IdlAttribute() +{ +} + +typedef ary::idl::ifc_attribute::attr AttributeAttr; + +void +HF_IdlAttribute::write_Declaration( const client & i_ce ) const +{ + if (AttributeAttr::HasAnyStereotype(i_ce)) + { + CurOut() << "[ "; + if (AttributeAttr::IsReadOnly(i_ce)) + CurOut() << "readonly "; + if (AttributeAttr::IsBound(i_ce)) + CurOut() << "bound "; + CurOut() << "] "; + } + + HF_IdlTypeText + aType( Env(), CurOut(), true ); + aType.Produce_byData( AttributeAttr::Type(i_ce) ); + + CurOut() + << " " + >> *new Html::Bold + << i_ce.LocalName(); + + dyn_type_list pGetExceptions; + dyn_type_list pSetExceptions; + AttributeAttr::Get_GetExceptions(pGetExceptions, i_ce); + AttributeAttr::Get_SetExceptions(pSetExceptions, i_ce); + + bool bGetRaises = (*pGetExceptions).IsValid(); + bool bSetRaises = (*pSetExceptions).IsValid(); + bool bRaises = bGetRaises OR bSetRaises; + if (bRaises) + { + HF_DocEntryList aSub(CurOut()); + + if (bGetRaises) + { + Xml::Element & + rGet = aSub.Produce_Definition(); + HF_IdlTypeText + aExc(Env(), rGet, true); + type_list & itExc = *pGetExceptions; + + rGet << "get raises ("; + aExc.Produce_byData(*itExc); + for (++itExc; itExc.operator bool(); ++itExc) + { + rGet + << ","; + aExc.Produce_byData(*itExc); + } // end for + rGet << ")"; + if (NOT bSetRaises) + rGet << ";"; + } // end if (bGetRaises) + + if (bSetRaises) + { + Xml::Element & + rSet = aSub.Produce_Definition(); + HF_IdlTypeText + aExc(Env(), rSet, true); + type_list & itExc = *pSetExceptions; + + rSet << "set raises ("; + aExc.Produce_byData(*itExc); + for (++itExc; itExc.operator bool(); ++itExc) + { + rSet + << ","; + aExc.Produce_byData(*itExc); + } // end for + rSet << ");"; + } // end if (bSetRaises) + } + else + { + CurOut() << ";"; + } +} + + + + +HF_IdlEnumValue::~HF_IdlEnumValue() +{ +} + +typedef ary::idl::ifc_enumvalue::attr EnumValueAttr; + +void +HF_IdlEnumValue::write_Declaration( const client & i_ce ) const +{ + CurOut() + >> *new Html::Bold + << i_ce.LocalName(); + + const String & + rValue = EnumValueAttr::Value(i_ce); + if ( NOT rValue.empty() ) + { CurOut() << " " // << " = " // In the moment this is somehow in the value + << rValue; + // CurOut() << ","; // In the moment this is somehow in the value + } + else + CurOut() << ","; +} + + +HF_IdlConstant::~HF_IdlConstant() +{ +} + +typedef ary::idl::ifc_constant::attr ConstantAttr; + +void +HF_IdlConstant::write_Declaration( const client & i_ce ) const +{ + CurOut() << "const "; + HF_IdlTypeText + aType( Env(), CurOut(), true ); + aType.Produce_byData(ConstantAttr::Type(i_ce)); + CurOut() + << " " + >> *new Html::Bold + << i_ce.LocalName(); + const String & + rValue = ConstantAttr::Value(i_ce); + CurOut() << " " // << " = " // In the moment this is somehow in the value + << rValue; + // << ";"; // In the moment this is somehow in the value +} + + +HF_IdlStructElement::~HF_IdlStructElement() +{ +} + +typedef ary::idl::ifc_structelement::attr StructElementAttr; + +void +HF_IdlStructElement::write_Declaration( const client & i_ce ) const +{ + HF_IdlTypeText + aType( Env(), CurOut(), true ); + aType.Produce_byData(StructElementAttr::Type(i_ce)); + CurOut() + << " " + >> *new Html::Bold + << i_ce.LocalName(); + CurOut() + << ";"; +} + +HF_IdlCommentedRelationElement::~HF_IdlCommentedRelationElement() +{ +} + +void +HF_IdlCommentedRelationElement::produce_Summary( Environment & io_env, + Xml::Element & io_context, + const comref & i_commentedRef, + const client & i_rScopeGivingCe ) +{ + csv_assert( i_commentedRef.Info() ); + + const ary::idl::Type_id aType = i_commentedRef.Type(); + const ce_info & rDocu = *i_commentedRef.Info(); + + bool bShort = NOT rDocu.Short().IsEmpty(); + bool bDescr = NOT rDocu.Description().IsEmpty(); + + if ( bShort ) + { + HF_IdlDocuTextDisplay + aDescription(io_env, 0, i_rScopeGivingCe); + + Xml::Element& rPara = io_context >> *new Html::Paragraph; + aDescription.Out().Enter( rPara ); + rDocu.Short().DisplayAt( aDescription ); + + // if there's more than just the summary - i.e. a description, or usage restrictions, or tags -, + // then add a link to the details section + if ( bDescr OR rDocu.IsDeprecated() OR rDocu.IsOptional() OR NOT rDocu.Tags().empty() ) + { + StreamLock aLocalLink(100); + aLocalLink() << "#" << get_LocalLinkName(io_env, i_commentedRef); + + aDescription.Out().Out() << "("; + aDescription.Out().Out() + >> *new Html::Link( aLocalLink().c_str() ) + << "details"; + aDescription.Out().Out() << ")"; + } + + aDescription.Out().Leave(); + } +} + +void +HF_IdlCommentedRelationElement::produce_LinkDoc( Environment & io_env, + const client & i_ce, + Xml::Element & io_context, + const comref & i_commentedRef, + const E_DocType i_docType ) +{ + if ( i_commentedRef.Info() != 0 ) + { + if ( i_docType == doctype_complete ) + { + HF_DocEntryList aDocList(io_context); + HF_IdlDocu aDocuDisplay(io_env, aDocList); + + aDocuDisplay.Produce_fromReference(*i_commentedRef.Info(), i_ce); + } + else + { + produce_Summary(io_env, io_context, i_commentedRef, i_ce); + } + } + else + { + HF_DocEntryList aDocList(io_context); + + const client * + pCe = io_env.Linker().Search_CeFromType(i_commentedRef.Type()); + const ce_info * + pShort = pCe != 0 + ? Get_IdlDocu(pCe->Docu()) + : (const ce_info *)(0); + if ( pShort != 0 ) + { + aDocList.Produce_NormalTerm("(referenced entity's summary:)"); + Xml::Element & + rDef = aDocList.Produce_Definition(); + HF_IdlDocuTextDisplay + aShortDisplay( io_env, &rDef, *pCe); + pShort->Short().DisplayAt(aShortDisplay); + } // end if (pShort != 0) + } // endif ( (*i_commentedRef).Info() != 0 ) else +} + + +String +HF_IdlCommentedRelationElement::get_LocalLinkName( Environment & io_env, + const comref & i_commentedRef ) +{ + StringVector aModules; + String sLocalName; + ce_id nCe; + int nSequenceCount = 0; + + const ary::idl::Type & + rType = io_env.Data().Find_Type(i_commentedRef.Type()); + io_env.Data().Get_TypeText(aModules, sLocalName, nCe, nSequenceCount, rType); + + // speaking strictly, this is not correct: If we have two interfaces with the same local + // name, but in different modules, then the link name will be ambiguous. However, this should + // be too seldom a case to really make the link names that ugly by adding the module information. + return sLocalName; +} + +void +HF_IdlCommentedRelationElement::write_Title( const client & /*i_ce*/ ) const +{ + + Xml::Element & + rAnchor = CurOut() + >> *new Html::Label(get_LocalLinkName(Env(), m_relation)) + << new Html::ClassAttr(C_sMemberTitle); + + HF_IdlTypeText + aText(Env(), rAnchor, true); + aText.Produce_byData(m_relation.Type()); +} + +void +HF_IdlCommentedRelationElement::write_Declaration( const client & /*i_ce*/ ) const +{ + // nothing to do here - an entity which is a commented relation does not have a declaration +} + +void +HF_IdlCommentedRelationElement::write_Description( const client & i_ce ) const +{ + produce_LinkDoc( Env(), i_ce, CurOut(), m_relation, doctype_complete ); +} diff --git a/autodoc/source/display/idl/hfi_property.hxx b/autodoc/source/display/idl/hfi_property.hxx new file mode 100644 index 000000000000..283ee554feb5 --- /dev/null +++ b/autodoc/source/display/idl/hfi_property.hxx @@ -0,0 +1,185 @@ + /************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_property.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HFI_PROPERTY_HXX +#define ADC_DISPLAY_HFI_PROPERTY_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_comrela.hxx> + +class HF_SubTitleTable; + +class HF_IdlDataMember : public HtmlFactory_Idl +{ + public: + void Produce_byData( + const client & ce ) const; + protected: + HF_IdlDataMember( + Environment & io_rEnv, + HF_SubTitleTable & o_table ); + virtual ~HF_IdlDataMember() {} + + private: + virtual void write_Title( + const client & i_ce ) const; + + virtual void write_Declaration( + const client & i_ce ) const = 0; + + virtual void write_Description( + const client & i_ce ) const; + + void enter_ContentCell() const; + void leave_ContentCell() const; +}; + + + +class HF_IdlProperty : public HF_IdlDataMember +{ + public: + HF_IdlProperty( + Environment & io_rEnv, + HF_SubTitleTable & o_table ) + : HF_IdlDataMember(io_rEnv, o_table) {} + virtual ~HF_IdlProperty(); + private: + virtual void write_Declaration( + const client & i_ce ) const; +}; + +class HF_IdlAttribute : public HF_IdlDataMember +{ + public: + HF_IdlAttribute( + Environment & io_rEnv, + HF_SubTitleTable & o_table ) + : HF_IdlDataMember(io_rEnv, o_table) {} + virtual ~HF_IdlAttribute(); + + private: + virtual void write_Declaration( + const client & i_ce ) const; +}; + + +class HF_IdlEnumValue : public HF_IdlDataMember +{ + public: + HF_IdlEnumValue( + Environment & io_rEnv, + HF_SubTitleTable & o_table ) + : HF_IdlDataMember(io_rEnv, o_table) {} + virtual ~HF_IdlEnumValue(); + + private: + virtual void write_Declaration( + const client & i_ce ) const; +}; + +class HF_IdlConstant : public HF_IdlDataMember +{ + public: + HF_IdlConstant( + Environment & io_rEnv, + HF_SubTitleTable & o_table ) + : HF_IdlDataMember(io_rEnv, o_table) {} + virtual ~HF_IdlConstant(); + + private: + virtual void write_Declaration( + const client & i_ce ) const; +}; + + +class HF_IdlStructElement : public HF_IdlDataMember +{ + public: + HF_IdlStructElement( + Environment & io_rEnv, + HF_SubTitleTable & o_table ) + : HF_IdlDataMember(io_rEnv, o_table) {} + virtual ~HF_IdlStructElement(); + + private: + virtual void write_Declaration( + const client & i_ce ) const; +}; + +class HF_IdlCommentedRelationElement : public HF_IdlDataMember +{ + public: + HF_IdlCommentedRelationElement( + Environment & io_rEnv, + HF_SubTitleTable & o_table, + const ary::idl::CommentedRelation& i_relation ) + : HF_IdlDataMember(io_rEnv, o_table) + , m_relation( i_relation ) + { + } + virtual ~HF_IdlCommentedRelationElement(); + + typedef ::ary::idl::CommentedRelation comref; + + static void produce_LinkDoc( + Environment & io_env, + const client & i_ce, + Xml::Element & io_context, + const comref & i_commentedRef, + const E_DocType i_docType ); + + private: + virtual void write_Title( + const client & i_ce ) const; + virtual void write_Declaration( + const client & i_ce ) const; + virtual void write_Description( + const client & i_ce ) const; + private: + static void produce_Summary( Environment & io_env, + Xml::Element & io_context, + const comref & i_commentedRef, + const client & i_rScopeGivingCe ); + + static String get_LocalLinkName( Environment & io_env, + const comref & i_commentedRef ); + + private: + const ary::idl::CommentedRelation& m_relation; +}; + +#endif diff --git a/autodoc/source/display/idl/hfi_service.cxx b/autodoc/source/display/idl/hfi_service.cxx new file mode 100644 index 000000000000..7fd3553e6c41 --- /dev/null +++ b/autodoc/source/display/idl/hfi_service.cxx @@ -0,0 +1,366 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_service.cxx,v $ + * $Revision: 1.10 $ + * + * 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 "hfi_service.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_property.hxx> +#include <ary/idl/ik_service.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_doc.hxx" +#include "hfi_navibar.hxx" +#include "hfi_property.hxx" +#include "hfi_tag.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + + + +extern const String + C_sCePrefix_Service("service"); + +namespace +{ + +const String + C_sList_IncludedServices("Services' Summary"); +const String + C_sList_IncludedServices_Heading("Included Services - Summary"); +const String + C_sList_IncludedServices_Label("ServicesSummary"); +const String + C_sList_IncludedServicesDetails("Services' Details"); +const String + C_sList_IncludedServicesDetails_Heading("Included Services - Details"); +const String + C_sList_IncludedServicesDetails_Label("ServicesDetails"); +const String + C_sList_ExportedInterfaces("Interfaces' Summary"); +const String + C_sList_ExportedInterfaces_Heading("Exported Interfaces - Summary"); +const String + C_sList_ExportedInterfaces_Label("InterfacesSummary"); +const String + C_sList_ExportedInterfacesDetails("Interfaces' Details"); +const String + C_sList_ExportedInterfacesDetails_Heading("Exported Interfaces - Details"); +const String + C_sList_ExportedInterfacesDetails_Label("InterfacesDetails"); +const String + C_sList_Properties("Properties' Summary"); +const String + C_sList_Properties_Label("PropertiesSummary"); +const String + C_sList_PropertiesDetails("Properties' Details"); +const String + C_sList_PropertiesDetails_Label("PropertiesDetails"); + + +enum E_SubListIndices +{ + sli_IncludedServicesSummary = 0, + sli_InterfacesSummary = 1, + sli_PropertiesSummary = 2, + sli_IncludedServicesDetails = 3, + sli_InterfacesDetails = 4, + sli_PropertiesDetails = 5 +}; + +} //anonymous namespace + + +HF_IdlService::HF_IdlService( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlService::~HF_IdlService() +{ + +} + +typedef ::ary::idl::ifc_service::attr + ServiceAttr; +typedef ::ary::Dyn_StdConstIterator< ::ary::idl::CommentedRelation > + dyn_comref_list; + +void +HF_IdlService::produce_CommentedRelations( const client & i_ce, + comref_list & it_list, + const String & i_summaryTitle, + const String & i_summaryLabel, + const String & i_detailsTitle, + const String & i_detailsLabel, + const E_DocType i_docType ) const +{ + csv_assert( it_list ); + + bool bSummaryOnly = ( i_docType == doctype_summaryOnly ); + HF_SubTitleTable aTable( + CurOut(), + bSummaryOnly ? i_summaryLabel : i_detailsLabel, + bSummaryOnly ? i_summaryTitle : i_detailsTitle, + 2 ); + + for ( ; it_list; ++it_list ) + { + Xml::Element & + rRow = aTable.Add_Row(); + + if ( bSummaryOnly ) + { + produce_Link(rRow, (*it_list).Type()); + produce_LinkSummary(i_ce, rRow, *it_list); + } + else + { + HF_IdlCommentedRelationElement + aRelation( Env(), aTable, *it_list ); + aRelation.Produce_byData( i_ce ); + } + } // end for +} + +void +HF_IdlService::Produce_byData( const client & i_ce ) const +{ + Dyn<HF_NaviSubRow> + pNaviSubRow( &make_Navibar(i_ce) ); + + HF_TitleTable + aTitle(CurOut()); + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + produce_Title(aTitle, C_sCePrefix_Service, i_ce); + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); + + // produce ... + // - included services: summary + dyn_comref_list dpIncludedServices; + ServiceAttr::Get_IncludedServices(dpIncludedServices, i_ce); + if ( (*dpIncludedServices).operator bool() ) + { + produce_CommentedRelations( i_ce, *dpIncludedServices, + C_sList_IncludedServices_Heading, + C_sList_IncludedServices_Label, + C_sList_IncludedServicesDetails_Heading, + C_sList_IncludedServicesDetails_Label, + doctype_summaryOnly ); + pNaviSubRow->SwitchOn(sli_IncludedServicesSummary); + } + + // - exported interfaces: summary + dyn_comref_list dpExportedInterfaces; + ServiceAttr::Get_ExportedInterfaces(dpExportedInterfaces, i_ce); + if ( (*dpExportedInterfaces).operator bool() ) + { + produce_CommentedRelations( i_ce, *dpExportedInterfaces, + C_sList_ExportedInterfaces_Heading, + C_sList_ExportedInterfaces_Label, + C_sList_ExportedInterfacesDetails_Heading, + C_sList_ExportedInterfacesDetails_Label, + doctype_summaryOnly ); + pNaviSubRow->SwitchOn(sli_InterfacesSummary); + } + + // - supported properties: summary + dyn_ce_list dpProperties; + ServiceAttr::Get_Properties(dpProperties, i_ce); + if ( (*dpProperties).operator bool() ) + { + produce_Members( *dpProperties, + C_sList_Properties, + C_sList_Properties_Label, + C_sList_PropertiesDetails, + C_sList_PropertiesDetails_Label, + viewtype_summary ); + pNaviSubRow->SwitchOn(sli_PropertiesSummary); + } + + // - included services: details + ServiceAttr::Get_IncludedServices(dpIncludedServices, i_ce); + if ( (*dpIncludedServices).operator bool() ) + { + produce_CommentedRelations( i_ce, *dpIncludedServices, + C_sList_IncludedServices_Heading, + C_sList_IncludedServices_Label, + C_sList_IncludedServicesDetails_Heading, + C_sList_IncludedServicesDetails_Label, + doctype_complete ); + pNaviSubRow->SwitchOn(sli_IncludedServicesDetails); + } + + // - exported interfaces: details + ServiceAttr::Get_ExportedInterfaces(dpExportedInterfaces, i_ce); + if ( (*dpExportedInterfaces).operator bool() ) + { + produce_CommentedRelations( i_ce, *dpExportedInterfaces, + C_sList_ExportedInterfaces_Heading, + C_sList_ExportedInterfaces_Label, + C_sList_ExportedInterfacesDetails_Heading, + C_sList_ExportedInterfacesDetails_Label, + doctype_complete ); + pNaviSubRow->SwitchOn(sli_InterfacesDetails); + } + + // supported properties: details + ServiceAttr::Get_Properties(dpProperties, i_ce); + if ( (*dpProperties).operator bool() ) + { + produce_Members( *dpProperties, + C_sList_Properties, + C_sList_Properties_Label, + C_sList_PropertiesDetails, + C_sList_PropertiesDetails_Label, + viewtype_details ); + pNaviSubRow->SwitchOn(sli_PropertiesDetails); + } + + pNaviSubRow->Produce_Row(); + CurOut() << new Xml::XmlCode("<br> "); +} + +typedef ary::idl::ifc_property::attr PropertyAttr; + +void +HF_IdlService::produce_SummaryDeclaration( Xml::Element & o_row, + const client & i_property ) const +{ + // KORR_FUTURE + // Put this in to HF_IdlProperty! + + Xml::Element & + rCell = o_row + >> *new Html::TableCell + << new Html::ClassAttr( C_sCellStyle_SummaryLeft ); + + if (PropertyAttr::HasAnyStereotype(i_property)) + { + rCell << "[ "; + if (PropertyAttr::IsReadOnly(i_property)) + rCell << "readonly "; + if (PropertyAttr::IsBound(i_property)) + rCell << "bound "; + if (PropertyAttr::IsConstrained(i_property)) + rCell << "constrained "; + if (PropertyAttr::IsMayBeAmbiguous(i_property)) + rCell << "maybeambiguous "; + if (PropertyAttr::IsMayBeDefault(i_property)) + rCell << "maybedefault "; + if (PropertyAttr::IsMayBeVoid(i_property)) + rCell << "maybevoid "; + if (PropertyAttr::IsRemovable(i_property)) + rCell << "removable "; + if (PropertyAttr::IsTransient(i_property)) + rCell << "transient "; + rCell << "] "; + } // end if + + HF_IdlTypeText + aType( Env(), rCell, true ); + aType.Produce_byData( PropertyAttr::Type(i_property) ); + + StreamLock aLocalLink(100); + aLocalLink() << "#" << i_property.LocalName(); + rCell + << new Html::LineBreak + >> *new Html::Link( aLocalLink().c_str() ) + << i_property.LocalName(); +} + +DYN HF_NaviSubRow & +HF_IdlService::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce); + + DYN HF_NaviSubRow & + ret = aNaviBar.Add_SubRow(); + ret.AddItem(C_sList_IncludedServices, C_sList_IncludedServices_Label, false); + ret.AddItem(C_sList_ExportedInterfaces, C_sList_ExportedInterfaces_Label, false); + ret.AddItem(C_sList_Properties, C_sList_Properties_Label, false); + ret.AddItem(C_sList_IncludedServicesDetails, C_sList_IncludedServicesDetails_Label, false); + ret.AddItem(C_sList_ExportedInterfacesDetails, C_sList_ExportedInterfacesDetails_Label, false); + ret.AddItem(C_sList_PropertiesDetails, C_sList_PropertiesDetails_Label, false); + + CurOut() << new Html::HorizontalLine(); + return ret; +} + +void +HF_IdlService::produce_Link( Xml::Element & o_row, + type_id i_type ) const +{ + Xml::Element & + rCell = o_row + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_SummaryLeft); + HF_IdlTypeText + aText(Env(), rCell, true); + aText.Produce_byData(i_type); +} + +void +HF_IdlService::produce_LinkSummary( const client & i_ce, + Xml::Element & o_row, + const comref & i_commentedRef ) const +{ + Xml::Element & + rCell = o_row + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_SummaryRight); + + HF_IdlCommentedRelationElement::produce_LinkDoc( Env(), i_ce, rCell, i_commentedRef, doctype_summaryOnly ); +} + +void +HF_IdlService::produce_MemberDetails( HF_SubTitleTable & o_table, + const client & i_ce ) const +{ + HF_IdlProperty + aProperty( Env(), o_table); + aProperty.Produce_byData( i_ce ); +} + + + diff --git a/autodoc/source/display/idl/hfi_service.hxx b/autodoc/source/display/idl/hfi_service.hxx new file mode 100644 index 000000000000..54b567dcc28f --- /dev/null +++ b/autodoc/source/display/idl/hfi_service.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_service.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HFI_SERVICE_HXX +#define ADC_DISPLAY_HFI_SERVICE_HXX + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_comrela.hxx> + +class HF_NaviSubRow; +class HF_SubTitleTable; + +class HF_IdlService : public HtmlFactory_Idl +{ + public: + typedef ::ary::idl::CommentedRelation comref; + typedef ::ary::StdConstIterator< comref > comref_list; + + HF_IdlService( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlService(); + + void Produce_byData( + const client & i_ce ) const; + private: + // Overwritten from HtmlFactory_Idl: + virtual void produce_SummaryDeclaration( + Xml::Element & o_row, + const client & i_ce ) const; + + // Locals + DYN HF_NaviSubRow & make_Navibar( + const client & i_ce ) const; + + void produce_Link( + Xml::Element & o_row, + type_id i_type ) const; + void produce_LinkSummary( + const client & i_ce, + Xml::Element & o_row, + const comref & i_commentedRef ) const; + + void produce_MemberDetails( /// of property + HF_SubTitleTable & o_table, + const client & i_ce ) const; + + void produce_CommentedRelations( + const client & i_ce, + comref_list & it_list, + const String & i_summaryTitle, + const String & i_summaryLabel, + const String & i_detailsTitle, + const String & i_detailsLabel, + const E_DocType i_docType ) const; + +}; + + + +// IMPLEMENTATION + +extern const String + C_sCePrefix_Service; + + + +#endif + + diff --git a/autodoc/source/display/idl/hfi_singleton.cxx b/autodoc/source/display/idl/hfi_singleton.cxx new file mode 100644 index 000000000000..6a0559a61dd9 --- /dev/null +++ b/autodoc/source/display/idl/hfi_singleton.cxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_singleton.cxx,v $ + * $Revision: 1.8 $ + * + * 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 "hfi_singleton.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_singleton.hxx> +#include <ary/idl/ik_sisingleton.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_navibar.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + + +extern const String + C_sCePrefix_Singleton("singleton"); + +const String + C_sAssociatedService("Associated Service"); +const String + C_sImplementedInterface("Supported Interface"); + + + +HF_IdlSingleton::HF_IdlSingleton( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlSingleton::~HF_IdlSingleton() +{ + +} + +typedef ::ary::idl::ifc_singleton::attr SingletonAttr; +typedef ::ary::idl::ifc_sglifcsingleton::attr SglIfcSingletonAttr; + +void +HF_IdlSingleton::Produce_byData_ServiceBased( const client & i_ce ) const +{ + make_Navibar(i_ce); + + HF_TitleTable + aTitle(CurOut()); + + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + produce_Title(aTitle, C_sCePrefix_Singleton, i_ce); + + HF_DocEntryList + aTopList( aTitle.Add_Row() ); + aTopList.Produce_Term(C_sAssociatedService); + + HF_IdlTypeText + aAssociatedService( Env(), aTopList.Produce_Definition(), true ); + aAssociatedService.Produce_byData( SingletonAttr::AssociatedService(i_ce) ); + + CurOut() << new Html::HorizontalLine; + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); +} + +void +HF_IdlSingleton::Produce_byData_InterfaceBased( const client & i_ce ) const +{ + make_Navibar(i_ce); + + HF_TitleTable + aTitle(CurOut()); + + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + produce_Title(aTitle, C_sCePrefix_Singleton, i_ce); + + HF_DocEntryList + aTopList( aTitle.Add_Row() ); + aTopList.Produce_Term(C_sImplementedInterface); + + HF_IdlTypeText + aImplementedInterface( Env(), aTopList.Produce_Definition(), true ); + aImplementedInterface.Produce_byData( SglIfcSingletonAttr::BaseInterface(i_ce) ); + + CurOut() << new Html::HorizontalLine; + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); +} + +void +HF_IdlSingleton::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce,true); // true := avoid link to Use-page. + + CurOut() << new Html::HorizontalLine(); +} diff --git a/autodoc/source/display/idl/hfi_singleton.hxx b/autodoc/source/display/idl/hfi_singleton.hxx new file mode 100644 index 000000000000..0ae9613fd4f0 --- /dev/null +++ b/autodoc/source/display/idl/hfi_singleton.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_singleton.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HFI_SINGLETON_HXX +#define ADC_DISPLAY_HFI_SINGLETON_HXX + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + +class HF_NaviSubRow; + + +class HF_IdlSingleton : public HtmlFactory_Idl +{ + public: + HF_IdlSingleton( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlSingleton(); + + void Produce_byData_ServiceBased( + const client & i_ce ) const; + void Produce_byData_InterfaceBased( + const client & i_ce ) const; + private: + void make_Navibar( + const client & i_ce ) const; +}; + + + +// IMPLEMENTATION + +extern const String + C_sCePrefix_Singleton; + + + +#endif + + diff --git a/autodoc/source/display/idl/hfi_siservice.cxx b/autodoc/source/display/idl/hfi_siservice.cxx new file mode 100644 index 000000000000..360422c13605 --- /dev/null +++ b/autodoc/source/display/idl/hfi_siservice.cxx @@ -0,0 +1,178 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_siservice.cxx,v $ + * $Revision: 1.8 $ + * + * 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 "hfi_siservice.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_function.hxx> +#include <ary/idl/ik_siservice.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_doc.hxx" +#include "hfi_method.hxx" +#include "hfi_navibar.hxx" +#include "hfi_typetext.hxx" +#include "hi_env.hxx" +#include "hi_linkhelper.hxx" + + + +namespace +{ + +const String + C_sImplementedInterface("Supported Interface"); + +const String + C_sList_Constructors("Constructors' Summary"); +const String + C_sList_Constructors_Label("ConstructorsSummary"); +const String + C_sDetails_Constructors("Constructors' Details"); +const String + C_sDetails_Constructors_Label("ConstructorsDetails"); + + +enum E_SubListIndices +{ + sli_ConstructorsSummary = 0, + sli_ConstructorsDetails = 1 +}; + +} //anonymous namespace + + +HF_IdlSglIfcService::HF_IdlSglIfcService( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlSglIfcService::~HF_IdlSglIfcService() +{ +} + +typedef ::ary::idl::ifc_sglifcservice::attr SglIfcServiceAttr; + +void +HF_IdlSglIfcService::Produce_byData( const client & i_ce ) const +{ + Dyn<HF_NaviSubRow> + pNaviSubRow( &make_Navibar(i_ce) ); + + HF_TitleTable + aTitle(CurOut()); + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + produce_Title(aTitle, C_sCePrefix_Service, i_ce); + + HF_DocEntryList + aTopList( aTitle.Add_Row() ); + aTopList.Produce_Term(C_sImplementedInterface); + + HF_IdlTypeText + aImplementedInterface( Env(), aTopList.Produce_Definition(), true, &i_ce); + aImplementedInterface.Produce_byData( SglIfcServiceAttr::BaseInterface(i_ce) ); + + CurOut() << new Html::HorizontalLine; + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); + + dyn_ce_list + dpConstructors; + SglIfcServiceAttr::Get_Constructors(dpConstructors, i_ce); + if ( (*dpConstructors).operator bool() ) + { + produce_Members( *dpConstructors, + C_sList_Constructors, + C_sList_Constructors_Label, + C_sDetails_Constructors, + C_sDetails_Constructors_Label ); + pNaviSubRow->SwitchOn(sli_ConstructorsSummary); + pNaviSubRow->SwitchOn(sli_ConstructorsDetails); + } + + pNaviSubRow->Produce_Row(); + CurOut() << new Xml::XmlCode("<br> "); +} + +DYN HF_NaviSubRow & +HF_IdlSglIfcService::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce, true); + + DYN HF_NaviSubRow & + ret = aNaviBar.Add_SubRow(); + ret.AddItem(C_sList_Constructors, C_sList_Constructors_Label, false); + ret.AddItem(C_sDetails_Constructors, C_sDetails_Constructors_Label, false); + + CurOut() << new Html::HorizontalLine(); + return ret; +} + +typedef ary::idl::ifc_function::attr funcAttr; + +void +HF_IdlSglIfcService::produce_MemberDetails( HF_SubTitleTable & o_table, + const client & i_ce ) const +{ + HF_IdlMethod + aConstructor( Env(), + o_table.Add_Row() + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_MDetail) ); + + ary::Dyn_StdConstIterator<ary::idl::Parameter> + pParameters; + funcAttr::Get_Parameters(pParameters, i_ce); + + ary::Dyn_StdConstIterator<ary::idl::Type_id> + pExceptions; + funcAttr::Get_Exceptions(pExceptions, i_ce); + + aConstructor.Produce_byData( i_ce.LocalName(), + funcAttr::ReturnType(i_ce), + *pParameters, + *pExceptions, + funcAttr::IsOneway(i_ce), + funcAttr::HasEllipse(i_ce), + i_ce ); +} diff --git a/autodoc/source/display/idl/hfi_siservice.hxx b/autodoc/source/display/idl/hfi_siservice.hxx new file mode 100644 index 000000000000..a6c39fdca93a --- /dev/null +++ b/autodoc/source/display/idl/hfi_siservice.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_siservice.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HFI_SISERVICE_HXX +#define ADC_DISPLAY_HFI_SISERVICE_HXX + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_comrela.hxx> + +class HF_NaviSubRow; +class HF_SubTitleTable; + +class HF_IdlSglIfcService : public HtmlFactory_Idl +{ + public: + HF_IdlSglIfcService( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlSglIfcService(); + + void Produce_byData( + const client & i_ce ) const; + private: + DYN HF_NaviSubRow & make_Navibar( + const client & i_ce ) const; + + void produce_MemberDetails( + HF_SubTitleTable & o_table, + const client & i_ce ) const; +}; + + + +// IMPLEMENTATION + +extern const String + C_sCePrefix_Service; + + + +#endif + + diff --git a/autodoc/source/display/idl/hfi_struct.cxx b/autodoc/source/display/idl/hfi_struct.cxx new file mode 100644 index 000000000000..6df8dd174374 --- /dev/null +++ b/autodoc/source/display/idl/hfi_struct.cxx @@ -0,0 +1,206 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_struct.cxx,v $ + * $Revision: 1.9 $ + * + * 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 "hfi_struct.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_struct.hxx> +#include <ary/idl/ik_exception.hxx> +#include <ary/idl/ik_struct.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_navibar.hxx" +#include "hfi_property.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + +extern const String + C_sCePrefix_Struct("struct"); +extern const String + C_sCePrefix_Exception("exception"); + + +namespace +{ + +const String + C_sBaseStruct("Base Hierarchy"); +const String + C_sBaseException("Base Hierarchy"); + +const String + C_sList_Elements("Elements' Summary"); +const String + C_sList_Elements_Label("Elements"); + +const String + C_sList_ElementDetails("Elements' Details"); +const String + C_sList_ElementDetails_Label("ElementDetails"); + +enum E_SubListIndices +{ + sli_ElementsSummary = 0, + sli_ElementsDetails = 1 +}; + +} // anonymous namespace + + + +HF_IdlStruct::HF_IdlStruct( Environment & io_rEnv, + Xml::Element & o_rOut, + bool i_bIsException ) + : HtmlFactory_Idl(io_rEnv, &o_rOut), + bIsException(i_bIsException) +{ +} + +HF_IdlStruct::~HF_IdlStruct() +{ +} + +void +HF_IdlStruct::Produce_byData( const client & i_ce ) const +{ + const ary::idl::Struct * + pStruct = + bIsException + ? 0 + : static_cast< const ary::idl::Struct* >(&i_ce); + bool bIsTemplate = + pStruct != 0 + ? pStruct->TemplateParameterType().IsValid() + : false; + + Dyn<HF_NaviSubRow> + pNaviSubRow( &make_Navibar(i_ce) ); + + HF_TitleTable + aTitle(CurOut()); + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + + // Title: + StreamLock + slAnnotations(200); + get_Annotations(slAnnotations(), i_ce); + + StreamLock rTitle(200); + if (bIsTemplate) + rTitle() << "template "; + rTitle() + << (bIsException + ? C_sCePrefix_Exception + : C_sCePrefix_Struct) + << " " + << i_ce.LocalName(); + if (bIsTemplate) + { + csv_assert(pStruct != 0); + rTitle() + << "<" + << pStruct->TemplateParameter() + << ">"; + } + aTitle.Produce_Title(slAnnotations().c_str(), rTitle().c_str()); + + // Bases: + produce_Bases( aTitle.Add_Row(), + i_ce, + bIsException + ? C_sBaseException + : C_sBaseStruct ); + + // Docu: + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); + + // Elements: + dyn_ce_list + dpElements; + if (bIsException) + ary::idl::ifc_exception::attr::Get_Elements(dpElements, i_ce); + else + ary::idl::ifc_struct::attr::Get_Elements(dpElements, i_ce); + + if ( (*dpElements).operator bool() ) + { + produce_Members( *dpElements, + C_sList_Elements, + C_sList_Elements_Label, + C_sList_ElementDetails, + C_sList_ElementDetails_Label ); + pNaviSubRow->SwitchOn(sli_ElementsSummary); + pNaviSubRow->SwitchOn(sli_ElementsDetails); + } + pNaviSubRow->Produce_Row(); +} + +HtmlFactory_Idl::type_id +HF_IdlStruct::inq_BaseOf( const client & i_ce ) const +{ + return bIsException + ? ary::idl::ifc_exception::attr::Base(i_ce) + : ary::idl::ifc_struct::attr::Base(i_ce); +} + +HF_NaviSubRow & +HF_IdlStruct::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce); + + DYN HF_NaviSubRow & + ret = aNaviBar.Add_SubRow(); + ret.AddItem(C_sList_Elements, C_sList_Elements_Label, false); + ret.AddItem(C_sList_ElementDetails, C_sList_ElementDetails_Label, false); + + CurOut() << new Html::HorizontalLine(); + return ret; +} + +void +HF_IdlStruct::produce_MemberDetails( HF_SubTitleTable & o_table, + const client & i_ce) const +{ + HF_IdlStructElement + aElement( Env(), o_table ); + aElement.Produce_byData(i_ce); +} diff --git a/autodoc/source/display/idl/hfi_struct.hxx b/autodoc/source/display/idl/hfi_struct.hxx new file mode 100644 index 000000000000..2ed5a12ff996 --- /dev/null +++ b/autodoc/source/display/idl/hfi_struct.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_struct.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HFI_STRUCT_HXX +#define ADC_DISPLAY_HFI_STRUCT_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + +/** Is used to display ->ary::idl::Exception s as well as ->ary::idl::Struct s. +*/ +class HF_IdlStruct : public HtmlFactory_Idl +{ + public: + + HF_IdlStruct( + Environment & io_rEnv, + Xml::Element & o_rOut, + bool i_bIsException ); + virtual ~HF_IdlStruct(); + + void Produce_byData( + const client & ce ) const; + private: + // Interface HtmlFactory_Idl: + virtual type_id inq_BaseOf( + const client & i_ce ) const; + // Locals + HF_NaviSubRow & make_Navibar( + const client & ce ) const; + virtual void produce_MemberDetails( + HF_SubTitleTable & o_table, + const client & ce ) const; + // DATA + bool bIsException; +}; + + + +// IMPLEMENTATION + + +extern const String + C_sCePrefix_Struct; +extern const String + C_sCePrefix_Exception; + + +#endif diff --git a/autodoc/source/display/idl/hfi_tag.cxx b/autodoc/source/display/idl/hfi_tag.cxx new file mode 100644 index 000000000000..8d194bc43222 --- /dev/null +++ b/autodoc/source/display/idl/hfi_tag.cxx @@ -0,0 +1,357 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_tag.cxx,v $ + * $Revision: 1.15 $ + * + * 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 "hfi_tag.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_module.hxx> +#include <ary_i/ci_text2.hxx> +#include <ary_i/d_token.hxx> +#include <toolkit/out_tree.hxx> +#include <adc_cl.hxx> +#include <adc_msg.hxx> +#include "hfi_typetext.hxx" +#include "hi_ary.hxx" +#include "hi_env.hxx" +#include "hi_linkhelper.hxx" + + +using ary::inf::DocuTex2; + + +inline void +HF_IdlTag::Enter_TextOut( Xml::Element & o_rText ) const +{ + aTextOut.Out().Enter(o_rText); +} + +inline void +HF_IdlTag::Leave_TextOut() const +{ + aTextOut.Out().Leave(); +} + +inline void +HF_IdlTag::PutText_Out( const ary::inf::DocuTex2 & i_rText ) const +{ + i_rText.DisplayAt( const_cast< HF_IdlDocuTextDisplay& >(aTextOut) ); +} + + + +HF_IdlTag::HF_IdlTag( Environment & io_rEnv, + const ary::idl::CodeEntity & i_rScopeGivingCe ) + : HtmlFactory_Idl( io_rEnv, 0 ), + pTitleOut(0), + aTextOut(io_rEnv, 0, i_rScopeGivingCe) +{ +} + +HF_IdlTag::~HF_IdlTag() +{ +} + +void +HF_IdlTag::Produce_byData( Xml::Element & o_rTitle, + Xml::Element & o_rText, + const ary::inf::AtTag2 & i_rTag ) const +{ + pTitleOut = &o_rTitle; + Enter_TextOut(o_rText); + i_rTag.DisplayAt( const_cast< HF_IdlTag& >(*this) ); + Leave_TextOut(); +} + +void +HF_IdlTag::Produce_byData( Xml::Element & o_rTitle, + Xml::Element & o_rText, + const std::vector< csi::dsapi::DT_SeeAlsoAtTag* > & + i_seeAlsoVector ) const +{ + o_rTitle << "See also"; + for ( std::vector< csi::dsapi::DT_SeeAlsoAtTag* >::const_iterator + it = i_seeAlsoVector.begin(); + it != i_seeAlsoVector.end(); + ++it ) + { + if (it != i_seeAlsoVector.begin()) + { + o_rText << ", "; + } + HF_IdlTypeText + aLinkText(Env(), o_rText, true, &aTextOut.ScopeGivingCe()); + aLinkText.Produce_byData( (*it)->LinkText() ); + } +} + +void +HF_IdlTag::Display_StdAtTag( const csi::dsapi::DT_StdAtTag & i_rTag ) +{ + if ( i_rTag.Text().IsEmpty() ) + return; + + csv_assert( pTitleOut != 0 ); + *pTitleOut << i_rTag.Title(); + PutText_Out( i_rTag.Text() ); +} + +void +HF_IdlTag::Display_SeeAlsoAtTag( const csi::dsapi::DT_SeeAlsoAtTag & i_rTag ) +{ + if ( i_rTag.Text().IsEmpty() ) + return; + + csv_assert( pTitleOut != 0 ); + *pTitleOut << "See also"; + + HF_IdlTypeText aLinkText(Env(),aTextOut.CurOut(),true, &aTextOut.ScopeGivingCe()); + aLinkText.Produce_byData( i_rTag.LinkText() ); + + aTextOut.CurOut() << new Html::LineBreak; + PutText_Out( i_rTag.Text() ); +} + +void +HF_IdlTag::Display_ParameterAtTag( const csi::dsapi::DT_ParameterAtTag & i_rTag ) +{ + csv_assert( pTitleOut != 0 ); + StreamLock sl(100); + *pTitleOut + << ( sl() << "Parameter " << i_rTag.Title() << c_str ); + PutText_Out( i_rTag.Text() ); +} + +void +HF_IdlTag::Display_SinceAtTag( const csi::dsapi::DT_SinceAtTag & i_rTag ) +{ + csv_assert(pTitleOut != 0); + + if ( i_rTag.Text().IsEmpty() ) + { + return; + } + + // Transform the value of the @since tag into the text to be displayed. + String sDisplay = + autodoc::CommandLine::Get_().DisplayOf_SinceTagValue( + i_rTag.Text().TextOfFirstToken() ); + if (sDisplay.empty()) + return; + + *pTitleOut << "Since "; + DocuTex2 aHelp; + aHelp.AddToken(* new csi::dsapi::DT_TextToken(sDisplay)); + PutText_Out(aHelp); +} + + +//******************** HF_IdlShortDocu *********************/ + +HF_IdlShortDocu::HF_IdlShortDocu( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl( io_rEnv, &o_rOut ) +{ +} + +HF_IdlShortDocu::~HF_IdlShortDocu() +{ +} + +void +HF_IdlShortDocu::Produce_byData( const ary::idl::CodeEntity & i_rCe ) +{ + const ce_info * + pDocu = Get_IdlDocu(i_rCe.Docu()); + if (pDocu == 0) + return; + + const ce_info & + rDocu = *pDocu; + if ( rDocu.IsDeprecated() ) + { + CurOut() + >> *new Html::Bold + << "[ DEPRECATED ]" << new Html::LineBreak; + } + if ( rDocu.IsOptional() ) + { + CurOut() + >> *new Html::Bold + << "[ OPTIONAL ]" << new Html::LineBreak; + } + + HF_IdlDocuTextDisplay + aText( Env(), &CurOut(), i_rCe); + rDocu.Short().DisplayAt(aText); +} + + +//******************** HF_IdlDocuTextDisplay *********************/ + + +HF_IdlDocuTextDisplay::HF_IdlDocuTextDisplay( Environment & io_rEnv, + Xml::Element * o_pOut, + const ary::idl::CodeEntity & i_rScopeGivingCe ) + : HtmlFactory_Idl(io_rEnv, o_pOut), + sScope(), + sLinkToken(), + bGatherLink(false), + pScopeGivingCe(&i_rScopeGivingCe) +{ +} + +HF_IdlDocuTextDisplay::~HF_IdlDocuTextDisplay() +{ +} + +void +HF_IdlDocuTextDisplay::Display_TextToken( const csi::dsapi::DT_TextToken & i_rToken ) +{ + if (bGatherLink) + { + if (sLinkToken.length() == 0) + { + sLinkToken = i_rToken.GetText(); + return; + } + else + { + if ( pScopeGivingCe == 0 ) + { // only in original file + TheMessages().Out_TypeVsMemberMisuse(sLinkToken, Env().CurPageCe_AsText(), 0); + } + + StopLinkGathering(); + } + } // endif (bGatherLink) + + CurOut() << new Xml::XmlCode( i_rToken.GetText() ); +} + +void +HF_IdlDocuTextDisplay::Display_White() +{ + CurOut() << " "; +} + +void +HF_IdlDocuTextDisplay::Display_MupType( const csi::dsapi::DT_MupType & i_rToken ) +{ + if (i_rToken.IsBegin()) + { + StartLinkGathering(i_rToken.Scope()); + } + else + { + if (bGatherLink) + { + CreateTypeLink(); + StopLinkGathering(); + } + } +} + +void +HF_IdlDocuTextDisplay::Display_MupMember( const csi::dsapi::DT_MupMember & i_rToken ) +{ + if (i_rToken.IsBegin()) + { + StartLinkGathering(i_rToken.Scope()); + } + else + { + if (bGatherLink) + { + CreateMemberLink(); + StopLinkGathering(); + } + } +} + +void +HF_IdlDocuTextDisplay::Display_MupConst( const csi::dsapi::DT_MupConst & i_rToken ) +{ + CurOut() + >> *new Html::Bold + << i_rToken.GetText(); +} + +void +HF_IdlDocuTextDisplay::Display_Style( const csi::dsapi::DT_Style & i_rToken ) +{ + CurOut() << new Xml::XmlCode( i_rToken.GetText() ); +} + +void +HF_IdlDocuTextDisplay::Display_EOL() +{ + CurOut() << "\n"; +} + +void +HF_IdlDocuTextDisplay::CreateTypeLink() +{ + if (strchr(sLinkToken,':') != 0) + { + TheMessages().Out_TypeVsMemberMisuse(sLinkToken, Env().CurPageCe_AsFile(".idl"), 0); + CurOut() << sLinkToken; + return; + } + HF_IdlTypeText aLink(Env(), CurOut(), true, &ScopeGivingCe()); + aLink.Produce_LinkInDocu(sScope, sLinkToken, String::Null_()); +} + +void +HF_IdlDocuTextDisplay::CreateMemberLink() +{ + + HF_IdlTypeText aLink(Env(), CurOut(), true, &ScopeGivingCe()); + + const char * + sSplit = strchr(sLinkToken,':'); + + if (sSplit != 0) + { + String sCe(sLinkToken.c_str(), sSplit - sLinkToken.c_str()); + String sMember(sSplit+2); + + if (NOT sScope.empty() OR ScopeGivingCe().LocalName() != sCe ) + aLink.Produce_LinkInDocu(sScope, sCe, sMember); + else + aLink.Produce_LocalLinkInDocu(sMember); + } + else + { + aLink.Produce_LocalLinkInDocu(sLinkToken); + } +} diff --git a/autodoc/source/display/idl/hfi_tag.hxx b/autodoc/source/display/idl/hfi_tag.hxx new file mode 100644 index 000000000000..23f16a46919f --- /dev/null +++ b/autodoc/source/display/idl/hfi_tag.hxx @@ -0,0 +1,180 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_tag.hxx,v $ + * $Revision: 1.7 $ + * + * 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 ADC_DISPLAY_HFI_TAG_HXX +#define ADC_DISPLAY_HFI_TAG_HXX + +// BASE CLASSES +#include "hi_factory.hxx" +#include <ary_i/disdocum.hxx> +// USED SERVICES +#include <ary/idl/i_types4idl.hxx> +#include <ary_i/ci_atag2.hxx> +#include <ary_i/ci_text2.hxx> +#include <ary/doc/d_oldidldocu.hxx> + +#include <toolkit/hf_docentry.hxx> + +namespace ary +{ +namespace idl +{ + class Module; +} +} + + + + +/** This class is an implementation of ary::inf::DocuText_Display + and will be used by that interface. +*/ +class HF_IdlDocuTextDisplay : public HtmlFactory_Idl, + public ary::inf::DocuText_Display +{ + public: + HF_IdlDocuTextDisplay( + Environment & io_rEnv, + Xml::Element * o_pOut, + const ary::idl::CodeEntity & + i_rScopeGivingCe ); + virtual ~HF_IdlDocuTextDisplay(); + + const ary::idl::CodeEntity & + ScopeGivingCe() const { return *pScopeGivingCe; } + private: + virtual void Display_TextToken( + const csi::dsapi::DT_TextToken & + i_rToken ); + virtual void Display_White(); + + virtual void Display_MupType( + const csi::dsapi::DT_MupType & + i_rToken ); + virtual void Display_MupMember( + const csi::dsapi::DT_MupMember & + i_rToken ); + virtual void Display_MupConst( + const csi::dsapi::DT_MupConst & + i_rToken ); + virtual void Display_Style( + const csi::dsapi::DT_Style & i_rToken ); + virtual void Display_EOL(); + + // Local + void StartLinkGathering( + const String & i_sScope ) + { sLinkToken = ""; sScope = i_sScope; bGatherLink = true; } + void StopLinkGathering() { bGatherLink = false; } + /** @precond + The scope is in sScope, the name is in sLinkToken. + */ + void CreateTypeLink(); + /** @precond + The scope is in sScope, the qualified member-name is in sLinkToken. + */ + void CreateMemberLink(); + + // DATA + String sScope; + String sLinkToken; + bool bGatherLink; + const ary::idl::CodeEntity * + pScopeGivingCe; +}; + + + +class HF_IdlShortDocu : public HtmlFactory_Idl +{ + public: + HF_IdlShortDocu( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlShortDocu(); + + void Produce_byData( + const ary::idl::CodeEntity & + i_rCe ); +}; + + + +class HF_IdlTag : public HtmlFactory_Idl, + public ary::inf::DocuTag_Display +{ + public: + HF_IdlTag( + Environment & io_rEnv, + const ary::idl::CodeEntity & + i_rScopeGivingCe ); + virtual ~HF_IdlTag(); + + void Produce_byData( + Xml::Element & o_rTitle, + Xml::Element & o_rText, + const ary::inf::AtTag2 & + i_rTag ) const; + void Produce_byData( + Xml::Element & o_rTitle, + Xml::Element & o_rText, + const std::vector< csi::dsapi::DT_SeeAlsoAtTag* > & + i_seeAlsoVector ) const; + private: + virtual void Display_StdAtTag( + const csi::dsapi::DT_StdAtTag & + i_rToken ); + virtual void Display_SeeAlsoAtTag( + const csi::dsapi::DT_SeeAlsoAtTag & + i_rToken ); + virtual void Display_ParameterAtTag( + const csi::dsapi::DT_ParameterAtTag & + i_rToken ); + virtual void Display_SinceAtTag( + const csi::dsapi::DT_SinceAtTag & + i_rToken ); + + void Enter_TextOut( + Xml::Element & o_rText ) const; + void Leave_TextOut() const; + void PutText_Out( + const ary::inf::DocuTex2 & + i_rText ) const; + // DATA + mutable Xml::Element * + pTitleOut; + mutable HF_IdlDocuTextDisplay + aTextOut; +}; + + + + +#endif diff --git a/autodoc/source/display/idl/hfi_typedef.cxx b/autodoc/source/display/idl/hfi_typedef.cxx new file mode 100644 index 000000000000..e0ed6f018784 --- /dev/null +++ b/autodoc/source/display/idl/hfi_typedef.cxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_typedef.cxx,v $ + * $Revision: 1.6 $ + * + * 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 "hfi_typedef.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_typedef.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_navibar.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + + +HF_IdlTypedef::HF_IdlTypedef( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlTypedef::~HF_IdlTypedef() +{ +} + +typedef ary::idl::ifc_typedef::attr TypedefAttr; + +void +HF_IdlTypedef::Produce_byData( const client & i_ce ) const +{ + make_Navibar(i_ce); + + HF_TitleTable + aTitle(CurOut()); + + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + produce_Title(aTitle, C_sCePrefix_Typedef, i_ce); + + HF_DocEntryList + aTopList( aTitle.Add_Row() ); + aTopList.Produce_Term("Defining Type"); + + HF_IdlTypeText + aDefinition( Env(), aTopList.Produce_Definition(), true ); + aDefinition.Produce_byData( TypedefAttr::DefiningType(i_ce) ); + + CurOut() << new Html::HorizontalLine; + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); +} + +void +HF_IdlTypedef::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce); + + CurOut() << new Html::HorizontalLine(); +} diff --git a/autodoc/source/display/idl/hfi_typedef.hxx b/autodoc/source/display/idl/hfi_typedef.hxx new file mode 100644 index 000000000000..3ad6d63d2e75 --- /dev/null +++ b/autodoc/source/display/idl/hfi_typedef.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_typedef.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_DISPLAY_HFI_TYPEDEF_HXX +#define ADC_DISPLAY_HFI_TYPEDEF_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + + +class HF_IdlTypedef : public HtmlFactory_Idl +{ + public: + HF_IdlTypedef( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlTypedef(); + + void Produce_byData( + const client & ce ) const; + private: + void make_Navibar( + const client & ce ) const; +}; + + + +// IMPLEMENTATION + + +const String + C_sCePrefix_Typedef("typedef"); + +#endif + + diff --git a/autodoc/source/display/idl/hfi_typetext.cxx b/autodoc/source/display/idl/hfi_typetext.cxx new file mode 100644 index 000000000000..1cb26e5af3a7 --- /dev/null +++ b/autodoc/source/display/idl/hfi_typetext.cxx @@ -0,0 +1,760 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_typetext.cxx,v $ + * $Revision: 1.14 $ + * + * 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 "hfi_typetext.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <string.h> +#include <ary/idl/i_type.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/ik_ce.hxx> +#include <adc_cl.hxx> +#include <adc_msg.hxx> +#include "hi_linkhelper.hxx" + + + + + + +inline const ary::idl::Module * +HF_IdlTypeText::referingModule() const +{ + if (pReferingCe == 0) + return Env().Linker().Search_CurModule(); + else + return &Env().Data().Find_Module(pReferingCe->NameRoom()); +} + +inline const HF_IdlTypeText::client * +HF_IdlTypeText::referingCe() const +{ + return pReferingCe; +} + + +HF_IdlTypeText::HF_IdlTypeText( Environment & io_rEnv, + Xml::Element & o_rOut, + bool i_bWithLink, + const client * i_pScopeGivingCe ) + : HtmlFactory_Idl(io_rEnv, &o_rOut), + pReferingCe( i_pScopeGivingCe ), + bWithLink(i_bWithLink) +{ +} + +HF_IdlTypeText::HF_IdlTypeText( Environment & io_rEnv, + E_Index ) + : HtmlFactory_Idl(io_rEnv, 0), + pReferingCe( 0 ), + bWithLink(true) +{ +} + +HF_IdlTypeText::~HF_IdlTypeText() +{ +} + +void +HF_IdlTypeText::Produce_byData(ary::idl::Type_id i_idType) const +{ + StringVector aModule_; + String sName; + ce_id nCe; + int nSequenceCount = 0; + csv::erase_container(aModule_); + + const ary::idl::Type & + rType = Env().Data().Find_Type(i_idType); + Env().Data().Get_TypeText(aModule_, sName, nCe, nSequenceCount, rType); + + if ( Env().Data().IsBuiltInOrRelated(rType) ) + { + produce_BuiltIn(sName,nSequenceCount); + } + else + { + produce_FromStd( aModule_, + sName, + String::Null_(), + nSequenceCount, + (nCe.IsValid() ? exists_yes : exists_no), + rType.FirstEnclosedNonSequenceType(Env().Gate()).TemplateParameters() ); + } +} + +void +HF_IdlTypeText::Produce_byData( ary::idl::Ce_id i_idCe ) const +{ + StringVector aModule_; + String sCe; + String sMember; + csv::erase_container(aModule_); + + const ary::idl::CodeEntity & + rCe = Env().Data().Find_Ce(i_idCe); + Env().Data().Get_CeText(aModule_, sCe, sMember, rCe); + produce_FromStd(aModule_, sCe, sMember, 0, exists_yes); +} + +void +HF_IdlTypeText::Produce_byData( const String & i_sFullName ) const +{ + if ( strncmp(i_sFullName,"http://", 7) == 0 ) + { + CurOut() + >> *new Html::Link(i_sFullName) + << i_sFullName; + return; + } + + StringVector aModule_; + String sCe, + sMember; + int nSequence = 0; + String sTypeText; + csv::erase_container(aModule_); + + const ary::idl::Module * + pScopeModule = referingModule(); + if (pScopeModule == 0) + { + // SYNTAX_ERR, but rather logical error: Missing module. + CurOut() << i_sFullName; + // KORR_FUTURE + // How to put a message about this? + // errorOut_UnresolvedLink(i_sFullName); + return; + } + + const char * sTypeStart = strrchr(i_sFullName,'<'); + if ( sTypeStart != 0 ) + { + const char * sTypeEnd = strchr(i_sFullName,'>'); + if (sTypeEnd == 0) + { // SYNTAX_ERR + CurOut() << i_sFullName; + // KORR_FUTURE + // How to put a message about this? + // errorOut_UnresolvedLink(i_sFullName); + return; + } + + nSequence = count_Sequences(i_sFullName); + sTypeStart++; + sTypeText.assign(sTypeStart, sTypeEnd-sTypeStart); + } + else + { + sTypeText = i_sFullName; + } + + csv::erase_container(aModule_); + bool bFound = // KORR : Check the semantics of this, see if ce really exists, if it is a member? + Env().Data().Search_Ce( aModule_, + sCe,sMember, + sTypeText, + *pScopeModule ); + if (NOT bFound) + { + if ( strchr(sTypeText,':') == 0 + AND + *sTypeText.c_str() != 'X' ) // This is a HACK, make this correct! + { + Produce_LocalLinkInDocu(sTypeText); + return; + } + CurOut() << i_sFullName; + // KORR + // How to put a message about this? + // errorOut_UnresolvedLink(i_sFullName); + return; + } + + produce_FromStd(aModule_, sCe, sMember, nSequence, exists_yes); +} + +void +HF_IdlTypeText::Produce_LinkInDocu( const String & i_scope, + const String & i_name, + const String & i_member ) const +{ + StringVector aModule_; + String sName; + csv::erase_container(aModule_); + + const ary::idl::Module * + pScopeModule = referingModule(); + if (pScopeModule == 0) + { + // SYNTAX_ERR, but rather logical error: Missing module. + CurOut() << i_scope << "::" << i_name; + if (NOT i_member.empty()) + CurOut() << "::" << i_member; + return; + } + + bool + bFound = Env().Data().Search_CesModule( aModule_, + i_scope, + i_name, + *pScopeModule ); + if (NOT bFound) + { + CurOut() << i_scope << "::" << i_name; + if (NOT i_member.empty()) + CurOut() << "::" << i_member; + return; + } + produce_FromStd(aModule_, i_name, i_member, 0, exists_yes); +} + +void +HF_IdlTypeText::Produce_LocalLinkInDocu( const String & i_member ) const +{ + StringVector aModule_; + String sName; + csv::erase_container(aModule_); + + csv_assert(referingCe() != 0); + if ( referingModule() == Env().Linker().Search_CurModule() ) + { + StreamLock slLink(200); + if (referingCe()->SightLevel() == ary::idl::sl_Member) + { + slLink() << "#" << i_member; + } + else + { + slLink() << referingCe()->LocalName() + << ".html#" + << i_member; + } + CurOut() + >> *new Html::Link(slLink().c_str()) + << i_member; + return; + } + + String sDummyMember; + Env().Data().Get_CeText(aModule_, sName, sDummyMember, *referingCe()); + produce_FromStd(aModule_, sName, i_member, 0, exists_yes); +} + +void +HF_IdlTypeText::Produce_IndexLink( Xml::Element & o_out, + const client & i_ce ) const +{ + StringVector aModule_; + String sCe; + String sMember; + csv::erase_container(aModule_); + + Out().Enter(o_out); + + Env().Data().Get_CeText(aModule_, sCe, sMember, i_ce); + produce_IndexLink(aModule_, sCe, sMember, false); + + Out().Leave(); +} + +void +HF_IdlTypeText::Produce_IndexOwnerLink( Xml::Element & o_out, + const client & i_owner ) const +{ + StringVector aModule_; + String sCe; + String sMember; + csv::erase_container(aModule_); + + Out().Enter(o_out); + + if (i_owner.Owner().IsValid()) + { + Env().Data().Get_CeText(aModule_, sCe, sMember, i_owner); + produce_IndexLink(aModule_, sCe, sMember, true); + } + else + { // global namespace: + + CurOut() + << "." + >> *new Html::Link("../module-ix.html") + << "global namespace"; + } + + + Out().Leave(); +} + +void +HF_IdlTypeText::Produce_IndexSecondEntryLink( Xml::Element & o_out, + const client & i_ce ) const +{ + StringVector aModule_; + String sCe; + String sMember; + csv::erase_container(aModule_); + + Out().Enter(o_out); + + Env().Data().Get_CeText(aModule_, sCe, sMember, i_ce); + produce_IndexLink(aModule_, sCe, sMember, true); + Out().Leave(); +} + + +void +HF_IdlTypeText::produce_FromStd( const StringVector & i_module, + const String & i_ce, + const String & i_member, + int i_sequenceCount, + E_Existence i_ceExists, + const std::vector<ary::idl::Type_id> * + i_templateParameters ) const +{ + if (i_ceExists == exists_no) + { + if ( is_ExternLink(i_module) ) + { + produce_ExternLink(i_module,i_ce,i_member,i_sequenceCount,i_templateParameters); + return; + } + errorOut_UnresolvedLink(i_module, i_ce, i_member); + } + + output::Node & + rCeNode = Env().OutputTree().Provide_Node(i_module); + output::Position + aTargetPos(rCeNode); + bool + bShowModule = rCeNode != Env().CurPosition().RelatedNode() + ? i_module.size() > 0 + : false; + bool + bUseMember = NOT i_member.empty(); + bool + bLink2Module = i_ceExists == exists_yes; + bool + bLink2Ce = i_ceExists == exists_yes; + bool + bLink2Member = NOT Env().Is_MemberExistenceCheckRequired() + AND i_ceExists == exists_yes; + bool + bHasCeOrName = NOT i_ce.empty(); + + if (i_sequenceCount > 0) + start_Sequence(i_sequenceCount); + + StreamLock aLink(300); + StreamStr & rLink = aLink(); + + // Produce output: module + if (bShowModule) + { + int nMax = i_module.size() - 1; + int nCount = 0; + StringVector::const_iterator + itm = i_module.begin(); + for ( ; + nCount < nMax; + ++itm, ++nCount ) + { + CurOut() << "::" << *itm; + } + + CurOut() << "::"; + if (bLink2Module) + { + aTargetPos.Set_File(output::ModuleFileName()); + Env().Linker().Get_Link2Position(rLink, aTargetPos); + CurOut() + >> *new Html::Link( rLink.c_str() ) + << *itm; + rLink.reset(); + } + else + { + CurOut() << *itm; + } + + if (bHasCeOrName) + CurOut() << "::"; + } // end if (bShowModule) + + // CodeEntity and member: + aTargetPos.Set_File( rLink << i_ce << ".html" << c_str ); + rLink.reset(); + + if (bHasCeOrName) + { + if (bLink2Ce) + { + Env().Linker().Get_Link2Position(rLink, aTargetPos); + CurOut() + >> *new Html::Link(rLink.c_str()) + << i_ce; + rLink.reset(); + } + else + { + CurOut() << i_ce; + } + + if (i_templateParameters != 0) + write_TemplateParameterList(*i_templateParameters); + + if (bUseMember) + { + CurOut() << "::"; + + if (bLink2Member) + { + bool bFunction = strstr(i_member,"()") != 0; + String sMember( i_member ); + if (bFunction) + sMember.assign(i_member.c_str(), sMember.length()-2); + + Env().Linker().Get_Link2Member(rLink, aTargetPos, sMember); + CurOut() + >> *new Html::Link(rLink.c_str()) + << i_member; + rLink.reset(); + } + else + { + CurOut() + << i_member; + } + } // endif (bUseMember) + } // endif (bHasCeOrName) + + if (i_sequenceCount > 0) + finish_Sequence(i_sequenceCount); +} + +void +HF_IdlTypeText::produce_BuiltIn( const String & i_type, + int i_sequenceCount ) const +{ + if (i_sequenceCount > 0) + start_Sequence(i_sequenceCount); + CurOut() << i_type; + if (i_sequenceCount > 0) + finish_Sequence(i_sequenceCount); +} + +void +HF_IdlTypeText::produce_IndexLink( const StringVector & i_module, + const String & i_ce, + const String & i_member, + bool i_bIsOwner ) const +{ + output::Node & + rCeNode = Env().OutputTree().Provide_Node(i_module); + output::Position + aTargetPos(rCeNode); + bool + bShowModule = i_bIsOwner OR (i_module.size() > 0 AND i_ce.empty()); + bool + bShowNonModule = NOT bShowModule OR (i_bIsOwner AND NOT i_ce.empty()); + bool + bUseMember = NOT i_member.empty(); + + StreamLock aLink(300); + StreamStr & rLink = aLink(); + + // Produce output: module + if (bShowModule) + { + if (i_bIsOwner) + { + int nMax = bShowNonModule ? i_module.size() : i_module.size() - 1; + int nCount = 0; + for ( StringVector::const_iterator itm = i_module.begin(); + nCount < nMax; + ++itm, ++nCount ) + { + CurOut() << "::" << *itm; + } + CurOut() << ":: ."; + } + + if (NOT bShowNonModule) + { + aTargetPos.Set_File(output::ModuleFileName()); + Env().Linker().Get_Link2Position(rLink, aTargetPos); + CurOut() + >> *new Html::Link( rLink.c_str() ) + >> *new Html::Bold + << i_module.back(); + rLink.reset(); + } + } // end if (bShowModule) + + if (bShowNonModule) + { + aTargetPos.Set_File( rLink << i_ce << ".html" << c_str ); + rLink.reset(); + + if (bUseMember) + { + bool bFunction = strstr(i_member,"()") != 0; + String sMember( i_member ); + if (bFunction) + sMember.assign(i_member.c_str(), sMember.length()-2); + Env().Linker().Get_Link2Member(rLink, aTargetPos, sMember); + CurOut() + >> *new Html::Link(rLink.c_str()) + >> *new Html::Bold + << i_member; + rLink.reset(); + } + else + { + Env().Linker().Get_Link2Position(rLink, aTargetPos); + if (i_bIsOwner) + { + CurOut() + >> *new Html::Link(rLink.c_str()) + << i_ce; + } + else + { + CurOut() + >> *new Html::Link(rLink.c_str()) + >> *new Html::Bold + << i_ce; + } + rLink.reset(); + } + } // endif (bHasCeOrName) +} + +int +HF_IdlTypeText::count_Sequences( const char * i_sFullType ) const +{ + int ret = 0; + + for ( const char * pCount = i_sFullType; + *pCount != 0; + ) + { + pCount = strstr(pCount,"sequence"); + if (pCount != 0) + { + pCount += sizeof("sequence"); // = strlen(sequence) + 1 for '<'. + if ( *(pCount-1) == '\0' ) + { + // SYNTAX_ERR + return 0; + } + ++ret; + } + } // end for + + return ret; +} + +void +HF_IdlTypeText::start_Sequence( int i_count ) const +{ + csv_assert( i_count > 0 ); + for (int i = 0; i < i_count; ++i ) + { + CurOut() << "sequence< "; + } +} + +void +HF_IdlTypeText::finish_Sequence( int i_count ) const +{ + csv_assert( i_count > 0 ); + for (int i = 0; i < i_count; ++i ) + { + CurOut() << " >"; + } +} + +void +HF_IdlTypeText::errorOut_UnresolvedLink( const char * i_name ) const +{ + StreamLock slFile(1000); + + // KORR + // Handle links in cited documentation from other entities. + slFile() << Env().CurPageCe_AsText(); + slFile().pop_back(5); + slFile() << ".idl"; + + // KORR + // Retrieve, correct line number. + TheMessages().Out_UnresolvedLink( i_name, + slFile().c_str(), + 0 ); +} + +void +HF_IdlTypeText::errorOut_UnresolvedLink( const StringVector & i_module, + const String & i_ce, + const String & i_member ) const +{ + StreamLock slName(500); + + if (i_module.size() > 0) + { + slName().operator_join(i_module.begin(), i_module.end(), "::"); + if (NOT i_ce.empty()) + slName() << "::"; + } + if (NOT i_ce.empty()) + { + slName() << i_ce; + if (NOT i_member.empty()) + slName() << "::" << i_member; + } + errorOut_UnresolvedLink(slName().c_str()); +} + +bool +HF_IdlTypeText::is_ExternLink( const StringVector & i_module ) const +{ + const autodoc::CommandLine & + rCmdLine = autodoc::CommandLine::Get_(); + uintt nExtNspLength = rCmdLine.ExternNamespace().length(); + if (nExtNspLength == 0) + return false; + + StreamStr s(1000); + s << "::"; + s.operator_join( i_module.begin(), + i_module.end(), + "::" ); + + if (s.length() < nExtNspLength) + return false; + return ( strncmp( rCmdLine.ExternNamespace().c_str(), + s.c_str(), + nExtNspLength ) == 0 ); +} + +void +HF_IdlTypeText::produce_ExternLink( const StringVector & i_module, + const String & i_ce, + const String & i_member, + int i_sequenceCount, + const std::vector<ary::idl::Type_id> * + i_templateParameters ) const +{ + // KORR + // Look again at this code and take some time. + + StreamLock aLink(1000); + StreamStr & rLink = aLink(); + + rLink << autodoc::CommandLine::Get_().ExternRoot(); + rLink.operator_join( i_module.begin(), + i_module.end(), + "/" ); + rLink << '/' + << i_ce + << ".html"; + if (i_member.length() > 0) + rLink << "/#" << i_member; + + if (i_sequenceCount > 0) + start_Sequence(i_sequenceCount); + + // module + int nMax = i_module.size(); + int nCount = 0; + StringVector::const_iterator + itm = i_module.begin(); + for ( ; + nCount < nMax; + ++itm, ++nCount ) + { + CurOut() << "::" << *itm; + } + CurOut() << "::"; + + + // CodeEntity + if (i_member.length() == 0) + { + CurOut() + >> *new Html::Link(rLink.c_str()) + << i_ce; + } + else + { + CurOut() + << i_ce; + } + + if (i_templateParameters != 0) + write_TemplateParameterList(*i_templateParameters); + + // Member + if (i_member.length() > 0) + { + CurOut() + >> *new Html::Link(rLink.c_str()) + << i_member; + } + + if (i_sequenceCount > 0) + finish_Sequence(i_sequenceCount); +} + +void +HF_IdlTypeText::write_TemplateParameterList( + const std::vector<ary::idl::Type_id> & i_templateParameters ) const +{ + if (i_templateParameters.size() == 0) + return; + + HF_IdlTypeText + aTemplateParamWriter(Env(), CurOut(), true, pReferingCe); + CurOut() << "< "; + std::vector<ary::idl::Type_id>::const_iterator + it = i_templateParameters.begin(); + aTemplateParamWriter.Produce_byData(*it); + for ( ++it; it != i_templateParameters.end(); ++it ) + { + CurOut() << ", "; + aTemplateParamWriter.Produce_byData(*it); + } + CurOut() << " >"; +} diff --git a/autodoc/source/display/idl/hfi_typetext.hxx b/autodoc/source/display/idl/hfi_typetext.hxx new file mode 100644 index 000000000000..028468238a50 --- /dev/null +++ b/autodoc/source/display/idl/hfi_typetext.hxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_typetext.hxx,v $ + * $Revision: 1.7 $ + * + * 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 ADC_DISPLAY_HFI_TYPETEXT_HXX +#define ADC_DISPLAY_HFI_TYPETEXT_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + + +class HF_IdlTypeText : public HtmlFactory_Idl +{ + public: + enum E_Index { use_for_javacompatible_index }; + + HF_IdlTypeText( + Environment & io_rEnv, + Xml::Element & o_rOut, + bool i_bWithLink, + const client * i_pScopeGivingCe = 0 ); + HF_IdlTypeText( + Environment & io_rEnv, + E_Index e ); + virtual ~HF_IdlTypeText(); + + void Produce_byData( + ary::idl::Type_id i_idType ) const; + void Produce_byData( + ary::idl::Ce_id i_idCe ) const; + void Produce_byData( + const String & i_sFullName ) const; + void Produce_LinkInDocu( + const String & i_scope, + const String & i_name, + const String & i_member ) const; + void Produce_LocalLinkInDocu( + const String & i_member ) const; + + /// Produce the first link for Java-help understood index entries. + void Produce_IndexLink( + Xml::Element & o_out, + const client & i_ce ) const; + /** Produce the second link for Java-help understood index entries. + For members this will be a link to their owner (this function is + used), else see @->Produce_IndexSecondEntryLink(); + */ + void Produce_IndexOwnerLink( + Xml::Element & o_out, + const client & i_owner ) const; + /** Produce the second link for Java-help understood index entries. + For non- members this will again be a link to to the entry itself + (this function is used), else see @->Produce_IndexOwnerLink(); + */ + void Produce_IndexSecondEntryLink( + Xml::Element & o_out, + const client & i_ce ) const; + private: + // Locals + enum E_Existence + { + exists_dontknow, + exists_yes, + exists_no + }; + + void produce_FromStd( + const StringVector & + i_module, + const String & i_ce, + const String & i_member, + int i_sequenceCount, + E_Existence i_ceExists, + const std::vector<ary::idl::Type_id> * + i_templateParameters = 0 ) const; + void produce_BuiltIn( + const String & i_type, + int i_sequenceCount ) const; + void produce_IndexLink( + const StringVector & + i_module, + const String & i_ce, + const String & i_member, + bool i_bIsOwner ) const; + int count_Sequences( + const char * i_sFullType ) const; + void start_Sequence( + int i_count ) const; + void finish_Sequence( + int i_count ) const; + void errorOut_UnresolvedLink( + const char * i_name ) const; + void errorOut_UnresolvedLink( + const StringVector & + i_module, + const String & i_ce, + const String & i_member ) const; + bool is_ExternLink( + const StringVector & + i_module ) const; + void produce_ExternLink( + const StringVector & + i_module, + const String & i_ce, + const String & i_member, + int i_sequenceCount, + const std::vector<ary::idl::Type_id> * + i_templateParameters ) const; + void write_TemplateParameterList( + const std::vector<ary::idl::Type_id> & + i_templateParameters ) const; + const ary::idl::Module * + referingModule() const; + const client * referingCe() const; + + // DATA + mutable const client * + pReferingCe; + bool bWithLink; +}; + + + +// IMPLEMENTATION + + + +#endif + + diff --git a/autodoc/source/display/idl/hfi_xrefpage.cxx b/autodoc/source/display/idl/hfi_xrefpage.cxx new file mode 100644 index 000000000000..1bca77884278 --- /dev/null +++ b/autodoc/source/display/idl/hfi_xrefpage.cxx @@ -0,0 +1,276 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_xrefpage.cxx,v $ + * $Revision: 1.11 $ + * + * 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 "hfi_xrefpage.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_ce.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_navibar.hxx" +#include "hfi_typetext.hxx" +#include "hi_env.hxx" + + +namespace +{ + +const String + C_sTitleStart("uses of "); +const String + C_sCRLF("\n"); +const String + C_sDevMan("References in Developers Guide"); + +} // anonymous namespace + + + +HF_IdlXrefs::HF_IdlXrefs( Environment & io_rEnv, + Xml::Element & o_rOut, + const String & i_prefix, + const client & i_ce ) + : HtmlFactory_Idl(io_rEnv, &o_rOut), + rContentDirectory(*new Html::Paragraph), + pClient(&i_ce) +{ + produce_Main(i_prefix, i_ce); +} + +HF_IdlXrefs::~HF_IdlXrefs() +{ +} + +void +HF_IdlXrefs::Write_ManualLinks( const client & i_ce ) const +{ + const StringVector & + rLinks2Refs = i_ce.Secondaries().Links2RefsInManual(); + if ( rLinks2Refs.size() == 0 ) + { + rContentDirectory + << C_sDevMan + << new Html::LineBreak + << C_sCRLF; + return; + } + + + rContentDirectory + >> *new Html::Link("#devmanrefs") + << C_sDevMan + << new Html::LineBreak + << C_sCRLF; + + HF_SubTitleTable + aList(CurOut(), "devmanrefs", C_sDevMan, 1); + Xml::Element & + rOutCell = aList.Add_Row() >>* new Html::TableCell; + + csv_assert(rLinks2Refs.size() % 2 == 0); + for ( StringVector::const_iterator it = rLinks2Refs.begin(); + it != rLinks2Refs.end(); + ++it ) + { + Xml::Element & + rLink = rOutCell >> *new Html::Link( Env().Link2Manual(*it)); + if ( (*(it+1)).empty() ) + + // HACK KORR_FUTURE + // Research what happens with manual links which contain normal characters + // in non-utf-8 texts. And research, why utfF-8 does not work here. + rLink << new Xml::XmlCode(*it); + else + // HACK KORR_FUTURE, see above. + rLink << new Xml::XmlCode( *(it+1) ); + rOutCell + << new Html::LineBreak + << C_sCRLF; + ++it; + } // end for +} + +void +HF_IdlXrefs::Produce_List( const char * i_title, + const char * i_label, + ce_list & i_iterator ) const +{ + if (NOT i_iterator) + { + rContentDirectory + << i_title + << new Html::LineBreak + << C_sCRLF; + return; + } + + csv_assert(*i_label == '#'); + + rContentDirectory + >> *new Html::Link(i_label) + << i_title + << new Html::LineBreak + << C_sCRLF; + + HF_SubTitleTable + aList(CurOut(), i_label+1, i_title, 1); + Xml::Element & + rOutCell = aList.Add_Row() >>* new Html::TableCell; + HF_IdlTypeText + aTypeWriter(Env(), rOutCell, true, pClient); + for ( ce_list & it = i_iterator; it; ++it ) + { + aTypeWriter.Produce_byData(*it); + rOutCell << new Html::LineBreak; + } // end for +} + +void +HF_IdlXrefs::Produce_Tree( const char * i_title, + const char * i_label, + const client & i_ce, + F_GET_SUBLIST i_sublistcreator ) const +{ + dyn_ce_list pResult; + (*i_sublistcreator)(pResult, i_ce); + + if (NOT (*pResult).operator bool()) + { + rContentDirectory + << i_title + << new Html::LineBreak + << C_sCRLF; + return; + } + + csv_assert(*i_label == '#'); + + rContentDirectory + >> *new Html::Link(i_label) + << i_title + << new Html::LineBreak + << C_sCRLF; + + HF_SubTitleTable + aList(CurOut(), i_label+1, i_title, 1); + Xml::Element & + rOut = aList.Add_Row() + >>* new Html::TableCell + >> *new csi::xml::AnElement("pre") + << new csi::html::StyleAttr("font-family:monospace;"); + + recursive_make_ListInTree( rOut, + 0, + i_ce, + *pResult, + i_sublistcreator ); +} + +void +HF_IdlXrefs::produce_Main( const String & i_prefix, + const client & i_ce ) const +{ + make_Navibar(i_ce); + + HF_TitleTable + aTitle(CurOut()); + StreamLock sl(200); + aTitle.Produce_Title( sl() + << C_sTitleStart + << i_prefix + << " " + << i_ce.LocalName() + << c_str ); + + aTitle.Add_Row() << &rContentDirectory; + sl().reset(); + rContentDirectory + >> *new Html::Link( sl() << i_ce.LocalName() + << ".html" + << c_str ) + >> *new Html::Bold + << "back to " + << i_prefix + << " " + << i_ce.LocalName(); + rContentDirectory + << new Html::LineBreak + << new Html::LineBreak + << C_sCRLF; + + CurOut() << new Html::HorizontalLine(); +} + +void +HF_IdlXrefs::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeXrefsMainRow(i_ce); + CurOut() << new Html::HorizontalLine(); +} + +void +HF_IdlXrefs::recursive_make_ListInTree( Xml::Element & o_rDisplay, + uintt i_level, + const client & i_ce, + ce_list & i_iterator, + F_GET_SUBLIST i_sublistcreator ) const +{ + const char * sLevelIndentation = " "; + + HF_IdlTypeText + aTypeWriter(Env(), o_rDisplay, true, &i_ce); + for ( ; i_iterator.operator bool(); ++i_iterator ) + { + for (uintt i = 0; i < i_level; ++i) + { + o_rDisplay << sLevelIndentation; + } // end for + + aTypeWriter.Produce_byData(*i_iterator); + o_rDisplay << C_sCRLF; + + dyn_ce_list pResult; + const client & rCe = Env().Gate().Ces().Find_Ce(*i_iterator); + (*i_sublistcreator)(pResult, rCe); + if ( (*pResult).operator bool() ) + { + recursive_make_ListInTree( o_rDisplay, + i_level + 1, + rCe, + *pResult, + i_sublistcreator ); + } + } // end for +} diff --git a/autodoc/source/display/idl/hfi_xrefpage.hxx b/autodoc/source/display/idl/hfi_xrefpage.hxx new file mode 100644 index 000000000000..1d73494c2137 --- /dev/null +++ b/autodoc/source/display/idl/hfi_xrefpage.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hfi_xrefpage.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HFI_XREFPAGE_HXX +#define ADC_DISPLAY_HFI_XREFPAGE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + + +class HF_IdlXrefs : public HtmlFactory_Idl +{ + public: + typedef void (*F_GET_SUBLIST)(dyn_ce_list&, const client&); + + HF_IdlXrefs( + Environment & io_rEnv, + Xml::Element & o_rOut, + const String & i_prefix, + const client & i_ce); + virtual ~HF_IdlXrefs(); + + /** @descr + Only lists which are tried to be produced by Produce_List() or + Produce_Tree(), will occur in the content directory of the page. + They will have links, if the list or tree has at least one element, + else the list is mentioned in the directory without link. + + @param i_label [*i_label == '#'] + */ + void Produce_List( + const char * i_title, + const char * i_label, + ce_list & i_iterator ) const; + void Write_ManualLinks( + const client & i_ce ) const; + /** @descr + Only lists which are tried to be produced by Produce_List() or + Produce_Tree(), will occur in the content directory of the page. + They will have links, if the list or tree has at least one element, + else the list is mentioned in the directory without link. + + @param i_label [*i_label == '#'] + */ + void Produce_Tree( + const char * i_title, + const char * i_label, + const client & i_ce, + F_GET_SUBLIST i_sublistcreator ) const; + + private: + // Locals + void produce_Main( + const String & i_prefix, + const client & i_ce ) const; + void make_Navibar( + const client & i_ce ) const; + /// @return true if there are any elements in sub lists. + void recursive_make_ListInTree( + Xml::Element & o_rDisplay, + uintt i_level, /// 0 is highest + const client & i_ce, + ce_list & i_iterator, + F_GET_SUBLIST i_sublistcreator ) const; + + // DATA + Xml::Element & rContentDirectory; + const client * pClient; +}; + + + +// IMPLEMENTATION + +#endif diff --git a/autodoc/source/display/idl/hi_ary.cxx b/autodoc/source/display/idl/hi_ary.cxx new file mode 100644 index 000000000000..e8865fc0b088 --- /dev/null +++ b/autodoc/source/display/idl/hi_ary.cxx @@ -0,0 +1,286 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hi_ary.cxx,v $ + * $Revision: 1.7 $ + * + * 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 "hi_ary.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/ploc_dir.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_type.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/idl/ip_type.hxx> + + +inline const ary::idl::Gate & +AryAccess::gate() const + { return rGate; } + +inline const ary::idl::CePilot & +AryAccess::ces() const + { return rGate.Ces(); } + +inline const ary::idl::TypePilot & +AryAccess::types() const + { return rGate.Types(); } + +inline const ary::idl::Module * +AryAccess::find_SubModule( const ary::idl::Module & i_parent, + const String & i_name ) const +{ + ary::idl::Ce_id + nModule = i_parent.Search_Name(i_name); + return ces().Search_Module(nModule); +} + +bool +AryAccess::nextName( const char * & io_TextPtr, + String & o_name ) const +{ + if ( strncmp(io_TextPtr,"::", 2) == 0 ) + io_TextPtr += 2; + + const char * pEnd = strchr(io_TextPtr,':'); + size_t nLen = pEnd == 0 + ? strlen(io_TextPtr) + : pEnd - io_TextPtr; + o_name.assign(io_TextPtr, nLen); + io_TextPtr += nLen; + + return nLen > 0; +} + + + +AryAccess::AryAccess( const ary::idl::Gate & i_rGate ) + : rGate(i_rGate) +{ +} + +const ary::idl::Module & +AryAccess::GlobalNamespace() const +{ + return ces().GlobalNamespace(); +} + +const ary::idl::Module & +AryAccess::Find_Module( ary::idl::Ce_id i_ce ) const +{ + return ces().Find_Module(i_ce); +} + + +const ary::idl::CodeEntity & +AryAccess::Find_Ce( ary::idl::Ce_id i_ce ) const +{ + return ces().Find_Ce(i_ce); +} + +const ary::idl::Type & +AryAccess::Find_Type( ary::idl::Type_id i_type ) const +{ + return types().Find_Type(i_type); +} + +ary::idl::Ce_id +AryAccess::CeFromType( ary::idl::Type_id i_type ) const +{ + return types().Search_CeRelatedTo(i_type); +} + +bool +AryAccess::IsBuiltInOrRelated( const ary::idl::Type & i_type ) const +{ + return types().IsBuiltInOrRelated(i_type); +} + +bool +AryAccess::Search_Ce( StringVector & o_module, + String & o_mainEntity, + String & o_memberEntity, + const char * i_sText, + const ary::idl::Module & i_referingScope ) const +{ + o_module.erase(o_module.begin(),o_module.end()); + o_mainEntity = String::Null_(); + o_memberEntity = String::Null_(); + + const ary::idl::Module * pModule = 0; + + if ( strncmp(i_sText, "::", 2) == 0 + OR strncmp(i_sText, "com::sun::star", 14) == 0 ) + pModule = &GlobalNamespace(); + else + { + pModule = &i_referingScope; + ces().Get_Text(o_module, o_mainEntity, o_memberEntity, *pModule); + } + + const char * pNext = i_sText; + String sNextName; + + // Find Module: + while ( nextName(pNext, sNextName) ) + { + const ary::idl::Module * + pSub = find_SubModule(*pModule, sNextName); + if (pSub != 0) + { + pModule = pSub; + o_module.push_back(sNextName); + } + else + break; + } + + // Find main CodeEntity: + if ( sNextName.length() == 0 ) + return true; + const ary::idl::Ce_id + nCe = pModule->Search_Name(sNextName); + if (NOT nCe.IsValid()) + return false; + o_mainEntity = sNextName; + + // Find member: + if ( *pNext == 0 ) + return true; + nextName(pNext, o_memberEntity); + if (strchr(o_memberEntity,':') != 0) + return false; // This must not happen in IDL + +#if 0 +// The following code avoids false links, but is rather expensive +// in runtime time consumation. + + const ary::idl::CodeEntity * + pCe = Find_Ce(nCe); + if (pCe == 0) + return false; + + if ( NOT ary::idl::ifc_ce::attr::Search_Member(*pCe,o_memberEntity) ) + return false; +#endif + + return true; +} + +bool +AryAccess::Search_CesModule( StringVector & o_module, + const String & i_scope, + const String & i_ce, + const ary::idl::Module & i_referingScope ) const +{ + o_module.erase(o_module.begin(),o_module.end()); + + const ary::idl::Module * + pModule = 0; + + if ( strncmp(i_scope, "::", 2) == 0 + OR strncmp(i_scope, "com::sun::star", 14) == 0 ) + pModule = &GlobalNamespace(); + else + { + pModule = &i_referingScope; + static String Dummy1; + static String Dummy2; + ces().Get_Text(o_module, Dummy1, Dummy2, *pModule); + } + + const char * pNext = i_scope; + String sNextName; + + // Find Module: + while ( nextName(pNext, sNextName) ) + { + const ary::idl::Module * + pSub = find_SubModule(*pModule, sNextName); + if (pSub != 0) + { + pModule = pSub; + o_module.push_back(sNextName); + } + else + return false; + } // end while + return pModule->Search_Name(i_ce).IsValid(); +} + +const ary::idl::Module * +AryAccess::Search_Module( const StringVector & i_nameChain ) const +{ + const ary::idl::Module * ret = + &GlobalNamespace(); + for ( StringVector::const_iterator it = i_nameChain.begin(); + it != i_nameChain.end(); + ++it ) + { + ret = find_SubModule(*ret, *it); + if (ret == 0) + break; + } // end for + return ret; +} + +void +AryAccess::Get_CeText( StringVector & o_module, + String & o_ce, + String & o_member, + const ary::idl::CodeEntity & i_ce ) const +{ + ces().Get_Text(o_module, o_ce, o_member, i_ce); +} + +void +AryAccess::Get_TypeText( StringVector & o_module, + String & o_sCe, + ary::idl::Ce_id & o_nCe, + int & o_sequenceCount, + const ary::idl::Type & i_type ) const +{ + i_type.Get_Text(o_module, o_sCe, o_nCe, o_sequenceCount, gate()); +} + +void +AryAccess::Get_IndexData( std::vector<ary::idl::Ce_id> & o_data, + ary::idl::alphabetical_index::E_Letter i_letter ) const +{ + rGate.Ces().Get_AlphabeticalIndex(o_data, i_letter); +} + + +const ary::idl::CePilot & +AryAccess::Ces() const +{ + return rGate.Ces(); +} diff --git a/autodoc/source/display/idl/hi_ary.hxx b/autodoc/source/display/idl/hi_ary.hxx new file mode 100644 index 000000000000..22d240cbdee3 --- /dev/null +++ b/autodoc/source/display/idl/hi_ary.hxx @@ -0,0 +1,165 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hi_ary.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_DISPLAY_HI_ARY_HXX +#define ADC_DISPLAY_HI_ARY_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <ary/idl/i_types4idl.hxx> + // PARAMETERS +#include <ary/idl/i_gate.hxx> +#include <ary/doc/d_docu.hxx> +#include <ary/doc/d_oldidldocu.hxx> + + +namespace ary +{ +namespace idl +{ + class Module; + class Gate; + class CePilot; + class TypePilot; +} +} +namespace output +{ + class Position; +} + + + + +inline const ary::doc::OldIdlDocu * +Get_IdlDocu(const ary::doc::Documentation & i_doc) +{ + return dynamic_cast< const ary::doc::OldIdlDocu* >(i_doc.Data()); +} + + + + + +/** A helper class to wrap the access to data in the Autodoc Repository. +*/ +class AryAccess +{ + public: + // LIFECYCLE + AryAccess( + const ary::idl::Gate & + i_rGate ); + // INQUIRY + const ary::idl::Module & + GlobalNamespace() const; + const ary::idl::Module & + Find_Module( + ary::idl::Ce_id i_ce ) const; + const ary::idl::CodeEntity & + Find_Ce( + ary::idl::Ce_id i_ce ) const; + const ary::idl::Type & + Find_Type( + ary::idl::Type_id i_type ) const; + ary::idl::Ce_id CeFromType( + ary::idl::Type_id i_type ) const; + bool IsBuiltInOrRelated( + const ary::idl::Type & + i_type ) const; + bool Search_Ce( + StringVector & o_module, + String & o_mainEntity, + String & o_memberEntity, + const char * i_sText, + const ary::idl::Module & + i_referingScope ) const; + bool Search_CesModule( + StringVector & o_module, + const String & i_scope, + const String & i_ce, + const ary::idl::Module & + i_referingScope ) const; + const ary::idl::Module * + Search_Module( + const StringVector & + i_nameChain ) const; + + void Get_CeText( + StringVector & o_module, + String & o_ce, + String & o_member, + const ary::idl::CodeEntity & + i_ce ) const; + void Get_TypeText( + StringVector & o_module, + String & o_sCe, + ary::idl::Ce_id & o_nCe, + int & o_sequenceCount, + const ary::idl::Type & + i_type ) const; + void Get_IndexData( + std::vector<ary::idl::Ce_id> & + o_data, + ary::idl::alphabetical_index::E_Letter + i_letter ) const; + + const ary::idl::CePilot & + Ces() const; + private: + const ary::idl::Module * + find_SubModule( + const ary::idl::Module & + i_parent, + const String & i_name ) const; + + /// Gets "::"-separated names out of a string. + bool nextName( + const char * & io_TextPtr, + String & o_name ) const; + + + const ary::idl::Gate & + gate() const; + const ary::idl::CePilot & + ces() const; + const ary::idl::TypePilot & + types() const; + // DATA + const ary::idl::Gate & + rGate; +}; + + +#endif + + diff --git a/autodoc/source/display/idl/hi_display.cxx b/autodoc/source/display/idl/hi_display.cxx new file mode 100644 index 000000000000..d35cdf78edac --- /dev/null +++ b/autodoc/source/display/idl/hi_display.cxx @@ -0,0 +1,210 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hi_display.cxx,v $ + * $Revision: 1.7 $ + * + * 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 <idl/hi_display.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <cosv/file.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/getncast.hxx> +#include <toolkit/out_tree.hxx> +#include <cfrstd.hxx> +#include "hi_ary.hxx" +#include "hi_env.hxx" +#include "hi_main.hxx" + + +extern const String C_sCssFilename_Idl; + + +inline bool +HtmlDisplay_Idl::IsModule( const ary::idl::CodeEntity & i_ce ) const +{ + return ary::is_type<ary::idl::Module>(i_ce); +} + +inline const ary::idl::Module & +HtmlDisplay_Idl::Module_Cast( const ary::idl::CodeEntity & i_ce ) const +{ + return ary::ary_cast<ary::idl::Module>(i_ce); +} + + + + +HtmlDisplay_Idl::HtmlDisplay_Idl() + : pCurPageEnv(), + pMainDisplay() +{ +} + +HtmlDisplay_Idl::~HtmlDisplay_Idl() +{ +} + +void +HtmlDisplay_Idl::do_Run( const char * i_sOutputDirectory, + const ary::idl::Gate & i_rAryGate, + const display::CorporateFrame & i_rLayout ) +{ + SetRunData( i_sOutputDirectory, i_rAryGate, i_rLayout ); + + Create_StartFile(); + Create_CssFile(); + Create_FilesInNameTree(); + Create_IndexFiles(); + Create_FilesInProjectTree(); + Create_PackageList(); + Create_HelpFile(); +} + +void +HtmlDisplay_Idl::SetRunData( const char * i_sOutputDirectory, + const ary::idl::Gate & i_rAryGate, + const display::CorporateFrame & i_rLayout ) +{ + csv::ploc::Path aOutputDir( i_sOutputDirectory, true ); + pCurPageEnv = new HtmlEnvironment_Idl( aOutputDir, i_rAryGate, i_rLayout ); + pMainDisplay = new MainDisplay_Idl(*pCurPageEnv); +} + +void +HtmlDisplay_Idl::Create_StartFile() +{ +} + +void +HtmlDisplay_Idl::Create_FilesInNameTree() +{ + Cout() << "\nCreate files in subtree namespaces ..." << Endl(); + + const ary::idl::Module & + rGlobalNamespace = pCurPageEnv->Data().GlobalNamespace(); + pCurPageEnv->Goto_Directory( pCurPageEnv->OutputTree().NamesRoot(), true ); + + RecursiveDisplay_Module(rGlobalNamespace); + + Cout() << "... done." << Endl(); +} + +void +HtmlDisplay_Idl::Create_IndexFiles() +{ + Cout() << "\nCreate files in subtree index ..." << Endl(); + pCurPageEnv->Goto_Directory( pCurPageEnv->OutputTree().IndexRoot(), true ); + pMainDisplay->WriteGlobalIndices(); + Cout() << "... done.\n" << Endl(); +} + +typedef ary::Dyn_StdConstIterator<ary::idl::Ce_id> Dyn_CeIterator; +typedef ary::StdConstIterator<ary::idl::Ce_id> CeIterator; + +void +HtmlDisplay_Idl::RecursiveDisplay_Module( const ary::idl::Module & i_module ) +{ + i_module.Accept(*pMainDisplay); + + Dyn_CeIterator + aMembers; + i_module.Get_Names(aMembers); + + for ( CeIterator & iter = *aMembers; + iter; + ++iter ) + { + const ary::idl::CodeEntity & + rCe = pCurPageEnv->Data().Find_Ce(*iter); + + if ( NOT IsModule(rCe) ) + rCe.Accept(*pMainDisplay); + else + { + pCurPageEnv->Goto_DirectoryLevelDown( rCe.LocalName(), true ); + RecursiveDisplay_Module( Module_Cast(rCe) ); + pCurPageEnv->Goto_DirectoryLevelUp(); + } + } // end for +} + +void +HtmlDisplay_Idl::Create_FilesInProjectTree() +{ +} + +void +HtmlDisplay_Idl::Create_PackageList() +{ +#if 0 + Cout() << "\nCreate package list ..." << std::flush; + + pCurPageEnv->CurPosition() = pCurPageEnv->OutputTree().Root(); + + // KORR + // ... + + Cout() << " done." << Endl(); +#endif // 0 +} + +void +HtmlDisplay_Idl::Create_HelpFile() +{ +} + +void +HtmlDisplay_Idl::Create_CssFile() +{ + Cout() << "\nCreate css file ..." << Endl(); + + pCurPageEnv->Goto_Directory( pCurPageEnv->OutputTree().Root(), true ); + pCurPageEnv->Set_CurFile( C_sCssFilename_Idl ); + + StreamLock + slCurFilePath(700); + pCurPageEnv->Get_CurFilePath(slCurFilePath()); + + csv::File + aCssFile(slCurFilePath().c_str(), csv::CFM_CREATE); + csv::OpenCloseGuard + aOpenGuard(aCssFile); + if (NOT aOpenGuard) + { + Cerr() << "Can't create file " << slCurFilePath().c_str() << "." << Endl(); + return; + } + + aCssFile.write("/* Autodoc css file for IDL documentation */\n\n\n"); + aCssFile.write(pCurPageEnv->Layout().CssStyle()); + aCssFile.write("\n\n\n"); + aCssFile.write(pCurPageEnv->Layout().CssStylesExplanation()); +} diff --git a/autodoc/source/display/idl/hi_env.cxx b/autodoc/source/display/idl/hi_env.cxx new file mode 100644 index 000000000000..d81ec47ba9e5 --- /dev/null +++ b/autodoc/source/display/idl/hi_env.cxx @@ -0,0 +1,202 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hi_env.cxx,v $ + * $Revision: 1.9 $ + * + * 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 "hi_env.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/ploc_dir.hxx> +#include <cfrstd.hxx> +#include <toolkit/out_tree.hxx> +#include "hi_ary.hxx" +#include "hi_linkhelper.hxx" + + + +const String C_s_index_files("index-files"); + +const String C_sUseFileSuffix("-use.html"); +const String C_IndexA_FileName("index-1.html"); + + +HtmlEnvironment_Idl::HtmlEnvironment_Idl( const csv::ploc::Path & i_rOutputDir, + const ary::idl::Gate & i_rGate, + const display::CorporateFrame & i_rLayout ) + : aOutputRoot(i_rOutputDir), + pData(new AryAccess(i_rGate)), + pGate(&i_rGate), + pOutputTree(new output::Tree), + aCurPosition(pOutputTree->Root()), + pCurPageCe(0), + pLayout(&i_rLayout), + pLinker() +{ + StringVector aHelp; + pOutputTree->Set_NamesRoot(aHelp); + + aHelp.push_back(output::IndexFilesDirName()); + pOutputTree->Set_IndexRoot(aHelp); + + (*aHelp.begin()) = String("com"); + aHelp.push_back(String("sun")); + aHelp.push_back(String("star")); + pOutputTree->Set_Overview(aHelp, output::ModuleFileName() ); + + pLinker = new LinkHelper(*this); +} + +HtmlEnvironment_Idl::~HtmlEnvironment_Idl() +{ +} + +namespace +{ +StringVector G_aChain; +} + +void +HtmlEnvironment_Idl::Goto_Directory( output::Position i_pos, + bool i_bCreateDirectoryIfNecessary ) +{ + aCurPosition = i_pos; + aCurPath = aOutputRoot.MyPath(); + + aCurPosition.Get_Chain(G_aChain); + for ( StringVector::const_iterator it = G_aChain.begin(); + it != G_aChain.end(); + ++it ) + { + aCurPath.DirChain() += *it; + } + + if (i_bCreateDirectoryIfNecessary) + create_Directory(aCurPath); +} + +void +HtmlEnvironment_Idl::Goto_DirectoryLevelDown( const String & i_subDirName, + bool i_bCreateDirectoryIfNecessary ) +{ + aCurPosition +=(i_subDirName); + + aCurPath.SetFile(String::Null_()); + aCurPath.DirChain() += i_subDirName; + + if (i_bCreateDirectoryIfNecessary) + create_Directory(aCurPath); +} + +void +HtmlEnvironment_Idl::Goto_DirectoryLevelUp() +{ + aCurPosition -= 1; + + aCurPath.SetFile(String::Null_()); + aCurPath.DirChain() -= 1; +} + +void +HtmlEnvironment_Idl::Set_CurFile( const String & i_fileName ) +{ + aCurPath.SetFile(i_fileName); +} + +void +HtmlEnvironment_Idl::create_Directory( const csv::ploc::Path & i_path ) + +{ + csv::ploc::Directory aCurDir(i_path); + if (NOT aCurDir.Exists()) + aCurDir.PhysicalCreate(); +} + +inline bool +IsAbsoluteLink(const char * i_link) +{ + const char + shttp[] = "http://"; + const char + sfile[] = "file://"; + const int + csize = sizeof shttp - 1; + csv_assert(csize == sizeof sfile - 1); + + return strncmp(i_link,shttp,csize) == 0 + OR strncmp(i_link,sfile,csize) == 0; +} + + +const char * +HtmlEnvironment_Idl::Link2Manual( const String & i_link ) const +{ + if ( IsAbsoluteLink(i_link.c_str()) ) + return i_link; + + static StreamStr aLink_(200); + aLink_.reset(); + String + sDvgRoot(pLayout->DevelopersGuideHtmlRoot()); + if (sDvgRoot.empty()) + sDvgRoot = "../DevelopersGuide"; + + // KORR_FUTURE + // Enhance performance by calculating this only one time: + if ( NOT IsAbsoluteLink(sDvgRoot.c_str()) ) + aCurPosition.Get_LinkToRoot(aLink_); + aLink_ << sDvgRoot + << "/" + << i_link; + return aLink_.c_str(); +} + +String +HtmlEnvironment_Idl::CurPageCe_AsText() const +{ + return CurPageCe_AsFile(".html"); +} + +String +HtmlEnvironment_Idl::CurPageCe_AsFile(const char * i_sEnding) const +{ + if (pCurPageCe == 0) + return String::Null_(); + + static StringVector aModule_; + String sCe; + String sDummy; + Data().Get_CeText(aModule_, sCe, sDummy, *pCurPageCe); + StreamLock slCe(500); + if (aModule_.size() > 0) + slCe().operator_join(aModule_.begin(), aModule_.end(), "/"); + if (NOT sCe.empty()) + slCe() << "/" << sCe << i_sEnding; + return String(slCe().c_str()); +} diff --git a/autodoc/source/display/idl/hi_env.hxx b/autodoc/source/display/idl/hi_env.hxx new file mode 100644 index 000000000000..1e4ec802c276 --- /dev/null +++ b/autodoc/source/display/idl/hi_env.hxx @@ -0,0 +1,164 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hi_env.hxx,v $ + * $Revision: 1.6 $ + * + * 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 ADC_DISPLAY_HI_ENV_HXX +#define ADC_DISPLAY_HI_ENV_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <cosv/ploc.hxx> +#include <cosv/ploc_dir.hxx> + // PARAMETERS +#include <toolkit/out_position.hxx> + +namespace ary +{ +namespace idl +{ + class Gate; + class CodeEntity; +} +} +namespace display +{ + class CorporateFrame; +} +namespace output +{ + class Tree; +} + +class AryAccess; +class LinkHelper; + +/** @resp + Provides enviroment information to the HTML factory + classes. + + @descr + All information that is not included in the data, especially + about the layout of the output tree and the access to + information from the repository are provided here. + + @see HtmlFactory +*/ +class HtmlEnvironment_Idl +{ + public: + // LIFECYCLE + HtmlEnvironment_Idl( + const csv::ploc::Path & + io_rOutputDir, + const ary::idl::Gate & + i_rGate, + const display::CorporateFrame & + i_rLayout ); + ~HtmlEnvironment_Idl(); + + // OPERATIONS + void Goto_Directory( + output::Position i_pos, + bool i_bCreateDirectoryIfNecessary ); + void Goto_DirectoryLevelDown( + const String & i_subDirName, + bool i_bCreateDirectoryIfNecessary ); + void Goto_DirectoryLevelUp(); + void Set_CurFile( + const String & i_fileName ); + void Set_CurPageCe( + const ary::idl::CodeEntity * + i_ce ) + { pCurPageCe = i_ce; } + // INQUIRY + const ary::idl::Gate & + Gate() const { return *pGate; } + const AryAccess & Data() const { return *pData; } + const char * Link2Manual( + const String & i_link ) const; + + /// This may be reimplemented for removing dead links to members. + bool Is_MemberExistenceCheckRequired() const + { return false; } + + /// @return Holds only the current directory, not the current file. + output::Position & CurPosition() const { return aCurPosition; } + void Get_CurFilePath( + StreamStr & o_buffer ) const + { o_buffer << aCurPath; } + + const display::CorporateFrame & + Layout() const { return *pLayout; } + const LinkHelper & Linker() const { return *pLinker; } + + void Get_LinkTo( + StreamStr & o_result, + output::Position i_destination ) + { CurPosition().Get_LinkTo(o_result, i_destination); } + String CurPageCe_AsText() const; + String CurPageCe_AsFile( + const char * i_sEnding) const; + const ary::idl::CodeEntity * + CurPageCe() const { return pCurPageCe; } + + // ACCESS + output::Tree & OutputTree() { return *pOutputTree; } + + private: + // Local + void create_Directory( + const csv::ploc::Path & + i_path ); + + // DATA + csv::ploc::Directory + aOutputRoot; + csv::ploc::Path aCurPath; + + Dyn<AryAccess> pData; /// @invariant *pData is valid. + const ary::idl::Gate * + pGate; /// @invariant pGate != 0. + Dyn<output::Tree> pOutputTree; /// @invariant *pOutputTree is valid. + mutable output::Position + aCurPosition; + const ary::idl::CodeEntity * + pCurPageCe; + + const display::CorporateFrame * + pLayout; + + Dyn<LinkHelper> pLinker; +}; + + +#endif + + diff --git a/autodoc/source/display/idl/hi_factory.cxx b/autodoc/source/display/idl/hi_factory.cxx new file mode 100644 index 000000000000..5b711d5d9ed6 --- /dev/null +++ b/autodoc/source/display/idl/hi_factory.cxx @@ -0,0 +1,324 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hi_factory.cxx,v $ + * $Revision: 1.16 $ + * + * 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 "hi_factory.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_doc.hxx" +#include "hfi_navibar.hxx" +#include "hfi_tag.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + +extern const String + C_sCellStyle_SummaryLeft("imsum_left"); +extern const String + C_sCellStyle_SummaryRight("imsum_right"); +extern const String + C_sCellStyle_MDetail("imdetail"); +extern const String + C_sMemberTitle("membertitle"); + + +namespace +{ + +const char C_sSpace[92] = " " + " " + " "; +} + + +void +HtmlFactory_Idl::produce_SummaryDeclaration( Xml::Element & o_row, + const client & i_ce ) const +{ + produce_InternalLink(o_row, i_ce); +} + +void +HtmlFactory_Idl::produce_InternalLink( Xml::Element & o_screen, + const client & i_ce ) const +{ + StreamLock aLocalLink(100); + aLocalLink() << "#" << i_ce.LocalName(); + + o_screen + >> *new Html::TableCell + << new Html::ClassAttr( C_sCellStyle_SummaryLeft ) + >> *new Html::Link( aLocalLink().c_str() ) + << i_ce.LocalName(); +} + +void +HtmlFactory_Idl::produce_ShortDoc( Xml::Element & o_screen, + const client & i_ce ) const +{ + Xml::Element & + rDetailsRowCell = o_screen + >> *new Html::TableCell + << new Html::ClassAttr( C_sCellStyle_SummaryRight ); + HF_IdlShortDocu + aLinkDoc(Env(), rDetailsRowCell); + aLinkDoc.Produce_byData( i_ce ); + + rDetailsRowCell << new Xml::XmlCode(" "); +} + +// KORR_FUTURE: Does not belong here (implementation inheritance)! +void +HtmlFactory_Idl::produce_Bases( Xml::Element & o_screen, + const client & i_ce, + const String & i_sLabel ) const +{ + ary::idl::Type_id nBaseT = baseOf(i_ce); + if ( nBaseT.IsValid() ) + { + HF_DocEntryList + aDocList( o_screen ); + aDocList.Produce_Term(i_sLabel); + + int nDepth = 0; + Xml::Element & + rBaseList = aDocList.Produce_Definition() + >> *new Xml::AnElement("pre") + << new Xml::AnAttribute("style","font-family:monospace;"); + rBaseList + >> *new Html::Strong + << i_ce.LocalName(); + rBaseList + << "\n"; + recursive_ShowBases( rBaseList, + nBaseT, + nDepth ); + } +} + +void +HtmlFactory_Idl::produce_Members( ce_list & it_list, + const String & i_summaryTitle, + const String & i_summaryLabel, + const String & i_detailsTitle, + const String & i_detailsLabel, + const E_MemberViewType i_viewType ) const +{ + csv_assert( it_list ); + + Dyn< HF_SubTitleTable > pSummary; + if ( ( i_viewType == viewtype_summary ) + || ( i_viewType == viewtype_complete ) + ) + { + pSummary = new HF_SubTitleTable( + CurOut(), + i_summaryLabel, + i_summaryTitle, + 2 ); + } + + Dyn< HF_SubTitleTable > pDetails; + if ( ( i_viewType == viewtype_details ) + || ( i_viewType == viewtype_complete ) + ) + { + pDetails = new HF_SubTitleTable( + CurOut(), + i_detailsLabel, + i_detailsTitle, + 1 ); + } + + for ( ; it_list.operator bool(); ++it_list ) + { + const ary::idl::CodeEntity & + rCe = Env().Data().Find_Ce(*it_list); + + if ( pSummary ) + { + Xml::Element & + rSummaryRow = pSummary->Add_Row(); + produce_SummaryDeclaration(rSummaryRow, rCe); +// produce_InternalLink(rSummaryRow, rCe); + produce_ShortDoc(rSummaryRow, rCe); + } + + if ( pDetails ) + produce_MemberDetails(*pDetails, rCe); + } +} + +void +HtmlFactory_Idl::produce_Title( HF_TitleTable & o_title, + const String & i_label, + const client & i_ce ) const +{ + StreamLock + slAnnotations(200); + get_Annotations(slAnnotations(), i_ce); + StreamLock + slTitle(200); + slTitle() << i_label << " " << i_ce.LocalName(); + o_title.Produce_Title( slAnnotations().c_str(), + slTitle().c_str() ); +} + +void +HtmlFactory_Idl::get_Annotations( StreamStr & o_out, + const client & i_ce ) const +{ + const ary::doc::OldIdlDocu * + doc = Get_IdlDocu(i_ce.Docu()); + if (doc != 0) + { + if (doc->IsDeprecated()) + o_out << "deprecated "; + if (NOT doc->IsPublished()) + o_out << "unpublished "; + } + + // KORR + // Need to display "unpublished", if there is no docu. +} + +void +HtmlFactory_Idl::write_Docu( Xml::Element & o_screen, + const client & i_ce ) const +{ + const ary::doc::OldIdlDocu * + doc = Get_IdlDocu(i_ce.Docu()); + if (doc != 0) + { + HF_DocEntryList + aDocuList( o_screen ); + HF_IdlDocu + aDocu( Env(), aDocuList ); + aDocu.Produce_fromCodeEntity(i_ce); + } + + write_ManualLinks(o_screen, i_ce); +} + +void +HtmlFactory_Idl::write_ManualLinks( Xml::Element & o_screen, + const client & i_ce ) const +{ + const StringVector & + rLinks2Descrs = i_ce.Secondaries().Links2DescriptionInManual(); + if ( rLinks2Descrs.size() == 0 ) + return; + + o_screen + >> *new Html::Label(C_sLocalManualLinks.c_str()+1) // Leave out the leading '#'. + << " "; + HF_DocEntryList + aDocuList( o_screen ); + aDocuList.Produce_Term("Developers Guide"); + csv_assert(rLinks2Descrs.size() % 2 == 0); + for ( StringVector::const_iterator it = rLinks2Descrs.begin(); + it != rLinks2Descrs.end(); + ++it ) + { + Xml::Element & + rLink = aDocuList.Produce_Definition() >> *new Html::Link( Env().Link2Manual(*it)); + if ( (*(it+1)).empty() ) + // HACK KORR_FUTURE + // Research what happens with manual links which contain normal characters + // in non-utf-8 texts. And research, why utfF-8 does not work here. + rLink << new Xml::XmlCode(*it); + else + rLink << new Xml::XmlCode( *(it+1) ); + ++it; + } // end for +} + +void +HtmlFactory_Idl::produce_MemberDetails( HF_SubTitleTable & , + const client & ) const +{ + // Dummy, which does not need to do anything. +} + +void +HtmlFactory_Idl::recursive_ShowBases( Xml::Element & o_screen, + type_id i_baseType, + int & io_nDepth ) const +{ + // Show this base + ++io_nDepth; + const ary::idl::CodeEntity * + pCe = Env().Linker().Search_CeFromType(i_baseType); + + csv_assert(io_nDepth > 0); + if (io_nDepth > 30) + io_nDepth = 30; + o_screen + << (C_sSpace + 93 - 3*io_nDepth) + << new csi::xml::XmlCode("┗") + << " "; + + if (pCe == 0) + { + HF_IdlTypeText + aText( Env(), o_screen, false ); + aText.Produce_byData( i_baseType ); + o_screen + << "\n"; + --io_nDepth; + return; + } + + HF_IdlTypeText + aBaseLink( Env(), o_screen, true ); + aBaseLink.Produce_byData(pCe->CeId()); + o_screen + << "\n"; + + // Bases + ary::idl::Type_id + nBaseT = baseOf(*pCe); + if (nBaseT.IsValid()) + recursive_ShowBases(o_screen,nBaseT,io_nDepth); + + --io_nDepth; + return; +} + +HtmlFactory_Idl::type_id +HtmlFactory_Idl::inq_BaseOf( const client & ) const +{ + // Unused dummy. + return type_id(0); +} + diff --git a/autodoc/source/display/idl/hi_factory.hxx b/autodoc/source/display/idl/hi_factory.hxx new file mode 100644 index 000000000000..3df0d29619dc --- /dev/null +++ b/autodoc/source/display/idl/hi_factory.hxx @@ -0,0 +1,172 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hi_factory.hxx,v $ + * $Revision: 1.8 $ + * + * 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 ADC_DISPLAY_HI_FACTORY_HXX +#define ADC_DISPLAY_HI_FACTORY_HXX + + +// USED SERVICES + // BASE CLASSES +#include <toolkit/htmlfactory.hxx> + // COMPONENTS + // PARAMETERS +#include <ary/stdconstiter.hxx> +#include <ary/idl/i_types4idl.hxx> +#include <toolkit/out_position.hxx> + + +namespace ary +{ +namespace idl +{ + class Module; +} +namespace doc +{ + class OldIdlDocu; +} +} + + +class HtmlEnvironment_Idl; +class LinkHelper; +class HF_NaviSubRow; +class HF_TitleTable; +class HF_SubTitleTable; + + +class HtmlFactory_Idl : public HtmlFactory<HtmlEnvironment_Idl> +{ + public: + enum E_MemberViewType + { + viewtype_summary, // the summary of the members + viewtype_details, // the details of the members + viewtype_complete // everything + }; + + enum E_DocType + { + doctype_summaryOnly, // only the summary + doctype_complete // the complete documentation + }; + + public: + typedef ary::idl::CodeEntity client; + typedef ary::idl::Ce_id ce_id; + typedef ary::idl::Type_id type_id; + typedef ary::doc::OldIdlDocu ce_info; + + typedef ary::Dyn_StdConstIterator<ce_id> dyn_ce_list; + typedef ary::Dyn_StdConstIterator<type_id> dyn_type_list; + typedef ary::StdConstIterator<ce_id> ce_list; + typedef ary::StdConstIterator<type_id> type_list; + + typedef HtmlEnvironment_Idl Environment; + typedef output::Position OutPosition; + + protected: + HtmlFactory_Idl( + Environment & io_rEnv, + Xml::Element * o_pOut = 0 ) + : HtmlFactory<Environment>(io_rEnv, o_pOut) + { } + virtual ~HtmlFactory_Idl() {} + + /** The default version only calls ->produce_InternalLink(). + This may be overwritten by derived classes. + */ + virtual void produce_SummaryDeclaration( + Xml::Element & o_row, + const client & i_ce ) const; + void produce_InternalLink( + Xml::Element & o_row, + const client & i_ce ) const; + void produce_ShortDoc( + Xml::Element & o_row, + const client & i_ce ) const; + + // KORR_FUTURE: Does not belong here (implementation inheritance)! + void produce_Bases( + Xml::Element & o_screen, + const client & i_ce, + const String & i_sLabel ) const; + void produce_Members( + ce_list & it_list, + const String & i_summaryTitle, + const String & i_summaryLabel, + const String & i_detailsTitle, + const String & i_detailsLabel, + const E_MemberViewType i_viewType = viewtype_complete ) const; + + void produce_Title( + HF_TitleTable & o_title, + const String & i_label, + const client & i_ce ) const; + void get_Annotations( + StreamStr & o_out, + const client & i_ce ) const; + + /// Writes complete docu in standard format. + void write_Docu( + Xml::Element & o_screen, + const client & i_ce ) const; + + void write_ManualLinks( + Xml::Element & o_screen, + const client & i_ce ) const; + private: + // Dummy does nothing + virtual void produce_MemberDetails( + HF_SubTitleTable & o_table, + const client & i_ce ) const; + void recursive_ShowBases( + Xml::Element & o_screen, + type_id i_baseType, + int & io_nDepth ) const; + type_id baseOf( + const client & i_ce ) const + { return inq_BaseOf(i_ce); } + virtual type_id inq_BaseOf( + const client & i_ce ) const; +}; + + +extern const String + C_sCellStyle_SummaryLeft; +extern const String + C_sCellStyle_SummaryRight; +extern const String + C_sCellStyle_MDetail; +extern const String + C_sMemberTitle; + + +#endif diff --git a/autodoc/source/display/idl/hi_linkhelper.cxx b/autodoc/source/display/idl/hi_linkhelper.cxx new file mode 100644 index 000000000000..26c612ee4841 --- /dev/null +++ b/autodoc/source/display/idl/hi_linkhelper.cxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hi_linkhelper.cxx,v $ + * $Revision: 1.7 $ + * + * 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 "hi_linkhelper.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_module.hxx> + + + + +const ary::idl::Module * +LinkHelper::Search_CurModule() const +{ + return Search_Module( rEnv.CurPosition().RelatedNode() ); +} + +const ary::idl::Module * +LinkHelper::Search_Module( output::Node & i_node ) const +{ + static StringVector aNames_; + + output::Node::relative_id + nId = i_node.RelatedNameRoom(); + if (nId == 0) + { + csv::erase_container(aNames_); + i_node.Get_Chain(aNames_); + const ary::idl::Module * pModule = + rEnv.Data().Search_Module(aNames_); + if ( pModule == 0 ) + return 0; + nId = static_cast<output::Node::relative_id>(pModule->Id()); + rEnv.CurPosition().RelatedNode().Set_RelatedNameRoom(nId); + } + + return & rEnv.Data().Find_Module( ary::idl::Ce_id(nId) ); +} + +namespace +{ + const String C_sXrefsSuffix("-xref"); +} + + +LinkHelper::OutPosition +LinkHelper::PositionOf_CurXRefs( const String & i_ceName ) const +{ + StreamLock sl(100); + return OutPosition( rEnv.CurPosition(), + sl() << i_ceName + << C_sXrefsSuffix + << ".html" + << c_str ); +} + +const String & +LinkHelper::XrefsSuffix() const +{ + return C_sXrefsSuffix; +} + + +String +nameChainLinker( const char * ) +{ + static const String + sModuleFileName_( output::ModuleFileName() ); + return sModuleFileName_; +} diff --git a/autodoc/source/display/idl/hi_linkhelper.hxx b/autodoc/source/display/idl/hi_linkhelper.hxx new file mode 100644 index 000000000000..98b3f43f1716 --- /dev/null +++ b/autodoc/source/display/idl/hi_linkhelper.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hi_linkhelper.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_DISPLAY_HI_LINKHELPER_HXX +#define ADC_DISPLAY_HI_LINKHELPER_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +#include "hi_ary.hxx" +#include "hi_env.hxx" +#include <toolkit/out_position.hxx> +#include <toolkit/out_tree.hxx> + + +class LinkHelper +{ + public: + typedef ary::idl::CodeEntity CE; + typedef output::Position OutPosition; + + LinkHelper( + HtmlEnvironment_Idl & + io_rEnv ) + : rEnv(io_rEnv) {} + + OutPosition PositionOf_CurModule() const + { return OutPosition( rEnv.CurPosition(), + output::ModuleFileName()); } + + OutPosition PositionOf_CurXRefs( + const String & i_ceName) const; + OutPosition PositionOf_Index() const + { OutPosition ret1 = rEnv.OutputTree().IndexRoot(); + return OutPosition( ret1, String(output::IndexFile_A()) ); } + + + const ary::idl::Module * + Search_CurModule() const; + const ary::idl::Module * + Search_Module( + output::Node & i_node ) const; + + const CE * Search_CeFromType( + ary::idl::Type_id i_type ) const; + + void Get_Link2Position( + StreamStr & o_link, + OutPosition & i_pos ) const + { rEnv.CurPosition().Get_LinkTo(o_link, i_pos); } + + void Get_Link2Member( + StreamStr & o_link, + OutPosition & i_ownerPos, + const String & i_memberName ) const + { Get_Link2Position(o_link, i_ownerPos); + o_link << "#" << i_memberName; } + const String & XrefsSuffix() const; + + private: + // DATA + mutable HtmlEnvironment_Idl & + rEnv; +}; + +inline const ary::idl::CodeEntity * +LinkHelper::Search_CeFromType( ary::idl::Type_id i_type ) const +{ + ary::idl::Ce_id nCe = rEnv.Data().CeFromType(i_type); + if (nCe.IsValid()) + return &rEnv.Data().Find_Ce(nCe); + return 0; +} + + + +String nameChainLinker( + const char * i_levelName ); + + +#endif diff --git a/autodoc/source/display/idl/hi_main.cxx b/autodoc/source/display/idl/hi_main.cxx new file mode 100644 index 000000000000..5dc8c7aea486 --- /dev/null +++ b/autodoc/source/display/idl/hi_main.cxx @@ -0,0 +1,767 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hi_main.cxx,v $ + * $Revision: 1.11 $ + * + * 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 "hi_main.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <algorithm> +#include <cosv/ploc.hxx> +#include <cosv/file.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_ce.hxx> +#include <ary/idl/ik_enum.hxx> +#include <ary/idl/ik_typedef.hxx> +#include <ary/idl/ik_interface.hxx> +#include <ary/idl/ik_struct.hxx> +#include <ary/idl/ik_exception.hxx> +#include <ary/idl/i_constant.hxx> +#include <ary/idl/i_constgroup.hxx> +#include <ary/idl/i_enum.hxx> +#include <ary/idl/i_singleton.hxx> +#include <ary/idl/i_sisingleton.hxx> +#include <ary/idl/i_exception.hxx> +#include <ary/idl/i_interface.hxx> +#include <ary/idl/i_service.hxx> +#include <ary/idl/i_siservice.hxx> +#include <ary/idl/i_struct.hxx> +#include <ary/idl/i_typedef.hxx> +#include <ary/idl/i_module.hxx> +#include <cfrstd.hxx> +#include <toolkit/htmlfile.hxx> +#include <toolkit/out_position.hxx> +#include <toolkit/out_tree.hxx> +#include "hfi_constgroup.hxx" +#include "hfi_enum.hxx" +#include "hfi_globalindex.hxx" +#include "hfi_interface.hxx" +#include "hfi_module.hxx" +#include "hfi_struct.hxx" +#include "hfi_service.hxx" +#include "hfi_singleton.hxx" +#include "hfi_siservice.hxx" +#include "hfi_typedef.hxx" +#include "hfi_xrefpage.hxx" +#include "hi_env.hxx" +#include "hi_linkhelper.hxx" + + +using ::ary::idl::Ce_id; +using ::ary::idl::Type_id; +using ::ary::idl::ifc_ce::Dyn_CeIterator; + + + +extern const String C_sCssFilename_Idl("idl.css"); + +/* +typedef ::ary::Dyn_StdConstIterator< ::ary::idl::CommentedRelation> + Dyn_ComRefIterator; +namespace read_module = ::ary::idl::ifc_module; +namespace read_interface = ::ary::idl::ifc_interface; +namespace read_service = ::ary::idl::ifc_service; +namespace read_struct = ::ary::idl::ifc_struct; +namespace read_exception = ::ary::idl::ifc_exception; +namespace read_enum = ::ary::idl::ifc_enum; +namespace read_typedef = ::ary::idl::ifc_typedef; +namespace read_constgroup = ::ary::idl::ifc_constantsgroup; +*/ + +namespace +{ + +/** @resp + Inits (constructor) and creates (destructor) the current + html documentation file ( MainDisplay_Idl.pMyFile ). +*/ +class Guard_CurFile +{ + public: + Guard_CurFile( /// For CodeEntities + DocuFile_Html & io_client, + HtmlEnvironment_Idl & + io_env, + const ary::idl::CodeEntity & + i_ce, + const String & i_titlePrefix ); + Guard_CurFile( /// For Use pages + DocuFile_Html & io_client, + HtmlEnvironment_Idl & + io_env, + const String & i_fileName, + const String & i_titlePrefix ); + Guard_CurFile( /// For Modules + DocuFile_Html & io_client, + HtmlEnvironment_Idl & + io_env, + const ary::idl::CodeEntity & + i_ce ); + Guard_CurFile( /// For Indices + DocuFile_Html & io_client, + HtmlEnvironment_Idl & + io_env, + char i_letter ); + ~Guard_CurFile(); + private: + DocuFile_Html & rClient; + HtmlEnvironment_Idl & + rEnv; + +}; + +/** @resp + Sets and releases the current factory pointer + ( MainDisplay_Idl.pCurFactory ). +*/ +class Guard_CurFactoryPtr +{ + public: + Guard_CurFactoryPtr( + HtmlFactory_Idl *& io_client, + HtmlFactory_Idl & i_factory ) + : rpClient(io_client) + { rpClient = &i_factory; } + + ~Guard_CurFactoryPtr() + { rpClient = 0; } + + private: + HtmlFactory_Idl *& rpClient; + +}; + + +Guard_CurFile::Guard_CurFile( DocuFile_Html & io_client, + HtmlEnvironment_Idl & io_env, + const ary::idl::CodeEntity & i_ce, + const String & i_titlePrefix ) + : rClient(io_client), + rEnv(io_env) +{ // For Ces + StreamLock sl(300); + io_env.Set_CurFile( sl() << i_ce.LocalName() + << ".html" + << c_str ); + StreamLock aCurFilePath(700); + io_env.Get_CurFilePath(aCurFilePath()); + + rClient.EmptyBody(); + csv::ploc::Path + aLocation(aCurFilePath().c_str()); + rClient.SetLocation(aLocation); + sl().reset(); + rClient.SetTitle( sl() << i_titlePrefix + << " " + << i_ce.LocalName() + << c_str ); + sl().reset(); + rClient.SetRelativeCssPath( + sl() << io_env.CurPosition().LinkToRoot() + << C_sCssFilename_Idl + << c_str ); + + io_env.Set_CurPageCe(&i_ce); +} + +Guard_CurFile::Guard_CurFile( DocuFile_Html & io_client, + HtmlEnvironment_Idl & io_env, + const String & i_fileName, + const String & i_titlePrefix ) + : rClient(io_client), + rEnv(io_env) +{ // For Use pages + StreamLock sl(300); + io_env.Set_CurFile( sl() << i_fileName + << ".html" + << c_str ); + StreamLock aCurFilePath(700); + io_env.Get_CurFilePath(aCurFilePath()); + csv::ploc::Path + aLocation(aCurFilePath().c_str()); + + rClient.EmptyBody(); + rClient.SetLocation(aLocation); + sl().reset(); + rClient.SetTitle( sl() << i_titlePrefix << " " << i_fileName << c_str ); + sl().reset(); + rClient.SetRelativeCssPath( + sl() << io_env.CurPosition().LinkToRoot() + << C_sCssFilename_Idl + << c_str ); + + io_env.Set_CurPageCe(0); +} + +Guard_CurFile::Guard_CurFile( DocuFile_Html & io_client, + HtmlEnvironment_Idl & io_env, + const ary::idl::CodeEntity & i_ce ) + : rClient(io_client), + rEnv(io_env) +{ // For Modules + io_env.Set_CurFile( output::ModuleFileName() ); + StreamLock aCurFilePath(700); + io_env.Get_CurFilePath(aCurFilePath()); + csv::ploc::Path + aLocation(aCurFilePath().c_str()); + + rClient.EmptyBody(); + rClient.SetLocation(aLocation); + StreamLock sl(300); + rClient.SetTitle( sl() << "Module " << io_env.CurPosition().Name() << c_str ); + sl().reset(); + rClient.SetRelativeCssPath( + sl() << io_env.CurPosition().LinkToRoot() + << C_sCssFilename_Idl + << c_str ); + + io_env.Set_CurPageCe(&i_ce); +} + +Guard_CurFile::Guard_CurFile( DocuFile_Html & io_client, + HtmlEnvironment_Idl & io_env, + char i_letter ) + : rClient(io_client), + rEnv(io_env) +{ // For Index pages + StreamLock sl(300); + io_env.Set_CurFile( sl() << "index-" + << ( i_letter != '_' + ? int(i_letter)-'a'+1 + : 27 ) + << ".html" + << c_str ); + StreamLock aCurFilePath(700); + io_env.Get_CurFilePath(aCurFilePath()); + csv::ploc::Path + aLocation(aCurFilePath().c_str()); + + rClient.EmptyBody(); + rClient.SetLocation(aLocation); + sl().reset(); + rClient.SetTitle( sl() << "Global Index " + << ( i_letter != '_' + ? char(i_letter-'a'+'A') + : '_' ) + << c_str ); + sl().reset(); + rClient.SetRelativeCssPath( + sl() << "../" + << C_sCssFilename_Idl + << c_str ); +} + +Guard_CurFile::~Guard_CurFile() +{ + rClient.CreateFile(); + rEnv.Set_CurPageCe(0); +} + + +} // anonymous namespace + + + + +MainDisplay_Idl::MainDisplay_Idl( HtmlEnvironment_Idl & io_rEnv ) + : pEnv(&io_rEnv), + pMyFile(new DocuFile_Html), + pCurFactory(0) +{ +// pMyFile->SetStyle( Env().Layout().CssStyle() ); + pMyFile->SetCopyright( Env().Layout().CopyrightText() ); +} + +MainDisplay_Idl::~MainDisplay_Idl() +{ +} + + +void +MainDisplay_Idl::WriteGlobalIndices() +{ + for ( const char * pLetter = "abcdefghijklmnopqrstuvwxyz_X"; *pLetter != 'X'; ++pLetter ) + { + Guard_CurFile gFile( *pMyFile, Env(), *pLetter ); + + HF_IdlGlobalIndex aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_Page( ary::idl::alphabetical_index::E_Letter(*pLetter) ); + } // end for +} + + +void +MainDisplay_Idl::do_Process( const ary::idl::Module & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce ); + HF_IdlModule aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::Interface & i_ce ) +{ + do_InterfaceDescr(i_ce); + do_Interface2s(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::Service & i_ce ) +{ + do_ServiceDescr(i_ce); + do_Service2s(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::SglIfcService & i_ce ) +{ + do_SglIfcServiceDescr(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::Struct & i_ce ) +{ + do_StructDescr(i_ce); + do_Struct2s(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::Exception & i_ce ) +{ + do_ExceptionDescr(i_ce); + do_Exception2s(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::Enum & i_ce ) +{ + do_EnumDescr(i_ce); + do_Enum2s(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::Typedef & i_ce ) +{ + do_TypedefDescr(i_ce); + do_Typedef2s(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::ConstantsGroup & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Constants' Group" ); + HF_IdlConstGroup aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::Singleton & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Singleton" ); + HF_IdlSingleton aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData_ServiceBased(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::SglIfcSingleton & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Singleton" ); + HF_IdlSingleton aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData_InterfaceBased(i_ce); +} + +void +MainDisplay_Idl::do_InterfaceDescr( const ary::idl::CodeEntity & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Interface" ); + HF_IdlInterface aInterface( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aInterface); + + aInterface.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_ServiceDescr( const ary::idl::CodeEntity & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Service" ); + HF_IdlService aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_SglIfcServiceDescr( const ary::idl::CodeEntity & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Service" ); + HF_IdlSglIfcService aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_StructDescr( const ary::idl::CodeEntity & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Struct" ); + HF_IdlStruct aFactory( *pEnv, pMyFile->Body(), false ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_ExceptionDescr( const ary::idl::CodeEntity & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Exception" ); + HF_IdlStruct aFactory( *pEnv, pMyFile->Body(), true ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_EnumDescr( const ary::idl::CodeEntity & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Enum" ); + HF_IdlEnum aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_TypedefDescr( const ary::idl::CodeEntity & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Typedef" ); + HF_IdlTypedef aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_Interface2s( const ary::idl::CodeEntity & i_ce ) +{ + StreamLock sl(100); + String sUsesFileName( + sl() + << i_ce.LocalName() + << Env().Linker().XrefsSuffix() + << c_str ); + Guard_CurFile gFile( *pMyFile, + Env(), + sUsesFileName, + "Uses of Interface" ); + HF_IdlXrefs aUses( *pEnv, + pMyFile->Body(), + C_sCePrefix_Interface, + i_ce ); + + + aUses.Produce_Tree( + "Derived Interfaces", + "#Deriveds", + i_ce, + &ary::idl::ifc_interface::xref::Get_Derivations ); + + Dyn_CeIterator pXrefList; + + ary::idl::ifc_interface::xref::Get_SynonymTypedefs(pXrefList,i_ce); + aUses.Produce_List( + "Synonym Typedefs", + "#Synonyms", + *pXrefList ); + ary::idl::ifc_interface::xref::Get_ExportingServices(pXrefList,i_ce); + aUses.Produce_List( + "Services which Support this Interface", + "#SupportingServices", + *pXrefList ); + ary::idl::ifc_interface::xref::Get_ExportingSingletons(pXrefList,i_ce); + aUses.Produce_List( + "Singletons which Support this Interface", + "#SupportingSingletons", + *pXrefList ); + ary::idl::ifc_interface::xref::Get_AsReturns(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Return Type", + "#Returns", + *pXrefList ); + ary::idl::ifc_interface::xref::Get_AsParameters(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Parameter", + "#Parameters", + *pXrefList ); + ary::idl::ifc_interface::xref::Get_AsDataTypes(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Data Type", + "#DataTypes", + *pXrefList ); + aUses.Write_ManualLinks(i_ce); +} + +void +MainDisplay_Idl::do_Service2s( const ary::idl::CodeEntity & i_ce ) +{ + StreamLock sl(100); + String sUsesFileName( + sl() + << i_ce.LocalName() + << Env().Linker().XrefsSuffix() + << c_str ); + Guard_CurFile gFile( *pMyFile, + Env(), + sUsesFileName, + "Uses of Service" ); + HF_IdlXrefs aUses( *pEnv, + pMyFile->Body(), + C_sCePrefix_Service, + i_ce ); + Dyn_CeIterator pXrefList; + ary::idl::ifc_service::xref::Get_IncludingServices(pXrefList,i_ce); + aUses.Produce_List( + "Services which Include this Service", + "#IncludingServices", + *pXrefList ); + + ary::idl::ifc_service::xref::Get_InstantiatingSingletons(pXrefList,i_ce); + aUses.Produce_List( + "Singletons which Instantiate this Service", + "#Singletons", + *pXrefList ); + aUses.Write_ManualLinks(i_ce); +} + +void +MainDisplay_Idl::do_Struct2s( const ary::idl::CodeEntity & i_ce ) +{ + StreamLock sl(100); + String sUsesFileName( + sl() + << i_ce.LocalName() + << Env().Linker().XrefsSuffix() + << c_str ); + Guard_CurFile gFile( *pMyFile, + Env(), + sUsesFileName, + "Uses of Struct" ); + HF_IdlXrefs aUses( *pEnv, + pMyFile->Body(), + C_sCePrefix_Struct, + i_ce ); + + aUses.Produce_Tree( + "Derived Structs", + "#Deriveds", + i_ce, + &ary::idl::ifc_struct::xref::Get_Derivations ); + + Dyn_CeIterator pXrefList; + + ary::idl::ifc_struct::xref::Get_SynonymTypedefs(pXrefList,i_ce); + aUses.Produce_List( + "Synonym Typedefs", + "#Synonyms", + *pXrefList ); + ary::idl::ifc_struct::xref::Get_AsReturns(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Return Type", + "#Returns", + *pXrefList ); + ary::idl::ifc_struct::xref::Get_AsParameters(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Parameter", + "#Parameters", + *pXrefList ); + ary::idl::ifc_struct::xref::Get_AsDataTypes(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Data Type", + "#DataTypes", + *pXrefList ); + aUses.Write_ManualLinks(i_ce); +} + +void +MainDisplay_Idl::do_Exception2s( const ary::idl::CodeEntity & i_ce ) +{ + StreamLock sl(100); + String sUsesFileName( + sl() + << i_ce.LocalName() + << Env().Linker().XrefsSuffix() + << c_str ); + Guard_CurFile gFile( *pMyFile, + Env(), + sUsesFileName, + "Uses of Exception" ); + HF_IdlXrefs aUses( *pEnv, + pMyFile->Body(), + C_sCePrefix_Exception, + i_ce ); + + aUses.Produce_Tree( + "Derived Exceptions", + "#Deriveds", + i_ce, + &ary::idl::ifc_exception::xref::Get_Derivations ); + + Dyn_CeIterator pXrefList; + + ary::idl::ifc_exception::xref::Get_RaisingFunctions(pXrefList,i_ce); + aUses.Produce_List( + "Raising Functions", + "#Raisers", + *pXrefList ); + aUses.Write_ManualLinks(i_ce); +} + +void +MainDisplay_Idl::do_Enum2s( const ary::idl::CodeEntity & i_ce ) +{ + StreamLock sl(100); + String sUsesFileName( + sl() + << i_ce.LocalName() + << Env().Linker().XrefsSuffix() + << c_str ); + Guard_CurFile gFile( *pMyFile, + Env(), + sUsesFileName, + "Uses of Enum" ); + HF_IdlXrefs aUses( *pEnv, + pMyFile->Body(), + C_sCePrefix_Enum, + i_ce ); + Dyn_CeIterator pXrefList; + ary::idl::ifc_enum::xref::Get_SynonymTypedefs(pXrefList,i_ce); + aUses.Produce_List( + "Synonym Typedefs", + "#Synonyms", + *pXrefList ); + ary::idl::ifc_enum::xref::Get_AsReturns(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Return Type", + "#Returns", + *pXrefList ); + ary::idl::ifc_enum::xref::Get_AsParameters(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Parameter", + "#Parameters", + *pXrefList ); + ary::idl::ifc_enum::xref::Get_AsDataTypes(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Data Type", + "#DataTypes", + *pXrefList ); + aUses.Write_ManualLinks(i_ce); +} + +void +MainDisplay_Idl::do_Typedef2s( const ary::idl::CodeEntity & i_ce ) +{ + StreamLock sl(100); + String sUsesFileName( + sl() << i_ce.LocalName() + << Env().Linker().XrefsSuffix() + << c_str ); + Guard_CurFile gFile( *pMyFile, + Env(), + sUsesFileName, + "Uses of Typedef" ); + HF_IdlXrefs aUses( *pEnv, + pMyFile->Body(), + C_sCePrefix_Typedef, + i_ce ); + Dyn_CeIterator pXrefList; + ary::idl::ifc_typedef::xref::Get_SynonymTypedefs(pXrefList,i_ce); + aUses.Produce_List( + "Synonym Typedefs", + "#Synonyms", + *pXrefList ); + ary::idl::ifc_typedef::xref::Get_AsReturns(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Return Type", + "#Returns", + *pXrefList ); + ary::idl::ifc_typedef::xref::Get_AsParameters(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Parameter", + "#Parameters", + *pXrefList ); + ary::idl::ifc_typedef::xref::Get_AsDataTypes(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Data Type", + "#DataTypes", + *pXrefList ); + aUses.Write_ManualLinks(i_ce); +} + diff --git a/autodoc/source/display/idl/hi_main.hxx b/autodoc/source/display/idl/hi_main.hxx new file mode 100644 index 000000000000..4302f779797e --- /dev/null +++ b/autodoc/source/display/idl/hi_main.hxx @@ -0,0 +1,181 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hi_main.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_DISPLAY_HFIDMAIN_HXX +#define ADC_DISPLAY_HFIDMAIN_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <cosv/tpl/processor.hxx> + // COMPONENTS +#include "hi_factory.hxx" + // PARAMETERS + + +class HtmlEnvironment_Idl; +class HtmlFactory_Idl; +class DocuFile_Html; + +namespace ary +{ +namespace idl +{ + + class Module; + class Service; + class SglIfcService; + class Interface; + class Struct; + class Exception; + class Enum; + class Typedef; + class ConstantsGroup; + class Singleton; + class SglIfcSingleton; + +} // namespace idl +} // namespace ary + + +class MainDisplay_Idl : public csv::ProcessorIfc, + public csv::ConstProcessor<ary::idl::Module>, + public csv::ConstProcessor<ary::idl::Service>, + public csv::ConstProcessor<ary::idl::SglIfcService>, + public csv::ConstProcessor<ary::idl::Interface>, + public csv::ConstProcessor<ary::idl::Struct>, + public csv::ConstProcessor<ary::idl::Exception>, + public csv::ConstProcessor<ary::idl::Enum>, + public csv::ConstProcessor<ary::idl::Typedef>, + public csv::ConstProcessor<ary::idl::ConstantsGroup>, + public csv::ConstProcessor<ary::idl::Singleton>, + public csv::ConstProcessor<ary::idl::SglIfcSingleton> +{ + public: + MainDisplay_Idl( + HtmlEnvironment_Idl & + io_rEnv ); + virtual ~MainDisplay_Idl(); + + void WriteGlobalIndices(); + + void Display_NamedEntityHierarchy(); + + private: + // Interface csv::ProcessorIfc: + virtual void do_Process( + const ary::idl::Module & i_client ); + virtual void do_Process( + const ary::idl::Service & i_client ); + virtual void do_Process( + const ary::idl::SglIfcService & + i_client ); + virtual void do_Process( + const ary::idl::Interface & i_client ); + virtual void do_Process( + const ary::idl::Struct & i_client ); + virtual void do_Process( + const ary::idl::Exception & i_client ); + virtual void do_Process( + const ary::idl::Enum & i_client ); + virtual void do_Process( + const ary::idl::Typedef & i_client ); + virtual void do_Process( + const ary::idl::ConstantsGroup & + i_client ); + virtual void do_Process( + const ary::idl::Singleton & i_client ); + virtual void do_Process( + const ary::idl::SglIfcSingleton & + i_client ); + // Locals + void do_ServiceDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_SglIfcServiceDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_InterfaceDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_StructDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_ExceptionDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_EnumDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_TypedefDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_SingletonDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_Service2s( + const ary::idl::CodeEntity & + i_rData ); + void do_Interface2s( + const ary::idl::CodeEntity & + i_rData ); + void do_Struct2s( + const ary::idl::CodeEntity & + i_rData ); + void do_Exception2s( + const ary::idl::CodeEntity & + i_rData ); + void do_Enum2s( + const ary::idl::CodeEntity & + i_rData ); + void do_Typedef2s( + const ary::idl::CodeEntity & + i_rData ); + void do_Singleton2s( + const ary::idl::CodeEntity & + i_rData ); + + const HtmlEnvironment_Idl & + Env() const { return *pEnv; } + HtmlEnvironment_Idl & + Env() { return *pEnv; } + Xml::Element & CurHtmlOut() { return pCurFactory->CurOut(); } + + // DATA + HtmlEnvironment_Idl * + pEnv; + Dyn<DocuFile_Html> pMyFile; + HtmlFactory_Idl * pCurFactory; +}; + + + +#endif diff --git a/autodoc/source/display/idl/makefile.mk b/autodoc/source/display/idl/makefile.mk new file mode 100644 index 000000000000..f34305363c30 --- /dev/null +++ b/autodoc/source/display/idl/makefile.mk @@ -0,0 +1,81 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.4 $ +# +# 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=display_idl + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/hfi_constgroup.obj \ + $(OBJ)$/hfi_doc.obj \ + $(OBJ)$/hfi_enum.obj \ + $(OBJ)$/hfi_globalindex.obj \ + $(OBJ)$/hfi_hierarchy.obj \ + $(OBJ)$/hfi_interface.obj \ + $(OBJ)$/hfi_method.obj \ + $(OBJ)$/hfi_module.obj \ + $(OBJ)$/hfi_navibar.obj \ + $(OBJ)$/hfi_property.obj \ + $(OBJ)$/hfi_service.obj \ + $(OBJ)$/hfi_singleton.obj \ + $(OBJ)$/hfi_siservice.obj \ + $(OBJ)$/hfi_struct.obj \ + $(OBJ)$/hfi_tag.obj \ + $(OBJ)$/hfi_typedef.obj \ + $(OBJ)$/hfi_typetext.obj \ + $(OBJ)$/hfi_xrefpage.obj \ + $(OBJ)$/hi_ary.obj \ + $(OBJ)$/hi_display.obj \ + $(OBJ)$/hi_env.obj \ + $(OBJ)$/hi_factory.obj \ + $(OBJ)$/hi_linkhelper.obj \ + $(OBJ)$/hi_main.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/display/inc/cfrstd.hxx b/autodoc/source/display/inc/cfrstd.hxx new file mode 100644 index 000000000000..2520d1acca0b --- /dev/null +++ b/autodoc/source/display/inc/cfrstd.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cfrstd.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_CFRSTD_HXX +#define ADC_CFRSTD_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <display/corframe.hxx> + // COMPONENTS + // PARAMETERS + + + +class StdFrame : public display::CorporateFrame +{ + public: + // LIFECYCLE + StdFrame(); + + // INQUIRY + virtual DYN Html_Image * + LogoSrc() const; + virtual const char * + LogoLink() const; + virtual const char * + CopyrightText() const; + virtual const char * + CssStyle() const; + virtual const char * + CssStylesExplanation() const; + virtual const char * + DevelopersGuideHtmlRoot() const; + virtual bool SimpleLinks() const; + + // ACCESS + virtual void Set_DevelopersGuideHtmlRoot( + const String & i_directory ); + virtual void Set_SimpleLinks(); + + private: + String sDevelopersGuideHtmlRoot; + bool bSimpleLinks; +}; + + + +// IMPLEMENTATION + + + + +#endif + diff --git a/autodoc/source/display/inc/html/chd_udk2.hxx b/autodoc/source/display/inc/html/chd_udk2.hxx new file mode 100644 index 000000000000..a73fd0bbb6fc --- /dev/null +++ b/autodoc/source/display/inc/html/chd_udk2.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: chd_udk2.hxx,v $ + * $Revision: 1.6 $ + * + * 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 ADC_DISPLAY_HTML_CHD_UDK2_HXX +#define ADC_DISPLAY_HTML_CHD_UDK2_HXX + +// BASE CLASSES +#include <autodoc/dsp_html_std.hxx> +// USED SERVICES +#include <cosv/ploc.hxx> + +namespace ary +{ +namespace cpp +{ + class Namespace; + class Gate; +} +} + +class OuputPage_Environment; + + + + +class CppHtmlDisplay_Udk2 : public autodoc::HtmlDisplay_UdkStd +{ + public: + CppHtmlDisplay_Udk2(); + ~CppHtmlDisplay_Udk2(); + private: + // Interface CppHtmlDisplay_UdkStd: + virtual void do_Run( + const char * i_sOutputDirectory, + const ary::cpp::Gate & + i_rAryGate, + const display::CorporateFrame & + i_rLayout ); + + // Local + void SetRunData( + const char * i_sOutputDirectory, + const ary::cpp::Gate & + i_rAryGate, + const display::CorporateFrame & + i_rLayout ); + + void Create_Css_File(); + void Create_Overview_File(); + void Create_Help_File(); + void Create_AllDefs_File(); + void CreateFiles_InSubTree_Namespaces(); + void CreateFiles_InSubTree_Index(); + + void RecursiveDisplay_Namespace( + const ary::cpp::Namespace & + i_rNsp ); + void DisplayFiles_InNamespace( + const ary::cpp::Namespace & + i_rNsp ); + const ary::cpp::Gate & + Gate() const; + // DATA + Dyn<OuputPage_Environment> + pCurPageEnv; +}; + + + + +#endif diff --git a/autodoc/source/display/inc/idl/hi_display.hxx b/autodoc/source/display/inc/idl/hi_display.hxx new file mode 100644 index 000000000000..54f18865fee3 --- /dev/null +++ b/autodoc/source/display/inc/idl/hi_display.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hi_display.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HI_DISPLAY_HXX +#define ADC_DISPLAY_HI_DISPLAY_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <autodoc/dsp_html_std.hxx> + // COMPONENTS +#include <cosv/ploc.hxx> + // PARAMETERS + + + +namespace ary +{ + namespace idl + { + class Module; + class CodeEntity; + } // namspace idl +} // namspace csi + + +class MainDisplay_Idl; +class HtmlEnvironment_Idl; + +class HtmlDisplay_Idl : public autodoc::HtmlDisplay_Idl_Ifc +{ + public: + HtmlDisplay_Idl(); + ~HtmlDisplay_Idl(); + private: + // Interface HtmlDisplay_Idl_Ifc: + virtual void do_Run( + const char * i_sOutputDirectory, + const ary::idl::Gate & + i_rAryGate, + const display::CorporateFrame & + i_rLayout ); + void SetRunData( + const char * i_sOutputDirectory, + const ary::idl::Gate & + i_rAryGate, + const display::CorporateFrame & + i_rLayout ); + void Create_StartFile(); + void Create_FilesInNameTree(); + void Create_IndexFiles(); + void Create_FilesInProjectTree(); + void Create_PackageList(); + void Create_HelpFile(); + void Create_CssFile(); + + /** @descr + - makes sure, the module's directory exists + - creates the module's docu file + - creates docu files for all members of the module + - does the same recursive for all sub-modules. + */ + void RecursiveDisplay_Module( + const ary::idl::Module & + i_rNamespace ); + bool IsModule( + const ary::idl::CodeEntity & + i_ce ) const; + const ary::idl::Module & + Module_Cast( /// @precond Cast must be valid. + const ary::idl::CodeEntity & + i_ce ) const; + // DATA + Dyn<HtmlEnvironment_Idl> + pCurPageEnv; + Dyn<MainDisplay_Idl> + pMainDisplay; +}; + + + +// IMPLEMENTATION + + +#endif + diff --git a/autodoc/source/display/inc/toolkit/hf_docentry.hxx b/autodoc/source/display/inc/toolkit/hf_docentry.hxx new file mode 100644 index 000000000000..af02bf1106a8 --- /dev/null +++ b/autodoc/source/display/inc/toolkit/hf_docentry.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hf_docentry.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HF_DOCENTRY_HXX +#define ADC_DISPLAY_HF_DOCENTRY_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "htmlfactory.hxx" + // COMPONENTS + // PARAMETERS + +/** @resp + Produces a list of <DT>..</DT> and <DD>. +*/ +class HF_DocEntryList : public HtmlMaker +{ + public: + + HF_DocEntryList( + Xml::Element & o_rOut ); + virtual ~HF_DocEntryList(); + + Xml::Element & Produce_Term( + const char * i_sTerm = 0 ); + Xml::Element & Produce_NormalTerm( /// Font will not be bold. + const char * i_sTerm = 0 ); + Xml::Element & Produce_Definition(); +}; + + + +#endif diff --git a/autodoc/source/display/inc/toolkit/hf_funcdecl.hxx b/autodoc/source/display/inc/toolkit/hf_funcdecl.hxx new file mode 100644 index 000000000000..dfe7ce716536 --- /dev/null +++ b/autodoc/source/display/inc/toolkit/hf_funcdecl.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hf_funcdecl.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HF_FUNCDECL_HXX +#define ADC_DISPLAY_HF_FUNCDECL_HXX + + +// USED SERVICES + // BASE CLASSES +#include <toolkit/htmlfactory.hxx> + // COMPONENTS + // PARAMETERS + + +#if 0 // old +/** @resp + Provides three cells to put in a function declaration. +*/ +class HF_FunctionDeclaration : public HtmlMaker +{ + public: + HF_FunctionDeclaration( + Xml::Element & o_rParent ); + virtual ~HF_FunctionDeclaration(); + + /// Inserts empty line in 2nd and 3rd cell and returns first. + Xml::Element & Add_ReturnLine(); + + /** Inserts empty line in 1st cell, "raises (" in 2nd + and returns 3rd. + */ + Xml::Element & Add_RaisesLine( + const char * i_sRaisesText, + bool i_bSuppressExtraLine = false ); + + Xml::Element & Front() { return *pFront; } + Xml::Element & Types() { return *pTypes; } + Xml::Element & Names() { return *pNames; } + + private: + Xml::Element * pFront; + Xml::Element * pTypes; + Xml::Element * pNames; +}; +#endif // 0 old + +class HF_FunctionDeclaration : public HtmlMaker +{ + public: + HF_FunctionDeclaration( + Xml::Element & o_rParent, + const String & i_sRaisesText ); + virtual ~HF_FunctionDeclaration(); + + // OPERATIONS + Xml::Element & ReturnCell(); + Xml::Element & NameCell(); + Xml::Element & NewParamTypeCell(); + Xml::Element & ParamNameCell(); + Xml::Element & ExceptionCell(); + + private: + Html::TableRow & ParameterLine(); + + // DATA + String sRaisesText; + Html::Table * pTable; + Xml::Element * pReturnCell; + Xml::Element * pNameCell; + Html::TableRow * pParameterLine; + Xml::Element * pLastParameterCell; + Xml::Element * pExceptionCell; +}; + + +// IMPLEMENTATION + + + +#endif diff --git a/autodoc/source/display/inc/toolkit/hf_linachain.hxx b/autodoc/source/display/inc/toolkit/hf_linachain.hxx new file mode 100644 index 000000000000..ef95e92cb3ac --- /dev/null +++ b/autodoc/source/display/inc/toolkit/hf_linachain.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hf_linachain.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HF_LINACHAIN_HXX +#define ADC_DISPLAY_HF_LINACHAIN_HXX + +// BASE CLASSES +#include "htmlfactory.hxx" +#include "out_position.hxx" + + + + +class HF_LinkedNameChain : public HtmlMaker +{ + public: + /** F_LinkMaker makes a link out of the name of the + parent position. + + Returns true, if there is a link, false if not. + */ + typedef String (*F_LinkMaker)(const char *); + + + HF_LinkedNameChain( + Xml::Element & o_rOut ); + virtual ~HF_LinkedNameChain(); + + void Produce_CompleteChain( + const output::Position & + i_curPosition, + F_LinkMaker i_linkMaker ) const; + void Produce_CompleteChain_forModule( + const output::Position & + i_curPosition, /// current Module's node + F_LinkMaker i_linkMaker ) const; + private: + void produce_Level( + output::Node & i_levelNode, + const output::Position & + i_startPosition, + F_LinkMaker i_linkMaker ) const; +}; + + + + +#endif diff --git a/autodoc/source/display/inc/toolkit/hf_navi_main.hxx b/autodoc/source/display/inc/toolkit/hf_navi_main.hxx new file mode 100644 index 000000000000..41e3013861e7 --- /dev/null +++ b/autodoc/source/display/inc/toolkit/hf_navi_main.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hf_navi_main.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_DISPLAY_HF_NAVI_MAIN_HXX +#define ADC_DISPLAY_HF_NAVI_MAIN_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include "htmlfactory.hxx" + // PARAMETERS + + +class HF_MainItem; + + +/** @task + Create a HTML navigation bar with lightly coloured background. + + @descr + There are three kinds of items: + Item with link: Add_StdItem(), + Item without link: Add_NoneItem(), + Item that is current page: Add_SelfItem(). +*/ +class HF_NaviMainRow : public HtmlMaker +{ + public: + enum E_Style + { + eStd, + eSelf, + eNo + }; + HF_NaviMainRow( + Xml::Element & o_out ); + ~HF_NaviMainRow(); + + void Add_StdItem( + const char * i_sText, + const char * i_sLink ); + void Add_SelfItem( + const char * i_sText ); + void Add_NoneItem( + const char * i_sText ); + + void Produce_Row(); + + private: + // DATA + typedef std::vector< DYN HF_MainItem* > ItemList; + + ItemList aItems; + Xml::Element * pRow; +}; + + + +// IMPLEMENTATION + + + + +#endif + + diff --git a/autodoc/source/display/inc/toolkit/hf_navi_sub.hxx b/autodoc/source/display/inc/toolkit/hf_navi_sub.hxx new file mode 100644 index 000000000000..0b02dba0d63d --- /dev/null +++ b/autodoc/source/display/inc/toolkit/hf_navi_sub.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hf_navi_sub.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_DISPLAY_HF_NAVI_SUB_HXX +#define ADC_DISPLAY_HFI_NAVI_SUB_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include "htmlfactory.hxx" + // PARAMETERS + + +class HF_NaviSubRow : public HtmlMaker +{ + public: + HF_NaviSubRow( + Xml::Element & o_rOut ); + virtual ~HF_NaviSubRow(); + + void AddItem( + const String & i_sText, + const String & i_sLink, + bool i_bSwitchOn ); + void SwitchOn( + int i_nIndex ); + void Produce_Row(); + + private: + typedef std::pair<String,String> SubRow_Data; + typedef std::pair<SubRow_Data,bool> SubRow_Item; + typedef std::vector<SubRow_Item> SubRow; + + /** Puts the row's table into the parent XML-element, but + doesn't write the items, because the actvity-status of + the subitems isn't known yet. + */ + void Setup_Row(); + + // DATA + SubRow aRow; + Xml::Element * pMyRow; +}; + + + + +// IMPLEMENTATION + + + + +#endif + + diff --git a/autodoc/source/display/inc/toolkit/hf_title.hxx b/autodoc/source/display/inc/toolkit/hf_title.hxx new file mode 100644 index 000000000000..2e47c31f3660 --- /dev/null +++ b/autodoc/source/display/inc/toolkit/hf_title.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hf_title.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_DISPLAY_HF_TITLE_HXX +#define ADC_DISPLAY_HF_TITLE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <toolkit/htmlfactory.hxx> + // COMPONENTS + // PARAMETERS + + +class HF_TitleTable : public HtmlMaker +{ + public: + HF_TitleTable( + Xml::Element & o_rOut ); + virtual ~HF_TitleTable(); + + void Produce_Title( + const char * i_title ); + void Produce_Title( + const char * i_annotations, +// const char * i_label, + const char * i_title ); + + /// @return a Html::TableCell reference. + Xml::Element & Add_Row(); +}; + + +class HF_SubTitleTable : public HtmlMaker +{ + public: + enum E_SubLevel + { + sublevel_1, /// Big title. + sublevel_2, /// Small title. + sublevel_3 /// No title. + }; + + /** @param i_nColumns [1 .. n] + @param i_nSubTitleLevel [1 .. 2] + 1 is a bit bigger than 2. + */ + + HF_SubTitleTable( + Xml::Element & o_rOut, + const String & i_label, + const String & i_title, + int i_nColumns, + E_SubLevel i_eSubTitleLevel = sublevel_1 ); + virtual ~HF_SubTitleTable(); + + /// @return an Html::TableRow reference. + Xml::Element & Add_Row(); +}; + + +// IMPLEMENTATION + + + +#endif diff --git a/autodoc/source/display/inc/toolkit/htmlfactory.hxx b/autodoc/source/display/inc/toolkit/htmlfactory.hxx new file mode 100644 index 000000000000..5a6108305e74 --- /dev/null +++ b/autodoc/source/display/inc/toolkit/htmlfactory.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: htmlfactory.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_HTMLFACTORY_HXX +#define ADC_DISPLAY_HTMLFACTORY_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include "outputstack.hxx" + // PARAMETERS +#include <udm/xml/xmlitem.hxx> +#include <udm/html/htmlitem.hxx> + +namespace Xml = ::csi::xml; +namespace Html = ::csi::html; + +/** @resp + Base class for HTML page creators (factories) for code entites or + similar items. +*/ +template <class ENV> +class HtmlFactory +{ + public: + // INQUIRY + ENV & Env() const { return *pEnv; } + Xml::Element & CurOut() const { return aDestination.Out(); } + + // ACCESS + OutputStack & Out() const { return aDestination; } + + protected: + HtmlFactory( + ENV & io_rEnv, + Xml::Element * o_pOut = 0 ) + : pEnv(&io_rEnv) { if (o_pOut != 0) aDestination.Enter(*o_pOut); } + ~HtmlFactory() {} + private: + // DATA + ENV * pEnv; + mutable OutputStack aDestination; +}; + + +/** @resp + Base class for HTML paragraph creators, which are to be put into + a parent HTML element. +*/ +class HtmlMaker +{ + public: + + // INQUIRY + Xml::Element & CurOut() const { return *pOut; } + + protected: + HtmlMaker( + Xml::Element & o_rOut ) + : pOut(&o_rOut) {} + private: + // DATA + Xml::Element * pOut; +}; + + + + +// IMPLEMENTATION + + + + +#endif + + diff --git a/autodoc/source/display/inc/toolkit/htmlfile.hxx b/autodoc/source/display/inc/toolkit/htmlfile.hxx new file mode 100644 index 000000000000..02a6ce9d1fd6 --- /dev/null +++ b/autodoc/source/display/inc/toolkit/htmlfile.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: htmlfile.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_DISPLAY_HTMLFILE_HXX +#define ADC_DISPLAY_HTMLFILE_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <udm/html/htmlitem.hxx> + // PARAMETERS +#include <cosv/ploc.hxx> + +namespace csv +{ + class File; +} + +/** Represents an HTML output file. +*/ +class DocuFile_Html +{ + public: + // LIFECYCLE + DocuFile_Html(); + + void SetLocation( + const csv::ploc::Path & + i_rFilePath ); + void SetTitle( + const char * i_sTitle ); + void SetRelativeCssPath( + const char * i_sCssFile_relativePath ); + void SetCopyright( + const char * i_sCopyright ); + void EmptyBody(); + + Html::Body & Body() { return aBodyData; } + bool CreateFile(); + + private: + void WriteHeader( + csv::File & io_aFile ); + void WriteBody( + csv::File & io_aFile ); + // DATA + String sFilePath; + String sTitle; + String sLocation; + String sStyle; + String sCssFile; + String sCopyright; + + Html::Body aBodyData; + StreamStr aBuffer; +}; + + + +#endif + + diff --git a/autodoc/source/display/inc/toolkit/out_node.hxx b/autodoc/source/display/inc/toolkit/out_node.hxx new file mode 100644 index 000000000000..bee41a5425ca --- /dev/null +++ b/autodoc/source/display/inc/toolkit/out_node.hxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: out_node.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_OUT_NODE_HXX +#define ADC_DISPLAY_OUT_NODE_HXX + + + + +namespace output +{ + + +/** @resp + Represents a tree of names where each node can have only one parent, + but a list of children. + + @see Position + @see Tree +*/ +class Node +{ + public: + typedef std::vector< Node* > List; + typedef UINT32 relative_id; + + // LIFECYCLE + enum E_NullObject { null_object }; + + Node(); + explicit Node( + E_NullObject ); + ~Node(); + + // OPERATORS + bool operator==( + const Node & i_node ) const + { return pParent == i_node.pParent AND sName == i_node.sName; } + bool operator!=( + const Node & i_node ) const + { return NOT operator==(i_node); } + + // OPERATIONS + /// Seek, and if not existent, create. + Node & Provide_Child( + const String & i_name ); + /// Seek, and if not existent, create. + Node & Provide_Child( + const StringVector & + i_path ) + { return provide_Child(i_path.begin(), i_path.end()); } + // INQUIRY + intt Depth() const { return nDepth; } + + const String & Name() const { return sName; } + /// @return Id of a namespace or class etc. this directory represents. + relative_id RelatedNameRoom() const { return nNameRoomId; } + /// @return No delimiter at start, with delimiter at end. + void Get_Path( + StreamStr & o_result, + intt i_maxDepth = -1 ) const; + void Get_Chain( + StringVector & o_result, + intt i_maxDepth = -1 ) const; + // ACCESS + void Set_RelatedNameRoom( + relative_id i_nNameRoomId ) + { nNameRoomId = i_nNameRoomId; } + Node * Parent() { return pParent; } + Node * Child( + const String & i_name ) + { return find_Child(i_name); } + List & Children() { return aChildren; } + + /// @return a reference to a Node with Depth() == -1. + static Node & Null_(); + + private: + // Local + Node( + const String & i_name, + Node & i_parent ); + + Node * find_Child( + const String & i_name ); + Node & add_Child( + const String & i_name ); + Node & provide_Child( + StringVector::const_iterator + i_next, + StringVector::const_iterator + i_end ); + // Data + String sName; + Node * pParent; + List aChildren; + intt nDepth; + relative_id nNameRoomId; +}; + + + + +} // namespace output +#endif diff --git a/autodoc/source/display/inc/toolkit/out_position.hxx b/autodoc/source/display/inc/toolkit/out_position.hxx new file mode 100644 index 000000000000..2426f37277a6 --- /dev/null +++ b/autodoc/source/display/inc/toolkit/out_position.hxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: out_position.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_DISPLAY_OUT_POSITION_HXX +#define ADC_DISPLAY_OUT_POSITION_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <toolkit/out_node.hxx> + // PARAMETERS + + + +namespace output +{ + + + +class Position +{ + public: + // LIFECYCLE + Position(); + explicit Position( + Node & i_directory, + const String & i_file = String::Null_() ); + Position( + const Position & i_directory, + const String & i_rDifferentFile ); + ~Position(); + + // OPERATIONS + Position & operator=( + Node & i_node ); + Position & operator+=( + const String & i_nodeName ); + Position & operator-=( + intt i_levels ); + + // INQUIRY + bool IsValid() const { return pDirectory->Depth() >= 0; } + const String & Name() const { return pDirectory->Name(); } + const String & File() const { return sFile; } + intt Depth() const { return pDirectory->Depth(); } + + void Get_Chain( + StringVector & o_result ) const + { pDirectory->Get_Chain(o_result); } + String LinkToRoot( + const String & i_localLabel = String::Null_() ) const; + + void Get_LinkTo( + StreamStr & o_result, + const Position & i_destination, + const String & i_localLabel = String::Null_() ) const; + void Get_LinkToRoot( + StreamStr & o_result, + const String & i_localLabel = String::Null_() ) const; + + static char Delimiter() { return '/'; } + + // ACCESS + Node & RelatedNode() const { return *pDirectory; } + + void Set( + Node & i_node, + const String & i_file = String::Null_() ); + void Set_File( + const String & i_file ); + + private: + // DATA + String sFile; + Node * pDirectory; +}; + + +/// @return No delimiter at start, with delimiter at end. +const char * get_UpLink( + uintt i_depth ); + + +// IMPLEMENTATION + +inline void +Position::Set_File( const String & i_file ) + { sFile = i_file; } + +} // namespace output + +#endif diff --git a/autodoc/source/display/inc/toolkit/out_tree.hxx b/autodoc/source/display/inc/toolkit/out_tree.hxx new file mode 100644 index 000000000000..79b7bffc43b4 --- /dev/null +++ b/autodoc/source/display/inc/toolkit/out_tree.hxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: out_tree.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_DISPLAY_OUT_TREE_HXX +#define ADC_DISPLAY_OUT_TREE_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include "out_position.hxx" + // PARAMETERS + + +namespace output +{ + +inline const char * +ModuleFileName() +{ return "module-ix.html"; } +inline const char * +IndexFilesDirName() +{ return "index-files"; } +inline const char * +IndexFile_A() +{ return "index-1.html"; } + + +class Tree +{ + public: + // LIFECYCLE + Tree(); + ~Tree(); + + // OPERATIONS + void Set_Overview( + const StringVector & + i_path, + const String & i_sFileName ); + Node & Set_NamesRoot( + const StringVector & + i_path ); + Node & Set_IndexRoot( + const StringVector & + i_path ); + Node & Set_ProjectsRoot( + const StringVector & + i_path ); + Node & Provide_Node( + const StringVector & + i_path ); + + // ACCESS + Node & RootNode() { return *pRoot; } + Node & NamesRootNode() { return *pNamesRoot; } + Node & IndexRootNode() { return *pIndexRoot; } + Node & ProjectsRootNode() { return *pProjectsRoot; } + + Position Root() { return Position(*pRoot); } + Position Overview() { return aOverview; } + Position NamesRoot() { return Position(*pNamesRoot); } + Position IndexRoot() { return Position(*pIndexRoot); } + Position ProjectsRoot() { return Position(*pProjectsRoot); } + + private: + // forbidden: + Tree(const Tree&); + Tree & operator=(const Tree&); + + // DATA + Dyn<Node> pRoot; + Node * pNamesRoot; + Node * pIndexRoot; + Node * pProjectsRoot; + Position aOverview; +}; + + +// IMPLEMENTATION + +inline Node & +Tree::Provide_Node( const StringVector & i_path ) + { return pRoot->Provide_Child(i_path); } + + +inline void +Tree::Set_Overview( const StringVector & i_path, + const String & i_sFileName ) + { aOverview.Set(Provide_Node(i_path), i_sFileName); } + +inline Node & +Tree::Set_NamesRoot( const StringVector & i_path ) + { pNamesRoot = &Provide_Node(i_path); + return *pNamesRoot; } + +inline Node & +Tree::Set_IndexRoot( const StringVector & i_path ) + { pIndexRoot = &Provide_Node(i_path); + return *pIndexRoot; } + +inline Node & +Tree::Set_ProjectsRoot( const StringVector & i_path ) + { pProjectsRoot = &Provide_Node(i_path); + return *pProjectsRoot; } + + + +} // namespace output + + +#endif diff --git a/autodoc/source/display/inc/toolkit/outputstack.hxx b/autodoc/source/display/inc/toolkit/outputstack.hxx new file mode 100644 index 000000000000..c98349e83f6e --- /dev/null +++ b/autodoc/source/display/inc/toolkit/outputstack.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: outputstack.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_DISPLAY_OUTPUTSTACK_HXX +#define ADC_DISPLAY_OUTPUTSTACK_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <estack.hxx> + // PARAMETERS +#include <udm/xml/xmlitem.hxx> + + +class OutputStack +{ + public: + // LIFECYCLE + OutputStack(); + ~OutputStack(); + + // OPERATIONS + void Enter( + csi::xml::Element & io_rDestination ); + void Leave(); + + // ACCESS + csi::xml::Element & Out() const; // CurOutputNode + + private: + EStack< csi::xml::Element * > + aCurDestination; // The front element is the currently used. + // The later ones are the parents. +}; + +inline csi::xml::Element & +OutputStack::Out() const +{ + csv_assert( aCurDestination.size() > 0 ); + return *aCurDestination.top(); +} + +// IMPLEMENTATION + + +#endif + + diff --git a/autodoc/source/display/kernel/displfct.cxx b/autodoc/source/display/kernel/displfct.cxx new file mode 100644 index 000000000000..7edcd3c4ac89 --- /dev/null +++ b/autodoc/source/display/kernel/displfct.cxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: displfct.cxx,v $ + * $Revision: 1.7 $ + * + * 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 "displfct.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <html/chd_udk2.hxx> +#include <idl/hi_display.hxx> +#include <cfrstd.hxx> + + +DYN DisplayToolsFactory * DisplayToolsFactory::dpTheInstance_ = 0; + + +namespace autodoc +{ + +DisplayToolsFactory_Ifc & +DisplayToolsFactory_Ifc::GetIt_() +{ + if ( DisplayToolsFactory::dpTheInstance_ == 0 ) + DisplayToolsFactory::dpTheInstance_ = new DisplayToolsFactory; + return *DisplayToolsFactory::dpTheInstance_; +} + +} // namespace autodoc + + +DisplayToolsFactory::DisplayToolsFactory() +{ +} + +DisplayToolsFactory::~DisplayToolsFactory() +{ +} + +// DYN autodoc::TextDisplay_FunctionList_Ifc * +// DisplayToolsFactory::Create_TextDisplay_FunctionList() const +// { +// return new CppTextDisplay_FunctionList; +// } + + +DYN autodoc::HtmlDisplay_UdkStd * +DisplayToolsFactory::Create_HtmlDisplay_UdkStd() const +{ + return new CppHtmlDisplay_Udk2; +} + +DYN autodoc::HtmlDisplay_Idl_Ifc * +DisplayToolsFactory::Create_HtmlDisplay_Idl() const +{ + return new HtmlDisplay_Idl; +} + +const display::CorporateFrame & +DisplayToolsFactory::Create_StdFrame() const +{ + static StdFrame aFrame; + return aFrame; +} + + diff --git a/autodoc/source/display/kernel/displfct.hxx b/autodoc/source/display/kernel/displfct.hxx new file mode 100644 index 000000000000..f668e9e49722 --- /dev/null +++ b/autodoc/source/display/kernel/displfct.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: displfct.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DISPLAY_DISPLFCT_HXX +#define ADC_DISPLAY_DISPLFCT_HXX + + +#include <autodoc/displaying.hxx> + + +/** Interface for parsing code of a programming language and + delivering the information into an Autodoc Repository. +**/ +class DisplayToolsFactory : public autodoc::DisplayToolsFactory_Ifc +{ + public: + DisplayToolsFactory(); + virtual ~DisplayToolsFactory(); + +// virtual DYN autodoc::TextDisplay_FunctionList_Ifc * +// Create_TextDisplay_FunctionList() const; + + virtual DYN autodoc::HtmlDisplay_UdkStd * + Create_HtmlDisplay_UdkStd() const; + virtual DYN autodoc::HtmlDisplay_Idl_Ifc * + Create_HtmlDisplay_Idl() const; + + virtual const display::CorporateFrame & + Create_StdFrame() const; + private: + static DYN DisplayToolsFactory * + dpTheInstance_; + + friend class autodoc::DisplayToolsFactory_Ifc; +}; + + +#endif + diff --git a/autodoc/source/display/kernel/makefile.mk b/autodoc/source/display/kernel/makefile.mk new file mode 100644 index 000000000000..5b96fd1995c1 --- /dev/null +++ b/autodoc/source/display/kernel/makefile.mk @@ -0,0 +1,59 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# 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=display_kernel +TARGETTYPE=CUI + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/displfct.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/display/toolkit/hf_docentry.cxx b/autodoc/source/display/toolkit/hf_docentry.cxx new file mode 100644 index 000000000000..ea2523351de0 --- /dev/null +++ b/autodoc/source/display/toolkit/hf_docentry.cxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hf_docentry.cxx,v $ + * $Revision: 1.6 $ + * + * 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 <toolkit/hf_docentry.hxx> + + +// NOT FULLY DEFINED SERVICES + + +HF_DocEntryList::HF_DocEntryList( Xml::Element & o_out ) + : HtmlMaker( o_out >>* new Html::DefList ) +{ +} + +HF_DocEntryList::~HF_DocEntryList() +{ +} + +Xml::Element & +HF_DocEntryList::Produce_Term(const char * i_sTerm ) +{ + Xml::Element & + ret = CurOut() + >> *new Html::DefListTerm + >> *new Html::Bold; + if ( NOT csv::no_str(i_sTerm)) + ret + << i_sTerm; + return ret; +} + +Xml::Element & +HF_DocEntryList::Produce_NormalTerm(const char * i_sTerm) +{ + Xml::Element & + ret = CurOut() + >> *new Html::DefListTerm; + if ( NOT csv::no_str(i_sTerm)) + ret + << i_sTerm; + return ret; +} + +Xml::Element & +HF_DocEntryList::Produce_Definition() +{ + return CurOut() + >> *new Html::DefListDefinition; +} diff --git a/autodoc/source/display/toolkit/hf_funcdecl.cxx b/autodoc/source/display/toolkit/hf_funcdecl.cxx new file mode 100644 index 000000000000..821af499ec04 --- /dev/null +++ b/autodoc/source/display/toolkit/hf_funcdecl.cxx @@ -0,0 +1,206 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hf_funcdecl.cxx,v $ + * $Revision: 1.8 $ + * + * 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 <toolkit/hf_funcdecl.hxx> + + +// NOT FULLY DEFINED SERVICES + +const String C_sValignTop("top"); +const String C_sValignBottom("bottom"); + + + +HF_FunctionDeclaration::HF_FunctionDeclaration( Xml::Element & o_rParent, + const String & i_sRaisesText ) + : HtmlMaker(o_rParent), + sRaisesText(i_sRaisesText), + pTable(0), + pReturnCell(0), + pNameCell(0), + pParameterLine(0), + pLastParameterCell(0), + pExceptionCell(0) +{ + pTable = new Html::Table; + CurOut() + >> *pTable + << new Html::ClassAttr("table-in-method") + << new Xml::AnAttribute("border","0"); +} + +HF_FunctionDeclaration::~HF_FunctionDeclaration() +{ +} + +Xml::Element & +HF_FunctionDeclaration::ReturnCell() +{ + if (pReturnCell != 0) + return *pReturnCell; + + pReturnCell = &( *pTable + >> *new Html::TableRow + >> *new Html::TableCell + << new Html::VAlignAttr(C_sValignTop) + << new Xml::AnAttribute("colspan", "3") + ); + return *pReturnCell; +} + +Xml::Element & +HF_FunctionDeclaration::NameCell() +{ + if (pNameCell != 0) + return *pNameCell; + + pNameCell = &( ParameterLine() + >> *new Html::TableCell + << new Html::VAlignAttr(C_sValignTop) + ); + pLastParameterCell = pNameCell; + + return *pNameCell; +} + +Xml::Element & +HF_FunctionDeclaration::NewParamTypeCell() +{ + if (pLastParameterCell != pNameCell) + { + pParameterLine = 0; + ParameterLine() + >> *new Html::TableCell; + } + + Xml::Element & + rParamType = ParameterLine() + >> *new Html::TableCell + << new Html::VAlignAttr(C_sValignTop); + pLastParameterCell + = &( ParameterLine() + >> *new Html::TableCell + << new Html::VAlignAttr(C_sValignBottom) + << new Xml::XmlCode(" ") + ); + return rParamType; +} + +Xml::Element & +HF_FunctionDeclaration::ParamNameCell() +{ + csv_assert(pLastParameterCell != pNameCell); + return *pLastParameterCell; +} + +Xml::Element & +HF_FunctionDeclaration::ExceptionCell() +{ + if (pExceptionCell != 0) + return *pExceptionCell; + + Xml::Element & + rExceptionRow = *pTable + >> *new Html::TableRow; + rExceptionRow + >> *new Html::TableCell + << new Html::VAlignAttr(C_sValignTop) + << new Xml::AnAttribute("align", "right") + << sRaisesText + << "( "; + + pExceptionCell = &( rExceptionRow + >> *new Html::TableCell + << new Html::VAlignAttr(C_sValignTop) + << new Xml::AnAttribute("colspan", "2") + ); + return *pExceptionCell; +} + +Html::TableRow & +HF_FunctionDeclaration::ParameterLine() +{ + if (pParameterLine != 0) + return *pParameterLine; + + pParameterLine = new Html::TableRow; + *pTable + >> *pParameterLine; + + return *pParameterLine; +} + + +#if 0 // old +HF_FunctionDeclaration::HF_FunctionDeclaration( Xml::Element & o_rParent ) + : HtmlMaker(o_rParent), + pFront(0), + pTypes(0), + pNames(0) +{ + Xml::Element & + rRow = CurOut() + >> *new Html::Table + << new Xml::AnAttribute("border","0") + >> *new Html::TableRow; + pFront = &(rRow >> *new Html::TableCell << new Html::VAlignAttr(C_sValignTop)); + pTypes = &(rRow >> *new Html::TableCell << new Html::VAlignAttr(C_sValignTop)); + pNames = &(rRow >> *new Html::TableCell << new Html::VAlignAttr(C_sValignTop)); +} + +HF_FunctionDeclaration::~HF_FunctionDeclaration() +{ +} + +Xml::Element & +HF_FunctionDeclaration::Add_ReturnLine() +{ + (*pTypes) << new Xml::XmlCode(" <br>\n"); + (*pNames) << new Xml::XmlCode(" <br>\n"); + return *pFront; +} + +Xml::Element & +HF_FunctionDeclaration::Add_RaisesLine( const char * i_sRaisesText, + bool i_bSuppressExtraLine ) +{ + if (NOT i_bSuppressExtraLine) + { + (*pTypes) << new Xml::XmlCode(" <br>"); + (*pNames) << new Xml::XmlCode(" <br>\n"); + } + (*pTypes) + << new Xml::XmlCode("<p class=\"raise\">") + << i_sRaisesText + << new Xml::XmlCode("( </p>\n"); + return *pNames; +} +#endif // 0 old diff --git a/autodoc/source/display/toolkit/hf_linachain.cxx b/autodoc/source/display/toolkit/hf_linachain.cxx new file mode 100644 index 000000000000..5bb7b6b8dd96 --- /dev/null +++ b/autodoc/source/display/toolkit/hf_linachain.cxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hf_linachain.cxx,v $ + * $Revision: 1.6 $ + * + * 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 <toolkit/hf_linachain.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <toolkit/out_position.hxx> + + + +HF_LinkedNameChain::HF_LinkedNameChain( Xml::Element & o_rOut ) + : HtmlMaker( o_rOut + >> *new Html::Paragraph + << new Html::ClassAttr("namechain") ) +{ +} + +HF_LinkedNameChain::~HF_LinkedNameChain() +{ +} + +void +HF_LinkedNameChain::Produce_CompleteChain( const output::Position & i_curPosition, + F_LinkMaker i_linkMaker ) const +{ + produce_Level(i_curPosition.RelatedNode(), i_curPosition, i_linkMaker); +} + +void +HF_LinkedNameChain::Produce_CompleteChain_forModule( const output::Position & i_curPosition, + F_LinkMaker i_linkMaker ) const +{ + if (i_curPosition.Depth() == 0) + return; + produce_Level(*i_curPosition.RelatedNode().Parent(), i_curPosition, i_linkMaker); +} + + + +namespace +{ + +StreamStr aLinkBuf(200); + +} + +void +HF_LinkedNameChain::produce_Level( output::Node & i_levelNode, + const output::Position & i_startPosition, + F_LinkMaker i_linkMaker ) const +{ + if ( i_levelNode.Depth() > 0 ) + { + produce_Level( *i_levelNode.Parent(), + i_startPosition, + i_linkMaker ); + } + + aLinkBuf.reset(); + + String + sFileName = (*i_linkMaker)(i_levelNode.Name()); + output::Position + aLevelPos(i_levelNode, sFileName); + + i_startPosition.Get_LinkTo(aLinkBuf, aLevelPos); + + if ( i_levelNode.Depth() > 0 ) + { + CurOut() + >> *new Html::Link(aLinkBuf.c_str()) + << new Html::ClassAttr("namechain") + << i_levelNode.Name(); + CurOut() << " :: "; + } + else + { + CurOut() + >> *new Html::Link(aLinkBuf.c_str()) + << new Html::ClassAttr("namechain") + << "::"; + CurOut() << " "; + } +} diff --git a/autodoc/source/display/toolkit/hf_navi_main.cxx b/autodoc/source/display/toolkit/hf_navi_main.cxx new file mode 100644 index 000000000000..659db61f91b9 --- /dev/null +++ b/autodoc/source/display/toolkit/hf_navi_main.cxx @@ -0,0 +1,241 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hf_navi_main.cxx,v $ + * $Revision: 1.7 $ + * + * 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 <toolkit/hf_navi_main.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> + + + +//******************** MainItem and derived ones ***************// +class HF_MainItem : public HtmlMaker +{ + public: + virtual ~HF_MainItem() {} + void Produce_Item() const { do_ProduceItem(); } + protected: + HF_MainItem( + Xml::Element & o_out ) + : HtmlMaker(o_out) {} + private: + virtual void do_ProduceItem() const = 0; +}; + + +namespace +{ + +class StdItem : public HF_MainItem +{ + public: + StdItem( + Xml::Element & o_out, + const char * i_sText, + const char * i_sLink ); + + ~StdItem(); + private: + virtual void do_ProduceItem() const; + + // DATA + String sText; + String sLink; +}; + +class SelfItem : public HF_MainItem +{ + public: + SelfItem( + Xml::Element & o_out, + const char * i_sText ); + ~SelfItem(); + private: + virtual void do_ProduceItem() const; + + // DATA + String sText; +}; + +class NoneItem : public HF_MainItem +{ + public: + NoneItem( + Xml::Element & o_out, + const char * i_sText ); + ~NoneItem(); + private: + virtual void do_ProduceItem() const; + + // DATA + String sText; +}; + +} // anonymous namespace + + + +//******************** HF_NaviMainRow ***************// + + + +HF_NaviMainRow::HF_NaviMainRow( Xml::Element & o_out ) + : HtmlMaker(o_out), + aItems(), + pRow(0) +{ + aItems.reserve(5); + + pRow = + &( CurOut() + >> *new Html::Table + << new Html::ClassAttr("navimain") + << new Xml::AnAttribute( "border", "0" ) + << new Xml::AnAttribute( "cellpadding", "3" ) + >> *new Html::TableRow + ); +} + +HF_NaviMainRow::~HF_NaviMainRow() +{ + csv::erase_container_of_heap_ptrs(aItems); +} + +void +HF_NaviMainRow::Add_StdItem( const char * i_sText, + const char * i_sLink ) +{ + aItems.push_back(new StdItem( *pRow,i_sText,i_sLink )); +} + +void +HF_NaviMainRow::Add_SelfItem( const char * i_sText ) +{ + aItems.push_back(new SelfItem( *pRow,i_sText )); +} + +void +HF_NaviMainRow::Add_NoneItem( const char * i_sText ) +{ + aItems.push_back(new NoneItem( *pRow,i_sText )); +} + +void +HF_NaviMainRow::Produce_Row() +{ + ItemList::iterator itEnd = aItems.end(); + for ( ItemList::iterator iter = aItems.begin(); + iter != itEnd; + ++iter ) + { + (*iter)->Produce_Item(); + } +} + + + + +//******************** MainItem and derived ones ***************// + +namespace +{ + +StdItem::StdItem( Xml::Element & o_out, + const char * i_sText, + const char * i_sLink ) + : HF_MainItem(o_out), + sText(i_sText), + sLink(i_sLink) +{ +} + +StdItem::~StdItem() +{ +} + +void +StdItem::do_ProduceItem() const +{ + Xml::Element & + rCell = CurOut() >>* new Html::TableCell; + rCell + << new Html::ClassAttr( "navimain" ) + >> *new Html::Link(sLink.c_str()) + << new Html::ClassAttr( "navimain" ) + << sText.c_str(); +} + +SelfItem::SelfItem( Xml::Element & o_out, + const char * i_sText ) + : HF_MainItem(o_out), + sText(i_sText) +{ +} + +SelfItem::~SelfItem() +{ +} + +void +SelfItem::do_ProduceItem() const +{ + Xml::Element & + rCell = CurOut() >>* new Html::TableCell; + rCell + << new Html::ClassAttr( "navimainself" ) + << sText.c_str(); +} + +NoneItem::NoneItem( Xml::Element & o_out, + const char * i_sText ) + : HF_MainItem(o_out), + sText(i_sText) +{ +} + +NoneItem::~NoneItem() +{ +} + +void +NoneItem::do_ProduceItem() const +{ + Xml::Element & + rCell = CurOut() >>* new Html::TableCell; + rCell + << new Html::ClassAttr( "navimainnone" ) + << sText.c_str(); +} + +} // anonymous namespace + + diff --git a/autodoc/source/display/toolkit/hf_navi_sub.cxx b/autodoc/source/display/toolkit/hf_navi_sub.cxx new file mode 100644 index 000000000000..40d97cc37f35 --- /dev/null +++ b/autodoc/source/display/toolkit/hf_navi_sub.cxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hf_navi_sub.cxx,v $ + * $Revision: 1.7 $ + * + * 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 <toolkit/hf_navi_sub.hxx> + + +// NOT FULLY DEFINED SERVICES + + +HF_NaviSubRow::HF_NaviSubRow( Xml::Element & o_rOut ) + : HtmlMaker(o_rOut), + aRow(), + pMyRow(0) +{ + Setup_Row(); +} + +HF_NaviSubRow::~HF_NaviSubRow() +{ +} + +void +HF_NaviSubRow::AddItem( const String & i_sText, + const String & i_sLink, + bool i_bSwitchOn ) +{ + aRow.push_back( SubRow_Item( SubRow_Data(i_sText,i_sLink), + i_bSwitchOn )); +} + +void +HF_NaviSubRow::SwitchOn( int i_nIndex ) +{ + if ( i_nIndex < int(aRow.size()) ) + aRow[i_nIndex].second = true; +} + +void +HF_NaviSubRow::Setup_Row() +{ + Html::Table * + pTable = new Html::Table; + CurOut() + >> *pTable + << new Html::ClassAttr("navisub") + << new Xml::AnAttribute( "border", "0" ) + << new Xml::AnAttribute( "cellpadding", "0" ); + pMyRow = &pTable->AddRow(); +} + +void +HF_NaviSubRow::Produce_Row() +{ + for ( SubRow::const_iterator it = aRow.begin(); + it != aRow.end(); + ++it ) + { + Xml::Element & + rCell = *pMyRow + >> *new Html::TableCell + << new Html::ClassAttr("navisub"); + StreamLock sl(100); + Xml::Element & + rGoon = (*it).second + ? ( rCell + >> *new Html::Link( sl() + << "#" + << (*it).first.second + << c_str ) + << new Html::ClassAttr("navisub") + ) + : rCell; + rGoon + << (*it).first.first; + } +} + + diff --git a/autodoc/source/display/toolkit/hf_title.cxx b/autodoc/source/display/toolkit/hf_title.cxx new file mode 100644 index 000000000000..6f63da2a5c25 --- /dev/null +++ b/autodoc/source/display/toolkit/hf_title.cxx @@ -0,0 +1,172 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hf_title.cxx,v $ + * $Revision: 1.9 $ + * + * 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 <toolkit/hf_title.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <stdlib.h> + + +const String C_sTitleBorder("0"); +const String C_sTitleWidth("100%"); +const String C_sTitlePadding("5"); +const String C_sTitleSpacing("3"); + +const String C_sSubTitleBorder("1"); +const String C_sSubTitleWidth("100%"); +const String C_sSubTitlePadding("5"); +const String C_sSubTitleSpacing("0"); +const String C_sColSpan("colspan"); + + +HF_TitleTable::HF_TitleTable( Xml::Element & o_rOut ) + : HtmlMaker(o_rOut >> *new Html::Table( C_sTitleBorder, + C_sTitleWidth, + C_sTitlePadding, + C_sTitleSpacing ) + << new Html::ClassAttr("title-table") + << new Html::StyleAttr("margin-bottom:6pt;") ) +{ +} + +HF_TitleTable::~HF_TitleTable() +{ +} + +void +HF_TitleTable::Produce_Title( const char * i_title ) +{ + Add_Row() + << new Html::ClassAttr("title") + << i_title; +} + +void +HF_TitleTable::Produce_Title( const char * i_annotations, + const char * i_title ) +{ + if (csv::no_str(i_annotations)) + { + Produce_Title(i_title); + return; + } + + Xml::Element & + rRow = Add_Row(); + rRow + << new Html::ClassAttr("title"); + + Xml::Element & + rTable = rRow + >> *new Html::Table() + << new Html::ClassAttr("title-table") + << new Html::WidthAttr("99%"); + Xml::Element & + rInnerRow = rTable + >> *new Html::TableRow; + rInnerRow + >> *new Html::TableCell + << new Html::WidthAttr("25%") + << new Html::ClassAttr("title2") + << i_annotations; + rInnerRow + >> *new Html::TableCell + << new Html::WidthAttr("50%") + << new Html::ClassAttr("title") + << i_title; + rInnerRow + >> *new Html::TableCell + << new Html::WidthAttr("*"); +} + +Xml::Element & +HF_TitleTable::Add_Row() +{ + return CurOut() + >> *new Html::TableRow + >> *new Html::TableCell; +} + + +inline const char * +get_SubTitleCssClass(HF_SubTitleTable::E_SubLevel i_eSubTitleLevel) +{ + return i_eSubTitleLevel == HF_SubTitleTable::sublevel_1 + ? "subtitle" + : "crosstitle"; +} + + +HF_SubTitleTable::HF_SubTitleTable( Xml::Element & o_rOut, + const String & i_label, + const String & i_title, + int i_nColumns, + E_SubLevel i_eSubTitleLevel ) + : HtmlMaker( o_rOut + << new Html::Label(i_label) + >> *new Html::Table( C_sSubTitleBorder, + C_sSubTitleWidth, + C_sSubTitlePadding, + C_sSubTitleSpacing ) + << new Html::ClassAttr(get_SubTitleCssClass(i_eSubTitleLevel)) ) +{ + csv_assert(i_nColumns > 0); + + if (i_eSubTitleLevel == sublevel_3) + return; + + Xml::Element & + rCell = CurOut() + >> *new Html::TableRow + >> *new Html::TableCell + << new Html::ClassAttr(get_SubTitleCssClass(i_eSubTitleLevel)) ; + + if (i_nColumns > 1) + { + StreamLock sl(20); + String sColumns = sl() << i_nColumns << c_str; + rCell + << new Xml::AnAttribute(C_sColSpan, sColumns); + } + rCell + << i_title; +} + +HF_SubTitleTable::~HF_SubTitleTable() +{ +} + +Xml::Element & +HF_SubTitleTable::Add_Row() +{ + return CurOut() >> *new Html::TableRow; +} diff --git a/autodoc/source/display/toolkit/htmlfile.cxx b/autodoc/source/display/toolkit/htmlfile.cxx new file mode 100644 index 000000000000..c0a33d098849 --- /dev/null +++ b/autodoc/source/display/toolkit/htmlfile.cxx @@ -0,0 +1,214 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: htmlfile.cxx,v $ + * $Revision: 1.9 $ + * + * 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 <toolkit/htmlfile.hxx> + +// NOT FULLY DECLARED SERVICES +#include <cosv/file.hxx> +#include <udm/html/htmlitem.hxx> + +namespace +{ +bool bUse_OOoFrameDiv = true; +const String C_sOOoFrameDiv_IdlId("adc-idlref"); +} + +using namespace csi; +using csi::xml::AnAttribute; + +DocuFile_Html::DocuFile_Html() + : sFilePath(), + sTitle(), + sLocation(), + sStyle(), + sCssFile(), + sCopyright(), + aBodyData(), + aBuffer(60000) // Grows dynamically, when necessary. +{ +} + +void +DocuFile_Html::SetLocation( const csv::ploc::Path & i_rFilePath ) +{ + StreamLock sPath(1000); + i_rFilePath.Get( sPath() ); + + sFilePath = sPath().c_str(); +} + +void +DocuFile_Html::SetTitle( const char * i_sTitle ) +{ + sTitle = i_sTitle; +} + +void +DocuFile_Html::SetRelativeCssPath( const char * i_sCssFile_relativePath ) +{ + sCssFile = i_sCssFile_relativePath; +} + +void +DocuFile_Html::SetCopyright( const char * i_sCopyright ) +{ + sCopyright = i_sCopyright; +} + +void +DocuFile_Html::EmptyBody() +{ + aBodyData.SetContent(0); + + if (bUse_OOoFrameDiv) + { + // Insert <div> tag to allow better formatting for OOo. + aBodyData + << new xml::XmlCode("<div id=\"") + << new xml::XmlCode(C_sOOoFrameDiv_IdlId) + << new xml::XmlCode("\">\n\n"); + } + + aBodyData + >> *new html::Label( "_top_" ) + << " "; +} + +bool +DocuFile_Html::CreateFile() +{ + csv::File aFile(sFilePath, csv::CFM_CREATE); + if (NOT aFile.open()) + { + Cerr() << "Can't create file " << sFilePath << "." << Endl(); + return false; + } + + WriteHeader(aFile); + WriteBody(aFile); + + // Write end + static const char sCompletion[] = "\n</html>\n"; + aFile.write( sCompletion ); + + aFile.close(); + Cout() << '.' << Flush(); + return true; +} + + +void +DocuFile_Html::WriteHeader( csv::File & io_aFile ) +{ + aBuffer.reset(); + + static const char s1[] = + "<html>\n<head>\n<title>"; + static const char s2[] = + "</title>\n" + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n"; + + aBuffer.write( s1 ); + aBuffer.write( sTitle ); + aBuffer.write( s2 ); + + + if (NOT sCssFile.empty()) + { + static const char s3[] = + "<link rel=\"stylesheet\" type=\"text/css\" href=\""; + static const char s4[] = + "\">\n"; + + aBuffer.write(s3); + aBuffer.write(sCssFile); + aBuffer.write(s4); + } + + if (NOT sStyle.empty()) + { + static const char s5[] = + "<style>"; + static const char s6[] = + "</style>\n"; + + aBuffer.write(s5); + aBuffer.write(sStyle); + aBuffer.write(s6); + } + + static const char s7[] = + "</head>\n"; + aBuffer.write(s7); + + io_aFile.write(aBuffer.c_str(), aBuffer.size()); +} + +void +DocuFile_Html::WriteBody( csv::File & io_aFile ) +{ + aBuffer.reset(); + + aBodyData + >> *new html::Link( "#_top_" ) + << "Top of Page"; + + if ( sCopyright.length() > 0 ) + { + aBodyData + << new xml::XmlCode("<hr size=\"3\">"); + + aBodyData + >> *new html::Paragraph + << new html::ClassAttr( "copyright" ) + << new xml::AnAttribute( "align", "center" ) + << new xml::XmlCode(sCopyright); + } + + if (bUse_OOoFrameDiv) + { + // Insert <div> tag to allow better formatting for OOo. + aBodyData + << new xml::XmlCode("\n</div> <!-- id=\"") + << new xml::XmlCode(C_sOOoFrameDiv_IdlId) + << new xml::XmlCode("\" -->\n"); + } + + aBodyData.WriteOut(aBuffer); + io_aFile.write(aBuffer.c_str(), aBuffer.size()); +} + + + + + + + diff --git a/autodoc/source/display/toolkit/makefile.mk b/autodoc/source/display/toolkit/makefile.mk new file mode 100644 index 000000000000..b7651cc70729 --- /dev/null +++ b/autodoc/source/display/toolkit/makefile.mk @@ -0,0 +1,68 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# 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=display_toolkit + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/hf_docentry.obj \ + $(OBJ)$/hf_funcdecl.obj \ + $(OBJ)$/hf_linachain.obj \ + $(OBJ)$/hf_navi_main.obj \ + $(OBJ)$/hf_navi_sub.obj \ + $(OBJ)$/hf_title.obj \ + $(OBJ)$/htmlfile.obj \ + $(OBJ)$/out_node.obj \ + $(OBJ)$/out_position.obj \ + $(OBJ)$/out_tree.obj \ + $(OBJ)$/outputstack.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/display/toolkit/out_node.cxx b/autodoc/source/display/toolkit/out_node.cxx new file mode 100644 index 000000000000..bc45f51a01e1 --- /dev/null +++ b/autodoc/source/display/toolkit/out_node.cxx @@ -0,0 +1,192 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: out_node.cxx,v $ + * $Revision: 1.7 $ + * + * 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 <toolkit/out_node.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <algorithm> + + +namespace output +{ + + +namespace +{ + +struct Less_NodePtr +{ + bool operator()( + Node * p1, + Node * p2 ) const + { return p1->Name() < p2->Name(); } +}; + +struct Less_NodePtr C_Less_NodePtr; + + +Node C_aNullNode(Node::null_object); + + +} // namepace anonymous + + +//********************** Node ***************************// + + +Node::Node() + : sName(), + pParent(0), + aChildren(), + nDepth(0), + nNameRoomId(0) +{ +} + +Node::Node( E_NullObject ) + : sName(), + pParent(0), + aChildren(), + nDepth(-1), + nNameRoomId(0) +{ +} + +Node::Node( const String & i_name, + Node & i_parent ) + : sName(i_name), + pParent(&i_parent), + aChildren(), + nDepth(i_parent.Depth()+1), + nNameRoomId(0) +{ +} + +Node::~Node() +{ + for ( List::iterator it = aChildren.begin(); + it != aChildren.end(); + ++it ) + { + delete *it; + } +} + +Node & +Node::Provide_Child( const String & i_name ) +{ + Node * + ret = find_Child(i_name); + if (ret != 0) + return *ret; + return add_Child(i_name); +} + +void +Node::Get_Path( StreamStr & o_result, + intt i_maxDepth ) const +{ + // Intentionally 'i_maxDepth != 0', so max_Depth == -1 sets no limit: + if (i_maxDepth != 0) + { + if (pParent != 0) + pParent->Get_Path(o_result, i_maxDepth-1); + o_result << sName << '/'; + } +} + +void +Node::Get_Chain( StringVector & o_result, + intt i_maxDepth ) const +{ + if (i_maxDepth != 0) + { + // This is called also for the toplevel Node, + // but there happens nothing: + if (pParent != 0) + { + pParent->Get_Chain(o_result, i_maxDepth-1); + o_result.push_back(sName); + } + } +} + +Node * +Node::find_Child( const String & i_name ) +{ + Node aSearch; + aSearch.sName = i_name; + + List::const_iterator + ret = std::lower_bound( aChildren.begin(), + aChildren.end(), + &aSearch, + C_Less_NodePtr ); + if ( ret != aChildren.end() ? (*ret)->Name() == i_name : false ) + return *ret; + + return 0; +} + +Node & +Node::add_Child( const String & i_name ) +{ + DYN Node * + pNew = new Node(i_name,*this); + aChildren.insert( std::lower_bound( aChildren.begin(), + aChildren.end(), + pNew, + C_Less_NodePtr ), + pNew ); + return *pNew; +} + +Node & +Node::provide_Child( StringVector::const_iterator i_next, + StringVector::const_iterator i_end ) +{ + if (i_next == i_end) + return *this; + return Provide_Child(*i_next).provide_Child(i_next+1,i_end); +} + + + + +Node & +Node::Null_() +{ + return C_aNullNode; +} + + +} // namespace output diff --git a/autodoc/source/display/toolkit/out_position.cxx b/autodoc/source/display/toolkit/out_position.cxx new file mode 100644 index 000000000000..13c5596e5f7e --- /dev/null +++ b/autodoc/source/display/toolkit/out_position.cxx @@ -0,0 +1,242 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: out_position.cxx,v $ + * $Revision: 1.9 $ + * + * 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 <toolkit/out_position.hxx> + + +// NOT FULLY DEFINED SERVICES + + + +namespace output +{ + + + +namespace +{ + +const int C_nAssumedMaxLinkLength = 500; + +void move_ToParent( + Node * & io_node, + intt i_levels = 1 ); + +void +move_ToParent( Node * & io_node, + intt i_levels ) +{ + for ( intt n = 0; n < i_levels; ++n ) + { + csv_assert(io_node != 0); + io_node = io_node->Parent(); + } +} + + + +} // namepace anonymous + + + +Position::Position() + : sFile(), + pDirectory(&Node::Null_()) +{ +} + + +Position::Position( Node & i_directory, + const String & i_file ) + : sFile(i_file), + pDirectory(&i_directory) +{ +} + +Position::Position( const Position & i_directory, + const String & i_sDifferentFile ) + : sFile(i_sDifferentFile), + pDirectory(i_directory.pDirectory) +{ +} + + +Position::~Position() +{ +} + + +Position & +Position::operator=( Node & i_node ) +{ + pDirectory = &i_node; + sFile.clear(); + return *this; +} + +Position & +Position::operator+=( const String & i_nodeName ) +{ + csv_assert(pDirectory != 0); + + pDirectory = &pDirectory->Provide_Child(i_nodeName); + sFile.clear(); + + return *this; +} + +Position & +Position::operator-=( intt i_levels ) +{ + csv_assert(pDirectory != 0); + + for ( intt i = i_levels; i > 0; --i ) + { + pDirectory = pDirectory->Parent(); + if (pDirectory == 0) + { + pDirectory = &Node::Null_(); + i = 0; + } + } + sFile.clear(); + + return *this; +} + +String +Position::LinkToRoot( const String & ) const +{ + StreamLock sl(C_nAssumedMaxLinkLength); + return sl() << get_UpLink(Depth()) << c_str; +} + +void +Position::Get_LinkTo( StreamStr & o_result, + const Position & i_destination, + const String & i_localLabel ) const +{ + Node * p1 = pDirectory; + Node * p2 = i_destination.pDirectory; + + intt diff = Depth() - i_destination.Depth(); + intt pathLength1 = 0; + intt pathLength2 = 0; + + if ( diff > 0 ) + { + pathLength1 = diff; + move_ToParent(p1,pathLength1); + } + else if ( diff < 0 ) + { + pathLength2 = -diff; + move_ToParent(p2,pathLength2); + } + + while ( p1 != p2 ) + { + move_ToParent(p1); + move_ToParent(p2); + ++pathLength1; + ++pathLength2; + } + + o_result << get_UpLink(pathLength1); + i_destination.pDirectory->Get_Path(o_result, pathLength2); + o_result << i_destination.sFile; + if (i_localLabel.length()) + o_result << "#" << i_localLabel; +} + +void +Position::Get_LinkToRoot( StreamStr & o_result, + const String & ) const +{ + o_result << get_UpLink(Depth()); +} + +void +Position::Set( Node & i_node, + const String & i_file ) +{ + sFile = i_file; + pDirectory = &i_node; +} + + + + +const char * +get_UpLink(uintt i_depth) +{ + static const uintt + C_nMaxDepth = 30; + static const char + C_sUpLinkArray[3*C_nMaxDepth+1] = + "../../../../../../../../../../" + "../../../../../../../../../../" + "../../../../../../../../../../"; + static const char * + C_sUpLink = &C_sUpLinkArray[0]; + + if ( i_depth <= C_nMaxDepth ) + { + return C_sUpLink + 3*(C_nMaxDepth - i_depth); + } + else + { // not THREAD fast + static std::vector<char> + aRet; + uintt nNeededSize = i_depth * 3 + 1; + + if (aRet.size() < nNeededSize) + { + aRet.resize(nNeededSize); + char * pEnd = &aRet[nNeededSize-1]; + *pEnd = '\0'; + + for ( char * pFill = &(*aRet.begin()); + pFill != pEnd; + pFill += 3 ) + { + memcpy(pFill, C_sUpLink, 3); + } + } // end if + + return &aRet[aRet.size() - 1 - 3*i_depth]; + } +} + + + + +} // namespace output diff --git a/autodoc/source/display/toolkit/out_tree.cxx b/autodoc/source/display/toolkit/out_tree.cxx new file mode 100644 index 000000000000..079e54be7963 --- /dev/null +++ b/autodoc/source/display/toolkit/out_tree.cxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: out_tree.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <toolkit/out_tree.hxx> + + +// NOT FULLY DEFINED SERVICES + + +namespace output +{ + +Tree::Tree() + : pRoot(new Node), + pNamesRoot(pRoot.Ptr()), + pIndexRoot(pRoot.Ptr()), + pProjectsRoot(pRoot.Ptr()), + aOverview() +{ +} + +Tree::~Tree() +{ +} + + + +} // namespace output diff --git a/autodoc/source/display/toolkit/outputstack.cxx b/autodoc/source/display/toolkit/outputstack.cxx new file mode 100644 index 000000000000..60a40c167143 --- /dev/null +++ b/autodoc/source/display/toolkit/outputstack.cxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: outputstack.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <toolkit/outputstack.hxx> + + +// NOT FULLY DEFINED SERVICES + + + +OutputStack::OutputStack() +{ +} + +OutputStack::~OutputStack() +{ +} + +void +OutputStack::Enter( csi::xml::Element & io_rDestination ) +{ + aCurDestination.push(&io_rDestination); +} + +void +OutputStack::Leave() +{ + csv_assert( NOT aCurDestination.empty() ); + aCurDestination.pop(); +} + + + diff --git a/autodoc/source/exes/adc_uni/adc_cl.cxx b/autodoc/source/exes/adc_uni/adc_cl.cxx new file mode 100644 index 000000000000..ca7255194516 --- /dev/null +++ b/autodoc/source/exes/adc_uni/adc_cl.cxx @@ -0,0 +1,571 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_cl.cxx,v $ + * $Revision: 1.14 $ + * + * 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 <adc_cl.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <algorithm> +#include <cosv/x.hxx> +#include <cosv/file.hxx> +#include <cosv/tpl/tpltools.hxx> +#include <ary/ary.hxx> +#include <tools/tkpchars.hxx> +#include <adc_msg.hxx> +#include "adc_cmds.hxx" +#include "adc_cmd_parse.hxx" +#include "cmd_sincedata.hxx" + + +namespace autodoc +{ + +CommandLine * CommandLine::pTheInstance_ = 0; + +const char * const C_sUserGuide = +"\n\n\n" +" General Use of Autodoc\n" +" ----------------------\n" +"\n" +" Example for C++:\n" +"\n" +" -html <OutputDirectory> -name \"UDK 3.x anything\" -lg c++\n" +" -p <ProjName> <ProjectRootDirectory>\n" +" -t <SourceDir_relativeToProjectRoot>\n" +"\n" +" There may be several projects specified by -p.\n" +"\n" +"\n" +" Example for IDL:\n" +"\n" +" -html <OutputDirectory> -name \"UDK 3.x anything\" -lg idl\n" +" -t <SourceDir1> <SourceDir2>\n" +"\n" +" For both languages, instead of or in addition to -t may be\n" +" used -d (no subdirectories) or -f (just one file). There can\n" +" be multiple arguments after each of these options (-t -d -f).\n" +"\n" +"\n" +" Replacing @since Tag Content\n" +" ----------------------------\n" +"\n" +" In both languages you can give a transformation file to replace\n" +" entries in @since tags by different entries.\n" +" This file is given by the option\n" +" -sincefile <TransformationFilePath>\n" +" This option has to appear between the -html and the -lg option.\n" +" Example:\n" +" -html <OutputDirectory> -sincefile replacesince.txt\n" +" -name \"UDK 3.x anything\" -lg idl -t <SourceDir>\n" +"\n" +"\n"; + + +#if 0 // FUTURE +"\n\n\n" +" Use of Autodoc\n" +" --------------\n" +"\n" +" Basics:\n" +"\n" +" Autodoc may perform different tasks.\n" +"\n" +" Possible tasks are\n" +" - parsing source code\n" +" - creating HTML-output.\n" +" On the command line each task starts with a specific\n" +" option:\n" +" '-parse' for parsing source code,\n" +" '-html' for creating HTML.\n" +" All command line options, related to one task, have to follow before\n" +" the starting option of the next task.\n" +"\n" +" Within the task '-parse', there may be defined different projects.\n" +" A project definition is started with '-p'.\n" +" All not project specific options within the task '-parse' have to\n" +" appear in front of the first '-p'.\n" +" There can be no project at all. Then all options, available for\n" +" projects, can be used like for one nameless default project, without using\n" +" '-p', but these options still have to appear behind all other\n" +" options of the task '-parse'.\n" +"\n" +"\n" +" Legend:\n" +"\n" +" <SomeText> Describes an argument.\n" +" 'SomeText' Within '...' is the literal value of an argument.\n" +" + There can be multiple arguments.\n" +" | Separator for alternative literal values of an argument.\n" +"\n" +"\n" +" Syntax:\n" +"\n" +" -parse\n" +" -name <RepositoryName>]\n" +" -lg 'c++'|'idl'\n" +" -extg <AdditonalExtensions>+\n" +" -docg 'usehtml'\n" +" -p <ProjectName> <ProjectRootDir>\n" +" -l 'c++'|'idl'\n" +" -ext <AdditonalExtensions>+\n" +" -doc 'usehtml'\n" +" -d <SourceDir_relative2ProjectRootDir_nosubdirs>+\n" +" -t <SourceTree_relative2ProjectRootDir>+\n" +" -f <SourceFile_relative2ProjectRootDir>+\n" +" -html <OutputDir>\n" +" -xlinks <Namespace> <ExternLinksRootDir>\n" +" -i <CommandFilePath>\n" +" -v <VerboseNr>\n" +"\n" +"\n" +" Detailed Options Description:\n" +"\n" +" Option Arguments\n" +" ----------------------------------------------------------\n" +"\n" +" -parse \n\n" +" Starts the task \"Parse source code\".\n" +" May be omitted, if it would be the first option on the\n" +" command line.\n" +"\n" +" -name <RepositoryName>\n\n" +" This name is used for naming the repository in\n" +" human readable output. In future it may be used also for\n" +" identifiing a repository in searches.\n" +"\n" +" -lg 'c++|'idl'\n\n" +" Identifies the programming language to be parsed.\n" +" 'c++': C++\n" +" Files with extensions '.h', '.hxx' are parsed.\n" +" 'idl': UNO-IDL\n" +" Files with extensions '.idl' are parsed.\n" +" Here the language is set globally for all projects.\n" +" A project can override this by using '-l'.\n" +"\n" +" -extg <.AdditionalExtension>+\n\n" +" Has to follow immediately behind '-lg'.\n" +" Specifies additional extensions, that will be recognised as\n" +" source code files of the previously specified programming\n" +" language. Each extension has to start with '.'.\n" +" It is possible to include extensionless files, too,\n" +" by the argument '.'\n" +" Here these extensions are set globally for all projects.\n" +" A project can override this by using '-l' and '-ext'.\n" +"\n" +" -docg 'html'|'nohtml'\n\n" +" Specifies the default for all comments in source code, so \n" +" that HTML-tags are interpreted as such or else treated as\n" +" regular text.\n" +" Without this option, the default is 'nohtml'.\n" +" Here the default is set globally for all projects.\n" +" A project can override this by using '-doc'.\n" +"\n" +" -p <ProjectName> <ProjectRootDirectory>\n\n" +" ProjectName is used in output as human readable identifier\n" +" for the project. ProjectRootDirectory is the path,\n" +" where the arguments of '-d', '-t' and '-f' are relative to.\n" +" This option can be omitted, then there is no project name\n" +" and all paths are relative to the current working directory.\n" +"\n" +" -l 'c++|'idl'\n\n" +" Overrides -lg and -extg for the current project, which is\n" +" specified by the last previous '-p'.\n" +" For details see at option '-lg'.\n" +"\n" +" -ext <.AdditionalExtension>+\n\n" +" Can be used only immediately behind '-l'.\n" +" Overrides -extg for the current project, which is\n" +" specified by the last previous '-p'.\n" +" For details see at option '-extg'.\n" +"\n" +" -doc 'html'|'nohtml'\n\n" +" Overrides -docg for the current project, which is\n" +" specified by the last previous '-p'.\n" +" For details see at option '-docg'.\n" +"\n" +" -d <SourceDir_relative2ProjectRootDir_nosubdirs>+\n\n" +" For the current project all files in the given\n" +" directories are parsed, which have valid extensions.\n" +" Subdirectories are NOT parsed.\n" +"\n" +" -t <SourceTree_relative2ProjectRootDir>+\n\n" +" For the current project all files in the given\n" +" directories AND its subdirectories are parsed, which\n" +" have valid extensions.\n" +"\n" +" -f <SourceFile_relative2ProjectRootDir>+\n\n" +" For the current project and language the given files\n" +" are parsed. It doesn't matter, if their extensions match\n" +" the valid extensions.\n" +"\n" +" -html <OutputRootDir>\n\n" +" Starts the task \"Create HTML output\".\n" +"\n" +" -xlinks <Namespace> <ExternLinksRootDir>\n\n" +" This option allows, to create links to external\n" +" HTML-documents.\n" +" For all source code objects (like classes or functions)\n" +" which belong in the given namespace, the given root\n" +" directory is used as a base for links to them.\n" +" Presently, this works only for C++-mappings of IDL-items.\n" +" The given namespace has to be absolute.\n" +"\n" +" -i <CommandFilePath>\n\n" +" This option is replaced by the contents of the given\n" +" file. The file has to be ASCII and each option\n" +" has to start in the first column of a new line.\n" +" So each valid line starts with a '-'.\n" +" Empty lines are allowed.\n" +" Comment lines have to start with '#'\n" +"\n" +" -v <VerboseNumber>\n\n" +" Show details during parsing:\n" +" 2 shows each parsed letter,\n" +" 4 shows stored objects.\n" +" 1 shows recognised tokens.\n" +" These bit-values can be combined.\n" +" This option suppresses errors, because of\n" +" missing output options (no '-html').\n"; +#endif // 0, FUTURE + + +CommandLine::CommandLine() + : nDebugStyle(0), + pSinceTransformator(new command::SinceTagTransformationData), + aCommands(), + bInitOk(false), + pCommand_CreateHtml(0), + pReposy( & ary::Repository::Create_() ), + bCpp(false), + bIdl(false) +{ + csv_assert(pTheInstance_ == 0); + pTheInstance_ = this; +} + +CommandLine::~CommandLine() +{ + csv::erase_container_of_heap_ptrs(aCommands); + pTheInstance_ = 0; +} + +int +CommandLine::Run() const +{ + Cout() << "\nAutodoc version 2.2.5" + << "\n---------------------" + << "\n" << Endl(); + + bool + ok = true; + for ( CommandList::const_iterator it = aCommands.begin(); + ok AND it != aCommands.end(); + ++it ) + { + ok = (*it)->Run(); + } + + if (pCommand_CreateHtml != 0) + { + StreamStr aDiagnosticMessagesFile(700); + aDiagnosticMessagesFile + << pCommand_CreateHtml->OutputDir() + << csv::ploc::Delimiter() + << "Autodoc_DiagnosticMessages.txt"; + TheMessages().WriteFile(aDiagnosticMessagesFile.c_str()); + } + + return ok ? 0 : 1; +} + +CommandLine & +CommandLine::Get_() +{ + csv_assert(pTheInstance_ != 0); + return *pTheInstance_; +} + +bool +CommandLine::DoesTransform_SinceTag() const +{ + return pSinceTransformator->DoesTransform(); +} + +//bool +//CommandLine::Strip_SinceTagText( String & io_sSinceTagValue ) const +//{ +// return pSinceTransformator->StripSinceTagText(io_sSinceTagValue); +//} + +const String & +CommandLine::DisplayOf_SinceTagValue( const String & i_sVersionNumber ) const +{ + return pSinceTransformator->DisplayOf(i_sVersionNumber); +} + +void +CommandLine::do_Init( int argc, + char * argv[] ) +{ + try + { + bInitOk = false; + StringVector aParameters; + + char * * itpEnd = &argv[0] + argc; + for ( char * * itp = &argv[1]; itp != itpEnd; ++itp ) + { + if ( strncmp(*itp, "-I:", 3) != 0 ) + aParameters.push_back(String(*itp)); + else + load_IncludedCommands(aParameters, (*itp)+3); + } + + StringVector::const_iterator itEnd = aParameters.end(); + for ( StringVector::const_iterator it = aParameters.begin(); + it != itEnd; + ) + { + if ( *it == command::C_opt_Verbose ) + do_clVerbose(it,itEnd); + else if ( *it == command::C_opt_LangAll + OR *it == command::C_opt_Name + OR *it == command::C_opt_DevmanFile ) + do_clParse(it,itEnd); + else if (*it == command::C_opt_CreateHtml) + do_clCreateHtml(it,itEnd); + else if (*it == command::C_opt_SinceFile) + do_clSinceFile(it,itEnd); + else if (*it == command::C_opt_ExternNamespace) + { + sExternNamespace = *(++it); + ++it; + if ( strncmp(sExternNamespace.c_str(), "::", 2) != 0) + { + throw command::X_CommandLine( + "-extnsp needs an absolute qualified namespace, starting with \"::\"." + ); + } + } + else if (*it == command::C_opt_ExternRoot) + { + ++it; + StreamLock sl(1000); + if ( csv::compare(*it, 0, "http://", 7) != 0 ) + { + sl() << "http://" << *it; + } + if ( *(sl().end()-1) != '/') + sl() << '/'; + sExternRoot = sl().c_str(); + + ++it; + } +// else if (*it == command::C_opt_CreateXml) +// do_clCreateXml(it,itEnd); +// else if (command::C_opt_Load) +// do_clLoad(it,itEnd); +// else if (*it == command::C_opt_Save) +// do_clSave(it,itEnd); + else if (*it == "-h" OR *it == "-?" OR *it == "?") + // Leads to displaying help, because bInitOk stays on false. + return; + else if ( *it == command::C_opt_Parse ) + // Only for backwards compatibility. + // Just ignore "-parse". + ++it; + else + { + StreamLock sl(200); + throw command::X_CommandLine( + sl() << "Unknown commandline option \"" + << *it + << "\"." + << c_str ); + } + } // end for + sort_Commands(); + + bInitOk = true; + + } // end try + catch ( command::X_CommandLine & xxx ) + { + xxx.Report( Cerr() ); + } + catch ( csv::Exception & xxx ) + { + xxx.GetInfo( Cerr() ); + } +} + +void +CommandLine::do_PrintUse() const +{ + Cout() << C_sUserGuide << Endl(); +} + +bool +CommandLine::inq_CheckParameters() const +{ + if (NOT bInitOk OR aCommands.size() == 0) + return false; + return true; +} + +void +CommandLine::load_IncludedCommands( StringVector & out, + const char * i_filePath ) +{ + CharacterSource + aIncludedCommands; + csv::File + aFile(i_filePath, csv::CFM_READ); + if (NOT aFile.open()) + { + Cerr() << "Command include file \"" + << i_filePath + << "\" not found." + << Endl(); + throw command::X_CommandLine("Invalid file in option -I:<command-file>."); + } + aIncludedCommands.LoadText(aFile); + aFile.close(); + + bool bInToken = false; + StreamLock aTransmit(200); + for ( ; NOT aIncludedCommands.IsFinished(); aIncludedCommands.MoveOn() ) + { + if (bInToken) + { + if (aIncludedCommands.CurChar() <= 32) + { + const char * + pToken = aIncludedCommands.CutToken(); + bInToken = false; + + if ( strncmp(pToken, "-I:", 3) != 0 ) + { + aTransmit().seekp(0); + aTransmit() << pToken; + aTransmit().replace_all('\\', *csv::ploc::Delimiter()); + aTransmit().replace_all('/', *csv::ploc::Delimiter()); + out.push_back(String(aTransmit().c_str())); + } + else + load_IncludedCommands(out, pToken+3); + } + } + else + { + if (aIncludedCommands.CurChar() > 32) + { + aIncludedCommands.CutToken(); + bInToken = true; + } + } // endif (bInToken) else + + } // end while() +} + +namespace +{ +inline int +v_nr(StringVector::const_iterator it) +{ + return int( *(*it).c_str() ) - int('0'); +} +} // anonymous namespace + +void +CommandLine::do_clVerbose( opt_iter & it, + opt_iter itEnd ) +{ + ++it; + if ( it == itEnd ? true : v_nr(it) < 0 OR v_nr(it) > 7 ) + throw command::X_CommandLine( "Missing or invalid number in -v option." ); + nDebugStyle = v_nr(it); + ++it; +} + +void +CommandLine::do_clParse( opt_iter & it, + opt_iter itEnd ) +{ + command::Command * + pCmd_Parse = new command::Parse; + pCmd_Parse->Init(it, itEnd); + aCommands.push_back(pCmd_Parse); +} + +void +CommandLine::do_clCreateHtml( opt_iter & it, + opt_iter itEnd ) +{ + pCommand_CreateHtml = new command::CreateHtml; + pCommand_CreateHtml->Init(it, itEnd); + aCommands.push_back(pCommand_CreateHtml); +} + +void +CommandLine::do_clSinceFile( opt_iter & it, + opt_iter itEnd ) +{ + pSinceTransformator->Init(it, itEnd); +} + + +namespace +{ + +struct Less_RunningRank +{ + bool operator()( + const command::Command * const & + i1, + const command::Command * const & + i2 ) const + { return i1->RunningRank() < i2->RunningRank(); } +}; + +} // anonymous namespace + + + +void +CommandLine::sort_Commands() +{ + std::sort( aCommands.begin(), + aCommands.end(), + Less_RunningRank() ); +} + +} // namespace autodoc diff --git a/autodoc/source/exes/adc_uni/adc_cmd.hxx b/autodoc/source/exes/adc_uni/adc_cmd.hxx new file mode 100644 index 000000000000..13f150d7f0db --- /dev/null +++ b/autodoc/source/exes/adc_uni/adc_cmd.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_cmd.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_ADC_CMD_HXX +#define ADC_ADC_CMD_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <cosv/comdline.hxx> + // COMPONENTS + // PARAMETERS + + +namespace autodoc +{ +namespace command +{ + +/** Context for a command, which can be read from the command line. +*/ +class Context +{ + public: + typedef StringVector::const_iterator opt_iter; + + virtual ~Context() {} + + void Init( + opt_iter & it, + opt_iter itEnd ); + private: + virtual void do_Init( + opt_iter & it, + opt_iter itEnd ) = 0; +}; + +// IMPLEMENTATION +inline void +Context::Init( opt_iter & i_nCurArgsBegin, + opt_iter i_nEndOfAllArgs ) + +{ do_Init(i_nCurArgsBegin, i_nEndOfAllArgs); } + + + +/** Interface for commands, autodoc is able to perform. +*/ +class Command : public Context +{ + public: + /** Running ranks of the commands are to be maintained at one location: + Here! + */ + enum E_Ranks + { + rank_Load = 10, + rank_Parse = 20, + rank_Save = 30, + rank_CreateHtml = 40, + rank_CreateXml = 50 + }; + + + bool Run() const; + int RunningRank() const; + + private: + virtual bool do_Run() const = 0; + virtual int inq_RunningRank() const = 0; +}; + +// IMPLEMENTATION +inline bool +Command::Run() const +{ return do_Run(); } +inline int +Command::RunningRank() const +{ return inq_RunningRank(); } + + + + +/** The exception thrown, if the command line is invalid. +*/ +class X_CommandLine +{ + public: + X_CommandLine( + const char * i_sExplanation ) + : sExplanation(i_sExplanation) {} + + void Report( + std::ostream & o_rOut ) + { o_rOut << "Error in command line: " + << sExplanation << Endl(); } + private: + String sExplanation; +}; + + + + +} // namespace command +} // namespace autodoc +#endif diff --git a/autodoc/source/exes/adc_uni/adc_cmd_parse.cxx b/autodoc/source/exes/adc_uni/adc_cmd_parse.cxx new file mode 100644 index 000000000000..53b8389520c4 --- /dev/null +++ b/autodoc/source/exes/adc_uni/adc_cmd_parse.cxx @@ -0,0 +1,346 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_cmd_parse.cxx,v $ + * $Revision: 1.11 $ + * + * 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 "adc_cmd_parse.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <adc_cl.hxx> +#include "adc_cmds.hxx" +#include "cmd_run.hxx" + + + +namespace autodoc +{ +namespace command +{ + +namespace +{ + +const String C_FileEnding_hxx("*.hxx"); +const String C_FileEnding_h("*.h"); +const String C_FileEnding_idl("*.idl"); +const String C_FileEnding_java("*.java"); + +inline void +CHECK( bool b, const String & text ) +{ + if (NOT b) + throw X_CommandLine( text ); +} + +} // anonymous namespace + + + +//************************** S_LanguageInfo ***********************// + +S_LanguageInfo::~S_LanguageInfo() +{ +} + +void +S_LanguageInfo::do_Init( opt_iter & it, + opt_iter itEnd ) +{ + ++it; // Cur is language. + CHECKOPT( it != itEnd AND + ( *it == C_arg_Cplusplus OR + *it == C_arg_Idl OR + *it == C_arg_Java ), + "language", + C_opt_LangAll ); + + if ( *it == C_arg_Cplusplus ) { + eLanguage = cpp; + } + else if ( *it == C_arg_Idl ) { + eLanguage = idl; + } + else if ( *it == C_arg_Java ) { + eLanguage = java; + } + else { + csv_assert(false); + } + + switch (eLanguage) + { + case cpp: aExtensions.push_back( C_FileEnding_hxx ); + aExtensions.push_back( C_FileEnding_h ); + CommandLine::Get_().Set_CppUsed(); + break; + case idl: aExtensions.push_back( C_FileEnding_idl ); + CommandLine::Get_().Set_IdlUsed(); + break; + case java: aExtensions.push_back( C_FileEnding_java ); + break; + default: // do nothing. + ; + } + + ++it; // Cur is next option. +} + +void +S_LanguageInfo::InitExtensions( opt_iter & it, + opt_iter itEnd ) +{ + ++it; + CHECKOPT( it != itEnd AND (*it).char_at(0) == '.', + "extensions", + C_opt_ExtensionsAll ); + + StreamLock slCheck(150); + slCheck() << C_opt_ExtensionsAll + << " used without previous " + << C_opt_LangAll; + + CHECK( eLanguage != none, + slCheck().c_str() ); + + do { + aExtensions.push_back(*it); + ++it; + } while (it != itEnd AND (*it).char_at(0) == '.'); +} + + + +//************************** Parse ***********************// + +Parse::Parse() + : sRepositoryName(), + aGlobalLanguage(), + aProjects(), + sDevelopersManual_RefFilePath() +{ +} + +Parse::~Parse() +{ + csv::erase_container_of_heap_ptrs(aProjects); +} + +void +Parse::do_Init( opt_iter & it, + opt_iter itEnd ) +{ + for ( ; it != itEnd; ) + { + if (*it == C_opt_Name) + do_clName(it, itEnd); + else if (*it == C_opt_LangAll) + aGlobalLanguage.Init(it, itEnd); + else if (*it == C_opt_ExtensionsAll) + aGlobalLanguage.InitExtensions(it, itEnd); + else if (*it == C_opt_DevmanFile) + do_clDevManual(it, itEnd); + else if (*it == C_opt_Project) + do_clProject(it, itEnd); + else if ( *it == C_opt_SourceTree + OR *it == C_opt_SourceDir + OR *it == C_opt_SourceFile ) + do_clDefaultProject(it, itEnd); + else + break; + } // for +} + +void +Parse::do_clName( opt_iter & it, + opt_iter itEnd ) +{ + ++it; + CHECKOPT( it != itEnd AND (*it).char_at(0) != '-', + "name", + C_opt_Name ); + sRepositoryName = *it; + ++it; +} + +void +Parse::do_clDevManual( opt_iter & it, + opt_iter itEnd ) +{ + ++it; + CHECKOPT( it != itEnd AND (*it).char_at(0) != '-', + "link file path", + C_opt_DevmanFile ); + sDevelopersManual_RefFilePath = *it; + ++it; +} + +void +Parse::do_clProject( opt_iter & it, + opt_iter itEnd ) +{ + if ( aProjects.size() == 1 ) + { + if ( aProjects.front()->IsDefault() ) + throw X_CommandLine( "Both, named projects and a default project, cannot be used together." ); + } + + S_ProjectData * dpProject = new S_ProjectData(aGlobalLanguage); + ++it; + dpProject->Init(it, itEnd); + aProjects.push_back(dpProject); +} + +void +Parse::do_clDefaultProject( opt_iter & it, + opt_iter itEnd ) +{ + if ( aProjects.size() > 0 ) + { + throw X_CommandLine( "Both, named projects and a default project, cannot be used together." ); + } + + S_ProjectData * dpProject = new S_ProjectData( aGlobalLanguage, + S_ProjectData::default_prj ); + dpProject->Init(it, itEnd); + aProjects.push_back(dpProject); +} + +bool +Parse::do_Run() const +{ + run::Parser + aParser(*this); + return aParser.Perform(); +} + +int +Parse::inq_RunningRank() const +{ + return static_cast<int>(rank_Parse); +} + + + +//************************** S_Sources ***********************// + +void +S_Sources::do_Init( opt_iter & it, + opt_iter itEnd ) +{ + StringVector * + pList = 0; + csv_assert((*it)[0] == '-'); + + for ( ; it != itEnd; ++it) + { + if ((*it)[0] == '-') + { + if (*it == C_opt_SourceTree) + pList = &aTrees; + else if (*it == C_opt_SourceDir) + pList = &aDirectories; + else if (*it == C_opt_SourceFile) + pList = &aFiles; + else + return; + } + else + pList->push_back(*it); + } // end for +} + + + +//************************** S_ProjectData ***********************// + + +S_ProjectData::S_ProjectData( const S_LanguageInfo & i_globalLanguage ) + : sName(), + aRootDirectory(), + aLanguage(i_globalLanguage), + aFiles(), + bIsDefault(false) +{ +} + +S_ProjectData::S_ProjectData( const S_LanguageInfo & i_globalLanguage, + E_Default ) + : sName(), + aRootDirectory("."), + aLanguage(i_globalLanguage), + aFiles(), + bIsDefault(true) +{ +} + +S_ProjectData::~S_ProjectData() +{ +} + +void +S_ProjectData::do_Init( opt_iter & it, + opt_iter itEnd ) +{ + if (NOT IsDefault()) + { + CHECKOPT( it != itEnd AND (*it).char_at(0) != '-', + "name", + C_opt_Project ); + sName = *it; + ++it; + + CHECKOPT( it != itEnd AND (*it).char_at(0) != '-', + "root directory", + C_opt_Project ); + aRootDirectory.Set((*it).c_str(), true); + ++it; + } + + for ( ; it != itEnd; ) + { + if ( *it == C_opt_SourceTree + OR *it == C_opt_SourceDir + OR *it == C_opt_SourceFile ) + aFiles.Init(it, itEnd); +// else if (*it == C_opt_Lang) +// aLanguage.Init(it, itEnd); +// else if (*it == C_opt_Extensions) +// aLanguage.InitExtensions(it, itEnd); + else + break; + } // for +} + +} // namespace command +} // namespace autodoc + + + diff --git a/autodoc/source/exes/adc_uni/adc_cmd_parse.hxx b/autodoc/source/exes/adc_uni/adc_cmd_parse.hxx new file mode 100644 index 000000000000..c84e65659a70 --- /dev/null +++ b/autodoc/source/exes/adc_uni/adc_cmd_parse.hxx @@ -0,0 +1,211 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_cmd_parse.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_ADC_CMD_PARSE_HXX +#define ADC_ADC_CMD_PARSE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "adc_cmd.hxx" + // COMPONENTS +#include <cosv/ploc.hxx> + // PARAMETERS + +namespace autodoc +{ +namespace command +{ + +/** A command context which holds the currently parsed programing language + and its valid file extensions. +*/ +struct S_LanguageInfo : public Context +{ + enum E_ProgrammingLanguage + { + none, + cpp, + idl, + java + }; + S_LanguageInfo() + : eLanguage(none), + aExtensions() {} + ~S_LanguageInfo(); + + void InitExtensions( + opt_iter & it, + opt_iter itEnd ); + // DATA + E_ProgrammingLanguage + eLanguage; + StringVector aExtensions; // An empty string is possible and means exactly that: files without extension. + + private: + // Interface Context: + virtual void do_Init( + opt_iter & it, + opt_iter itEnd ); +}; + + +class S_ProjectData; + + +/** A command that parses source code into the Autodoc Repository. +*/ +class Parse : public Command +{ + public: + typedef std::vector< DYN S_ProjectData * > ProjectList; + typedef ProjectList::const_iterator ProjectIterator; + + Parse(); + ~Parse(); + + // INQUIRY + const String & ReposyName() const; + const S_LanguageInfo & + GlobalLanguage() const; + ProjectIterator ProjectsBegin() const; + ProjectIterator ProjectsEnd() const; + const String & DevelopersManual_RefFilePath() const + { return sDevelopersManual_RefFilePath; } + + private: + // Interface Context: + virtual void do_Init( + opt_iter & i_nCurArgsBegin, + opt_iter i_nEndOfAllArgs ); + // Interface Command: + virtual bool do_Run() const; + virtual int inq_RunningRank() const; + + // Locals + void do_clName( + opt_iter & it, + opt_iter itEnd ); + void do_clDevManual( + opt_iter & it, + opt_iter itEnd ); + void do_clProject( + opt_iter & it, + opt_iter itEnd ); + void do_clDefaultProject( + opt_iter & it, + opt_iter itEnd ); + + // DATA + String sRepositoryName; + S_LanguageInfo aGlobalLanguage; + + ProjectList aProjects; + + String sDevelopersManual_RefFilePath; +}; + +inline const String & +Parse::ReposyName() const + { return sRepositoryName; } +inline const S_LanguageInfo & +Parse::GlobalLanguage() const + { return aGlobalLanguage; } +inline Parse::ProjectIterator +Parse::ProjectsBegin() const + { return aProjects.begin(); } +inline Parse::ProjectIterator +Parse::ProjectsEnd() const + { return aProjects.end(); } +//inline const String & +//Parse::DevelopersManual_RefFilePath() const +// { return sDevelopersManual_RefFilePath; } +//inline const String & +//Parse::DevelopersManual_HtmlRoot() const +// { return sDevelopersManual_HtmlRoot; } + + +struct S_Sources : public Context +{ + StringVector aTrees; + StringVector aDirectories; + StringVector aFiles; + + private: + // Interface Context: + virtual void do_Init( + opt_iter & it, + opt_iter itEnd ); +}; + +class S_ProjectData : public Context +{ + public: + enum E_Default { default_prj }; + + S_ProjectData( + const S_LanguageInfo & + i_globalLanguage ); + S_ProjectData( + const S_LanguageInfo & + i_globalLanguage, + E_Default unused ); + ~S_ProjectData(); + + bool IsDefault() const { return bIsDefault; } + const String & Name() const { return sName; } + const csv::ploc::Path & + RootDirectory() const { return aRootDirectory; } + const S_LanguageInfo & + Language() const { return aLanguage; } + const S_Sources Sources() const { return aFiles; } + + private: + // Interface Context: + virtual void do_Init( + opt_iter & it, + opt_iter itEnd ); + // Locals + + // DATA + String sName; + csv::ploc::Path aRootDirectory; + S_LanguageInfo aLanguage; + S_Sources aFiles; + bool bIsDefault; +}; + + +} // namespace command +} // namespace autodoc + + +#endif diff --git a/autodoc/source/exes/adc_uni/adc_cmds.cxx b/autodoc/source/exes/adc_uni/adc_cmds.cxx new file mode 100644 index 000000000000..8c689e9f6e45 --- /dev/null +++ b/autodoc/source/exes/adc_uni/adc_cmds.cxx @@ -0,0 +1,180 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_cmds.cxx,v $ + * $Revision: 1.10 $ + * + * 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 "adc_cmds.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/ary.hxx> +#include <autodoc/displaying.hxx> +#include <autodoc/dsp_html_std.hxx> +#include <display/corframe.hxx> +#include <adc_cl.hxx> + + +namespace autodoc +{ +namespace command +{ + +extern const String C_opt_Include("-I:"); + +extern const String C_opt_Verbose("-v"); + +extern const String C_opt_Parse("-parse"); +extern const String C_opt_Name("-name"); +extern const String C_opt_LangAll("-lg"); +extern const String C_opt_ExtensionsAll("-extg"); +extern const String C_opt_DevmanFile("-dvgfile"); +extern const String C_opt_SinceFile("-sincefile"); + +extern const String C_arg_Cplusplus("c++"); +extern const String C_arg_Idl("idl"); +extern const String C_arg_Java("java"); + +extern const String C_opt_Project("-p"); +//extern const String C_opt_Lang; +//extern const String C_opt_Extensions; +extern const String C_opt_SourceDir("-d"); +extern const String C_opt_SourceTree("-t"); +extern const String C_opt_SourceFile("-f"); + +extern const String C_opt_CreateHtml("-html"); +extern const String C_opt_DevmanRoot("-dvgroot"); + +//extern const String C_opt_CreateXml("-xml"); +//extern const String C_opt_Load("-load"); +//extern const String C_opt_Save("-save"); + +extern const String C_opt_ExternNamespace("-extnsp"); +extern const String C_opt_ExternRoot("-extroot"); + + + +//************************** CreateHTML ***********************// + +CreateHtml::CreateHtml() + : sOutputRootDirectory(), + sDevelopersManual_HtmlRoot() +{ +} + +CreateHtml::~CreateHtml() +{ +} + +void +CreateHtml::do_Init( opt_iter & it, + opt_iter itEnd ) +{ + ++it; + CHECKOPT( it != itEnd && (*it).char_at(0) != '-', + "output directory", C_opt_CreateHtml ); + sOutputRootDirectory = *it; + + for ( ++it; + it != itEnd AND (*it == C_opt_DevmanRoot); + ++it ) + { + if (*it == C_opt_DevmanRoot) + { + ++it; + CHECKOPT( it != itEnd AND (*it).char_at(0) != '-', + "HTML root directory of Developers Guide", + C_opt_DevmanRoot ); + sDevelopersManual_HtmlRoot = *it; + } + } // end for +} + +bool +CreateHtml::do_Run() const +{ + if ( CommandLine::Get_().IdlUsed() ) + run_Idl(); + if ( CommandLine::Get_().CppUsed() ) + run_Cpp(); + return true; +} + +int +CreateHtml::inq_RunningRank() const +{ + return static_cast<int>(rank_CreateHtml); +} + +void +CreateHtml::run_Idl() const +{ + const ary::idl::Gate & + rGate = CommandLine::Get_().TheRepository().Gate_Idl(); + + Cout() << "Creating HTML-output into the directory " + << sOutputRootDirectory + << "." + << Endl(); + + const DisplayToolsFactory_Ifc & + rToolsFactory = DisplayToolsFactory_Ifc::GetIt_(); + Dyn<autodoc::HtmlDisplay_Idl_Ifc> + pDisplay( rToolsFactory.Create_HtmlDisplay_Idl() ); + + DYN display::CorporateFrame & // KORR_FUTURE: Remove the need for const_cast + drFrame = const_cast< display::CorporateFrame& >(rToolsFactory.Create_StdFrame()); + if (NOT DevelopersManual_HtmlRoot().empty()) + drFrame.Set_DevelopersGuideHtmlRoot( DevelopersManual_HtmlRoot() ); + + pDisplay->Run( sOutputRootDirectory, + rGate, + drFrame ); +} + +void +CreateHtml::run_Cpp() const +{ + const ary::Repository & + rReposy = CommandLine::Get_().TheRepository(); + const ary::cpp::Gate & + rGate = rReposy.Gate_Cpp(); + + const DisplayToolsFactory_Ifc & + rToolsFactory = DisplayToolsFactory_Ifc::GetIt_(); + Dyn< autodoc::HtmlDisplay_UdkStd > + pDisplay( rToolsFactory.Create_HtmlDisplay_UdkStd() ); + + pDisplay->Run( sOutputRootDirectory, + rGate, + rToolsFactory.Create_StdFrame() ); +} + + +} // namespace command +} // namespace autodoc diff --git a/autodoc/source/exes/adc_uni/adc_cmds.hxx b/autodoc/source/exes/adc_uni/adc_cmds.hxx new file mode 100644 index 000000000000..67f2426cae74 --- /dev/null +++ b/autodoc/source/exes/adc_uni/adc_cmds.hxx @@ -0,0 +1,128 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_cmds.hxx,v $ + * $Revision: 1.7 $ + * + * 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 ADC_ADC_CMDS_HXX +#define ADC_ADC_CMDS_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "adc_cmd.hxx" + // COMPONENTS + // PARAMETERS + +namespace autodoc +{ +namespace command +{ + + +/** A command that produces HTML output from the Autodoc Repository. +*/ +class CreateHtml : public Command +{ + public: + CreateHtml(); + ~CreateHtml(); + + const String & OutputDir() const; + const String & DevelopersManual_HtmlRoot() const + { return sDevelopersManual_HtmlRoot; } + + private: + // Interface Context: + virtual void do_Init( + opt_iter & i_nCurArgsBegin, + opt_iter i_nEndOfAllArgs ); + // Interface Command: + virtual bool do_Run() const; + virtual int inq_RunningRank() const; + + // Locals + void run_Cpp() const; + void run_Idl() const; + + // DATA + String sOutputRootDirectory; + String sDevelopersManual_HtmlRoot; +}; + +inline const String & +CreateHtml::OutputDir() const + { return sOutputRootDirectory; } + + +extern const String C_opt_Verbose; + +extern const String C_opt_Parse; +extern const String C_opt_Name; +extern const String C_opt_LangAll; +extern const String C_opt_ExtensionsAll; +extern const String C_opt_DevmanFile; +extern const String C_opt_SinceFile; + +extern const String C_arg_Cplusplus; +extern const String C_arg_Idl; +extern const String C_arg_Java; + +extern const String C_opt_Project; +//extern const String C_opt_Lang; +//extern const String C_opt_Extensions; +extern const String C_opt_SourceTree; +extern const String C_opt_SourceDir; +extern const String C_opt_SourceFile; + +extern const String C_opt_CreateHtml; +extern const String C_opt_DevmanRoot; + +//extern const String C_opt_CreateXml; +//extern const String C_opt_Load; +//extern const String C_opt_Save; + +extern const String C_opt_ExternNamespace; +extern const String C_opt_ExternRoot; + + +inline void +CHECKOPT( bool b, const char * miss, const String & opt ) +{ + if ( NOT b ) + { + StreamLock slMsg(100); + throw X_CommandLine( slMsg() << "Missing " << miss <<" after " << opt << "." << c_str ); + } +} + +} // namespace command +} // namespace autodoc + + +#endif diff --git a/autodoc/source/exes/adc_uni/adc_msg.cxx b/autodoc/source/exes/adc_uni/adc_msg.cxx new file mode 100644 index 000000000000..5beaac48b936 --- /dev/null +++ b/autodoc/source/exes/adc_uni/adc_msg.cxx @@ -0,0 +1,211 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_msg.cxx,v $ + * $Revision: 1.8 $ + * + * 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 <adc_msg.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <cosv/file.hxx> +#include <cosv/tpl/tpltools.hxx> + + +namespace autodoc +{ + + +Messages::Messages() + : aMissingDocs(), + aParseErrors(), + aInvalidConstSymbols(), + aUnresolvedLinks(), + aTypeVsMemberMisuses() +{ +} + +Messages::~Messages() +{ +} + +void +Messages::WriteFile(const String & i_sOutputFilePath) +{ + csv::File + aOut(i_sOutputFilePath, csv::CFM_CREATE); + aOut.open(); + + // KORR_FUTURE Enable this when appropriate: + WriteParagraph( aOut, + aParseErrors, + "Incompletely Parsed Files", + "Stopped parsing at " ); + + WriteParagraph( aOut, + aMissingDocs, + "Entities Without Documentation", + " in " ); + + WriteParagraph( aOut, + aInvalidConstSymbols, + "Incorrectly Written Const Symbols", + " in " ); + + WriteParagraph( aOut, + aUnresolvedLinks, + "Unresolved Links", + " in\n " ); + + WriteParagraph( aOut, + aTypeVsMemberMisuses, + "Confusion or Misuse of <Type> vs. <Member>", + " in " ); + aOut.close(); +} + +void +Messages::Out_MissingDoc( const String & i_sEntity, + const String & i_sFile, + uintt i_nLine) +{ + AddValue( aMissingDocs, + i_sEntity, + i_sFile, + i_nLine ); +} + +void +Messages::Out_ParseError( const String & i_sFile, + uintt i_nLine) +{ + aParseErrors[Location(i_sFile,i_nLine)] = String::Null_(); +} + +void +Messages::Out_InvalidConstSymbol( const String & i_sText, + const String & i_sFile, + uintt i_nLine) +{ + AddValue( aInvalidConstSymbols, + i_sText, + i_sFile, + i_nLine ); +} + +void +Messages::Out_UnresolvedLink( const String & i_sLinkText, + const String & i_sFile, + uintt i_nLine) +{ + AddValue( aUnresolvedLinks, + i_sLinkText, + i_sFile, + i_nLine ); +} + +void +Messages::Out_TypeVsMemberMisuse( const String & i_sLinkText, + const String & i_sFile, + uintt i_nLine) +{ + AddValue( aTypeVsMemberMisuses, + i_sLinkText, + i_sFile, + i_nLine ); +} + +Messages & +Messages::The_() +{ + static Messages TheMessages_; + return TheMessages_; +} + +void +Messages::AddValue( MessageMap & o_dest, + const String & i_sText, + const String & i_sFile, + uintt i_nLine ) +{ + String & + rDest = o_dest[Location(i_sFile,i_nLine)]; + StreamLock + slDest(2000); + if (NOT rDest.empty()) + slDest() << rDest; + slDest() << "\n " << i_sText; + rDest = slDest().c_str(); +} + +void +Messages::WriteParagraph( csv::File & o_out, + const MessageMap & i_source, + const String & i_title, + const String & ) +{ + StreamStr aLine(2000); + + // Write title of paragraph: + aLine << i_title + << "\n"; + o_out.write(aLine.c_str()); + + aLine.seekp(0); + for (uintt i = i_title.size(); i > 0; --i) + { + aLine << '-'; + } + aLine << "\n\n"; + o_out.write(aLine.c_str()); + + // Write Content + MessageMap::const_iterator it = i_source.begin(); + MessageMap::const_iterator itEnd = i_source.end(); + for ( ; it != itEnd; ++it ) + { + aLine.seekp(0); + aLine << (*it).first.sFile; + // Nobody wants to see this, if we don't know the line: + if ((*it).first.nLine != 0) + { + aLine << ", line " + << (*it).first.nLine; + } + if (NOT (*it).second.empty()) + { + aLine << ':' + << (*it).second + << "\n"; + } + o_out.write(aLine.c_str()); + } + o_out.write("\n\n\n"); +} + +} // namespace autodoc diff --git a/autodoc/source/exes/adc_uni/cmd_run.cxx b/autodoc/source/exes/adc_uni/cmd_run.cxx new file mode 100644 index 000000000000..a346d0df7336 --- /dev/null +++ b/autodoc/source/exes/adc_uni/cmd_run.cxx @@ -0,0 +1,616 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cmd_run.cxx,v $ + * $Revision: 1.12 $ + * + * 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 "cmd_run.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/file.hxx> +#include <cosv/x.hxx> +#include <ary/ary.hxx> +#include <ary/cpp/c_gate.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> +#include <autodoc/filecoli.hxx> +#include <autodoc/parsing.hxx> +#include <autodoc/prs_code.hxx> +#include <autodoc/prs_docu.hxx> +#include <parser/unoidl.hxx> +#include <adc_cl.hxx> +#include "adc_cmd_parse.hxx" +#include "adc_cmds.hxx" + +namespace autodoc +{ +namespace command +{ +namespace run +{ + +Parser::Parser( const Parse & i_command ) + : rCommand(i_command), + pCppParser(), + pCppDocuInterpreter(), + pIdlParser() +{ +} + +Parser::~Parser() +{ +} + +bool +Parser::Perform() +{ + Cout() << "Parsing the repository " + << rCommand.ReposyName() + << " ..." + << Endl(); + try + { + ::ary::Repository & + rAry = CommandLine::Get_().TheRepository(); + rAry.Set_Title(rCommand.ReposyName()); + + Dyn< FileCollector_Ifc > + pFiles( ParseToolsFactory().Create_FileCollector(6000) ); + + bool bIDL = false; + bool bCpp = false; + + command::Parse::ProjectIterator + itEnd = rCommand.ProjectsEnd(); + for ( command::Parse::ProjectIterator it = rCommand.ProjectsBegin(); + it != itEnd; + ++it ) + { + uintt nCount = GatherFiles( *pFiles, *(*it) ); + Cout() << nCount + << " files found to parse in project " + << (*it)->Name() + << "." + << Endl(); + + switch ( (*it)->Language().eLanguage ) + { + case command::S_LanguageInfo::idl: + { + Get_IdlParser().Run(*pFiles); + bIDL = true; + } break; + case command::S_LanguageInfo::cpp: + { + Get_CppParser().Run( *pFiles ); + bCpp = true; + } break; + default: + Cerr() << "Project in yet unimplemented language skipped." + << Endl(); + } + } // end for + + if (bCpp) + { + rAry.Gate_Cpp().Calculate_AllSecondaryInformation(); + } + if (bIDL) + { + rAry.Gate_Idl().Calculate_AllSecondaryInformation( + rCommand.DevelopersManual_RefFilePath() ); + +// ::ary::idl::SecondariesPilot & +// rIdl2sPilot = rAry.Gate_Idl().Secondaries(); +// +// rIdl2sPilot.CheckAllInterfaceBases( rAry.Gate_Idl() ); +// rIdl2sPilot.Connect_Types2Ces(); +// rIdl2sPilot.Gather_CrossReferences(); +// +// if (NOT rCommand.DevelopersManual_RefFilePath().empty()) +// { +// csv::File +// aFile(rCommand.DevelopersManual_RefFilePath(), csv::CFM_READ); +// if ( aFile.open() ) +// { +// rIdl2sPilot.Read_Links2DevManual(aFile); +// aFile.close(); +// } +// } + } // endif (bIDL) + + return true; + + } // end try + catch (csv::Exception & xx) + { + xx.GetInfo(Cerr()); + Cerr() << " program will exit." << Endl(); + + return false; + } +} + +CodeParser_Ifc & +Parser::Get_CppParser() +{ + if ( NOT pCppParser ) + Create_CppParser(); + return *pCppParser; +} + +IdlParser & +Parser::Get_IdlParser() +{ + if ( NOT pIdlParser ) + Create_IdlParser(); + return *pIdlParser; +} + +void +Parser::Create_CppParser() +{ + pCppParser = ParseToolsFactory().Create_Parser_Cplusplus(); + pCppDocuInterpreter = ParseToolsFactory().Create_DocuParser_AutodocStyle(); + + pCppParser->Setup( CommandLine::Get_().TheRepository(), + *pCppDocuInterpreter ); +} + +void +Parser::Create_IdlParser() +{ + pIdlParser = new IdlParser(CommandLine::Get_().TheRepository()); +} + +const ParseToolsFactory_Ifc & +Parser::ParseToolsFactory() +{ + return ParseToolsFactory_Ifc::GetIt_(); +} + +uintt +Parser::GatherFiles( FileCollector_Ifc & o_rFiles, + const S_ProjectData & i_rProject ) +{ + uintt ret = 0; + o_rFiles.EraseAll(); + + typedef StringVector StrVector; + typedef StrVector::const_iterator StrIterator; + const S_Sources & + rSources = i_rProject.Sources(); + const StrVector & + rExtensions = i_rProject.Language().aExtensions; + + StrIterator it; + StrIterator itTreesEnd = rSources.aTrees.end(); + StrIterator itDirsEnd = rSources.aDirectories.end(); + StrIterator itFilesEnd = rSources.aFiles.end(); + StrIterator itExt; + StrIterator itExtEnd = rExtensions.end(); + + csv::StreamStr aDir(500); + i_rProject.RootDirectory().Get( aDir ); + + uintt nProjectDir_AddPosition = + ( strcmp(aDir.c_str(),".\\") == 0 OR strcmp(aDir.c_str(),"./") == 0 ) + ? 0 + : uintt( aDir.tellp() ); + + for ( it = rSources.aDirectories.begin(); + it != itDirsEnd; + ++it ) + { + aDir.seekp( nProjectDir_AddPosition ); + aDir << *it; + + for ( itExt = rExtensions.begin(); + itExt != itExtEnd; + ++itExt ) + { + ret += o_rFiles.AddFilesFrom( aDir.c_str(), + *itExt, + FileCollector_Ifc::flat ); + } // end for itExt + } // end for it + for ( it = rSources.aTrees.begin(); + it != itTreesEnd; + ++it ) + { + aDir.seekp( nProjectDir_AddPosition ); + aDir << *it; + + for ( itExt = rExtensions.begin(); + itExt != itExtEnd; + ++itExt ) + { + ret += o_rFiles.AddFilesFrom( aDir.c_str(), + *itExt, + FileCollector_Ifc::recursive ); + } // end for itExt + } // end for it + for ( it = rSources.aFiles.begin(); + it != itFilesEnd; + ++it ) + { + aDir.seekp( nProjectDir_AddPosition ); + aDir << *it; + + o_rFiles.AddFile( aDir.c_str() ); + } // end for it + ret += rSources.aFiles.size(); + + return ret; +} + + +} // namespace run +} // namespace command + + +#if 0 +inline const ParseToolsFactory_Ifc & +CommandRunner::ParseToolsFactory() + { return ParseToolsFactory_Ifc::GetIt_(); } + + +inline const command::S_LanguageInfo & +CommandRunner::Get_ProjectLanguage( const command::Parse & i_rCommand, + const command::S_ProjectData & i_rProject ) +{ + if ( i_rProject.pLanguage ) + return *i_rProject.pLanguage; + return *i_rCommand.GlobalLanguageInfo(); +} + +inline bool +CommandRunner::HasParsedCpp() const + { return pCppParser; } +inline bool +CommandRunner::HasParsedIdl() const + { return pIdlParser; } + + + + + +CommandRunner::CommandRunner() + : pCommandLine(0), + pReposy(0), + pNewReposy(0), + nResultCode(0) +{ + Cout() << "\nAutodoc version 2.2.1" + << "\n-------------------" + << "\n" << Endl(); +} + +CommandRunner::~CommandRunner() +{ + ary::Repository::Destroy_(); + Cout() << "\n" << Endl(); +} + +void +CommandRunner::Run( const CommandLine & i_rCL ) +{ + ary::Repository::Destroy_(); +// ary::Repository::Destroy_(); + pReposy = 0; + pNewReposy = 0; + nResultCode = 0; + pCommandLine = &i_rCL; + + pCommandLine->Run(); +} + +void +CommandRunner::Parse() +{ + try + { + + csv_assert( pCommandLine->Cmd_Parse() != 0 ); + const command::Parse & + rCmd = *pCommandLine->Cmd_Parse(); + + Cout() << "Parsing the repository " + << rCmd.ReposyName() + << " ..." + << Endl(); + + if ( pReposy == 0 ) + pReposy = & ary::Repository::Create_( rCmd.ReposyName(), 0 ); + if ( pNewReposy == 0 ) + pNewReposy = & ary::Repository::Create_( rCmd.ReposyName() ); + + Dyn< FileCollector_Ifc > pFiles; + pFiles = ParseToolsFactory().Create_FileCollector(6000); + + bool bCpp = false; + bool bIDL = false; + + command::Parse::ProjectIterator itEnd = rCmd.ProjectsEnd(); + for ( command::Parse::ProjectIterator it = rCmd.ProjectsBegin(); + it != itEnd; + ++it ) + { + + uintt nCount = GatherFiles( *pFiles, rCmd, *(*it) ); + Cout() << nCount + << " files found to parse in project " + << (*it)->Name() + << "." + << Endl(); + + + switch ( Get_ProjectLanguage(rCmd, *(*it)).eLanguage ) + { + case command::S_LanguageInfo::cpp: + { + Get_CppParser().Run( (*it)->Name(), + (*it)->RootDirectory(), + *pFiles ); + bCpp = true; + } break; + case command::S_LanguageInfo::idl: + { + Get_IdlParser().Run(*pFiles); + bIDL = true; + } break; + default: + Cerr() << "Project in yet unimplemented language skipped." + << Endl(); + } + } // end for + + if (bCpp) + pReposy->RwGate_Cpp().Connect_AllTypes_2_TheirRelated_CodeEntites(); + if (bIDL) + { + pNewReposy->Gate_Idl().Secondaries().Connect_Types2Ces(); + pNewReposy->Gate_Idl().Secondaries().Gather_CrossReferences(); + } + + } // end try + catch (csv::Exception & xx) + { + xx.GetInfo(Cerr()); + Cerr() << " program will exit." << Endl(); + nResultCode = 1; + } + catch (...) + { + Cerr() << "Unknown exception - program will exit." << Endl(); + nResultCode = 1; + } +} + +void +CommandRunner::Load() +{ + Cout() << "This would load the repository from the directory " + << pCommandLine->Cmd_Load()->ReposyDir() + << "." + << Endl(); +} + + +void +CommandRunner::Save() +{ + Cout() << "This would save the repository into the directory " + << pCommandLine->Cmd_Save()->ReposyDir() + << "." + << Endl(); +} + + +void +CommandRunner::CreateHtml() +{ + Cout() << "Creating HTML-output into the directory " + << pCommandLine->Cmd_CreateHtml()->OutputDir() + << "." + << Endl(); + + if ( HasParsedCpp() ) + CreateHtml_NewStyle(); + if ( HasParsedIdl() ) + CreateHtml_OldIdlStyle(); +} + + + +void +CommandRunner::CreateXml() +{ + Cout() << "This would create the XML-output into the directory " + << pCommandLine->Cmd_CreateXml()->OutputDir() + << "." + << Endl(); +} + +CodeParser_Ifc & +CommandRunner::Get_CppParser() +{ + if ( NOT pCppParser ) + Create_CppParser(); + return *pCppParser; +} + +IdlParser & +CommandRunner::Get_IdlParser() +{ + if ( NOT pIdlParser ) + Create_IdlParser(); + return *pIdlParser; +} + +void +CommandRunner::Create_CppParser() +{ + pCppParser = ParseToolsFactory().Create_Parser_Cplusplus(); + pCppDocuInterpreter = ParseToolsFactory().Create_DocuParser_AutodocStyle(); + + pCppParser->Setup( *pReposy, + *pCppDocuInterpreter ); +} + +void +CommandRunner::Create_IdlParser() +{ + pIdlParser = new IdlParser(*pNewReposy); +} + +uintt +CommandRunner::GatherFiles( FileCollector_Ifc & o_rFiles, + const command::Parse & i_rCommand, + const command::S_ProjectData & i_rProject ) +{ + uintt ret = 0; + o_rFiles.EraseAll(); + + typedef StringVector StrVector; + typedef StrVector::const_iterator StrIterator; + const command::S_Sources & + rSources = i_rProject.aFiles; + const StrVector & + rExtensions = Get_ProjectLanguage(i_rCommand,i_rProject).aExtensions; + + StrIterator it; + StrIterator itDirsEnd = rSources.aDirectories.end(); + StrIterator itTreesEnd = i_rProject.aFiles.aTrees.end(); + StrIterator itFilesEnd = i_rProject.aFiles.aFiles.end(); + StrIterator itExt; + StrIterator itExtEnd = rExtensions.end(); + + csv::StreamStr aDir(500); + i_rProject.aRootDirectory.Get( aDir ); + + uintt nProjectDir_AddPosition = + ( strcmp(aDir.c_str(),".\\") == 0 OR strcmp(aDir.c_str(),"./") == 0 ) + ? 0 + : uintt( aDir.tellp() ); + + for ( it = rSources.aDirectories.begin(); + it != itDirsEnd; + ++it ) + { + aDir.seekp( nProjectDir_AddPosition ); + aDir << *it; + + for ( itExt = rExtensions.begin(); + itExt != itExtEnd; + ++itExt ) + { + ret += o_rFiles.AddFilesFrom( aDir.c_str(), + *itExt, + FileCollector_Ifc::flat ); + } // end for itExt + } // end for it + for ( it = rSources.aTrees.begin(); + it != itTreesEnd; + ++it ) + { + aDir.seekp( nProjectDir_AddPosition ); + aDir << *it; + + for ( itExt = rExtensions.begin(); + itExt != itExtEnd; + ++itExt ) + { + ret += o_rFiles.AddFilesFrom( aDir.c_str(), + *itExt, + FileCollector_Ifc::recursive ); + } // end for itExt + } // end for it + for ( it = rSources.aFiles.begin(); + it != itFilesEnd; + ++it ) + { + aDir.seekp( nProjectDir_AddPosition ); + aDir << *it; + + o_rFiles.AddFile( aDir.c_str() ); + } // end for it + ret += rSources.aFiles.size(); + + return ret; +} + +void +CommandRunner::CreateHtml_NewStyle() +{ + const ary::cpp::DisplayGate & + rGate = pReposy->DisplayGate_Cpp(); + + Dyn< autodoc::HtmlDisplay_UdkStd > pHtmlDisplay; + pHtmlDisplay = DisplayToolsFactory_Ifc::GetIt_() + .Create_HtmlDisplay_UdkStd(); + + pHtmlDisplay->Run( pCommandLine->Cmd_CreateHtml()->OutputDir(), + rGate, + DisplayToolsFactory_Ifc::GetIt_().Create_StdFrame() ); +} + +void +CommandRunner::CreateHtml_OldIdlStyle() +{ + ary::idl::Gate & + rAryGate = pNewReposy->Gate_Idl(); + + // Read DevManualLinkFile: + // KORR_FUTURE + csv::File + aFile("devmanref.txt", csv::CFM_READ); + if ( aFile.open() ) + { + rAryGate.Secondaries().Read_Links2DevManual(aFile); + aFile.close(); + } + + // New Style Output + Dyn<autodoc::HtmlDisplay_Idl_Ifc> pNewDisplay; + pNewDisplay = DisplayToolsFactory_Ifc::GetIt_() + .Create_HtmlDisplay_Idl(); + pNewDisplay->Run( pCommandLine->Cmd_CreateHtml()->OutputDir(), + rAryGate, + DisplayToolsFactory_Ifc::GetIt_().Create_StdFrame() ); +} +#endif // 0 + +} // namespace autodoc + + + + diff --git a/autodoc/source/exes/adc_uni/cmd_run.hxx b/autodoc/source/exes/adc_uni/cmd_run.hxx new file mode 100644 index 000000000000..4e4cbf7f23b8 --- /dev/null +++ b/autodoc/source/exes/adc_uni/cmd_run.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cmd_run.hxx,v $ + * $Revision: 1.7 $ + * + * 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 ADC_CMD_RUN_HXX +#define ADC_CMD_RUN_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <cosv/comdline.hxx> + // COMPONENTS + // PARAMETERS + +namespace ary +{ + class Repository; +} + +namespace autodoc +{ + class FileCollector_Ifc; + class ParseToolsFactory_Ifc; + class CodeParser_Ifc; + class DocumentationParser_Ifc; + class IdlParser; + + +namespace command +{ + class Parse; + class S_ProjectData; + struct S_LanguageInfo; + +namespace run +{ + +/** Performs an ::autodoc::command::Parse . +*/ +class Parser +{ + public: + Parser( + const Parse & i_command ); + ~Parser(); + + bool Perform(); + + private: + // Locals + CodeParser_Ifc & Get_CppParser(); + IdlParser & Get_IdlParser(); + void Create_CppParser(); + void Create_IdlParser(); + const ParseToolsFactory_Ifc & + ParseToolsFactory(); + uintt GatherFiles( + FileCollector_Ifc & o_rFiles, + const S_ProjectData & + i_rProject ); + // DATA + const Parse & rCommand; + + Dyn<CodeParser_Ifc> pCppParser; + Dyn<DocumentationParser_Ifc> + pCppDocuInterpreter; + Dyn<IdlParser> pIdlParser; +}; + + + + +// IMPLEMENTATION + + +} // namespace run +} // namespace command +} // namespace autodoc + +#endif diff --git a/autodoc/source/exes/adc_uni/cmd_sincedata.cxx b/autodoc/source/exes/adc_uni/cmd_sincedata.cxx new file mode 100644 index 000000000000..0a577eb8ef8f --- /dev/null +++ b/autodoc/source/exes/adc_uni/cmd_sincedata.cxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cmd_sincedata.cxx,v $ + * $Revision: 1.8 $ + * + * 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 "cmd_sincedata.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/file.hxx> +#include <cosv/tpl/tpltools.hxx> +#include "adc_cmds.hxx" + + + +namespace autodoc +{ +namespace command +{ + +SinceTagTransformationData::SinceTagTransformationData() + : aTransformationTable() +{ +} + +SinceTagTransformationData::~SinceTagTransformationData() +{ +} + +bool +SinceTagTransformationData::DoesTransform() const +{ + return NOT aTransformationTable.empty(); +} + +const String & +SinceTagTransformationData::DisplayOf( const String & i_versionNumber ) const +{ + if (DoesTransform()) + { + StreamLock + sl(200); + sl() << i_versionNumber; + sl().strip_frontback_whitespace(); + String + sVersionNumber(sl().c_str()); + + const String * + ret = csv::find_in_map(aTransformationTable, sVersionNumber); + return ret != 0 + ? *ret + : String::Null_(); + } + else + { + return i_versionNumber; + } +} + +void +SinceTagTransformationData::do_Init( opt_iter & it, + opt_iter itEnd ) +{ + ++it; // Cur is since-file path. + + CHECKOPT( it != itEnd , + "file path", + C_opt_SinceFile ); + + csv::File aSinceFile(*it); + csv::OpenCloseGuard aSinceFileGuard(aSinceFile); + StreamStr sLine(200); + + if (aSinceFileGuard) + { + for ( sLine.operator_read_line(aSinceFile); + NOT sLine.empty(); + sLine.operator_read_line(aSinceFile) ) + { + + if (*sLine.begin() != '"') + continue; + + const char * pVersion = sLine.c_str() + 1; + const char * pVersionEnd = strchr(pVersion, '"'); + if (pVersionEnd == 0) + continue; + const char * pDisplay = strchr(pVersionEnd+1, '"'); + if (pDisplay == 0) + continue; + ++pDisplay; + const char * pDisplayEnd = strchr(pDisplay, '"'); + if (pDisplayEnd == 0) + continue; + + aTransformationTable[ String(pVersion,pVersionEnd) ] + = String(pDisplay,pDisplayEnd); + sLine.clear(); + } // end for + } // end if + + ++it; // Cur is next option. +} + +} // namespace command +} // namespace autodoc diff --git a/autodoc/source/exes/adc_uni/cmd_sincedata.hxx b/autodoc/source/exes/adc_uni/cmd_sincedata.hxx new file mode 100644 index 000000000000..5c539d2d813d --- /dev/null +++ b/autodoc/source/exes/adc_uni/cmd_sincedata.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cmd_sincedata.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_CMD_SINCEDATA_HXX +#define ADC_CMD_SINCEDATA_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "adc_cmd.hxx" + // COMPONENTS + // PARAMETERS + +namespace autodoc +{ +namespace command +{ + + +/** Provides replacements for the contents of the @@since documentation tag. + + Because the @@since tag is part of the source code, it allows only one kind + of version information there. If this is to be mapped for different products + (example: from OpenOffice.org versions in the @@since tag to StarOffice or + StarSuite products), the value of @@since needs a replacement, which is provided + by this class. + +*/ +class SinceTagTransformationData : public Context +{ + public: + /** The key of this map are the version numbers within @since. + The value is the string to display for each version number. + */ + typedef std::map<String,String> Map_Version2Display; + + // LIFECYCLE + SinceTagTransformationData(); + virtual ~SinceTagTransformationData(); + + // INQUIRY + /// False, if no transformation table exists. + bool DoesTransform() const; + + /** Gets the string to display for a version number. + + @param i_sVersionNumber + Usually should be the result of ->StripSinceTagValue(). + */ + const String & DisplayOf( + const String & i_sVersionNumber ) const; + private: + // Interface Context: + virtual void do_Init( + opt_iter & i_nCurArgsBegin, + opt_iter i_nEndOfAllArgs ); + // DATA + Map_Version2Display aTransformationTable; +}; + + +} // namespace command +} // namespace autodoc + + +#endif diff --git a/autodoc/source/exes/adc_uni/main.cxx b/autodoc/source/exes/adc_uni/main.cxx new file mode 100644 index 000000000000..549451e60eaa --- /dev/null +++ b/autodoc/source/exes/adc_uni/main.cxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: main.cxx,v $ + * $Revision: 1.8 $ + * + * 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> + + +// NOT FULLY DECLARED SERVICES + +#include <adc_cl.hxx> +#include "cmd_run.hxx" + + +int +#ifdef WNT + _cdecl +#endif +main( int argc, + char * argv[] ) +{ + autodoc::CommandLine aCL; + aCL.Init(argc, argv); + if (NOT aCL.CheckParameters() ) + return 1; + + int ret = aCL.Run(); + return ret; +} + + + diff --git a/autodoc/source/exes/adc_uni/makefile.mk b/autodoc/source/exes/adc_uni/makefile.mk new file mode 100644 index 000000000000..01cb0e41cd05 --- /dev/null +++ b/autodoc/source/exes/adc_uni/makefile.mk @@ -0,0 +1,108 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.16 $ +# +# 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=autodoc +TARGETTYPE=CUI + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + +UWINAPILIB=$(0) +LIBSALCPPRT=$(0) + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/adc_cl.obj \ + $(OBJ)$/adc_cmd_parse.obj \ + $(OBJ)$/adc_cmds.obj \ + $(OBJ)$/adc_msg.obj \ + $(OBJ)$/cmd_run.obj \ + $(OBJ)$/cmd_sincedata.obj + + +# --- Targets ------------------------------------------------------ + +LIB1TARGET=$(LB)$/atdoc.lib +LIB1FILES= \ + $(LB)$/$(TARGET).lib $(LB)$/autodoc_tools.lib \ + $(LB)$/ary_kernel.lib $(LB)$/ary_cpp.lib $(LB)$/ary_idl.lib \ + $(LB)$/ary_info.lib $(LB)$/ary_loc.lib \ + $(LB)$/parser_kernel.lib $(LB)$/parser_tokens.lib $(LB)$/parser_semantic.lib \ + $(LB)$/parser_cpp.lib $(LB)$/parser_adoc.lib \ + $(LB)$/display_kernel.lib $(LB)$/display_html.lib $(LB)$/display_idl.lib \ + $(LB)$/display_toolkit.lib $(LB)$/parser2_tokens.lib \ + $(LB)$/parser2_s2_luidl.lib $(LB)$/parser2_s2_dsapi.lib \ + $(LB)$/ary2_cinfo.lib $(LB)$/ary_doc.lib + + + +APP1TARGET= $(TARGET) +APP1STACK= 1000000 +APP1OBJS= $(OBJ)$/main.obj + +APP1RPATH=SDK + +.IF "$(GUI)"=="WNT" +APP1STDLIBS= $(LIBSTLPORT) $(COSVLIB) $(UDMLIB) +.ELSE +.IF "$(OS)"=="MACOSX" +# See <http://porting.openoffice.org/servlets/ReadMsg?list=mac&msgNo=6911>: +APP1STDLIBS= $(LIBSTLPORT) -Wl,-all_load -ludm -lcosv +.ELSE +APP1STDLIBS= -lcosv -ludm +.ENDIF +.ENDIF + +APP1LIBS=$(LB)$/atdoc.lib + +DEPOBJFILES += $(APP1OBJS) + +APP1DEPN= $(LB)$/$(TARGET).lib $(LB)$/autodoc_tools.lib \ + $(LB)$/ary_kernel.lib $(LB)$/ary_cpp.lib $(LB)$/ary_idl.lib \ + $(LB)$/ary_info.lib $(LB)$/ary_loc.lib \ + $(LB)$/parser_kernel.lib $(LB)$/parser_tokens.lib $(LB)$/parser_semantic.lib \ + $(LB)$/parser_cpp.lib $(LB)$/parser_adoc.lib \ + $(LB)$/display_kernel.lib $(LB)$/display_html.lib $(LB)$/display_idl.lib \ + $(LB)$/display_toolkit.lib $(LB)$/parser2_tokens.lib \ + $(LB)$/parser2_s2_luidl.lib $(LB)$/parser2_s2_dsapi.lib \ + $(LB)$/ary2_cinfo.lib $(LB)$/ary_doc.lib + + +.INCLUDE : target.mk diff --git a/autodoc/source/exes/adc_uni/spec-CommandLine.txt b/autodoc/source/exes/adc_uni/spec-CommandLine.txt new file mode 100644 index 000000000000..756b3184a2e4 --- /dev/null +++ b/autodoc/source/exes/adc_uni/spec-CommandLine.txt @@ -0,0 +1,181 @@ + Command Line Options + -------------------- + +autodoc [-v <level>] + -html <out> + [-extroot <externroot> -extnsp <externnamespace>] + -lg <proglang> + [-t <sourcetree>[ <sourcetree> ...] + [-d <sourcedir>[ <sourcedir> ...] + [-f <sourcefile>[ <sourcefile> ...] + + + -html <OutputDirectory> + Directory where the output will be created. + + -lg <ProgrammingLanguage> + Allowed values: "c++" or "idl" + + -extroot <externroot> + Only together with "-lg idl" and -extnsp. + Links to code entities not found within the current parsed + code, will be linked there, but only if -extnsp is given and + the linked entity is in the given namespace. + <externroot> is a http link, it needs no "http://" at the + beginning nor slash at the end. + + -extnsp <externnamespace> + Only together with "-lg idl" and -extroot. + If a code entity is not found in the current parsed code, but + dwells in the namespace (or its children) given here, it is + linked into the loction given by -extroot. + <externnamespace> is an absolute qualified namespace, + starting with "::". + + -t <SourceTree>* + Directory with all subdirectories. + + -d <SourceDirectory>* + Directory without subdirectories. + + -f <SourceFile>* + Any file. Here also files with extensions not matching the + language are accepted. + + -I:<ResponseFile> + Each line in the response file has to have one command line + option. No whitespace at start of line. + + -C:<ConfigurationFile> + Format see below. + + -v <VerboseLevel> + Only for debugging. Bits 1, 2 and 4 in any combination give + different output. + + -h + Displays help. + -? + Displays help. + + + + + + Command Line Options especially for the OpenOffice.org SDK + ---------------------------------------------------------- + + -dvgroot <DevelopersGuide> + Root directory of the SDK Developers Guide. + + -dvgfile <ReferenceFile> + File with references to the SDK Developers Guide. + + -sincefile <@since-AssociationFile> + File that maps OpenOffice versions to the wished displayed version names. + + -idlref <IdlDocumentationRoot> <Namespace[,Namespace ...]> + Gives the outputdirectory of an IDL documentation, where + symbols not found in the currently parsed namespaces of C++ + or Java can be found. + + + + Configure File Format + --------------------- + +<AutodocConfiguration> + <RepositoryName></RepositoryName> + // Base name of the binary repository files. + // Has to be a valid file name. + + <HtmlOutputTitle></HtmlOutputTitle> + // Title on the "welcome page" of the created HTML documentation. + // Can be any text. + + <CppExtensions></CppExtensions> + // Overwrites the default. Default is: .hxx .h .hpp + // Format: File extensions with a dot in front, like ".hcc". + + <IdlExtensions></IdlExtensions> + // Overwrites the default. Default is: .idl + // Format: File extensions with a dot in front, like ".txt". + + <CppDocu html="(on|off) off"/> + + <IdlDocu html="(on|off) on"/> + +</AutodocConfiguration> + + + + + + + Historical Command Line Options + ------------------------------- + +autodoc.exe + [ -v <VerboseNr> ] + -html <OutputDirectory> + { + [ -parse ] + [ -name <RepositoryName> ] + -lg <ProgrammingLanguage> + { + [ -p <ProjectName> <ProjectRootDirectory> ] + { + -t <SourceDirectory>* + -d <SourceDirectory>* + -f <SourceFile>* + }+ + }+ + } + +Legend: + <Text> + command line parameter + [ ] + optional + { } + Block of connected options. + The sequence of not connected options does not matter. So the -html or -v options can be used before or after all the parsing options. + + + once or more times + * + none or more times + + +Explanation of the Options + -v <VerboseNr> Only for debugging. Bits 1, 2 and 4 in any combination give different output. + -html <OutputDirectory> + Gives the directory, where a HTML version of the docu shall be generated. + -parse Starts the block, where all the parse options are given. This can be omitted, because the parse options are identifiable without it, but it may make a commandline more readable. + -name <RepositoryName> This name appears as title of the documentation (currently only in the in the C++ version). + -lg <ProgrammingLanguage> + + + Possible values are: + + c++ + This parses all files with the endings .hxx and .h . + idl + This parses all files with the ending .idl . + + -p with -t/-d/-f: If there are more than one project, the -p option is required for each one. + + The directory given wit the -p option is the root directory of the project. + If there is no -p option, the working directory is seen as root. + + All paths given with -t/-d/-f are relative to that root directory. It is possible to use "." as argument for -t or -d. + + Each of -t/-d/-f can have several arguments: + One could write "-f file1.hxx file2.hxx file_xyz.hxx" + After each -p (or after -lg, if there is no -p option), there has to be at least one of the following three: + -t Tree, which means: include subdirectories + -d Directory, which means: no subdirectories + -f File", which means: single file name with ending. + This option also allows to parse some files with an ending different from those, the -lg option implies. + + + diff --git a/autodoc/source/exes/adc_uni/spec-DevGuideReferenceFile.txt b/autodoc/source/exes/adc_uni/spec-DevGuideReferenceFile.txt new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/autodoc/source/exes/adc_uni/spec-DevGuideReferenceFile.txt diff --git a/autodoc/source/exes/adc_uni/spec-SinceTag_Handling.txt b/autodoc/source/exes/adc_uni/spec-SinceTag_Handling.txt new file mode 100644 index 000000000000..7cf264e76be3 --- /dev/null +++ b/autodoc/source/exes/adc_uni/spec-SinceTag_Handling.txt @@ -0,0 +1,49 @@ + General Handling + ---------------- + +- The developer inserts the OpenOffice.org version into the @since tag. + +- @since-Tag may contain any string which needs to end with a Version number. + The first cipher following immediately on a white space is interpreted as start of the version number. + +- The @since Tag must stay completely within one line to allow tool support for retargeting. + +- To replace @since entries in the generated documentation, one needs to use + the command line option + + -sincefile <TransformationFile-path> + + This option has to occur immediately after the -html option. + If this option is not given, the original text of the @since tag is + displayed. + + If the TransformationFile does not contain a specific entry, + nothing is displayed for this entry. + + + + Format of the @since Tag Transformation File + -------------------------------------------- + +Example +------- + +***** BEGIN OF FILE ****** +"1.1" "StarOffice 7.0" +"2.0" "StarOffice 8.0" +"2.1" "StarOffice 9.0" +***** END OF FILE ****** + + + +Rules and Restrictions +---------------------- + +* Each line contains two strings within "". + The first string is the OpenOffice.org version number which is found in the @since tag. + The second string is the string to display for this version. +* No specific order among product versions is needed. +* Empty lines and whitespaces are allowed, except: + - Non empty lines must not start with white space. + - Within OpenOffice.org version strings, no whitespace is allowed. +* Whitespace within display strings is displayed as it is. diff --git a/autodoc/source/inc/adc_cl.hxx b/autodoc/source/inc/adc_cl.hxx new file mode 100644 index 000000000000..895c5a4f2667 --- /dev/null +++ b/autodoc/source/inc/adc_cl.hxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_cl.hxx,v $ + * $Revision: 1.9 $ + * + * 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 ADC_ADC_CL_HXX +#define ADC_ADC_CL_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <cosv/comdline.hxx> + // COMPONENTS + // PARAMETERS + +namespace ary +{ + class Repository; +} + +namespace autodoc +{ +namespace command +{ + class Command; + class CreateHtml; + class SinceTagTransformationData; +} + + +/** Reads and runs an Autodoc command line. +*/ +class CommandLine : public csv::CommandLine_Ifc +{ + public: + // LIFECYCLE + CommandLine(); + ~CommandLine(); + // OPERATIONS + int Run() const; + + // INQUIRY + // debugging + bool DebugStyle_ShowText() const; + bool DebugStyle_ShowStoredObjects() const; + bool DebugStyle_ShowTokens() const; + + // @since tags + bool DoesTransform_SinceTag() const; + +// /// @see command::SinceTagTransformationData::StripSinceTagValue() +// bool Strip_SinceTagText( +// String & io_sSinceTagValue ) const; + + /// @see command::SinceTagTransformationData::DisplayOf() + const String & DisplayOf_SinceTagValue( + const String & i_sVersionNumber ) const; + + // extern IDL links + const String & ExternRoot() const { return sExternRoot; } + const String & ExternNamespace() const { return sExternNamespace; } + + bool CppUsed() const { return bCpp; } + bool IdlUsed() const { return bIdl; } + + // ACCESS + static CommandLine & + Get_(); + void Set_ExternRoot( + const String & i_s ) + { sExternRoot = i_s; } + void Set_ExternNamespace( + const String & i_s ) + { sExternNamespace = i_s; } + ary::Repository & TheRepository() const { csv_assert(pReposy != 0); + return *pReposy; } + void Set_CppUsed() { bCpp = true; } + void Set_IdlUsed() { bIdl = true; } + + private: + // Interface cosv::CommandLine_Ifc: + virtual void do_Init( + int argc, + char * argv[] ); + virtual void do_PrintUse() const; + virtual bool inq_CheckParameters() const; + + // Locals + typedef StringVector::const_iterator opt_iter; + typedef std::vector< DYN command::Command* > CommandList; + + void load_IncludedCommands( + StringVector & out, + const char * i_filePath ); + + void do_clVerbose( + opt_iter & it, + opt_iter itEnd ); + void do_clParse( + opt_iter & it, + opt_iter itEnd ); + void do_clCreateHtml( + opt_iter & it, + opt_iter itEnd ); + void do_clSinceFile( + opt_iter & it, + opt_iter itEnd ); + +// void do_clCreateXml( +// opt_iter & it, +// opt_iter itEnd ); +// void do_clLoad( +// opt_iter & it, +// opt_iter itEnd ); +// void do_clSave( +// opt_iter & it, +// opt_iter itEnd ); + + void sort_Commands(); + + // DATA + uintt nDebugStyle; + Dyn<command::SinceTagTransformationData> + pSinceTransformator; + + CommandList aCommands; + bool bInitOk; + command::CreateHtml * + pCommand_CreateHtml; + + String sExternRoot; + String sExternNamespace; + + mutable Dyn<ary::Repository> + pReposy; + bool bCpp; + bool bIdl; + + static CommandLine * + pTheInstance_; +}; + + + +// IMPLEMENTATION +inline bool +CommandLine::DebugStyle_ShowText() const + { return (nDebugStyle & 2) != 0; } +inline bool +CommandLine::DebugStyle_ShowStoredObjects() const + { return (nDebugStyle & 4) != 0; } +inline bool +CommandLine::DebugStyle_ShowTokens() const + { return (nDebugStyle & 1) != 0; } + +} // namespace autodoc + + +inline bool +DEBUG_ShowText() + { return autodoc::CommandLine::Get_().DebugStyle_ShowText(); } +inline bool +DEBUG_ShowStoring() + { return autodoc::CommandLine::Get_().DebugStyle_ShowStoredObjects(); } +inline bool +DEBUG_ShowTokens() + { return autodoc::CommandLine::Get_().DebugStyle_ShowTokens(); } + +#endif + diff --git a/autodoc/source/inc/adc_msg.hxx b/autodoc/source/inc/adc_msg.hxx new file mode 100644 index 000000000000..996b6d7dc270 --- /dev/null +++ b/autodoc/source/inc/adc_msg.hxx @@ -0,0 +1,144 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_msg.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_ADC_MSG_HXX +#define ADC_ADC_MSG_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +namespace csv +{ + class File; +} + + +namespace autodoc +{ + + +/** Gathers, sorts and displays (mainly diagnostic) messages to the + user of Autodoc. +*/ +class Messages +{ + public: + // LIFECYCLE + Messages(); + ~Messages(); + // OPERATIONS + void WriteFile( + const String & i_sOutputFilePath); + // INQUIRY + + // ACCESS + void Out_MissingDoc( + const String & i_sEntity, + const String & i_sFile, + uintt i_nLine); + void Out_ParseError( + const String & i_sFile, + uintt i_nLine); + void Out_InvalidConstSymbol( + const String & i_sText, + const String & i_sFile, + uintt i_nLine); + void Out_UnresolvedLink( + const String & i_sLinkText, + const String & i_sFile, + uintt i_nLine); + void Out_TypeVsMemberMisuse( + const String & i_sLinkText, + const String & i_sFile, + uintt i_nLine); + + static Messages & The_(); + + private: + struct Location + { + String sFile; + uintt nLine; + + Location( + const String & i_file, + uintt i_line) + : sFile(i_file), + nLine(i_line) {} + bool operator<( + const Location & i_other) const + { int cmp = csv::compare(sFile,i_other.sFile); + return cmp < 0 + ? true + : cmp > 0 + ? false + : nLine < i_other.nLine; + } + }; + + typedef std::map<Location,String> MessageMap; + + // Locals + void AddValue( + MessageMap & o_dest, + const String & i_sText, + const String & i_sFile, + uintt i_nLine ); + void WriteParagraph( + csv::File & o_out, + const MessageMap & i_source, + const String & i_title, + const String & i_firstIntermediateText ); + + // DATA + MessageMap aMissingDocs; + MessageMap aParseErrors; + MessageMap aInvalidConstSymbols; + MessageMap aUnresolvedLinks; + MessageMap aTypeVsMemberMisuses; +}; + + + +// IMPLEMENTATION + + +} // namespace autodoc + +inline autodoc::Messages & +TheMessages() +{ + return autodoc::Messages::The_(); +} + +#endif diff --git a/autodoc/source/inc/docu_node_ids.hxx b/autodoc/source/inc/docu_node_ids.hxx new file mode 100644 index 000000000000..c7b11c234cd4 --- /dev/null +++ b/autodoc/source/inc/docu_node_ids.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: docu_node_ids.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_DOCU_NODE_IDS_HXX +#define ADC_DOCU_NODE_IDS_HXX + + + +namespace ary +{ +namespace doc +{ +namespace nodetype +{ +enum E_Ids +{ + + nt_none, + nt_OldCppDocu, + nt_OldIdlDocu + + + + + + + + + +}; +} // namespace nodetype +} // namespace doc +} // namespace ary + +namespace docnt = ::ary::doc::nodetype; + + + + +#endif diff --git a/autodoc/source/inc/estack.hxx b/autodoc/source/inc/estack.hxx new file mode 100644 index 000000000000..b1946c174e7d --- /dev/null +++ b/autodoc/source/inc/estack.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: estack.hxx,v $ + * $Revision: 1.6 $ + * + * 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_ESTACK_HXX +#define ARY_ESTACK_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <slist> + // COMPONENTS + // PARAMETERS + + + +template <class ELEM> +class EStack : private std::slist<ELEM> +{ + private: + typedef std::slist<ELEM> base; + const base & Base() const { return *this; } + base & Base() { return *this; } + + public: + typedef ELEM value_type; + typedef typename std::slist<ELEM>::size_type size_type; + + // LIFECYCLE + EStack() {} + EStack( + const EStack & i_rStack ) + : base( (const base &)(i_rStack) ) {} + ~EStack() {} + // OPERATORS + EStack & operator=( + const EStack & i_rStack ) + { base::operator=( i_rStack.Base() ); + return *this; } + bool operator==( + const EStack<ELEM> & + i_r2 ) const + { return std::operator==( Base(), this->i_rStack.Base() ); } + bool operator<( + const EStack<ELEM> & + i_r2 ) const + { return std::operator<( Base(), this->i_rStack.Base() ); } + // OPERATIONS + void push( + const value_type & i_rElem ) + { base::push_front(i_rElem); } + void pop() { base::pop_front(); } + void erase_all() { while (NOT empty()) pop(); } + + // INQUIRY + const value_type & top() const { return base::front(); } + size_type size() const { return base::size(); } + bool empty() const { return base::empty(); } + + // ACCESS + value_type & top() { return base::front(); } +}; + + + +// IMPLEMENTATION + + +#endif + diff --git a/autodoc/source/inc/luxenum.hxx b/autodoc/source/inc/luxenum.hxx new file mode 100644 index 000000000000..eee69d734f40 --- /dev/null +++ b/autodoc/source/inc/luxenum.hxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: luxenum.hxx,v $ + * $Revision: 1.7 $ + * + * 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 UDM_LUXENUM_HXX +#define UDM_LUXENUM_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +#include <map> +#include <algorithm> + + +namespace lux +{ + +typedef std::map< intt, String > EnumValueMap; + + +template <class DIFF> +class Enum // : public Template_Base +{ + public: + // TYPES + typedef Enum< DIFF > self; + + // LIFECYCLE + Enum( + DIFF i_nValue, + const char * i_sText ) + : nValue(i_nValue) { Values_()[nValue] = i_sText; + // Sequence_().insert( + // std::lower_bound( Sequence_().begin(), Sequence_().end(), i_nValue ), + // i_nValue ); + } + Enum( + DIFF i_nValue ) + : nValue(i_nValue) { ; } + Enum( + intt i_nValue = 0 ) + : nValue(i_nValue) { if ( NOT CheckIntt(i_nValue) ) { csv_assert(false); } } + Enum( + const self & i_rEnum ) + : nValue(i_rEnum.nValue) {;} + + self & operator=( + DIFF i_nValue ) + { nValue = i_nValue; return *this; } + self & operator=( + intt i_nValue ) + { if ( CheckIntt(i_nValue) ) {nValue = DIFF(i_nValue);} + else {csv_assert(false);} return *this; } + self & operator=( + const self & i_rEnum ) + { nValue = i_rEnum.nValue; return *this; } + operator DIFF() const { return DIFF(nValue); } + + DIFF operator()() const { return nValue; } + const String & Text() const { return Values_()[nValue]; } + + private: + static EnumValueMap & + Values_(); + bool CheckIntt( + intt i_nNumber ) + { return Values_().find(i_nNumber) != Values_().end(); } + // DATA + intt nValue; +}; + + + + +} // namespace lux +#endif + diff --git a/autodoc/source/inc/manip.hxx b/autodoc/source/inc/manip.hxx new file mode 100644 index 000000000000..afa03e9be1b5 --- /dev/null +++ b/autodoc/source/inc/manip.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: manip.hxx,v $ + * $Revision: 1.4 $ + * + * 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_MANIP_HXX +#define ARY_MANIP_HXX + +template <class XY > +class Manipulator +{ + public: + virtual ~Manipulator() {} + + void operator()( + XY & io_r ) const + { op_fcall(io_r); } + private: + virtual void op_fcall( + XY & io_r ) const = 0; +}; + +template <class XY > +class Const_Manipulator +{ + public: + virtual ~Const_Manipulator() {} + + void operator()( + const XY & io_r ) const + { op_fcall(io_r); } + private: + virtual void op_fcall( + const XY & io_r ) const = 0; +}; + + +#endif + diff --git a/autodoc/source/inc/precomp.h b/autodoc/source/inc/precomp.h new file mode 100644 index 000000000000..ae288a3e8d1c --- /dev/null +++ b/autodoc/source/inc/precomp.h @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: precomp.h,v $ + * $Revision: 1.8 $ + * + * 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 ADC_PRECOMP_H_06071998 +#define ADC_PRECOMP_H_06071998 + + +// For en/disabling csv_assertions: +#ifndef DEBUG +#define CSV_NO_ASSERTIONS +#endif + +#include <cosv/csv_precomp.h> + +#include <vector> +#include <map> +#include <set> + + + +// Shortcuts to access csv::-types: +using csv::String; +using csv::StringVector; +using csv::StreamStr; +using csv::c_str; +typedef csv::StreamStrLock StreamLock; + + + +inline std::ostream & +Cout() { return std::cout; } +inline std::ostream & +Cerr() { return std::cerr; } + +inline csv::F_FLUSHING_FUNC +Endl() { return csv::Endl; } +inline csv::F_FLUSHING_FUNC +Flush() { return csv::Flush; } + + + + +#endif diff --git a/autodoc/source/inc/prprpr.hxx b/autodoc/source/inc/prprpr.hxx new file mode 100644 index 000000000000..9f67732002b4 --- /dev/null +++ b/autodoc/source/inc/prprpr.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: prprpr.hxx,v $ + * $Revision: 1.3 $ + * + * 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_PRPRPR_HXX // PRePRocessorPRocessing +#define ARY_CPP_PRPRPR_HXX + + + +// Implemented in autodoc/source/parser/cpp/defdescr.cxx . + +bool CheckForOperator( + bool & o_bStringify, + bool & o_bConcatenate, + const String & i_sTextItem ); +void Do_bConcatenate( + csv::StreamStr & o_rText, + bool & io_bConcatenate ); +void Do_bStringify_begin( + csv::StreamStr & o_rText, + bool i_bStringify ); +void Do_bStringify_end( + csv::StreamStr & o_rText, + bool & io_bStringify ); +bool HandleOperatorsBeforeTextItem( /// @return true, if text item is done here + csv::StreamStr & o_rText, + bool & io_bStringify, + bool & io_bConcatenate, + const String & i_sTextItem ); + + + + +#endif diff --git a/autodoc/source/inc/tools/filecoll.hxx b/autodoc/source/inc/tools/filecoll.hxx new file mode 100644 index 000000000000..028001f777c8 --- /dev/null +++ b/autodoc/source/inc/tools/filecoll.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: filecoll.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_FILECOLL_HXX +#define ADC_FILECOLL_HXX + +// USED SERVICES + // BASE CLASSES +#include <autodoc/filecoli.hxx> + // COMPONENTS + // PARAMETERS + + + +class FileCollector : public autodoc::FileCollector_Ifc +{ + public: + // LIFECYCLE + FileCollector( + uintt i_nRoughNrOfFiles = 0 ); + + // OPERATIONS + virtual uintt AddFilesFrom( + const char * i_sRootDir, + const char * i_sFilter, + E_SearchMode i_eSearchMode ); + virtual uintt AddFile( + const char * i_sFilePath ); + virtual void EraseAll(); + + // INQUIRY + virtual const_iterator + Begin() const; + virtual const_iterator + End() const; + virtual uintt Size() const; + + private: + // DATA + StringVector aFoundFiles; +}; + + +#endif + diff --git a/autodoc/source/inc/tools/tkpchars.hxx b/autodoc/source/inc/tools/tkpchars.hxx new file mode 100644 index 000000000000..03cc774c4dbe --- /dev/null +++ b/autodoc/source/inc/tools/tkpchars.hxx @@ -0,0 +1,173 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkpchars.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_TKPCHARS_HXX +#define ADC_TKPCHARS_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETRS +#include <adc_cl.hxx> +#include <stack> + + + +/** @descr + + dpSource: + + 1||||||||||||||||||||||a||||||||||||b|||c||||||||||||||||||||... + + + 1 := first character of Sourcecode. + a := nLastTokenStart, there starts the last cut token. + b := nLastCut, there is a '\0'-char which marks the end of + the last cut token. The original character at b is stored + in cCharAtLastCut and will replace the '\0'-char, when the + next token is cut. + c := The current cursor position. + + + @needs cosv.lib + + @use This class can be used by any parser to get the chars of a + text one by one and separate them to tokens. +**/ + +class CharacterSource +{ + public: + // LIFECYCLE + CharacterSource(); + ~CharacterSource(); + + // OPERATIONS + /** Loads the complete contents of in_rSource into the classes private memory. + If in_rSource is a file, it has to be open of course. + After loading the text, the CurChar() is set on the begin of the text. + **/ + void LoadText( + csv::bstream & io_rSource); + + void InsertTextAtCurPos( + const char * i_sText2Insert ); + + /// @return CurChar() after moving forward one char. + char MoveOn(); + /** @return + The token which starts at the char which was CurChar(), when + CutToken() was called the last time - or at the beginning of the text. + The token ends by the CurChar() being replaced by a '\0'. + + Value is valid until the next call of CutToken() or ~CharacterSource(). + **/ + const char * CutToken(); + + // INQUIRY + char CurChar() const; + /// @return The result of the last CutToken(). Or NULL, if there was none yet. + const char * CurToken() const; + + // INQUIRY + /// @return true, if + bool IsFinished() const; + + private: + struct S_SourceState + { + DYN char * dpSource; + intt nSourceSize; + + intt nCurPos; + intt nLastCut; + intt nLastTokenStart; + char cCharAtLastCut; + + S_SourceState( + DYN char * dpSource, + intt nSourceSize, + intt nCurPos, + intt nLastCut, + intt nLastTokenStart, + char cCharAtLastCut ); + }; + + void BeginSource(); + intt CurPos() const; + char MoveOn_OverStack(); + + // DATA + std::stack< S_SourceState > + aSourcesStack; + + DYN char * dpSource; + intt nSourceSize; + + intt nCurPos; + intt nLastCut; + intt nLastTokenStart; + char cCharAtLastCut; +}; + + +inline char +CharacterSource::MoveOn() + { +if (DEBUG_ShowText()) +{ + Cerr() << char(dpSource[nCurPos+1]) << Flush(); +} + if ( nCurPos < nSourceSize-1 ) + return dpSource[++nCurPos]; + else if ( aSourcesStack.size() > 0 ) + return MoveOn_OverStack(); + else + return dpSource[nCurPos = nSourceSize]; + } +inline char +CharacterSource::CurChar() const + { return nCurPos != nLastCut ? dpSource[nCurPos] : cCharAtLastCut; } +inline const char * +CharacterSource::CurToken() const + { return &dpSource[nLastTokenStart]; } +inline bool +CharacterSource::IsFinished() const + { return nCurPos >= nSourceSize; } +inline intt +CharacterSource::CurPos() const + { return nCurPos; } + + + + +#endif + + diff --git a/autodoc/source/mkinc/fullcpp.mk b/autodoc/source/mkinc/fullcpp.mk new file mode 100644 index 000000000000..2bc5f0438a68 --- /dev/null +++ b/autodoc/source/mkinc/fullcpp.mk @@ -0,0 +1,58 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: fullcpp.mk,v $ +# +# $Revision: 1.10 $ +# +# 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. +# +#************************************************************************* + + + +# --- Settings ----------------------------------------------------- +# Has to be included AFTER settings.mk ! + + +# RTTI +.IF "$(GUI)"=="WNT" +CFLAGS+= -GR +.ENDIF +.IF "$(OS)"=="LINUX" || "$(OS)"=="FREEBSD" || "$(OS)"=="NETBSD" || $(COM) == "GCC" +CFLAGSCXX+= -frtti +.ENDIF + + + +# Precompiled Headers +.IF "$(NP_LOCALBUILD)"!="" && "$(GUI)"=="WNT" + +PCH_NAME=autodoc +.IF "$(debug)"=="" +CFLAGS+= -YX"precomp.h" -Fp$(PRJ)$/$(INPATH)$/misc$/$(PCH_NAME).pch +.ELSE +CFLAGS+= -YX"precomp.h" -Fp$(PRJ)$/$(INPATH)$/misc$/$(PCH_NAME).pcd +.ENDIF + +.ENDIF # "$(NP_LOCALBUILD)"!="" && "$(GUI)"=="WNT" diff --git a/autodoc/source/parser/adoc/a_rdocu.cxx b/autodoc/source/parser/adoc/a_rdocu.cxx new file mode 100644 index 000000000000..8ec5e73d9fef --- /dev/null +++ b/autodoc/source/parser/adoc/a_rdocu.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: a_rdocu.cxx,v $ + * $Revision: 1.6 $ + * + * 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 <adoc/a_rdocu.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <adoc/docu_pe.hxx> +#include <adoc/adoc_tok.hxx> +#include <ary/doc/d_oldcppdocu.hxx> +#include <doc_deal.hxx> + + + +namespace adoc +{ + + +DocuExplorer::DocuExplorer() + : pDocuDistributor(0), + pPE(new Adoc_PE), + bIsPassedFirstDocu(false) +{ +} + +DocuExplorer::~DocuExplorer() +{ +} + +void +DocuExplorer::StartNewFile( DocuDealer & o_rDocuDistributor ) +{ + pDocuDistributor = &o_rDocuDistributor; + bIsPassedFirstDocu = false; +} + + +void +DocuExplorer::Process_Token( DYN adoc::Token & let_drToken ) +{ + csv_assert(pDocuDistributor != 0); + + let_drToken.Trigger(*pPE); + if ( pPE->IsComplete() ) + { + ary::doc::OldCppDocu * + pDocu = pPE->ReleaseJustParsedDocu(); + if ( pDocu != 0 ) + { + if (bIsPassedFirstDocu) + pDocuDistributor->TakeDocu( *pDocu ); + else + { + delete pDocu; + bIsPassedFirstDocu = true; + } + } + } + + delete &let_drToken; +} + + +} // namespace adoc + diff --git a/autodoc/source/parser/adoc/adoc_tok.cxx b/autodoc/source/parser/adoc/adoc_tok.cxx new file mode 100644 index 000000000000..353fec80ca0c --- /dev/null +++ b/autodoc/source/parser/adoc/adoc_tok.cxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adoc_tok.cxx,v $ + * $Revision: 1.7 $ + * + * 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 <adoc/adoc_tok.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <adoc/atokdeal.hxx> +#include <../cpp/c_dealer.hxx> + + +namespace adoc { + +void +Token::DealOut( ::TokenDealer & o_rDealer ) +{ + o_rDealer.AsDistributor()->Deal_AdcDocu(*this); +} + + +} // namespace adoc + diff --git a/autodoc/source/parser/adoc/cx_a_std.cxx b/autodoc/source/parser/adoc/cx_a_std.cxx new file mode 100644 index 000000000000..3066d0f85cd8 --- /dev/null +++ b/autodoc/source/parser/adoc/cx_a_std.cxx @@ -0,0 +1,519 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_a_std.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <adoc/cx_a_std.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <adoc/cx_a_sub.hxx> +#include <x_parse.hxx> +#include <tools/tkpchars.hxx> +#include <adoc/tk_attag.hxx> +#include <adoc/tk_docw.hxx> +#include <tokens/tokdeal.hxx> + + + +namespace adoc { + + +const intt C_nStatusSize = 128; +const intt C_nCppInitialNrOfStati = 400; + + +const uintt nF_fin_Error = 1; +const uintt nF_fin_Ignore = 2; +const uintt nF_fin_LineStart = 3; +const uintt nF_fin_Eol = 4; +const uintt nF_fin_Eof = 5; +const uintt nF_fin_AnyWord = 6; +const uintt nF_fin_Whitespace = 7; + +const uintt nF_goto_AtTag = 20; +const uintt nF_goto_CheckStar = 21; + +DYN TextToken * TCF_DocWord(const char * text) { return new Tok_DocWord(text); } + +DYN TextToken * TCF_atstd_ATT(const char * ) { return new Tok_at_std(ary::info::atid_ATT); } +DYN TextToken * TCF_atstd_author(const char * ) { return new Tok_at_std(ary::info::atid_author); } +DYN TextToken * TCF_atstd_change(const char * ) { return new Tok_at_std(ary::info::atid_change); } +DYN TextToken * TCF_atstd_collab(const char * ) { return new Tok_at_std(ary::info::atid_collab); } +DYN TextToken * TCF_atstd_contact(const char * ) { return new Tok_at_std(ary::info::atid_contact); } +DYN TextToken * TCF_atstd_copyright(const char * ) { return new Tok_at_std(ary::info::atid_copyright); } +DYN TextToken * TCF_atstd_descr(const char * ) { return new Tok_at_std(ary::info::atid_descr); } +DYN TextToken * TCF_atstd_docdate(const char * ) { return new Tok_at_std(ary::info::atid_docdate); } +DYN TextToken * TCF_atstd_derive(const char * ) { return new Tok_at_std(ary::info::atid_derive); } +DYN TextToken * TCF_atstd_instance(const char * ) { return new Tok_at_std(ary::info::atid_instance); } +DYN TextToken * TCF_atstd_life(const char * ) { return new Tok_at_std(ary::info::atid_life); } +DYN TextToken * TCF_atstd_multi(const char * ) { return new Tok_at_std(ary::info::atid_multi); } +DYN TextToken * TCF_atstd_onerror(const char * ) { return new Tok_at_std(ary::info::atid_onerror); } +DYN TextToken * TCF_atstd_persist(const char * ) { return new Tok_at_std(ary::info::atid_persist); } +DYN TextToken * TCF_atstd_postcond(const char * ) { return new Tok_at_std(ary::info::atid_postcond); } +DYN TextToken * TCF_atstd_precond(const char * ) { return new Tok_at_std(ary::info::atid_precond); } +DYN TextToken * TCF_atstd_responsibility(const char * ) { return new Tok_at_std(ary::info::atid_resp); } +DYN TextToken * TCF_atstd_return(const char * ) { return new Tok_at_std(ary::info::atid_return); } +DYN TextToken * TCF_atstd_short(const char * ) { return new Tok_at_std(ary::info::atid_short); } +DYN TextToken * TCF_atstd_todo(const char * ) { return new Tok_at_std(ary::info::atid_todo); } +DYN TextToken * TCF_atstd_version(const char * ) { return new Tok_at_std(ary::info::atid_version); } + +DYN TextToken * TCF_at_base(const char *) { return new Tok_at_base; } +DYN TextToken * TCF_at_exception(const char *) { return new Tok_at_exception; } +DYN TextToken * TCF_at_impl(const char *) { return new Tok_at_impl; } +DYN TextToken * TCF_at_interface(const char *) { return new Tok_at_interface; } +DYN TextToken * TCF_at_key(const char *) { return new Tok_at_key; } +DYN TextToken * TCF_at_param(const char *) { return new Tok_at_param; } +DYN TextToken * TCF_at_see(const char *) { return new Tok_at_see; } +DYN TextToken * TCF_at_template(const char *) { return new Tok_at_template; } +DYN TextToken * TCF_at_internal(const char *) { return new Tok_at_internal; } +DYN TextToken * TCF_at_obsolete(const char *) { return new Tok_at_obsolete; } +DYN TextToken * TCF_at_module(const char *) { return new Tok_at_module; } +DYN TextToken * TCF_at_file(const char *) { return new Tok_at_file; } +DYN TextToken * TCF_at_gloss(const char *) { return new Tok_at_gloss; } +DYN TextToken * TCF_at_global(const char *) { return new Tok_at_global; } +DYN TextToken * TCF_at_include(const char *) { return new Tok_at_include; } +DYN TextToken * TCF_at_label(const char *) { return new Tok_at_label; } +DYN TextToken * TCF_at_since(const char *) { return new Tok_at_since; } +DYN TextToken * TCF_at_HTML(const char *) { return new Tok_at_HTML; } +DYN TextToken * TCF_at_NOHTML(const char *) { return new Tok_at_NOHTML; } +DYN TextToken * TCF_Whitespace(const char * i_sText); +DYN TextToken * TCF_EoDocu(const char *) { return new Tok_EoDocu; } +DYN TextToken * TCF_EoLine(const char *) { return new Tok_Eol; } +DYN TextToken * TCF_Eof(const char *) { return new Tok_Eof; } + + + + +Context_AdocStd::Context_AdocStd() + : aStateMachine(C_nStatusSize, C_nCppInitialNrOfStati), + pDealer(0), + pParentContext(0), + pFollowUpContext(0), + pCx_LineStart(0), + pCx_CheckStar(0), + pCx_AtTagCompletion(0), + pNewToken(0), + bIsMultiline(false) +{ + pCx_LineStart = new Cx_LineStart(*this); + pCx_CheckStar = new Cx_CheckStar(*this); + pCx_AtTagCompletion = new Cx_AtTagCompletion(*this); + + SetupStateMachine(); +} + +void +Context_AdocStd::SetParentContext( TkpContext & io_rParentContext, + const char * ) +{ + pFollowUpContext = pParentContext = &io_rParentContext; + pCx_CheckStar->Set_End_FollowUpContext(io_rParentContext); +} + +Context_AdocStd::~Context_AdocStd() +{ +} + +void +Context_AdocStd::AssignDealer( TokenDealer & o_rDealer ) +{ + pDealer = &o_rDealer; + pCx_LineStart->AssignDealer(o_rDealer); + pCx_CheckStar->AssignDealer(o_rDealer); + pCx_AtTagCompletion->AssignDealer(o_rDealer); +} + +void +Context_AdocStd::ReadCharChain( CharacterSource & io_rText ) +{ + csv_assert(pParentContext != 0); + pNewToken = 0; + + TextToken::F_CRTOK fTokenCreateFunction = 0; + StmBoundsStatus & rBound = aStateMachine.GetCharChain(fTokenCreateFunction, io_rText); + + // !!! + // The order of the next two lines is essential, because + // pFollowUpContext may be changed by PerformStatusFunction() also, + // which then MUST override the previous assignment. + pFollowUpContext = rBound.FollowUpContext(); + PerformStatusFunction(rBound.StatusFunctionNr(), fTokenCreateFunction, io_rText); +} + +bool +Context_AdocStd::PassNewToken() +{ + if (pNewToken) + { + pNewToken.Release()->DealOut(*pDealer); + return true; + } + return false; +} + +TkpContext & +Context_AdocStd::FollowUpContext() +{ + csv_assert(pFollowUpContext != 0); + return *pFollowUpContext; +} + +void +Context_AdocStd::PerformStatusFunction( uintt i_nStatusSignal, + F_CRTOK i_fTokenCreateFunction, + CharacterSource & io_rText ) +{ + switch (i_nStatusSignal) + { + case nF_fin_Error: + { + char cCC = io_rText.CurChar(); + String sChar( &cCC, 1 ); + throw X_Parser(X_Parser::x_InvalidChar, sChar, String ::Null_(), 0); + } // no break, because of throw + case nF_fin_Ignore: + io_rText.CutToken(); + pNewToken = 0; + break; + case nF_fin_LineStart: + csv_assert(i_fTokenCreateFunction != 0); + pNewToken = (*i_fTokenCreateFunction)(io_rText.CutToken()); + break; + case nF_fin_Eol: + io_rText.CutToken(); + pDealer->Deal_Eol(); + if ( bIsMultiline ) + { + pNewToken = TCF_EoLine(0); + pFollowUpContext = pCx_LineStart.Ptr(); + } + else + { + pNewToken = TCF_EoDocu(0); + pFollowUpContext = pParentContext; + } + break; + case nF_fin_Eof: + pNewToken = TCF_Eof(0); + break; + case nF_fin_AnyWord: + if (i_fTokenCreateFunction != 0) + pNewToken = (*i_fTokenCreateFunction)(io_rText.CutToken()); + else + pNewToken = TCF_DocWord(io_rText.CutToken()); + break; + case nF_fin_Whitespace: + pNewToken = TCF_Whitespace(io_rText.CutToken()); + break; + case nF_goto_AtTag: + pNewToken = 0; + pCx_AtTagCompletion->SetCurToken(i_fTokenCreateFunction); + break; + case nF_goto_CheckStar: + pNewToken = 0; + pCx_CheckStar->SetCanBeEnd( bIsMultiline ); + break; + default: + { + char cCC = io_rText.CurChar(); + String sChar( &cCC, 1 ); + throw X_Parser(X_Parser::x_InvalidChar, sChar, String::Null_(), 0); + } + } // end switch (i_nStatusSignal) +} + +void +Context_AdocStd::SetupStateMachine() +{ + // Besondere Array-Stati (kein Tokenabschluss oder Kontextwechsel): +// const INT16 bas = 0; // Base-Status + const INT16 wht = 1; // Whitespace-Status + const INT16 awd = 2; // Any-Word-Read-Status + + // Kontextwechsel-Stati: + const INT16 goto_CheckStar = 3; + const INT16 goto_AtTag = 4; + + // Tokenfinish-Stati: + const INT16 finError = 5; +// const INT16 finIgnore = 6; + const INT16 finEol = 7; + const INT16 finEof = 8; + const INT16 finAnyWord = 9; + const INT16 finWhitespace = 10; + + // Konstanten zur Benutzung in der Tabelle: + const INT16 fof = finEof; + const INT16 err = finError; + const INT16 faw = finAnyWord; +// const INT16 fig = finIgnore; + const INT16 fwh = finWhitespace; + + /// The '0's will be replaced by calls of AddToken(). + + const INT16 A_nTopStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht, 0,wht,wht, 0,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // ... 31 + wht,awd,awd,awd,awd,awd,awd,awd,awd,awd, 0,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 63 + 0,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 95 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd // ... 127 + }; + + const INT16 A_nWhitespaceStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht,fwh,wht,wht,fwh,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // ... 31 + wht,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, // ... 63 + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, // ... 95 + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh // ... 127 + }; + + const INT16 A_nWordStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {faw,err,err,err,err,err,err,err,err,faw,faw,faw,faw,faw,err,err, + err,err,err,err,err,err,err,err,err,err,faw,err,err,err,err,err, // ... 31 + faw,awd,awd,awd,awd,awd,awd,awd,awd,awd,faw,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 63 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 95 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd // ... 127 + }; + + const INT16 A_nAtTagDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {faw,err,err,err,err,err,err,err,err,faw,faw,faw,faw,faw,err,err, + err,err,err,err,err,err,err,err,err,err,faw,err,err,err,err,err, // ... 31 + faw,awd,awd,awd,awd,awd,awd,awd,awd,awd,faw,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 63 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 95 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd // ... 127 + }; + + const INT16 A_nPunctDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 16 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 48 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 80 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err // 112 ... + }; + + DYN StmArrayStatus * dpStatusTop + = new StmArrayStatus( C_nStatusSize, A_nTopStatus, 0, true); + DYN StmArrayStatus * dpStatusWhite + = new StmArrayStatus( C_nStatusSize, A_nWhitespaceStatus, 0, true); + DYN StmArrayStatus * dpStatusWord + = new StmArrayStatus( C_nStatusSize, A_nWordStatus, TCF_DocWord, true); + + DYN StmBoundsStatus * dpBst_goto_CheckStar + = new StmBoundsStatus( *this, *pCx_CheckStar, nF_goto_CheckStar, true ); + DYN StmBoundsStatus * dpBst_goto_AtTag + = new StmBoundsStatus( *this, *pCx_AtTagCompletion, nF_goto_AtTag, true ); + + DYN StmBoundsStatus * dpBst_finError + = new StmBoundsStatus( *this, TkpContext::Null_(), nF_fin_Error, true ); + DYN StmBoundsStatus * dpBst_finIgnore + = new StmBoundsStatus( *this, *this, nF_fin_Ignore, true); + DYN StmBoundsStatus * dpBst_finEol + = new StmBoundsStatus( *this, *pCx_LineStart, nF_fin_Eol, false); + DYN StmBoundsStatus * dpBst_finEof + = new StmBoundsStatus( *this, TkpContext::Null_(), nF_fin_Eof, false); + DYN StmBoundsStatus * dpBst_finAnyWord + = new StmBoundsStatus( *this, *this, nF_fin_AnyWord, true); + DYN StmBoundsStatus * dpBst_finWhitespace + = new StmBoundsStatus( *this, *this, nF_fin_Whitespace, true); + + // dpMain aufbauen: + aStateMachine.AddStatus(dpStatusTop); + aStateMachine.AddStatus(dpStatusWhite); + aStateMachine.AddStatus(dpStatusWord); + + aStateMachine.AddStatus(dpBst_goto_CheckStar); + aStateMachine.AddStatus(dpBst_goto_AtTag); + + aStateMachine.AddStatus(dpBst_finError); + aStateMachine.AddStatus(dpBst_finIgnore); + aStateMachine.AddStatus(dpBst_finEol); + aStateMachine.AddStatus(dpBst_finEof); + aStateMachine.AddStatus(dpBst_finAnyWord); + aStateMachine.AddStatus(dpBst_finWhitespace); + + aStateMachine.AddToken( "*", 0, A_nPunctDefStatus, goto_CheckStar ); + aStateMachine.AddToken( "@ATT", TCF_atstd_ATT, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@att", TCF_atstd_ATT, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@ATTENTION", + TCF_atstd_ATT, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@attention", + TCF_atstd_ATT, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@author", TCF_atstd_author, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@change", TCF_atstd_change, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@collab", TCF_atstd_collab, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@collaborator", + TCF_atstd_collab, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@contact", TCF_atstd_contact, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@copyright",TCF_atstd_copyright, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@descr", TCF_atstd_descr, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@docdate", TCF_atstd_docdate, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@derive", TCF_atstd_derive, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@instance",TCF_atstd_instance, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@life", TCF_atstd_life, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@lifecycle", + TCF_atstd_life, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@multi", TCF_atstd_multi, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@multiplicity", + TCF_atstd_multi, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@onerror", TCF_atstd_onerror, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@persist", TCF_atstd_persist, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@postcond",TCF_atstd_postcond,A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@precond", TCF_atstd_precond, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@resp", TCF_atstd_responsibility, + A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@responsibility", + TCF_atstd_return, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@return", TCF_atstd_return, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@short", TCF_atstd_short, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@todo", TCF_atstd_todo, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@version", TCF_atstd_version, A_nAtTagDefStatus, goto_AtTag ); + + aStateMachine.AddToken( "@base", TCF_at_base, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@exception",TCF_at_exception, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@impl", TCF_at_impl, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@key", TCF_at_key, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@param", TCF_at_param, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@see", TCF_at_see, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@seealso", TCF_at_see, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@since", TCF_at_since, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@tpl", TCF_at_template, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@tplparam", + TCF_at_template, A_nAtTagDefStatus, goto_AtTag ); + + aStateMachine.AddToken( "@interface",TCF_at_interface, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@internal",TCF_at_internal, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@obsolete",TCF_at_obsolete, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@deprecated",TCF_at_obsolete, A_nAtTagDefStatus, goto_AtTag ); + + aStateMachine.AddToken( "@module", TCF_at_module, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@file", TCF_at_file, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@gloss", TCF_at_gloss, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@global#", TCF_at_global, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@include#",TCF_at_include, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@#", TCF_at_label, A_nAtTagDefStatus, goto_AtTag ); + + aStateMachine.AddToken( "@HTML", TCF_at_HTML, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@NOHTML", TCF_at_NOHTML, A_nAtTagDefStatus, goto_AtTag ); + + aStateMachine.AddToken( "\r\n", 0, A_nPunctDefStatus, finEol ); + aStateMachine.AddToken( "\n", 0, A_nPunctDefStatus, finEol ); + aStateMachine.AddToken( "\r", 0, A_nPunctDefStatus, finEol ); +}; + +void +Context_AdocStd::SetMode_IsMultiLine( bool i_bTrue ) +{ + bIsMultiline = i_bTrue; +} + +DYN TextToken * +TCF_Whitespace(const char * i_sText) +{ + UINT8 nSize = static_cast<UINT8>(strlen(i_sText)); + for ( const char * pTab = strchr(i_sText,'\t'); + pTab != 0; + pTab = strchr(pTab+1,'\t') ) + { + nSize += 3; + } + + return new Tok_Whitespace(nSize); +} + + +} // namespace adoc + + +/* +@ATT[ENTION] +@author +@change[s] +@collab[orators] +@contact +@copyright +@descr +@devstat[e] +@docdate +@derive +@instance +@life[cycle] +@multi[plicity] +@onerror +@persist[ence] +@postcond +@precond +@return +@short +@todo + +@module +@file +@gloss[ary] + + +@base <BasisklassenName> +@exception <ExceptionName> +@impl[ements] <IDL-Construct> +@key[words]|[s] +@param <FunctionParameterName> [<Range of valid values>] +@see[also] +@templ[ate] <FormalTemplateParameterName> + +@internal +@obsolete + +@#<Label> + +@global#<Label> Global comment. +@include#<Label> + + +*/ + diff --git a/autodoc/source/parser/adoc/cx_a_sub.cxx b/autodoc/source/parser/adoc/cx_a_sub.cxx new file mode 100644 index 000000000000..448829901751 --- /dev/null +++ b/autodoc/source/parser/adoc/cx_a_sub.cxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_a_sub.cxx,v $ + * $Revision: 1.6 $ + * + * 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 <adoc/cx_a_sub.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <tokens/parseinc.hxx> +#include <x_parse.hxx> +#include <adoc/tk_docw.hxx> + + +namespace adoc { + +//************************ Cx_LineStart ************************// + +Cx_LineStart::Cx_LineStart( TkpContext & i_rFollowUpContext ) + : pDealer(0), + pFollowUpContext(&i_rFollowUpContext) +{ +} + +void +Cx_LineStart::ReadCharChain( CharacterSource & io_rText ) +{ + uintt nCount = 0; + for ( char cNext = io_rText.CurChar(); cNext == 32 OR cNext == 9; cNext = io_rText.MoveOn() ) + { + if (cNext == 32) + nCount++; + else if (cNext == 9) + nCount += 4; + } + io_rText.CutToken(); + + if (nCount < 50) + pNewToken = new Tok_LineStart(UINT8(nCount)); + else + pNewToken = new Tok_LineStart(0); +} + +bool +Cx_LineStart::PassNewToken() +{ + if (pNewToken) + { + pNewToken.Release()->DealOut(*pDealer); + return true; + } + return false; +} + +TkpContext & +Cx_LineStart::FollowUpContext() +{ + return *pFollowUpContext; +} + + +//************************ Cx_CheckStar ************************// + +Cx_CheckStar::Cx_CheckStar( TkpContext & i_rFollowUpContext ) + : pDealer(0), + pFollowUpContext(&i_rFollowUpContext), + pEnd_FollowUpContext(0), + bCanBeEnd(false), + bEndTokenFound(false) +{ +} + + +void +Cx_CheckStar::ReadCharChain( CharacterSource & io_rText ) +{ + bEndTokenFound = false; + if (bCanBeEnd) + { + char cNext = jumpOver(io_rText,'*'); + if ( NULCH == cNext ) + throw X_Parser(X_Parser::x_UnexpectedEOF, "", String::Null_(), 0); + if (cNext == '/') + { + io_rText.MoveOn(); + pNewToken = new Tok_EoDocu; + bEndTokenFound = true; + } + else + { + pNewToken = new Tok_DocWord(io_rText.CutToken()); + } + } + else + { + jumpToWhite(io_rText); + pNewToken = new Tok_DocWord(io_rText.CutToken()); + } +} + +bool +Cx_CheckStar::PassNewToken() +{ + if (pNewToken) + { + pNewToken.Release()->DealOut(*pDealer); + return true; + } + return false; +} + +TkpContext & +Cx_CheckStar::FollowUpContext() +{ + if (bEndTokenFound) + return *pEnd_FollowUpContext; + else + return *pFollowUpContext; +} + + +//************************ Cx_AtTagCompletion ************************// + +Cx_AtTagCompletion::Cx_AtTagCompletion( TkpContext & i_rFollowUpContext ) + : pDealer(0), + pFollowUpContext(&i_rFollowUpContext) +{ +} + +void +Cx_AtTagCompletion::ReadCharChain( CharacterSource & io_rText ) +{ + jumpToWhite(io_rText); + csv_assert(fCur_TokenCreateFunction != 0); + pNewToken = (*fCur_TokenCreateFunction)(io_rText.CutToken()); +} + +bool +Cx_AtTagCompletion::PassNewToken() +{ + if (pNewToken) + { + pNewToken.Release()->DealOut(*pDealer); + return true; + } + return false; +} + +TkpContext & +Cx_AtTagCompletion::FollowUpContext() +{ + return *pFollowUpContext; +} + + + + +} // namespace adoc + diff --git a/autodoc/source/parser/adoc/docu_pe.cxx b/autodoc/source/parser/adoc/docu_pe.cxx new file mode 100644 index 000000000000..97f36ac36476 --- /dev/null +++ b/autodoc/source/parser/adoc/docu_pe.cxx @@ -0,0 +1,406 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: docu_pe.cxx,v $ + * $Revision: 1.9 $ + * + * 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 <adoc/docu_pe.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/doc/d_oldcppdocu.hxx> +#include <ary/info/ci_attag.hxx> +#include <ary/info/ci_text.hxx> +#include <adoc/adoc_tok.hxx> +#include <adoc/tk_attag.hxx> +#include <adoc/tk_docw.hxx> + + +namespace adoc +{ + + +inline bool +Adoc_PE::UsesHtmlInDocuText() +{ + return bUsesHtmlInDocuText; +} + + + + +Adoc_PE::Adoc_PE() + : pCurDocu(0), + pCurAtTag(0), + nLineCountInDocu(0), + nCurSpecialMeaningTokens(0), + nCurSubtractFromLineStart(0), + eCurTagState(ts_new), + eDocuState(ds_wait_for_short), + bIsComplete(false), + bUsesHtmlInDocuText(false) +{ +} + +Adoc_PE::~Adoc_PE() +{ +} + +void +Adoc_PE::Hdl_at_std( const Tok_at_std & i_rTok ) +{ + InstallAtTag( + CurDocu().Create_StdTag(i_rTok.Id()) ); +} + +void +Adoc_PE::Hdl_at_base( const Tok_at_base & ) +{ + InstallAtTag( + CurDocu().CheckIn_BaseTag() ); +} + +void +Adoc_PE::Hdl_at_exception( const Tok_at_exception & ) +{ + InstallAtTag( + CurDocu().CheckIn_ExceptionTag() ); +} + +void +Adoc_PE::Hdl_at_impl( const Tok_at_impl & ) +{ + InstallAtTag( + CurDocu().Create_ImplementsTag() ); +} + +void +Adoc_PE::Hdl_at_key( const Tok_at_key & ) +{ + InstallAtTag( + CurDocu().Create_KeywordTag() ); +} + +void +Adoc_PE::Hdl_at_param( const Tok_at_param & ) +{ + InstallAtTag( + CurDocu().CheckIn_ParameterTag() ); +} + +void +Adoc_PE::Hdl_at_see( const Tok_at_see & ) +{ + InstallAtTag( + CurDocu().CheckIn_SeeTag() ); +} + +void +Adoc_PE::Hdl_at_template( const Tok_at_template & ) +{ + InstallAtTag( + CurDocu().CheckIn_TemplateTag() ); +} + +void +Adoc_PE::Hdl_at_interface( const Tok_at_interface & ) +{ + CurDocu().Set_Interface(); +} + +void +Adoc_PE::Hdl_at_internal( const Tok_at_internal & ) +{ + CurDocu().Set_Internal(); +} + +void +Adoc_PE::Hdl_at_obsolete( const Tok_at_obsolete & ) +{ + CurDocu().Set_Obsolete(); +} + +void +Adoc_PE::Hdl_at_module( const Tok_at_module & ) +{ + // KORR_FUTURE + +// pCurAtTag = CurDocu().Assign2_ModuleTag(); +// nCurSpecialMeaningTokens = pCurAtTag->NrOfSpecialMeaningTokens(); +} + +void +Adoc_PE::Hdl_at_file( const Tok_at_file & ) +{ + // KORR_FUTURE + +// pCurAtTag = CurDocu().Assign2_FileTag(); +// nCurSpecialMeaningTokens = pCurAtTag->NrOfSpecialMeaningTokens(); +} + +void +Adoc_PE::Hdl_at_gloss( const Tok_at_gloss & ) +{ + // KORR_FUTURE + +// Create_GlossaryEntry(); +} + +void +Adoc_PE::Hdl_at_global( const Tok_at_global & ) +{ + // KORR_FUTURE +// Create_GlobalTextComponent(); +} + +void +Adoc_PE::Hdl_at_include( const Tok_at_include & ) +{ + // KORR_FUTURE +} + +void +Adoc_PE::Hdl_at_label( const Tok_at_label & ) +{ + InstallAtTag( + CurDocu().Create_LabelTag() ); +} + +void +Adoc_PE::Hdl_at_since( const Tok_at_since & ) +{ + InstallAtTag( + CurDocu().Create_SinceTag() ); +} + +void +Adoc_PE::Hdl_at_HTML( const Tok_at_HTML & ) +{ + bUsesHtmlInDocuText = true; +} + +void +Adoc_PE::Hdl_at_NOHTML( const Tok_at_NOHTML & ) +{ + bUsesHtmlInDocuText = false; +} + +void +Adoc_PE::Hdl_DocWord( const Tok_DocWord & i_rTok ) +{ + bool bIsSpecial = false; + if ( nCurSpecialMeaningTokens > 0 ) + { + bIsSpecial = CurAtTag().Add_SpecialMeaningToken( + i_rTok.Text(), + CurAtTag().NrOfSpecialMeaningTokens() + - (--nCurSpecialMeaningTokens) ); + } + + if ( NOT bIsSpecial ) + { + if ( eDocuState == ds_wait_for_short OR eDocuState == ds_1newline_after_short ) + eDocuState = ds_in_short; + if (nLineCountInDocu == 0) + nLineCountInDocu = 1; + + uintt nLength = i_rTok.Length(); + if ( nLength > 2 ) + { + bool bMaybeGlobalLink = strncmp( "::", i_rTok.Text(), 2 ) == 0; + bool bMayBeFunction = *(i_rTok.Text() + nLength - 2) == '(' + AND *(i_rTok.Text() + nLength - 1) == ')'; + if ( bMaybeGlobalLink OR bMayBeFunction ) + { + CurAtTag().Add_PotentialLink( i_rTok.Text(), + bMaybeGlobalLink, + bMayBeFunction ); + return; + } + } + + CurAtTag().Add_Token( i_rTok.Text() ); + eCurTagState = ts_std; + } +} + +void +Adoc_PE::Hdl_Whitespace( const Tok_Whitespace & i_rTok ) +{ + if ( eCurTagState == ts_std ) + { + + CurAtTag().Add_Whitespace(i_rTok.Size()); + } +} + +void +Adoc_PE::Hdl_LineStart( const Tok_LineStart & i_rTok ) +{ + if ( pCurAtTag == 0 ) + return; + + if ( nLineCountInDocu == 2 ) + { + nCurSubtractFromLineStart = i_rTok.Size(); + eCurTagState = ts_std; + } + else if ( nLineCountInDocu > 2 ) + { + if ( i_rTok.Size() > nCurSubtractFromLineStart ) + { + CurAtTag().Add_Whitespace( i_rTok.Size() + - nCurSubtractFromLineStart ); + } + // else do nothing, because there is no whitespace. + } +} + +void +Adoc_PE::Hdl_Eol( const Tok_Eol & ) +{ + if ( pCurAtTag == 0 ) + return; + + nLineCountInDocu++; + + if ( nCurSpecialMeaningTokens == 0 ) + { + CurAtTag().Add_Eol(); + + switch ( eDocuState ) + { + case ds_wait_for_short: break; + case ds_in_short: if ( nLineCountInDocu < 4 ) + eDocuState = ds_1newline_after_short; + else + { + RenameCurShortTag(); + eDocuState = ds_in_descr; + } + break; + case ds_1newline_after_short: FinishCurShortTag(); + eDocuState = ds_in_descr; + break; + default: + ; // Do noting. + } + } + else + { + nCurSpecialMeaningTokens = 0; + } + + +} + +void +Adoc_PE::Hdl_EoDocu( const Tok_EoDocu & ) +{ + bIsComplete = true; +} + +DYN ary::doc::OldCppDocu * +Adoc_PE::ReleaseJustParsedDocu() +{ + pCurAtTag = 0; + nLineCountInDocu = 0; + nCurSpecialMeaningTokens = 0; + nCurSubtractFromLineStart = 0; + eCurTagState = ts_new; + eDocuState = ds_wait_for_short; + bIsComplete = false; + return pCurDocu.Release(); +} + +void +Adoc_PE::InstallAtTag( DYN ary::info::AtTag * let_dpTag, + bool i_bImplicit ) +{ + pCurAtTag = let_dpTag; + if ( pCurAtTag != 0 ) + { + nCurSpecialMeaningTokens = pCurAtTag->NrOfSpecialMeaningTokens(); + pCurAtTag->Set_HtmlUseInDocuText( bUsesHtmlInDocuText ); + } + + eCurTagState = ts_new; + if ( NOT i_bImplicit ) + eDocuState = ds_std; +} + +ary::doc::OldCppDocu & +Adoc_PE::CurDocu() +{ + if (NOT pCurDocu) + pCurDocu = new ary::doc::OldCppDocu; + return *pCurDocu; +} + +ary::info::AtTag & +Adoc_PE::CurAtTag() +{ + if (NOT pCurAtTag) + { + if ( int(eDocuState) < int(ds_in_descr) ) + { + InstallAtTag( + CurDocu().Create_StdTag(ary::info::atid_short), + true ); + } + else + { + InstallAtTag( + CurDocu().Create_StdTag(ary::info::atid_descr), + true ); + } + } + return *pCurAtTag; +} + +void +Adoc_PE::RenameCurShortTag() +{ + CurDocu().Replace_AtShort_By_AtDescr(); +} + +void +Adoc_PE::FinishCurShortTag() +{ + InstallAtTag( + CurDocu().Create_StdTag(ary::info::atid_descr), + true ); +} + + +} // namespace adoc + + + + + diff --git a/autodoc/source/parser/adoc/makefile.mk b/autodoc/source/parser/adoc/makefile.mk new file mode 100644 index 000000000000..29087875491b --- /dev/null +++ b/autodoc/source/parser/adoc/makefile.mk @@ -0,0 +1,66 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# 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=parser_adoc + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/adoc_tok.obj \ + $(OBJ)$/a_rdocu.obj \ + $(OBJ)$/cx_a_std.obj \ + $(OBJ)$/cx_a_sub.obj \ + $(OBJ)$/docu_pe.obj \ + $(OBJ)$/prs_adoc.obj \ + $(OBJ)$/tk_attag.obj \ + $(OBJ)$/tk_docw.obj + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser/adoc/prs_adoc.cxx b/autodoc/source/parser/adoc/prs_adoc.cxx new file mode 100644 index 000000000000..531fc794c677 --- /dev/null +++ b/autodoc/source/parser/adoc/prs_adoc.cxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: prs_adoc.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <adoc/prs_adoc.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <adoc/cx_a_std.hxx> + + + +namespace adoc +{ + +DocuParser_AutodocStyle::DocuParser_AutodocStyle() +{ +} + +DocuParser_AutodocStyle::~DocuParser_AutodocStyle() +{ +} + +DYN autodoc::TkpDocuContext * +DocuParser_AutodocStyle::Create_DocuContext() const +{ + return new Context_AdocStd; +} + +} // namespace adoc + + + diff --git a/autodoc/source/parser/adoc/tk_attag.cxx b/autodoc/source/parser/adoc/tk_attag.cxx new file mode 100644 index 000000000000..2a1e5bb9e81e --- /dev/null +++ b/autodoc/source/parser/adoc/tk_attag.cxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_attag.cxx,v $ + * $Revision: 1.8 $ + * + * 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 <adoc/tk_attag.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <adoc/tokintpr.hxx> + + + +namespace adoc { + +#if 0 +#define EV_AtTagId( val, tex ) ENUM_VALUE(E_AtTagId, eATTAGID_##val, val, tex ) + +EV_AtTagId(atid_ATT, "ATTENTION" ); +EV_AtTagId(atid_author, "Author" ); +EV_AtTagId(atid_change, "Change" ); +EV_AtTagId(atid_collab, "Collaborators" ); +EV_AtTagId(atid_contact, "Contact" ); +EV_AtTagId(atid_copyright, "Copyright (c)" ); +EV_AtTagId(atid_descr, "Description" ); +EV_AtTagId(atid_devstat, "Development State" ); +EV_AtTagId(atid_docdate, "Date of Documentation" ); +EV_AtTagId(atid_derive, "How to Derive from this class" ); +EV_AtTagId(atid_instance, "Instances" ); +EV_AtTagId(atid_life, "Lifecycle" ); +EV_AtTagId(atid_multi, "Multiplicity" ); +EV_AtTagId(atid_onerror, "On Error" ); +EV_AtTagId(atid_persist, "Persistence" ); +EV_AtTagId(atid_postcond, "Postcondition" ); +EV_AtTagId(atid_precond, "Precondition" ); +EV_AtTagId(atid_return, "Return" ); +EV_AtTagId(atid_short, "Summary" ); +EV_AtTagId(atid_since, "Valid Since" ); +EV_AtTagId(atid_todo, "Todo" ); +EV_AtTagId(atid_version, "Version" ); +#endif // 0 + +void +Tok_at_std::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Hdl_at_std(*this); +} + +const char * +Tok_at_std::Text() const +{ + // KORR_FUTURE + return "A Tag"; + +// return eId.Text(); +} + + +#define DEFINE_TOKEN_CLASS(name, text) \ +void \ +Tok_##name::Trigger( TokenInterpreter & io_rInterpreter ) const \ +{ io_rInterpreter.Hdl_##name(*this); } \ +const char * \ +Tok_##name::Text() const \ +{ return text; } + +DEFINE_TOKEN_CLASS(at_base, "Base Classes") +DEFINE_TOKEN_CLASS(at_exception, "Exceptions") +DEFINE_TOKEN_CLASS(at_impl, "Implements") +DEFINE_TOKEN_CLASS(at_key, "Keywords") +DEFINE_TOKEN_CLASS(at_param, "Parameters") +DEFINE_TOKEN_CLASS(at_see, "See Also") +DEFINE_TOKEN_CLASS(at_template, "Template Parameters") +DEFINE_TOKEN_CLASS(at_interface, "Interface") +DEFINE_TOKEN_CLASS(at_internal, "[ INTERNAL ]") +DEFINE_TOKEN_CLASS(at_obsolete, "[ DEPRECATED ]") +DEFINE_TOKEN_CLASS(at_module, "Module") +DEFINE_TOKEN_CLASS(at_file, "File") +DEFINE_TOKEN_CLASS(at_gloss, "Glossary") +DEFINE_TOKEN_CLASS(at_global, "<global doc text>") +DEFINE_TOKEN_CLASS(at_include, "<included text>") +DEFINE_TOKEN_CLASS(at_label, "Label") +DEFINE_TOKEN_CLASS(at_HTML, "") +DEFINE_TOKEN_CLASS(at_NOHTML, "") +DEFINE_TOKEN_CLASS(at_since, "Since"); + +} // namespace adoc + diff --git a/autodoc/source/parser/adoc/tk_docw.cxx b/autodoc/source/parser/adoc/tk_docw.cxx new file mode 100644 index 000000000000..1e05d6e6e3d2 --- /dev/null +++ b/autodoc/source/parser/adoc/tk_docw.cxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_docw.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <adoc/tk_docw.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <adoc/tokintpr.hxx> + + + +namespace adoc { + + + static const char C_sSpace[300] = + " " + " " + " " + " " + " " + " "; + + +//*********************** Tok_DocWord ******************// + +void +Tok_DocWord::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Hdl_DocWord(*this); +} + +const char * +Tok_DocWord::Text() const +{ + return sText; +} + +//*********************** Tok_Whitespace ******************// + + +void +Tok_Whitespace::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Hdl_Whitespace(*this); +} + +const char * +Tok_Whitespace::Text() const +{ + return C_sSpace + 299 - nSize; +} + + + +//*********************** Tok_LineStart ******************// + + +void +Tok_LineStart::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Hdl_LineStart(*this); +} + +const char * +Tok_LineStart::Text() const +{ + return C_sSpace + 299 - nSize; +} + + +//*********************** Tok_Eol ******************// + +void +Tok_Eol::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Hdl_Eol(*this); +} + +const char * +Tok_Eol::Text() const +{ + return "\n"; +} + + + +//*********************** Tok_EoDocu ******************// + +void +Tok_EoDocu::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Hdl_EoDocu(*this); +} + +const char * +Tok_EoDocu::Text() const +{ + return "*/"; +} + +} // namespace adoc + + diff --git a/autodoc/source/parser/cpp/all_toks.cxx b/autodoc/source/parser/cpp/all_toks.cxx new file mode 100644 index 000000000000..78531222d76b --- /dev/null +++ b/autodoc/source/parser/cpp/all_toks.cxx @@ -0,0 +1,154 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: all_toks.cxx,v $ + * $Revision: 1.9 $ + * + * 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 <all_toks.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <cpp/ctokdeal.hxx> +#include "c_dealer.hxx" +#include "tokintpr.hxx" + + + +namespace cpp { + + +void +Token::DealOut( ::TokenDealer & o_rDealer ) +{ + // KORR_FUTURE HACK (casting to derivation cpp::TokenDealer) + o_rDealer.AsDistributor()->Deal_CppCode(*this); +} + + +#define DEF_TOKEN_CLASS(name) \ +void \ +Tok_##name::Trigger( TokenInterpreter & io_rInterpreter ) const \ +{ io_rInterpreter.Hdl_##name(*this); } \ +INT16 \ +Tok_##name::TypeId() const { return Tid_##name; } \ +const char * \ +Tok_##name::Text() const { return #name; } + +#define DEF_TOKEN_CLASS_WITHTEXT(name, text ) \ +void \ +Tok_##name::Trigger( TokenInterpreter & io_rInterpreter ) const \ +{ io_rInterpreter.Hdl_##name(*this); } \ +INT16 \ +Tok_##name::TypeId() const { return Tid_##name; } \ +const char * \ +Tok_##name::Text() const { return text; } + + +DEF_TOKEN_CLASS_WITHTEXT(Identifier,sText) +DEF_TOKEN_CLASS_WITHTEXT(Operator,sText) + +DEF_TOKEN_CLASS(operator) +DEF_TOKEN_CLASS(class) +DEF_TOKEN_CLASS(struct) +DEF_TOKEN_CLASS(union) +DEF_TOKEN_CLASS(enum) +DEF_TOKEN_CLASS(typedef) +DEF_TOKEN_CLASS(public) +DEF_TOKEN_CLASS(protected) +DEF_TOKEN_CLASS(private) +DEF_TOKEN_CLASS(template) +DEF_TOKEN_CLASS(virtual) +DEF_TOKEN_CLASS(friend) +DEF_TOKEN_CLASS_WITHTEXT(Tilde,"~") +DEF_TOKEN_CLASS(const) +DEF_TOKEN_CLASS(volatile) +DEF_TOKEN_CLASS(extern) +DEF_TOKEN_CLASS(static) +DEF_TOKEN_CLASS(mutable) +DEF_TOKEN_CLASS(register) +DEF_TOKEN_CLASS(inline) +DEF_TOKEN_CLASS(explicit) +DEF_TOKEN_CLASS(namespace) +DEF_TOKEN_CLASS(using) +DEF_TOKEN_CLASS(throw) +DEF_TOKEN_CLASS_WITHTEXT(SwBracket_Left,"{") +DEF_TOKEN_CLASS_WITHTEXT(SwBracket_Right,"}") +DEF_TOKEN_CLASS_WITHTEXT(ArrayBracket_Left,"[") +DEF_TOKEN_CLASS_WITHTEXT(ArrayBracket_Right,"]") +DEF_TOKEN_CLASS_WITHTEXT(Bracket_Left,"(") +DEF_TOKEN_CLASS_WITHTEXT(Bracket_Right,")") +DEF_TOKEN_CLASS_WITHTEXT(DoubleColon,"::") +DEF_TOKEN_CLASS_WITHTEXT(Semicolon,";") +DEF_TOKEN_CLASS_WITHTEXT(Comma,",") +DEF_TOKEN_CLASS_WITHTEXT(Colon,":") +DEF_TOKEN_CLASS_WITHTEXT(Assign,"=") +DEF_TOKEN_CLASS_WITHTEXT(Less,"<") +DEF_TOKEN_CLASS_WITHTEXT(Greater,">") +DEF_TOKEN_CLASS_WITHTEXT(Asterix,"*") +DEF_TOKEN_CLASS_WITHTEXT(AmpersAnd,"&") +DEF_TOKEN_CLASS_WITHTEXT(Ellipse,"...") +DEF_TOKEN_CLASS(typename) + +DEF_TOKEN_CLASS_WITHTEXT(DefineName,sText) +DEF_TOKEN_CLASS_WITHTEXT(MacroName,sText) +DEF_TOKEN_CLASS_WITHTEXT(MacroParameter,sText) +// DEF_TOKEN_CLASS_WITHTEXT(PreProDefinition,sText) + +void +Tok_PreProDefinition::Trigger( TokenInterpreter & io_rInterpreter ) const +{ io_rInterpreter.Hdl_PreProDefinition(*this); } + +INT16 +Tok_PreProDefinition::TypeId() const { return Tid_PreProDefinition; } + +const char * +Tok_PreProDefinition::Text() const +{ + return sText; +} + + + +DEF_TOKEN_CLASS_WITHTEXT(BuiltInType,sText) +DEF_TOKEN_CLASS_WITHTEXT(TypeSpecializer,sText) +DEF_TOKEN_CLASS_WITHTEXT(Constant,sText) + +const char * +Tok_UnblockMacro::Text() const +{ + return sMacroName; +} + +void +Tok_UnblockMacro::DealOut( ::TokenDealer & o_rDealer ) +{ + // KORR_FUTURE HACK (casting to derivation cpp::TokenDealer) + o_rDealer.AsDistributor()->Deal_Cpp_UnblockMacro(*this); +} + +} // namespace cpp diff --git a/autodoc/source/parser/cpp/all_toks.hxx b/autodoc/source/parser/cpp/all_toks.hxx new file mode 100644 index 000000000000..fa3943250a99 --- /dev/null +++ b/autodoc/source/parser/cpp/all_toks.hxx @@ -0,0 +1,222 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: all_toks.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_CPP_ALL_TOKS_HXX +#define ADC_CPP_ALL_TOKS_HXX + +// USED SERVICES + // BASE CLASSES +#include "cpp_tok.hxx" + // COMPONENTS + // PARAMETERS + +namespace cpp { + +class Tok_Identifier : public cpp::Token +{ + public: + Tok_Identifier( + const char * i_sText ) : sText(i_sText) {} + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual INT16 TypeId() const; + virtual const char * + Text() const; + private: + String sText; +}; +const INT16 Tid_Identifier = 1; + +/** == != <= >= && || ! + + new delete sizeof typeid + + - / % ^ | << >> + . -> ? + += -= *= /= %= &= |= ^= <<= >>= +*/ +class Tok_Operator : public cpp::Token +{ + public: + Tok_Operator( + const char * i_sText ) : sText(i_sText) {} + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual INT16 TypeId() const; + virtual const char * + Text() const; + private: + String sText; +}; +const INT16 Tid_Operator = 2; + + + +#define DECL_TOKEN_CLASS(name,tid) \ +class Tok_##name : public cpp::Token \ +{ public: \ + virtual void Trigger( \ + TokenInterpreter & io_rInterpreter ) const; \ + virtual INT16 TypeId() const; \ + virtual const char * \ + Text() const; \ +}; \ +const INT16 Tid_##name = tid + +DECL_TOKEN_CLASS(operator,3); +DECL_TOKEN_CLASS(class,4); +DECL_TOKEN_CLASS(struct,5); +DECL_TOKEN_CLASS(union,6); +DECL_TOKEN_CLASS(enum,7); +DECL_TOKEN_CLASS(typedef,8); +DECL_TOKEN_CLASS(public,9); +DECL_TOKEN_CLASS(protected,10); +DECL_TOKEN_CLASS(private,11); +DECL_TOKEN_CLASS(template,12); +DECL_TOKEN_CLASS(virtual,13); +DECL_TOKEN_CLASS(friend,14); +DECL_TOKEN_CLASS(Tilde,15); +DECL_TOKEN_CLASS(const,16); +DECL_TOKEN_CLASS(volatile,17); +DECL_TOKEN_CLASS(extern,18); +DECL_TOKEN_CLASS(static,19); +DECL_TOKEN_CLASS(mutable,20); +DECL_TOKEN_CLASS(register,21); +DECL_TOKEN_CLASS(inline,22); +DECL_TOKEN_CLASS(explicit,23); +DECL_TOKEN_CLASS(namespace,24); +DECL_TOKEN_CLASS(using,25); +DECL_TOKEN_CLASS(throw,26); +DECL_TOKEN_CLASS(SwBracket_Left,27); +DECL_TOKEN_CLASS(SwBracket_Right,28); +DECL_TOKEN_CLASS(ArrayBracket_Left,29); +DECL_TOKEN_CLASS(ArrayBracket_Right,30); +DECL_TOKEN_CLASS(Bracket_Left,31); +DECL_TOKEN_CLASS(Bracket_Right,32); +DECL_TOKEN_CLASS(DoubleColon,33); +DECL_TOKEN_CLASS(Semicolon,34); +DECL_TOKEN_CLASS(Comma,35); +DECL_TOKEN_CLASS(Colon,36); +DECL_TOKEN_CLASS(Assign,37); +DECL_TOKEN_CLASS(Less,38); +DECL_TOKEN_CLASS(Greater,39); +DECL_TOKEN_CLASS(Asterix,40); +DECL_TOKEN_CLASS(AmpersAnd,41); +DECL_TOKEN_CLASS(Ellipse,42); +DECL_TOKEN_CLASS(typename,43); + +#undef DECL_TOKEN_CLASS + +#define DECL_TOKEN_CLASS_WITHTEXT(name,tid) \ +class Tok_##name : public cpp::Token \ +{ public: \ + Tok_##name( \ + const char * i_sText ) : sText(i_sText) {} \ + virtual void Trigger( \ + TokenInterpreter & io_rInterpreter ) const; \ + virtual INT16 TypeId() const; \ + virtual const char * \ + Text() const; \ + private: \ + String sText; \ +}; \ +const INT16 Tid_##name = tid + + + +DECL_TOKEN_CLASS_WITHTEXT(DefineName,44); +DECL_TOKEN_CLASS_WITHTEXT(MacroName,45); +DECL_TOKEN_CLASS_WITHTEXT(MacroParameter,46); +DECL_TOKEN_CLASS_WITHTEXT(PreProDefinition,47); + +/** char short int long float double wchar_t size_t +*/ +DECL_TOKEN_CLASS_WITHTEXT(BuiltInType, 48); + +/** signed unsigned +*/ +DECL_TOKEN_CLASS_WITHTEXT(TypeSpecializer, 49); +DECL_TOKEN_CLASS_WITHTEXT(Constant, 50); + + + +/** This token does nothing in C++ code. It is added by the + internal macro-replacer to mark the position, where a + define or macro becomes valid again, which was until then + invalid, because the text was a replacement of this macro. + ( Avoiding endless recursive macro replacement. ) +*/ +class Tok_UnblockMacro : public ::TextToken +{ + public: + Tok_UnblockMacro( + const char * i_sMacroName ) : sMacroName(i_sMacroName) {} + virtual const char* Text() const; + + virtual void DealOut( + ::TokenDealer & o_rDealer ); + private: + String sMacroName; +}; + + + +#if 0 // just for viewing: +class Tok_TypeKey : public cpp::Token // file-><type-PE> +class Tok_Template : public cpp::Token // file +class Tok_Namespace : public cpp::Token // file +class Tok_Bracket : public cpp::Token // ueberall +class Tok_Separator : public cpp::Token // ueberall + +class Tok_Identifier : public cpp::Token // ueberall +class Tok_NameSeparator : public cpp::Token // Type, Name +class Tok_BuiltInType : public cpp::Token // ueberall +class Tok_ConVol : public cpp::Token // class-><FuVa> +class Tok_StorageClass : public cpp::Token // file-><type>,<FuVa> +class Tok_OperatorFunctionName : public cpp::Token // class + +class Tok_Protection : public cpp::Token // class +class Tok_Virtual : public cpp::Token // class +class Tok_Friend : public cpp::Token // class +class Tok_Tilde : public cpp::Token // class, expression + +class Tok_Ellipse : public cpp::Token // function-ParaList +class Tok_Assignment : public cpp::Token // VariableDeclaraton, Function, Parameter +class Tok_Throw : public cpp::Token // function +class Tok_LessMore : public cpp::Token +class Tok_Operator : public cpp::Token // expression + +class Tok_Ignore : public cpp::Token +class Tok_ContextChanger : public cpp::Token +#endif // 0 + + +} // namespace cpp + +#endif diff --git a/autodoc/source/parser/cpp/c_dealer.cxx b/autodoc/source/parser/cpp/c_dealer.cxx new file mode 100644 index 000000000000..ba8e44321e49 --- /dev/null +++ b/autodoc/source/parser/cpp/c_dealer.cxx @@ -0,0 +1,152 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_dealer.cxx,v $ + * $Revision: 1.8 $ + * + * 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_dealer.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <ary/cpp/c_gate.hxx> +#include <ary/loc/locp_le.hxx> +#include <ary/loc/loc_root.hxx> +#include <ary/loc/loc_file.hxx> +//#include <ary/docu.hxx> +#include <adoc/a_rdocu.hxx> +#include "all_toks.hxx" +#include "c_rcode.hxx" + + +namespace ary +{ +namespace loc +{ + class Root; +} +} + + + + +namespace cpp +{ + +Distributor::Distributor( ary::cpp::Gate & io_rAryGate ) + : aCppPreProcessor(), + aCodeExplorer(io_rAryGate), + aDocuExplorer(), + pGate(&io_rAryGate), + pFileEventHandler(0), + pDocuDistributor(0) +{ + pFileEventHandler = & aCodeExplorer.FileEventHandler(); + pDocuDistributor = & aCodeExplorer.DocuDistributor(); +} + +void +Distributor::AssignPartners( CharacterSource & io_rSourceText, + const MacroMap & i_rValidMacros ) +{ + aCppPreProcessor.AssignPartners(aCodeExplorer, io_rSourceText, i_rValidMacros); +} + +Distributor::~Distributor() +{ +} + +void +Distributor::StartNewFile( const csv::ploc::Path & i_file ) +{ + const csv::ploc::Root & + root_dir = i_file.RootDir(); + StreamLock + sl(700); + root_dir.Get(sl()); + csv::ploc::Path + root_path( sl().c_str(), true ); + ary::loc::Le_id + root_id = pGate->Locations().CheckIn_Root(root_path).LeId(); + ary::loc::File & + rFile = pGate->Locations().CheckIn_File( + i_file.File(), + i_file.DirChain(), + root_id ); + pFileEventHandler->SetCurFile(rFile); + + aCodeExplorer.StartNewFile(); + + csv_assert( pDocuDistributor != 0 ); + aDocuExplorer.StartNewFile(*pDocuDistributor); +} + + +void +Distributor::Deal_Eol() +{ + pFileEventHandler->Event_IncrLineCount(); +} + +void +Distributor::Deal_Eof() +{ + // Do nothing yet. +} + +void +Distributor::Deal_Cpp_UnblockMacro( Tok_UnblockMacro & let_drToken ) +{ + aCppPreProcessor.UnblockMacro(let_drToken.Text()); + delete &let_drToken; +} + +void +Distributor::Deal_CppCode( cpp::Token & let_drToken ) +{ + aCppPreProcessor.Process_Token(let_drToken); +} + +void +Distributor::Deal_AdcDocu( adoc::Token & let_drToken ) +{ + aDocuExplorer.Process_Token(let_drToken); +} + +Distributor * +Distributor::AsDistributor() +{ + return this; +} + + + + + +} // namespace cpp + + diff --git a/autodoc/source/parser/cpp/c_dealer.hxx b/autodoc/source/parser/cpp/c_dealer.hxx new file mode 100644 index 000000000000..b891cf9e5a5f --- /dev/null +++ b/autodoc/source/parser/cpp/c_dealer.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_dealer.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_CPP_C_DEALER_HXX +#define ADC_CPP_C_DEALER_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <cpp/ctokdeal.hxx> +#include <adoc/atokdeal.hxx> +#include <ary/info/docstore.hxx> + // COMPONENTS +#include "preproc.hxx" +#include "c_rcode.hxx" +#include <adoc/a_rdocu.hxx> + // PARAMETERS + +namespace csv +{ + namespace ploc + { + class Path; + class DirectoryChain; + } +} + + +class TokenParser; + + +namespace cpp +{ + +class PE_File; +class DefineDescription; + + +class Distributor : public cpp::TokenDealer, /// Handle C++ code tokens. + public adoc::TokenDealer /// Handle Autodoc documentation tokens. +{ + public: + typedef std::map< String, DefineDescription* > MacroMap; + + // LIFECYCLE + Distributor( + ary::cpp::Gate & io_rGate ); + ~Distributor(); + // OPERATIONS + void AssignPartners( + CharacterSource & io_rSourceText, + const MacroMap & i_rValidMacros ); + void StartNewFile( + const csv::ploc::Path & + i_file ); + virtual void Deal_Eol(); + virtual void Deal_Eof(); + + virtual void Deal_CppCode( + cpp::Token & let_drToken ); + virtual void Deal_Cpp_UnblockMacro( + Tok_UnblockMacro & let_drToken ); + + virtual void Deal_AdcDocu( + adoc::Token & let_drToken ); + virtual Distributor * + AsDistributor(); + private: + // DATA + PreProcessor aCppPreProcessor; + CodeExplorer aCodeExplorer; + adoc::DocuExplorer aDocuExplorer; + ary::cpp::Gate * pGate; + FileScope_EventHandler * + pFileEventHandler; + DocuDealer * pDocuDistributor; +}; + + + +} // namespace cpp +#endif + diff --git a/autodoc/source/parser/cpp/c_rcode.cxx b/autodoc/source/parser/cpp/c_rcode.cxx new file mode 100644 index 000000000000..dd62dbbae2e5 --- /dev/null +++ b/autodoc/source/parser/cpp/c_rcode.cxx @@ -0,0 +1,164 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_rcode.cxx,v $ + * $Revision: 1.7 $ + * + * 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_rcode.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_namesp.hxx> +// #include <ary/cpp/c_groups.hxx> +#include <ary/loc/locp_le.hxx> +#include "cpp_pe.hxx" +#include <adc_cl.hxx> +#include <x_parse.hxx> +#include "pe_file.hxx" + +const uintt C_nNO_TRY = uintt(-1); + + +namespace cpp { + + +CodeExplorer::CodeExplorer( ary::cpp::Gate & io_rAryGate ) + : aGlobalParseContext(io_rAryGate), + // aEnvironments, + pPE_File(0), + pGate(&io_rAryGate), + dpCurToken(0) +{ + pPE_File = new PE_File( aGlobalParseContext ); +} + +CodeExplorer::~CodeExplorer() +{ +} + +void +CodeExplorer::StartNewFile() +{ + csv::erase_container(aEnvironments); + + aEnvironments.push_back( pPE_File.MutablePtr() ); + pPE_File->Enter(push); +} + +void +CodeExplorer::Process_Token( DYN cpp::Token & let_drToken ) +{ +if (DEBUG_ShowTokens()) +{ + Cout() << let_drToken.Text() << Endl(); +} + dpCurToken = &let_drToken; + aGlobalParseContext.ResetResult(); + + do { + CurToken().Trigger( CurEnv() ); + AcknowledgeResult(); + } while ( dpCurToken ); +} + +void +CodeExplorer::AcknowledgeResult() +{ + if (CurResult().eDone == done) + dpCurToken = 0; + + switch ( CurResult().eStackAction ) + { + case stay: + break; + case push: + CurEnv().Leave(push); + aEnvironments.push_back( &PushEnv() ); + PushEnv().Enter(push); + break; + case pop_success: + CurEnv().Leave(pop_success); + aEnvironments.pop_back(); + CurEnv().Enter(pop_success); + break; + case pop_failure: + { + Cpp_PE * pRecover = 0; + do { + CurEnv().Leave(pop_failure); + aEnvironments.pop_back(); + if ( aEnvironments.empty() ) + break; + pRecover = CurEnv().Handle_ChildFailure(); + } while ( pRecover == 0 ); + if ( pRecover != 0 ) + { + aEnvironments.push_back(pRecover); + pRecover->Enter(push); + } + else + { + throw X_Parser( X_Parser::x_UnexpectedToken, CurToken().Text(), aGlobalParseContext.CurFileName(), aGlobalParseContext.LineCount() ); + } + } break; + default: + csv_assert(false); + } // end switch(CurResult().eStackAction) +} + +const Token & +CodeExplorer::CurToken() const +{ + csv_assert(dpCurToken); + + return *dpCurToken; +} + +Cpp_PE & +CodeExplorer::CurEnv() const +{ + csv_assert(aEnvironments.size() > 0); + csv_assert(aEnvironments.back() != 0); + + return *aEnvironments.back(); +} + +Cpp_PE & +CodeExplorer::PushEnv() const +{ + TokenProcessing_Result & rCurResult = const_cast< TokenProcessing_Result& >(aGlobalParseContext.CurResult()); + Cpp_PE * ret = dynamic_cast< Cpp_PE* >(rCurResult.pEnv2Push); + csv_assert( ret != 0 ); + return *ret; +} + + + +} // namespace cpp + diff --git a/autodoc/source/parser/cpp/c_rcode.hxx b/autodoc/source/parser/cpp/c_rcode.hxx new file mode 100644 index 000000000000..28a2785de917 --- /dev/null +++ b/autodoc/source/parser/cpp/c_rcode.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: c_rcode.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_C_RCODE_HXX +#define ADC_CPP_C_RCODE_HXX + +// BASE CLASSES +#include <tokens/tokproct.hxx> +// USED SERVICES +#include <cosv/ploc.hxx> +#include "cxt2ary.hxx" +#include <ary/cpp/c_types4cpp.hxx> +#include <ary/loc/loc_types4loc.hxx> + + + +namespace ary +{ +namespace cpp +{ + class Gate; +} +namespace doc +{ + class OldCppDocu; +} +} + +namespace cpp +{ + class PE_File; + class Token; + class Cpp_PE; + + + + +class CodeExplorer : private TokenProcessing_Types + +{ + public: + CodeExplorer( + ary::cpp::Gate & io_rAryGate ); + ~CodeExplorer(); + + void StartNewFile(); + void Process_Token( + DYN cpp::Token & let_drToken ); + // ACCESS + FileScope_EventHandler & + FileEventHandler() { return aGlobalParseContext; } + DocuDealer & DocuDistributor() { return aGlobalParseContext; } + + private: + typedef std::vector< cpp::Cpp_PE* > EnvironmentStack; + + void AcknowledgeResult(); + const Token & CurToken() const; + Cpp_PE & CurEnv() const; + Cpp_PE & PushEnv() const; + TokenProcessing_Result & + CurResult() { return aGlobalParseContext.CurResult(); } + + // DATA + ContextForAry aGlobalParseContext; + + EnvironmentStack aEnvironments; + Dyn<PE_File> pPE_File; + + ary::cpp::Gate * pGate; + cpp::Token * dpCurToken; +}; + + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/cpp_pe.cxx b/autodoc/source/parser/cpp/cpp_pe.cxx new file mode 100644 index 000000000000..858bea64612e --- /dev/null +++ b/autodoc/source/parser/cpp/cpp_pe.cxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cpp_pe.cxx,v $ + * $Revision: 1.7 $ + * + * 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 "cpp_pe.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/doc/d_oldcppdocu.hxx> +#include "cpp_tok.hxx" + + + + +namespace cpp { + +void +Cpp_PE::SetTokenResult( E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + ParseEnvironment * i_pParseEnv2Push ) +{ + rMyEnv.SetTokenResult( i_eDone, + i_eWhat2DoWithEnvStack, + i_pParseEnv2Push ); +} + +Cpp_PE::Cpp_PE( Cpp_PE * io_pParent ) + : ParseEnvironment( io_pParent ), + rMyEnv( io_pParent->Env() ) +{ + csv_assert(io_pParent != 0); +} + +Cpp_PE::Cpp_PE( EnvData & i_rEnv ) + : ParseEnvironment(0), + rMyEnv(i_rEnv) +{ +} + +void +Cpp_PE::StdHandlingOfSyntaxError( const char * ) +{ + SetTokenResult(not_done, pop_failure); +} + + +Cpp_PE * +Cpp_PE::Handle_ChildFailure() +{ + return 0; +} + +} // namespace cpp + diff --git a/autodoc/source/parser/cpp/cpp_pe.hxx b/autodoc/source/parser/cpp/cpp_pe.hxx new file mode 100644 index 000000000000..af46c1312884 --- /dev/null +++ b/autodoc/source/parser/cpp/cpp_pe.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cpp_pe.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_CPP_PE_HXX +#define ADC_CPP_CPP_PE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <semantic/parseenv.hxx> +#include "tokintpr.hxx" + // COMPONENTS +#include "pev.hxx" + // PARAMETERS +#include <ary/cpp/c_types4cpp.hxx> + + +namespace cpp { + +class Cpp_PE : public ::ParseEnvironment, + public TokenInterpreter +{ + public: + typedef cpp::PeEnvironment EnvData; + + void SetTokenResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + ParseEnvironment * i_pParseEnv2Push = 0 ); + + virtual Cpp_PE * Handle_ChildFailure(); // Defaulted to 0. + + protected: + Cpp_PE( + Cpp_PE * io_pParent ); + Cpp_PE( + EnvData & i_rEnv ); + + EnvData & Env() const; + + void StdHandlingOfSyntaxError( + const char * i_sText ); + + private: + // DATA + EnvData & rMyEnv; +}; + +inline Cpp_PE::EnvData & +Cpp_PE::Env() const + { return rMyEnv; } + +} // namespace cpp + +#endif + diff --git a/autodoc/source/parser/cpp/cpp_tok.hxx b/autodoc/source/parser/cpp/cpp_tok.hxx new file mode 100644 index 000000000000..413fc9136c90 --- /dev/null +++ b/autodoc/source/parser/cpp/cpp_tok.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cpp_tok.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_CPP_TOK_HXX +#define ADC_CPP_TOK_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/token.hxx> + // COMPONENTS + // PARAMETERS + + +namespace cpp { + + +class TokenInterpreter; + + +class Token : public TextToken +{ + public: + // LIFECYCLE + virtual ~Token() {} + + // OPERATIONS + virtual INT16 TypeId() const = 0; + virtual void DealOut( + ::TokenDealer & o_rDealer ); + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const = 0; +}; + + +} // namespace cpp + +#endif + + diff --git a/autodoc/source/parser/cpp/cx_base.cxx b/autodoc/source/parser/cpp/cx_base.cxx new file mode 100644 index 000000000000..38a4c14b6be4 --- /dev/null +++ b/autodoc/source/parser/cpp/cx_base.cxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_base.cxx,v $ + * $Revision: 1.5 $ + * + * 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 "cx_base.hxx" + +// NOT FULLY DECLARED SERVICES +#include <tokens/token.hxx> +#include "c_dealer.hxx" + + + +namespace cpp { + + + +Cx_Base::Cx_Base( TkpContext * io_pFollowUpContext ) + : pDealer(0), + pFollowUpContext(io_pFollowUpContext) + // pNewToken +{ +} + +bool +Cx_Base::PassNewToken() +{ + if (pNewToken) + { + pNewToken.Release()->DealOut(Dealer()); + return true; + } + return false; +} + +TkpContext & +Cx_Base::FollowUpContext() +{ + csv_assert(pFollowUpContext != 0); + return *pFollowUpContext; +} + +void +Cx_Base::AssignDealer( Distributor & o_rDealer ) +{ + pDealer = &o_rDealer; +} + + +} // namespace cpp + + + + diff --git a/autodoc/source/parser/cpp/cx_base.hxx b/autodoc/source/parser/cpp/cx_base.hxx new file mode 100644 index 000000000000..88102ca9ea90 --- /dev/null +++ b/autodoc/source/parser/cpp/cx_base.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_base.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_CPP_CX_BASE_HXX +#define ADC_CPP_CX_BASE_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcontx.hxx> + // COMPONENTS + // PARAMETERS + + +class TextToken; + + +namespace cpp +{ + +class Distributor; + + +class Cx_Base : public ::TkpContext +{ + public: + virtual bool PassNewToken(); + virtual TkpContext & + FollowUpContext(); + + virtual void AssignDealer( + Distributor & o_rDealer ); + protected: + // LIFECYCLE + Cx_Base( + TkpContext * io_pFollowUpContext ); + + void SetNewToken( + DYN ::TextToken * let_dpToken ); + void SetFollowUpContext( + TkpContext * io_pContext ); + + Distributor & Dealer() const; + + private: + // DATA + Distributor * pDealer; + TkpContext * pFollowUpContext; + Dyn< ::TextToken > pNewToken; +}; + + + + +inline void +Cx_Base::SetNewToken( DYN ::TextToken * let_dpToken ) + { pNewToken = let_dpToken; } +inline void +Cx_Base::SetFollowUpContext( TkpContext * io_pContext ) + { pFollowUpContext = io_pContext; } +inline Distributor & +Cx_Base::Dealer() const + { csv_assert(pDealer != 0); + return *pDealer; } + + + + + +} // namespace cpp + +#endif + diff --git a/autodoc/source/parser/cpp/cx_c_pp.cxx b/autodoc/source/parser/cpp/cx_c_pp.cxx new file mode 100644 index 000000000000..8121d34c318f --- /dev/null +++ b/autodoc/source/parser/cpp/cx_c_pp.cxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_c_pp.cxx,v $ + * $Revision: 1.9 $ + * + * 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 "cx_c_pp.hxx" + + + +// NOT FULLY DECLARED SERVICES +#include "c_dealer.hxx" +#include <tokens/parseinc.hxx> +#include <x_parse.hxx> +#include "all_toks.hxx" + + +namespace cpp +{ + +Context_Preprocessor::Context_Preprocessor( TkpContext & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext), + pContext_Parent(&i_rFollowUpContext), + pContext_PP_MacroParams( 0 ), + pContext_PP_Definition( new Context_PP_Definition(i_rFollowUpContext) ) +{ + pContext_PP_MacroParams = new Context_PP_MacroParams(*pContext_PP_Definition); +} + +void +Context_Preprocessor::ReadCharChain( CharacterSource & io_rText ) +{ + jumpOverWhite( io_rText ); + jumpToWhite( io_rText ); + const char * sPP_Keyword = io_rText.CutToken(); + if ( strcmp(sPP_Keyword, "define") == 0 ) + ReadDefine(io_rText); + else + ReadDefault(io_rText); +} + +void +Context_Preprocessor::AssignDealer( Distributor & o_rDealer ) +{ + Cx_Base::AssignDealer(o_rDealer); + pContext_PP_MacroParams->AssignDealer(o_rDealer); + pContext_PP_Definition->AssignDealer(o_rDealer); +} + +void +Context_Preprocessor::ReadDefault( CharacterSource & io_rText ) +{ + int o_rCount_BackslashedLineBreaks = 0; + jumpToEol(io_rText,o_rCount_BackslashedLineBreaks); + for ( ; o_rCount_BackslashedLineBreaks > 0; --o_rCount_BackslashedLineBreaks ) + Dealer().Deal_Eol(); + + if (io_rText.CurChar() != NULCH) + jumpOverEol(io_rText); + io_rText.CutToken(); + Dealer().Deal_Eol(); + SetNewToken(0); + SetFollowUpContext( pContext_Parent ); +} + +void +Context_Preprocessor::ReadDefine( CharacterSource & io_rText ) +{ + jumpOverWhite( io_rText ); + io_rText.CutToken(); + + char cNext = '\0'; + for ( cNext = io_rText.CurChar(); + static_cast<UINT8>(cNext) > 32 AND cNext != '('; + cNext = io_rText.MoveOn() ) + { } + + bool bMacro = cNext == '('; + + if ( NOT bMacro ) + { + SetNewToken( new Tok_DefineName(io_rText.CutToken()) ); + SetFollowUpContext( pContext_PP_Definition.Ptr() ); + } + else + { + SetNewToken( new Tok_MacroName(io_rText.CutToken()) ); + io_rText.MoveOn(); + io_rText.CutToken(); + SetFollowUpContext( pContext_PP_MacroParams.Ptr() ); + } +} + + +Context_PP_MacroParams::Context_PP_MacroParams( Cx_Base & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext), + pContext_PP_Definition(&i_rFollowUpContext) +{ +} + +void +Context_PP_MacroParams::ReadCharChain( CharacterSource & io_rText ) +{ + uintt nLen; + + jumpOverWhite( io_rText ); + // KORR_FUTURE Handling line breaks within macro parameters: + char cSeparator = jumpTo( io_rText, ',', ')' ); + csv_assert( cSeparator != 0 ); + + static char cBuf[500]; + // KORR_FUTURE, make it still safer, here: + strcpy( cBuf, io_rText.CutToken() ); // SAFE STRCPY (#100211# - checked) + for ( nLen = strlen(cBuf); + nLen > 0 AND cBuf[nLen-1] < 33; + --nLen ) + { } + cBuf[nLen] = '\0'; + SetNewToken( new Tok_MacroParameter(cBuf) ); + + io_rText.MoveOn(); + io_rText.CutToken(); + if ( cSeparator == ',') + SetFollowUpContext( this ); + else // Must be ')' + SetFollowUpContext( pContext_PP_Definition ); +} + +Context_PP_Definition::Context_PP_Definition( TkpContext & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext), + pContext_Parent(&i_rFollowUpContext) +{ +} + +void +Context_PP_Definition::ReadCharChain( CharacterSource & io_rText ) +{ + int o_rCount_BackslashedLineBreaks = 0; + jumpToEol(io_rText,o_rCount_BackslashedLineBreaks); + for ( ; o_rCount_BackslashedLineBreaks > 0; --o_rCount_BackslashedLineBreaks ) + Dealer().Deal_Eol(); + SetNewToken( new Tok_PreProDefinition(io_rText.CutToken()) ); + if (io_rText.CurChar() != NULCH) + jumpOverEol(io_rText); + Dealer().Deal_Eol(); +} + + +} // namespace cpp + + + + + + + + + diff --git a/autodoc/source/parser/cpp/cx_c_pp.hxx b/autodoc/source/parser/cpp/cx_c_pp.hxx new file mode 100644 index 000000000000..47a14f795702 --- /dev/null +++ b/autodoc/source/parser/cpp/cx_c_pp.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_c_pp.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_CPP_CX_C_PP_HXX +#define ADC_CPP_CX_C_PP_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcontx.hxx> +#include "cx_base.hxx" + // COMPONENTS + // PARAMETERS + + +namespace cpp +{ + +class Context_Preprocessor : public Cx_Base +{ + public: + Context_Preprocessor( + TkpContext & i_rFollowUpContext ); + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual void AssignDealer( + Distributor & o_rDealer ); + private: + // Locals + void ReadDefault( + CharacterSource & io_rText ); + void ReadDefine( + CharacterSource & io_rText ); + + // DATA + TkpContext * pContext_Parent; + Dyn<Cx_Base> pContext_PP_MacroParams; + Dyn<Cx_Base> pContext_PP_Definition; +}; + +class Context_PP_MacroParams : public Cx_Base +{ + public: + Context_PP_MacroParams( + Cx_Base & i_rFollowUpContext ); + + virtual void ReadCharChain( + CharacterSource & io_rText ); + private: + // DATA + Cx_Base * pContext_PP_Definition; +}; + +class Context_PP_Definition : public Cx_Base +{ + public: + Context_PP_Definition( + TkpContext & i_rFollowUpContext ); + + virtual void ReadCharChain( + CharacterSource & io_rText ); + + private: + // DATA + TkpContext * pContext_Parent; +}; + + +} // namespace cpp + +#endif + diff --git a/autodoc/source/parser/cpp/cx_c_std.cxx b/autodoc/source/parser/cpp/cx_c_std.cxx new file mode 100644 index 000000000000..6c5edfed190d --- /dev/null +++ b/autodoc/source/parser/cpp/cx_c_std.cxx @@ -0,0 +1,532 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_c_std.cxx,v $ + * $Revision: 1.9 $ + * + * 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 "cx_c_std.hxx" + + +// NOT FULLY DECLARED SERVICES +#include "all_toks.hxx" +#include "cx_c_pp.hxx" +#include "cx_c_sub.hxx" +#include <tools/tkpchars.hxx> +#include <tokens/tkpstama.hxx> +#include <x_parse.hxx> +#include "c_dealer.hxx" + + +namespace cpp { + + +const intt C_nCppInitialNrOfStati = 600; +const intt C_nStatusSize = 128; + + + +const uintt nF_fin_Error = 1; +const uintt nF_fin_CreateWithoutText = 2; +const uintt nF_fin_CreateWithText = 3; +const uintt nF_fin_Ignore = 4; +const uintt nF_fin_EOL = 5; +const uintt nF_fin_EOF = 6; +const uintt nF_fin_Bezeichner = 7; + +const uintt nF_goto_Preprocessor = 10; +const uintt nF_goto_Comment = 11; +const uintt nF_goto_Docu = 12; +const uintt nF_goto_Const = 13; +const uintt nF_goto_UnblockMacro = 14; + +// Token create functions for the state machine: +DYN TextToken * TCF_Identifier(const char * text) { return new Tok_Identifier(text); } + +DYN TextToken * TCF_operator(const char *) { return new Tok_operator; } +DYN TextToken * TCF_class(const char *) { return new Tok_class; } +DYN TextToken * TCF_struct(const char *) { return new Tok_struct; } +DYN TextToken * TCF_union(const char *) { return new Tok_union; } +DYN TextToken * TCF_enum(const char *) { return new Tok_enum; } +DYN TextToken * TCF_typedef(const char *) { return new Tok_typedef; } +DYN TextToken * TCF_public(const char *) { return new Tok_public; } +DYN TextToken * TCF_protected(const char *) { return new Tok_protected; } +DYN TextToken * TCF_private(const char *) { return new Tok_private; } +DYN TextToken * TCF_template(const char *) { return new Tok_template; } +DYN TextToken * TCF_virtual(const char *) { return new Tok_virtual; } +DYN TextToken * TCF_friend(const char *) { return new Tok_friend; } +DYN TextToken * TCF_Tilde(const char *) { return new Tok_Tilde; } +DYN TextToken * TCF_const(const char *) { return new Tok_const; } +DYN TextToken * TCF_volatile(const char *) { return new Tok_volatile; } +DYN TextToken * TCF_extern(const char *) { return new Tok_extern; } +DYN TextToken * TCF_static(const char *) { return new Tok_static; } +DYN TextToken * TCF_mutable(const char *) { return new Tok_mutable; } +DYN TextToken * TCF_register(const char *) { return new Tok_register; } +DYN TextToken * TCF_inline(const char *) { return new Tok_inline; } +DYN TextToken * TCF_explicit(const char *) { return new Tok_explicit; } +DYN TextToken * TCF_namespace(const char *) { return new Tok_namespace; } +DYN TextToken * TCF_using(const char *) { return new Tok_using; } +DYN TextToken * TCF_throw(const char *) { return new Tok_throw; } +DYN TextToken * TCF_SwBracketOpen(const char *) { return new Tok_SwBracket_Left; } +DYN TextToken * TCF_SwBracketClose(const char *) { return new Tok_SwBracket_Right; } +DYN TextToken * TCF_ArBracketOpen(const char *) { return new Tok_ArrayBracket_Left; } +DYN TextToken * TCF_ArBracketClose(const char *) { return new Tok_ArrayBracket_Right; } +DYN TextToken * TCF_BracketOpen(const char *) { return new Tok_Bracket_Left; } +DYN TextToken * TCF_BracketClose(const char *) { return new Tok_Bracket_Right; } +DYN TextToken * TCF_DblColon(const char *) { return new Tok_DoubleColon; } +DYN TextToken * TCF_Semikolon(const char *) { return new Tok_Semicolon; } +DYN TextToken * TCF_Komma(const char *) { return new Tok_Comma; } +DYN TextToken * TCF_Colon(const char *) { return new Tok_Colon; } +DYN TextToken * TCF_Zuweisung(const char *) { return new Tok_Assign; } +DYN TextToken * TCF_Smaller(const char *) { return new Tok_Less; } +DYN TextToken * TCF_Bigger(const char *) { return new Tok_Greater; } +DYN TextToken * TCF_Stern(const char *) { return new Tok_Asterix; } +DYN TextToken * TCF_Ampersand(const char *) { return new Tok_AmpersAnd; } +DYN TextToken * TCF_Ellipse(const char *) { return new Tok_Ellipse; } +DYN TextToken * TCF_typename(const char *) { return new Tok_typename; } + + // Operators +DYN TextToken * TCF_Operator(const char * text) { return new Tok_Operator(text); } + +DYN TextToken * TCF_BuiltInType(const char * text) { return new Tok_BuiltInType(text); } +DYN TextToken * TCF_TypeModifier(const char * text) { return new Tok_TypeSpecializer(text); } + +DYN TextToken * TCF_Eof(const char *) { return new Tok_Eof; } + + + +Context_CppStd::Context_CppStd( DYN autodoc::TkpDocuContext & let_drContext_Docu ) + : Cx_Base(0), + aStateMachine(C_nStatusSize,C_nCppInitialNrOfStati), + pDocuContext(&let_drContext_Docu), + pContext_Comment(0), + pContext_Preprocessor(0), + pContext_ConstString(0), + pContext_ConstChar(0), + pContext_ConstNumeric(0), + pContext_UnblockMacro(0) +{ + pDocuContext->SetParentContext(*this,"*/"); + + pContext_Comment = new Context_Comment(*this); + pContext_Preprocessor = new Context_Preprocessor(*this); + pContext_ConstString = new Context_ConstString(*this); + pContext_ConstChar = new Context_ConstChar(*this); + pContext_ConstNumeric = new Context_ConstNumeric(*this); + pContext_UnblockMacro = new Context_UnblockMacro(*this); + + SetupStateMachine(); +} + +Context_CppStd::~Context_CppStd() +{ +} + +void +Context_CppStd::ReadCharChain( CharacterSource & io_rText ) +{ + SetNewToken(0); + + TextToken::F_CRTOK fTokenCreateFunction = 0; + StmBoundsStatus & rBound = aStateMachine.GetCharChain(fTokenCreateFunction, io_rText); + + // !!! + // The order of the next two lines is essential, because + // pFollowUpContext may be changed by PerformStatusFunction() also, + // which then MUST override the previous assignment. + SetFollowUpContext(rBound.FollowUpContext()); + PerformStatusFunction(rBound.StatusFunctionNr(), fTokenCreateFunction, io_rText); +} + +void +Context_CppStd::AssignDealer( Distributor & o_rDealer ) +{ + Cx_Base::AssignDealer(o_rDealer); + + pDocuContext->AssignDealer(o_rDealer); + pContext_Comment->AssignDealer(o_rDealer); + pContext_Preprocessor->AssignDealer(o_rDealer); + pContext_ConstString->AssignDealer(o_rDealer); + pContext_ConstChar->AssignDealer(o_rDealer); + pContext_ConstNumeric->AssignDealer(o_rDealer); + pContext_UnblockMacro->AssignDealer(o_rDealer); +} + +void +Context_CppStd::PerformStatusFunction( uintt i_nStatusSignal, + F_CRTOK i_fTokenCreateFunction, + CharacterSource & io_rText ) +{ + switch (i_nStatusSignal) + { + case nF_fin_CreateWithoutText: + io_rText.CutToken(); + csv_assert(i_fTokenCreateFunction != 0); + SetNewToken( (*i_fTokenCreateFunction)(0) ); + break; + case nF_fin_CreateWithText: + csv_assert(i_fTokenCreateFunction != 0); + SetNewToken( (*i_fTokenCreateFunction)(io_rText.CutToken()) ); + break; + case nF_fin_Ignore: + io_rText.CutToken(); + SetNewToken(0); + break; + case nF_fin_EOL: + io_rText.CutToken(); + SetNewToken(0); + Dealer().Deal_Eol(); + break; + case nF_fin_EOF: + io_rText.CutToken(); + SetNewToken( TCF_Eof(0) ); + break; + case nF_fin_Bezeichner: + SetNewToken( TCF_Identifier(io_rText.CutToken()) ); + break; + + case nF_goto_Preprocessor: + io_rText.CutToken(); + SetNewToken(0); + break; + case nF_goto_Comment: + SetNewToken(0); + pContext_Comment->SetMode_IsMultiLine( io_rText.CutToken()[1] == '*' ); + break; + case nF_goto_Docu: + SetNewToken(0); + pDocuContext->SetMode_IsMultiLine( io_rText.CutToken()[1] == '*' ); + break; + case nF_goto_Const: + SetNewToken(0); + break; + case nF_goto_UnblockMacro: + SetNewToken(0); + break; + + case nF_fin_Error: + default: + { + char cCC = io_rText.CurChar(); + String sCurChar( &cCC, 1 ); + throw X_Parser( X_Parser::x_InvalidChar, sCurChar, String::Null_(), 0 ); + } + } // end switch (i_nStatusSignal) +} + +void +Context_CppStd::SetupStateMachine() +{ + // Besondere Array-Stati (kein Tokenabschluss oder Kontextwechsel): +// const INT16 top = 0; // Top-Status + const INT16 wht = 1; // Whitespace-berlese-Status + const INT16 bez = 2; // Bezeichner-lese-Status + + // Tokenfinish-Stati: + const INT16 finError = 3; + const INT16 finIgnore = 4; + const INT16 finBezeichner = 5; + const INT16 finKeyword = 6; + const INT16 finPunctuation = 7; + const INT16 finBiType = 8; + const INT16 finTypeModifier = 9; + const INT16 finEOL = 10; + const INT16 finEOF = 11; + + // Kontextwechsel-Stati: + const INT16 gotoComment = 12; + const INT16 gotoDocu = 13; + const INT16 gotoPreprocessor = 14; + const INT16 gotoConstString = 15; + const INT16 gotoConstChar = 16; + const INT16 gotoConstNumeric = 17; + const INT16 gotoUnblockMacro = 18; + + // Abbreviations to be used in status tables: + const INT16 err = finError; + const INT16 fig = finIgnore; + const INT16 fbz = finBezeichner; + const INT16 fof = finEOF; + const INT16 cst = gotoConstString; + const INT16 cch = gotoConstChar; + const INT16 cnr = gotoConstNumeric; + + + /// Zeros - '0' - will be replaced by AddToken(). + + const INT16 A_nTopStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht, 0,wht,wht, 0,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // 16 ... + wht, 0,cst, 0,err, 0, 0,cch, 0, 0, 0, 0, 0, 0, 0, 0, + cnr,cnr,cnr,cnr,cnr,cnr,cnr,cnr,cnr,cnr, 0, 0, 0, 0, 0, 0, // 48 ... + 0,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 0, 0, 0, 0,bez, // 80 ... + 0,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 0, 0, 0, 0,err, // 80 ... + }; + + const INT16 A_nWhitespaceStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht,fig,wht,wht,fig,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // 16 ... + wht,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, // 48 ... + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, // 80 ... + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,err + }; + + const INT16 A_nBezeichnerStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fbz,err,err,err,err,err,err,err,err,fbz,fbz,fbz,fbz,fbz,err,err, + err,err,err,err,err,err,err,err,err,err,fbz,err,err,err,err,err, // 16 ... + fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,fbz,fbz, // 48 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,bez, // 80 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,err + }; + + + const INT16 A_nOperatorDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 16 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 48 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 80 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err + }; + + const INT16 A_nBezDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fbz,err,err,err,err,err,err,err,err,fbz,fbz,fbz,fbz,fbz,err,err, + err,err,err,err,err,err,err,err,err,err,fbz,err,err,err,err,err, // 16 ... + fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,fbz,fbz, // 48 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,bez, // 80 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,err + }; + + DYN StmArrayStatus * dpStatusTop + = new StmArrayStatus( C_nStatusSize, A_nTopStatus, 0, true); + DYN StmArrayStatus * dpStatusWhite + = new StmArrayStatus( C_nStatusSize, A_nWhitespaceStatus, 0, true); + DYN StmArrayStatus * dpStatusBez + = new StmArrayStatus( C_nStatusSize, A_nBezeichnerStatus, TCF_Identifier, true); + + DYN StmBoundsStatus * dpBst_finError + = new StmBoundsStatus( *this, TkpContext::Null_(), nF_fin_Error, true ); + DYN StmBoundsStatus * dpBst_finIgnore + = new StmBoundsStatus( *this, *this, nF_fin_Ignore, true ); + DYN StmBoundsStatus * dpBst_finBezeichner + = new StmBoundsStatus( *this, *this, nF_fin_Bezeichner, true ); + DYN StmBoundsStatus * dpBst_finKeyword + = new StmBoundsStatus( *this, *this, nF_fin_CreateWithoutText, false ); + DYN StmBoundsStatus * dpBst_finPunctuation + = new StmBoundsStatus( *this, *this, nF_fin_CreateWithText, false ); + DYN StmBoundsStatus * dpBst_finBiType + = new StmBoundsStatus( *this, *this, nF_fin_CreateWithText, false ); + DYN StmBoundsStatus * dpBst_finTypeModifier + = new StmBoundsStatus( *this, *this, nF_fin_CreateWithText, false ); + DYN StmBoundsStatus * dpBst_finEOL + = new StmBoundsStatus( *this, *this, nF_fin_EOL, false ); + DYN StmBoundsStatus * dpBst_finEOF + = new StmBoundsStatus( *this, TkpContext::Null_(), nF_fin_EOF, false ); + + DYN StmBoundsStatus * dpBst_gotoComment + = new StmBoundsStatus( *this, *pContext_Comment, nF_goto_Comment, false ); + DYN StmBoundsStatus * dpBst_gotoDocu + = new StmBoundsStatus( *this, *pDocuContext, nF_goto_Docu, false ); + DYN StmBoundsStatus * dpBst_gotoPreprocessor + = new StmBoundsStatus( *this, *pContext_Preprocessor, nF_goto_Preprocessor, false ); + DYN StmBoundsStatus * dpBst_gotoConstString + = new StmBoundsStatus( *this, *pContext_ConstString, nF_goto_Const, false ); + DYN StmBoundsStatus * dpBst_gotoConstChar + = new StmBoundsStatus( *this, *pContext_ConstChar, nF_goto_Const, false ); + DYN StmBoundsStatus * dpBst_gotoConstNumeric + = new StmBoundsStatus( *this, *pContext_ConstNumeric, nF_goto_Const, false ); + DYN StmBoundsStatus * dpBst_gotoUnblockMacro + = new StmBoundsStatus( *this, *pContext_UnblockMacro, nF_goto_UnblockMacro, false ); + + // dpMain aufbauen: + aStateMachine.AddStatus(dpStatusTop); + + aStateMachine.AddStatus(dpStatusWhite); + aStateMachine.AddStatus(dpStatusBez); + + aStateMachine.AddStatus(dpBst_finError); + aStateMachine.AddStatus(dpBst_finIgnore); + aStateMachine.AddStatus(dpBst_finBezeichner); + aStateMachine.AddStatus(dpBst_finKeyword); + aStateMachine.AddStatus(dpBst_finPunctuation); + aStateMachine.AddStatus(dpBst_finBiType); + aStateMachine.AddStatus(dpBst_finTypeModifier); + aStateMachine.AddStatus(dpBst_finEOL); + aStateMachine.AddStatus(dpBst_finEOF); + + aStateMachine.AddStatus(dpBst_gotoComment); + aStateMachine.AddStatus(dpBst_gotoDocu); + aStateMachine.AddStatus(dpBst_gotoPreprocessor); + aStateMachine.AddStatus(dpBst_gotoConstString); + aStateMachine.AddStatus(dpBst_gotoConstChar); + aStateMachine.AddStatus(dpBst_gotoConstNumeric); + aStateMachine.AddStatus(dpBst_gotoUnblockMacro); + + // Identifier + + // Keywords and other unique Tokens + aStateMachine.AddToken("operator",TCF_operator,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("class",TCF_class,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("struct",TCF_struct,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("union",TCF_union,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("enum",TCF_enum,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("typedef",TCF_typedef,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("public",TCF_public,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("protected",TCF_protected,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("private",TCF_private,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("template",TCF_template,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("virtual",TCF_virtual,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("friend",TCF_friend,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("~",TCF_Tilde,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("const",TCF_const,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("volatile",TCF_volatile,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("extern",TCF_extern,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("static",TCF_static,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("mutable",TCF_mutable,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("register",TCF_register,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("inline",TCF_inline,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("explicit",TCF_explicit,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("namespace",TCF_namespace,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("using",TCF_using,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("throw",TCF_throw,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("{",TCF_SwBracketOpen,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("}",TCF_SwBracketClose,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("[",TCF_ArBracketOpen,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("]",TCF_ArBracketClose,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("(",TCF_BracketOpen,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken(")",TCF_BracketClose,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("::",TCF_DblColon,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken(";",TCF_Semikolon,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken(",",TCF_Komma,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken(":",TCF_Colon,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("=",TCF_Zuweisung,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("<",TCF_Smaller,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken(">",TCF_Bigger,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("*",TCF_Stern,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("&",TCF_Ampersand,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("...",TCF_Ellipse,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("typename",TCF_typename,A_nOperatorDefStatus,finKeyword); + + // Operators + aStateMachine.AddToken("==",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("!=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("<=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken(">=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("&&",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("||",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("!",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("new",TCF_Operator,A_nBezDefStatus,finPunctuation); + aStateMachine.AddToken("delete",TCF_Operator,A_nBezDefStatus,finPunctuation); + aStateMachine.AddToken("sizeof",TCF_Operator,A_nBezDefStatus,finPunctuation); + aStateMachine.AddToken("typeid",TCF_Operator,A_nBezDefStatus,finPunctuation); + aStateMachine.AddToken("+",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("-",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("/",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("%",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("^",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("|",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("<<",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken(">>",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken(".",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("->",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("?",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("+=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("-=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("*=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("/=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("%=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("&=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("|=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("^=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("<<=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken(">>=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + + // Builtin types + aStateMachine.AddToken("char", TCF_BuiltInType, A_nBezDefStatus, finBiType); + aStateMachine.AddToken("short", TCF_BuiltInType, A_nBezDefStatus, finBiType); + aStateMachine.AddToken("int", TCF_BuiltInType, A_nBezDefStatus, finBiType); + aStateMachine.AddToken("long", TCF_BuiltInType, A_nBezDefStatus, finBiType); + aStateMachine.AddToken("float", TCF_BuiltInType, A_nBezDefStatus, finBiType); + aStateMachine.AddToken("double",TCF_BuiltInType, A_nBezDefStatus, finBiType); + aStateMachine.AddToken("wchar_t",TCF_BuiltInType, A_nBezDefStatus, finBiType); + aStateMachine.AddToken("size_t",TCF_BuiltInType, A_nBezDefStatus, finBiType); + + // Type modifiers + aStateMachine.AddToken("signed", TCF_TypeModifier, A_nBezDefStatus, finTypeModifier); + aStateMachine.AddToken("unsigned", TCF_TypeModifier, A_nBezDefStatus, finTypeModifier); + + // To ignore + aStateMachine.AddToken("auto", 0, A_nBezDefStatus, finIgnore); + aStateMachine.AddToken("_cdecl", 0, A_nBezDefStatus, finIgnore); + aStateMachine.AddToken("__cdecl", 0, A_nBezDefStatus, finIgnore); + aStateMachine.AddToken("__stdcall", 0, A_nBezDefStatus, finIgnore); + aStateMachine.AddToken("__fastcall",0, A_nBezDefStatus, finIgnore); + aStateMachine.AddToken("/**/", 0, A_nOperatorDefStatus,finIgnore); + + // Context changers + aStateMachine.AddToken("#", 0, A_nOperatorDefStatus, gotoPreprocessor); + aStateMachine.AddToken("#undef",0, A_nOperatorDefStatus, gotoPreprocessor); + aStateMachine.AddToken("#unblock-", + 0, A_nOperatorDefStatus, gotoUnblockMacro); + aStateMachine.AddToken("/*", 0, A_nOperatorDefStatus, gotoComment); + aStateMachine.AddToken("//", 0, A_nOperatorDefStatus, gotoComment); + aStateMachine.AddToken("/**", 0, A_nOperatorDefStatus, gotoDocu); + aStateMachine.AddToken("///", 0, A_nOperatorDefStatus, gotoDocu); + + // Line ends + // regular + aStateMachine.AddToken("\r\n", 0, A_nOperatorDefStatus, finEOL); + aStateMachine.AddToken("\n", 0, A_nOperatorDefStatus, finEOL); + aStateMachine.AddToken("\r", 0, A_nOperatorDefStatus, finEOL); + // To ignore in some cases(may be only at preprocessor?), but + // linecount has to be incremented. + aStateMachine.AddToken("\\\r\n",0, A_nOperatorDefStatus, finEOL); + aStateMachine.AddToken("\\\n", 0, A_nOperatorDefStatus, finEOL); + aStateMachine.AddToken("\\\r", 0, A_nOperatorDefStatus, finEOL); +}; + + +} // namespace cpp + diff --git a/autodoc/source/parser/cpp/cx_c_std.hxx b/autodoc/source/parser/cpp/cx_c_std.hxx new file mode 100644 index 000000000000..34bcf56e3c77 --- /dev/null +++ b/autodoc/source/parser/cpp/cx_c_std.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_c_std.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_CPP_CX_C_STD_HXX +#define ADC_CPP_CX_C_STD_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcontx.hxx> +#include "cx_base.hxx" + // COMPONENTS +#include <tokens/tkpstama.hxx> + // PARAMETERS + + + +namespace cpp { + +class Context_Comment; + +/** +*/ +class Context_CppStd : public Cx_Base, + private StateMachineContext +{ + public: + // LIFECYCLE + Context_CppStd( + DYN autodoc::TkpDocuContext & + let_drContext_Docu ); + ~Context_CppStd(); + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual void AssignDealer( + Distributor & o_rDealer ); + private: + // SERVICE FUNCTIONS + void PerformStatusFunction( + uintt i_nStatusSignal, + StmArrayStatus::F_CRTOK + i_fTokenCreateFunction, + CharacterSource & io_rText ); + void SetupStateMachine(); + + // DATA + StateMachine aStateMachine; + + // Contexts + Dyn<autodoc::TkpDocuContext> + pDocuContext; + + Dyn<Context_Comment> + pContext_Comment; + Dyn<Cx_Base> pContext_Preprocessor; + Dyn<Cx_Base> pContext_ConstString; + Dyn<Cx_Base> pContext_ConstChar; + Dyn<Cx_Base> pContext_ConstNumeric; + Dyn<Cx_Base> pContext_UnblockMacro; +}; + + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/cx_c_sub.cxx b/autodoc/source/parser/cpp/cx_c_sub.cxx new file mode 100644 index 000000000000..e45f121efb66 --- /dev/null +++ b/autodoc/source/parser/cpp/cx_c_sub.cxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_c_sub.cxx,v $ + * $Revision: 1.9 $ + * + * 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 "cx_c_sub.hxx" + + + +// NOT FULLY DECLARED SERVICES +#include <ctype.h> +#include "c_dealer.hxx" +#include <tokens/parseinc.hxx> +#include <x_parse.hxx> +#include "all_toks.hxx" + + +namespace cpp { + + + +void +Context_Comment::ReadCharChain( CharacterSource & io_rText ) +{ + // KORR_FUTURE + // Counting of lines must be implemented. + if (bCurrentModeIsMultiline) + { + char cNext = NULCH; + + do { + do { + cNext = jumpTo( io_rText,'*',char(10) ); + if (cNext == NULCH) + throw X_Parser( X_Parser::x_UnexpectedEOF, "", String::Null_(), 0 ); + else if ( cNext == char(10) ) + { + jumpOverEol(io_rText); + Dealer().Deal_Eol(); + } + } while ( cNext != '*'); + cNext = jumpOver(io_rText,'*'); + if (cNext == NULCH) + throw X_Parser( X_Parser::x_UnexpectedEOF, "", String::Null_(), 0 ); + } while (cNext != '/'); + io_rText.MoveOn(); + io_rText.CutToken(); + SetNewToken(0); + } + else // + { + int o_rCount_BackslashedLineBreaks = 0; + jumpToEol(io_rText,o_rCount_BackslashedLineBreaks); + for ( ; o_rCount_BackslashedLineBreaks > 0; --o_rCount_BackslashedLineBreaks ) + Dealer().Deal_Eol(); + + if (io_rText.CurChar() != NULCH) + jumpOverEol(io_rText); + io_rText.CutToken(); + Dealer().Deal_Eol(); + SetNewToken(0); + } // endif +} + + +void +Context_ConstString::ReadCharChain( CharacterSource & io_rText ) +{ + char cNext = io_rText.MoveOn(); + + while (cNext != '"') + { // Get one complete string constant: "...." + while (cNext != '"' AND cNext != '\\') + { // Get string till next '\\' + cNext = io_rText.MoveOn(); + } + if (cNext == '\\') + { + io_rText.MoveOn(); + cNext = io_rText.MoveOn(); + } + } + io_rText.MoveOn(); + SetNewToken(new Tok_Constant(io_rText.CutToken())); +} + +void +Context_ConstChar::ReadCharChain( CharacterSource & io_rText ) +{ + char cNext = io_rText.MoveOn(); + + while (cNext != '\'') + { // Get one complete char constant: "...." + while (cNext != '\'' AND cNext != '\\') + { // Get string till next '\\' + cNext = io_rText.MoveOn(); + } + if (cNext == '\\') + { + io_rText.MoveOn(); + cNext = io_rText.MoveOn(); + } + } + io_rText.MoveOn(); + SetNewToken(new Tok_Constant(io_rText.CutToken())); +} + +void +Context_ConstNumeric::ReadCharChain(CharacterSource & io_rText) +{ + char cNext = 0; + + do { + do { + cNext = static_cast<char>( tolower(io_rText.MoveOn()) ); + } while ( (cNext != 'e' AND isalnum(cNext)) OR cNext == '.'); + if (cNext == 'e') + { + cNext = io_rText.MoveOn(); + if (cNext == '+' OR cNext == '-') + cNext = io_rText.MoveOn(); + } // endif + } while (isalnum(cNext) OR cNext == '.'); // Reicht aus, wenn Zahlen korrekt geschrieben sind + SetNewToken(new Tok_Constant(io_rText.CutToken())); +} + +void +Context_UnblockMacro::ReadCharChain(CharacterSource & io_rText) +{ + jumpToWhite(io_rText); + SetNewToken(new Tok_UnblockMacro( io_rText.CutToken() + strlen("#unblock-") )); +} + +} // namespace cpp diff --git a/autodoc/source/parser/cpp/cx_c_sub.hxx b/autodoc/source/parser/cpp/cx_c_sub.hxx new file mode 100644 index 000000000000..d51d9c213cfc --- /dev/null +++ b/autodoc/source/parser/cpp/cx_c_sub.hxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_c_sub.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_CPP_CX_C_SUB_HXX +#define ADC_CPP_CX_C_SUB_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcontx.hxx> +#include "cx_base.hxx" + // COMPONENTS + // PARAMETERS + + +namespace cpp { + + +class Context_Comment : public Cx_Base +{ + public: + Context_Comment( + TkpContext & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetMode_IsMultiLine( + bool i_bTrue ) + { bCurrentModeIsMultiline = i_bTrue; } + private: + bool bCurrentModeIsMultiline; +}; + +class Context_ConstString : public Cx_Base +{ + public: + Context_ConstString( + TkpContext & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + +class Context_ConstChar : public Cx_Base +{ + public: + Context_ConstChar( + TkpContext & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + +class Context_ConstNumeric : public Cx_Base +{ + public: + Context_ConstNumeric( + TkpContext & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + +class Context_UnblockMacro : public Cx_Base +{ + public: + Context_UnblockMacro( + TkpContext & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/cxt2ary.cxx b/autodoc/source/parser/cpp/cxt2ary.cxx new file mode 100644 index 000000000000..7a30c7884a1b --- /dev/null +++ b/autodoc/source/parser/cpp/cxt2ary.cxx @@ -0,0 +1,360 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cxt2ary.cxx,v $ + * $Revision: 1.9 $ + * + * 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 "cxt2ary.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/entity.hxx> +#include <ary/cpp/c_class.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_tydef.hxx> +#include <ary/cpp/c_vari.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <ary/loc/loc_file.hxx> +#include <ary/doc/d_oldcppdocu.hxx> +#include <ary/info/docstore.hxx> +#include "icprivow.hxx" + +// Implementationheaders, only to be used in this file! +#include "sfscope.hxx" +#include "sownstck.hxx" +#include "sdocdist.hxx" +#include "srecover.hxx" + + + + + +namespace cpp +{ + +using ary::cpp::E_Protection; + +ContextForAry::ContextForAry( ary::cpp::Gate & io_rAryGate ) + : pGate(&io_rAryGate), + aTokenResult(), + pFileScopeInfo( new S_FileScopeInfo ), + pOwnerStack( new S_OwnerStack ), + pDocuDistributor( new S_DocuDistributor ), + pRecoveryGuard( new S_RecoveryGuard ) +{ + OpenNamespace( pGate->Ces().GlobalNamespace() ); +} + +ContextForAry::~ContextForAry() +{ +} + +ary::loc::File & +ContextForAry::inq_CurFile() const +{ + csv_assert(pFileScopeInfo->pCurFile != 0); + + return *pFileScopeInfo->pCurFile; +} + +ary::cpp::Namespace & +ContextForAry::inq_CurNamespace() const +{ + return pOwnerStack->CurNamespace(); +} + +ary::cpp::Class * +ContextForAry::inq_CurClass() const +{ + return pOwnerStack->CurClass(); +} + +ary::cpp::Enum * +ContextForAry::inq_CurEnum() const +{ + return pOwnerStack->CurEnum(); +} + + +ary::cpp::InputContext::Owner & +ContextForAry::inq_CurOwner() const +{ + return pOwnerStack->CurOwner(); +} + +E_Protection +ContextForAry::inq_CurProtection() const +{ + return pOwnerStack->CurProtection(); +} + +void +ContextForAry::do_SetTokenResult( E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + ParseEnvironment * i_pParseEnv2Push ) +{ + aTokenResult.eDone = i_eDone; + aTokenResult.eStackAction = i_eWhat2DoWithEnvStack; + aTokenResult.pEnv2Push = i_pParseEnv2Push; +} + +void +ContextForAry::do_OpenNamespace( ary::cpp::Namespace & io_rOpenedNamespace ) +{ + pOwnerStack->OpenNamespace( io_rOpenedNamespace ); +} + +void +ContextForAry::do_OpenExternC( bool ) +{ + pOwnerStack->OpenExternC(); + // KORR_FUTURE + // use i_bOnlyForOneDeclaration +} + +void +ContextForAry::do_OpenClass( ary::cpp::Class & io_rOpenedClass ) +{ + pOwnerStack->OpenClass(io_rOpenedClass); + pDocuDistributor->SetCurrentlyStoredRe(io_rOpenedClass); +} + +void +ContextForAry::do_OpenEnum( ary::cpp::Enum & io_rOpenedEnum ) +{ + pOwnerStack->OpenEnum(io_rOpenedEnum); + pDocuDistributor->SetCurrentlyStoredRe(io_rOpenedEnum); +} + +void +ContextForAry::do_CloseBlock() +{ + pOwnerStack->CloseBlock(); +} + +void +ContextForAry::do_CloseClass() +{ + pOwnerStack->CloseClass(); +} + +void +ContextForAry::do_CloseEnum() +{ + pOwnerStack->CloseEnum(); +} + +void +ContextForAry::do_SetCurProtection( ary::cpp::E_Protection i_eProtection ) +{ + pOwnerStack->SetCurProtection(i_eProtection); +} + +void +ContextForAry::do_OpenTemplate( const StringVector & i_rParameters ) +{ + pFileScopeInfo->pCurTemplateParameters = new StringVector(i_rParameters); +} + +DYN StringVector * +ContextForAry::do_Get_CurTemplateParameters() +{ + return pFileScopeInfo->pCurTemplateParameters.Release(); +} + +void +ContextForAry::do_Close_OpenTemplate() +{ + if (pFileScopeInfo->pCurTemplateParameters) + delete pFileScopeInfo->pCurTemplateParameters.Release(); +} + +void +ContextForAry::do_Event_Class_FinishedBase( const String & ) +{ + // KORR_FUTURE +} + +void +ContextForAry::do_Event_Store_Typedef( ary::cpp::Typedef & io_rTypedef ) +{ + pDocuDistributor->SetCurrentlyStoredRe(io_rTypedef); +} + +void +ContextForAry::do_Event_Store_EnumValue( ary::cpp::EnumValue & io_rEnumValue ) +{ + pDocuDistributor->SetCurrentlyStoredRe(io_rEnumValue); +} + +void +ContextForAry::do_Event_Store_CppDefinition( ary::cpp::DefineEntity & io_rDefinition ) +{ + pDocuDistributor->SetCurrentlyStoredRe(io_rDefinition); +} + +void +ContextForAry::do_Event_EnterFunction_ParameterList() +{ + // KORR_FUTURE + // Inform pDocuDistributor about possibility of parameters' inline documentation. +} + +void +ContextForAry::do_Event_Function_FinishedParameter( const String & ) +{ + // KORR_FUTURE +} + +void +ContextForAry::do_Event_LeaveFunction_ParameterList() +{ + // KORR_FUTURE +} + +void +ContextForAry::do_Event_EnterFunction_Implementation() +{ + // KORR_FUTURE +} + +void +ContextForAry::do_Event_LeaveFunction_Implementation() +{ + // KORR_FUTURE +} + +void +ContextForAry::do_Event_Store_Function( ary::cpp::Function & io_rFunction ) +{ + pDocuDistributor->SetCurrentlyStoredRe(io_rFunction); +} + + +void +ContextForAry::do_Event_Store_Variable( ary::cpp::Variable & io_rVariable ) +{ + pDocuDistributor->SetCurrentlyStoredRe(io_rVariable); +} + +void +ContextForAry::do_TakeDocu( DYN ary::doc::OldCppDocu & let_drInfo ) +{ + let_drInfo.Store2(*pDocuDistributor); +} + +void +ContextForAry::do_StartWaitingFor_Recovery() +{ + pRecoveryGuard->StartWaitingFor_Recovery(); +} + +ary::cpp::Gate & +ContextForAry::inq_AryGate() const +{ + return * const_cast< ary::cpp::Gate* >(pGate); +} + +const ary::cpp::InputContext & +ContextForAry::inq_Context() const +{ + return *this; +} + +String +ContextForAry::inq_CurFileName() const +{ + return pFileScopeInfo->pCurFile != 0 + ? pFileScopeInfo->pCurFile->LocalName() + : String::Null_(); +} + +uintt +ContextForAry::inq_LineCount() const +{ + return pFileScopeInfo->nLineCount; +} + +bool +ContextForAry::inq_IsWaitingFor_Recovery() const +{ + return pRecoveryGuard->IsWithinRecovery(); +} + +bool +ContextForAry::inq_IsExternC() const +{ + return pOwnerStack->IsExternC(); +} + +void +ContextForAry::do_SetCurFile( ary::loc::File & io_rCurFile ) +{ + pFileScopeInfo->pCurFile = &io_rCurFile; + pFileScopeInfo->nLineCount = 0; + pFileScopeInfo->pCurTemplateParameters = 0; + + pOwnerStack->Reset(); + pDocuDistributor->Reset(); + pRecoveryGuard->Reset(); +} + +void +ContextForAry::do_Event_IncrLineCount() +{ + ++pFileScopeInfo->nLineCount; + pDocuDistributor->Event_LineBreak(); +} + +void +ContextForAry::do_Event_SwBracketOpen() +{ + pRecoveryGuard->Hdl_SwBracketOpen(); +} + +void +ContextForAry::do_Event_SwBracketClose() +{ + pRecoveryGuard->Hdl_SwBracketClose(); +} + +void +ContextForAry::do_Event_Semicolon() +{ + pRecoveryGuard->Hdl_Semicolon(); +} + + + + +} // namespace cpp diff --git a/autodoc/source/parser/cpp/cxt2ary.hxx b/autodoc/source/parser/cpp/cxt2ary.hxx new file mode 100644 index 000000000000..93597ac5c097 --- /dev/null +++ b/autodoc/source/parser/cpp/cxt2ary.hxx @@ -0,0 +1,201 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cxt2ary.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_CPP_CTX2ARY_HXX +#define ADC_CPP_CTX2ARY_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <ary/cpp/inpcontx.hxx> +#include <doc_deal.hxx> +#include "pev.hxx" +#include "fevnthdl.hxx" + // COMPONENTS + // PARAMETERS + +namespace ary +{ +namespace loc +{ + class File; +} +} + + + +namespace cpp +{ + + +/** @descr + This class provides information about the context of an + CodeEntity, which is going to be stored in the repository. + The information is used mainly by class ary::cpp::Gate. + + Also it provides information for the parser about actual + state of several public variables. + + @todo + Include events, which allow correct storing of inline + documentation after enum values, parameters, + base classes. +*/ +class ContextForAry : public ary::cpp::InputContext, + public cpp::PeEnvironment, + public cpp::FileScope_EventHandler, + public DocuDealer +{ + public: + // LIFECYCLE + ContextForAry( + ary::cpp::Gate & io_rAryGate ); + virtual ~ContextForAry(); + + // OPERATIONS + void ResetResult() { aTokenResult.Reset(); } + + // INQUIRY + const TokenProcessing_Result & + CurResult() const { return aTokenResult; } + // ACCESS + TokenProcessing_Result & + CurResult() { return aTokenResult; } + + private: + // Interface ary::cpp::InputContext: + virtual ary::loc::File & + inq_CurFile() const; + virtual ary::cpp::Namespace & + inq_CurNamespace() const; + virtual ary::cpp::Class * + inq_CurClass() const; + virtual ary::cpp::Enum * + inq_CurEnum() const; + + virtual Owner & inq_CurOwner() const; + virtual ary::cpp::E_Protection + inq_CurProtection() const; + + // Interface PeEnvironment + virtual void do_SetTokenResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + ParseEnvironment * i_pParseEnv2Push ); + virtual void do_OpenNamespace( + ary::cpp::Namespace & + io_rOpenedNamespace ); + virtual void do_OpenExternC( + bool i_bOnlyForOneDeclaration ); + virtual void do_OpenClass( + ary::cpp::Class & io_rOpenedClass ); + virtual void do_OpenEnum( + ary::cpp::Enum & io_rOpenedEnum ); + virtual void do_CloseBlock(); + virtual void do_CloseClass(); + virtual void do_CloseEnum(); + virtual void do_SetCurProtection( + ary::cpp::E_Protection + i_eProtection ); + virtual void do_OpenTemplate( + const StringVector & + i_rParameters ); + virtual DYN StringVector * + do_Get_CurTemplateParameters(); + virtual void do_Close_OpenTemplate(); + virtual void do_Event_Class_FinishedBase( + const String & i_sBaseName ); + + virtual void do_Event_Store_Typedef( + ary::cpp::Typedef & io_rTypedef ); + virtual void do_Event_Store_EnumValue( + ary::cpp::EnumValue & + io_rEnumValue ); + virtual void do_Event_Store_CppDefinition( + ary::cpp::DefineEntity & + io_rDefinition ); + virtual void do_Event_EnterFunction_ParameterList(); + virtual void do_Event_Function_FinishedParameter( + const String & i_sParameterName ); + virtual void do_Event_LeaveFunction_ParameterList(); + virtual void do_Event_EnterFunction_Implementation(); + virtual void do_Event_LeaveFunction_Implementation(); + virtual void do_Event_Store_Function( + ary::cpp::Function & + io_rFunction ); + virtual void do_Event_Store_Variable( + ary::cpp::Variable & + io_rVariable ); + virtual void do_TakeDocu( + DYN ary::doc::OldCppDocu & + let_drInfo ); + virtual void do_StartWaitingFor_Recovery(); + virtual ary::cpp::Gate & + inq_AryGate() const; + virtual const ary::cpp::InputContext & + inq_Context() const; + virtual String inq_CurFileName() const; + virtual uintt inq_LineCount() const; + virtual bool inq_IsWaitingFor_Recovery() const; + virtual bool inq_IsExternC() const; + + // Interface FileScope_EventHandler + virtual void do_SetCurFile( + ary::loc::File & io_rCurFile ); + virtual void do_Event_IncrLineCount(); + virtual void do_Event_SwBracketOpen(); + virtual void do_Event_SwBracketClose(); + virtual void do_Event_Semicolon(); + + // Local types + struct S_FileScopeInfo; + struct S_OwnerStack; + struct S_DocuDistributor; + struct S_RecoveryGuard; + + // DATA + ary::cpp::Gate * pGate; + TokenProcessing_Result + aTokenResult; + Dyn<S_FileScopeInfo> + pFileScopeInfo; + Dyn<S_OwnerStack> pOwnerStack; + Dyn<S_DocuDistributor> + pDocuDistributor; + Dyn<S_RecoveryGuard> + pRecoveryGuard; +}; + + + + +} // namespace cpp +#endif diff --git a/autodoc/source/parser/cpp/defdescr.cxx b/autodoc/source/parser/cpp/defdescr.cxx new file mode 100644 index 000000000000..fc0ece01cda5 --- /dev/null +++ b/autodoc/source/parser/cpp/defdescr.cxx @@ -0,0 +1,228 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: defdescr.cxx,v $ + * $Revision: 1.6.18.1 $ + * + * 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 "defdescr.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <prprpr.hxx> + + + + +namespace cpp +{ + + + + +DefineDescription::DefineDescription( const String & i_sName, + const str_vector & i_rDefinition ) + : sName(i_sName), + // aParams, + aDefinition(i_rDefinition), + eDefineType(type_define) +{ +} + +DefineDescription::DefineDescription( const String & i_sName, + const str_vector & i_rParams, + const str_vector & i_rDefinition ) + : sName(i_sName), + aParams(i_rParams), + aDefinition(i_rDefinition), + eDefineType(type_macro) +{ +} + +DefineDescription::~DefineDescription() +{ +} + +void +DefineDescription::GetDefineText( csv::StreamStr & o_rText ) const +{ + if ( aDefinition.begin() == aDefinition.end() OR eDefineType != type_define ) + return; + + + bool bSwitch_Stringify = false; + bool bSwitch_Concatenate = false; + + for ( str_vector::const_iterator it = aDefinition.begin(); + it != aDefinition.end(); + ++it ) + { + if ( HandleOperatorsBeforeTextItem( o_rText, + bSwitch_Stringify, + bSwitch_Concatenate, + *it ) ) + { + continue; + } + + o_rText << (*it); + + Do_bStringify_end(o_rText, bSwitch_Stringify); + o_rText << " "; + } + o_rText.seekp(-1, csv::cur); +} + +void +DefineDescription::GetMacroText( csv::StreamStr & o_rText, + const StringVector & i_rGivenArguments ) const +{ + bool bSwitch_Stringify = false; + bool bSwitch_Concatenate = false; + intt nActiveParamNr = -1; + + if ( aDefinition.begin() == aDefinition.end() OR eDefineType != type_macro ) + return; + + for ( str_vector::const_iterator it = aDefinition.begin(); + it != aDefinition.end(); + ++it ) + { + if ( HandleOperatorsBeforeTextItem( o_rText, + bSwitch_Stringify, + bSwitch_Concatenate, + *it ) ) + { + continue; + } + + for ( str_vector::const_iterator param_it = aParams.begin(); + param_it != aParams.end() AND nActiveParamNr == -1; + ++param_it ) + { + if ( strcmp(*it, *param_it) == 0 ) + nActiveParamNr = param_it - aParams.begin(); + } + if ( nActiveParamNr == -1 ) + { + o_rText << (*it); + } + else + { + o_rText << i_rGivenArguments[nActiveParamNr]; + nActiveParamNr = -1; + } + + Do_bStringify_end(o_rText, bSwitch_Stringify); + o_rText << " "; + } + o_rText.seekp(-1, csv::cur); +} + + + +} // end namespace cpp + + + + + +bool +CheckForOperator( bool & o_bStringify, + bool & o_bConcatenate, + const String & i_sTextItem ) +{ + if ( strcmp(i_sTextItem, "##") == 0 ) + { + o_bConcatenate = true; + return true; + } + else if ( strcmp(i_sTextItem, "#") == 0 ) + { + o_bStringify = true; + return true; + } + return false; +} + +void +Do_bConcatenate( csv::StreamStr & o_rText, + bool & io_bConcatenate ) +{ + if ( io_bConcatenate ) + { + uintt nPos; + for ( nPos = o_rText.tellp() - 1; + nPos > 0 ? o_rText.c_str()[nPos] == ' ' : false; + --nPos ) ; + o_rText.seekp(nPos+1); + io_bConcatenate = false; + } +} + +void +Do_bStringify_begin( csv::StreamStr & o_rText, + bool i_bStringify ) +{ + if ( i_bStringify ) + { + o_rText << "\""; + } +} + +void +Do_bStringify_end( csv::StreamStr & o_rText, + bool & io_bStringify ) +{ + if ( io_bStringify ) + { + o_rText << "\""; + io_bStringify = false; + } +} + + +bool +HandleOperatorsBeforeTextItem( csv::StreamStr & o_rText, + bool & io_bStringify, + bool & io_bConcatenate, + const String & i_sTextItem ) +{ + if ( CheckForOperator( io_bStringify, + io_bConcatenate, + i_sTextItem) ) + { + return true; + } + Do_bConcatenate(o_rText, io_bConcatenate); + Do_bStringify_begin(o_rText, io_bStringify); + + return false; +} + + + diff --git a/autodoc/source/parser/cpp/defdescr.hxx b/autodoc/source/parser/cpp/defdescr.hxx new file mode 100644 index 000000000000..3a0707212f7f --- /dev/null +++ b/autodoc/source/parser/cpp/defdescr.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: defdescr.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_DEFDESCR_HXX +#define ADC_CPP_DEFDESCR_HXX + + + + +namespace cpp +{ + +/** Describes a C/C++ #define statement. May be a define or a macro, for which + two cases the two different constructors are to be used. + + This class is used by cpp::PreProcessor. +*/ +class DefineDescription +{ + public: + enum E_DefineType + { + type_define, + type_macro + }; + typedef StringVector str_vector; + + DefineDescription( /// Used for: #define DEFINE xyz + const String & i_sName, + const str_vector & i_rDefinition ); + DefineDescription( /// Used for: #define MACRO(...) abc + const String & i_sName, + const str_vector & i_rParams, + const str_vector & i_rDefinition ); + ~DefineDescription(); + + /// Only vaild if (eDefineType == type_define) else returns "". + void GetDefineText( + csv::StreamStr & o_rText ) const; + + /// Only vaild if (eDefineType == type_macro) else returns "". + void GetMacroText( + csv::StreamStr & o_rText, + const StringVector & + i_rGivenArguments ) const; + + uintt ParamCount() const; + E_DefineType DefineType() const; + + private: + // DATA + String sName; + str_vector aParams; + str_vector aDefinition; + E_DefineType eDefineType; +}; + + + + +// IMPLEMENTATION +inline uintt +DefineDescription::ParamCount() const + { return aParams.size(); } +inline DefineDescription::E_DefineType +DefineDescription::DefineType() const + { return eDefineType; } + + + + +} // end namespace cpp +#endif diff --git a/autodoc/source/parser/cpp/fevnthdl.hxx b/autodoc/source/parser/cpp/fevnthdl.hxx new file mode 100644 index 000000000000..d6bf67c68027 --- /dev/null +++ b/autodoc/source/parser/cpp/fevnthdl.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fevnthdl.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_FEVNTHDL_HXX +#define ADC_CPP_FEVNTHDL_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + + +namespace ary +{ +namespace loc +{ + class File; +} +} + + + + +namespace cpp +{ + + +/** This is an interface, which accepts the file scope events that may + be important for parsing. It is implementation-dependant, where to + put or what to do with them. +*/ +class FileScope_EventHandler +{ + public: + // LIFECYCLE + virtual ~FileScope_EventHandler() {} + + // OPERATIONS + void SetCurFile( + ary::loc::File & io_rCurFile ); + void Event_IncrLineCount(); + void Event_SwBracketOpen(); + void Event_SwBracketClose(); + void Event_Semicolon(); + + private: + virtual void do_SetCurFile( + ary::loc::File & io_rCurFile ) = 0; + virtual void do_Event_IncrLineCount() = 0; + virtual void do_Event_SwBracketOpen() = 0; + virtual void do_Event_SwBracketClose() = 0; + virtual void do_Event_Semicolon() = 0; +}; + + +// IMPLEMENTATION + +inline void +FileScope_EventHandler::SetCurFile( ary::loc::File & io_rCurFile ) + { do_SetCurFile(io_rCurFile); } +inline void +FileScope_EventHandler::Event_IncrLineCount() + { do_Event_IncrLineCount(); } +inline void +FileScope_EventHandler::Event_SwBracketOpen() + { do_Event_SwBracketOpen(); } +inline void +FileScope_EventHandler::Event_SwBracketClose() + { do_Event_SwBracketClose(); } +inline void +FileScope_EventHandler::Event_Semicolon() + { do_Event_Semicolon(); } + + + + +} // namespace cpp +#endif + diff --git a/autodoc/source/parser/cpp/icprivow.cxx b/autodoc/source/parser/cpp/icprivow.cxx new file mode 100644 index 000000000000..c227f53c63f3 --- /dev/null +++ b/autodoc/source/parser/cpp/icprivow.cxx @@ -0,0 +1,195 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: icprivow.cxx,v $ + * $Revision: 1.8 $ + * + * 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 <icprivow.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_class.hxx> + + + +namespace cpp +{ + + + +//****************** Owner_Namespace ********************// +Owner_Namespace::Owner_Namespace() + : pScope(0) +{ +} + +void +Owner_Namespace::SetAnotherNamespace( ary::cpp::Namespace & io_rScope ) +{ + pScope = &io_rScope; +} + +bool +Owner_Namespace::HasClass( const String & i_sLocalName ) +{ + return pScope->Search_LocalClass(i_sLocalName).IsValid(); +} + +void +Owner_Namespace::do_Add_Class( const String & i_sLocalName, + Cid i_nId ) +{ + csv_assert(pScope != 0); + pScope->Add_LocalClass(i_sLocalName, i_nId); +} + +void +Owner_Namespace::do_Add_Enum( const String & i_sLocalName, + Cid i_nId ) +{ + csv_assert(pScope != 0); + pScope->Add_LocalEnum(i_sLocalName, i_nId); +} + +void +Owner_Namespace::do_Add_Typedef( const String & i_sLocalName, + Cid i_nId ) +{ + csv_assert(pScope != 0); + pScope->Add_LocalTypedef(i_sLocalName, i_nId); +} + +void +Owner_Namespace::do_Add_Operation( const String & i_sLocalName, + Cid i_nId, + bool ) +{ + csv_assert(pScope != 0); + pScope->Add_LocalOperation(i_sLocalName, i_nId); +} + +void +Owner_Namespace::do_Add_Variable( const String & i_sLocalName, + Cid i_nId, + bool i_bIsConst, + bool ) +{ + csv_assert(pScope != 0); + if (i_bIsConst) + pScope->Add_LocalConstant(i_sLocalName, i_nId); + else + pScope->Add_LocalVariable(i_sLocalName, i_nId); +} + + +Cid +Owner_Namespace::inq_CeId() const +{ + csv_assert(pScope != 0); + return pScope->CeId(); +} + + +//****************** Owner_Class ********************// + +Owner_Class::Owner_Class() + : pScope(0) +{ +} + +void +Owner_Class::SetAnotherClass( ary::cpp::Class & io_rScope ) +{ + pScope = &io_rScope; +} + +bool +Owner_Class::HasClass( const String & ) +{ + return false; +} + +void +Owner_Class::do_Add_Class( const String & i_sLocalName, + Cid i_nId ) +{ + csv_assert(pScope != 0); + pScope->Add_LocalClass(i_sLocalName, i_nId); +} + +void +Owner_Class::do_Add_Enum( const String & i_sLocalName, + Cid i_nId ) +{ + csv_assert(pScope != 0); + pScope->Add_LocalEnum(i_sLocalName, i_nId); +} + +void +Owner_Class::do_Add_Typedef( const String & i_sLocalName, + Cid i_nId ) +{ + csv_assert(pScope != 0); + pScope->Add_LocalTypedef(i_sLocalName, i_nId); +} + +void +Owner_Class::do_Add_Operation( const String & i_sLocalName, + Cid i_nId, + bool i_bIsStatic ) +{ + csv_assert(pScope != 0); + if (i_bIsStatic) + pScope->Add_LocalStaticOperation(i_sLocalName, i_nId); + else + pScope->Add_LocalOperation(i_sLocalName, i_nId); +} + +void +Owner_Class::do_Add_Variable( const String & i_sLocalName, + Cid i_nId, + bool , + bool i_bIsStatic ) +{ + csv_assert(pScope != 0); + if (i_bIsStatic) + pScope->Add_LocalStaticData(i_sLocalName, i_nId); + else + pScope->Add_LocalData(i_sLocalName, i_nId); +} + +Cid +Owner_Class::inq_CeId() const +{ + csv_assert(pScope != 0); + return pScope->CeId(); +} + + +} // namespace cpp diff --git a/autodoc/source/parser/cpp/icprivow.hxx b/autodoc/source/parser/cpp/icprivow.hxx new file mode 100644 index 000000000000..9500f72e5963 --- /dev/null +++ b/autodoc/source/parser/cpp/icprivow.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: icprivow.hxx,v $ + * $Revision: 1.5 $ + * + * 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_ICPRIVOW_HXX +#define ARY_CPP_ICPRIVOW_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <ary/cpp/inpcontx.hxx> + // COMPONENTS + // PARAMETERS + +namespace cpp +{ + + + +typedef ary::cpp::Ce_id Cid; + + +class Owner_Namespace : public ary::cpp::InputContext::Owner +{ + public: + Owner_Namespace(); + void SetAnotherNamespace( + ary::cpp::Namespace & + io_rScope ); + virtual bool HasClass( + const String & i_sLocalName ); + private: + virtual void do_Add_Class( + const String & i_sLocalName, + Cid i_nId ); + virtual void do_Add_Enum( + const String & i_sLocalName, + Cid i_nId ); + virtual void do_Add_Typedef( + const String & i_sLocalName, + Cid i_nId ); + virtual void do_Add_Operation( + const String & i_sLocalName, + Cid i_nId, + bool ); + virtual void do_Add_Variable( + const String & i_sLocalName, + Cid i_nId, + bool i_bIsConst, + bool i_bIsStatic ); + virtual Cid inq_CeId() const; + + // DATA + ary::cpp::Namespace * + pScope; +}; + +class Owner_Class : public ary::cpp::InputContext::Owner +{ + public: + Owner_Class(); + void SetAnotherClass( + ary::cpp::Class & io_rScope ); + + /** @attention Only a dummy for use at ary::cpp::Gate! + Will work nerver! + */ + virtual bool HasClass( + const String & i_sLocalName ); + private: + virtual void do_Add_Class( + const String & i_sLocalName, + Cid i_nId ); + virtual void do_Add_Enum( + const String & i_sLocalName, + Cid i_nId ); + virtual void do_Add_Typedef( + const String & i_sLocalName, + Cid i_nId ); + virtual void do_Add_Operation( + const String & i_sLocalName, + Cid i_nId, + bool i_bIsStaticMember ); + virtual void do_Add_Variable( + const String & i_sLocalName, + Cid i_nId, + bool i_bIsConst, + bool i_bIsStatic ); + virtual Cid inq_CeId() const; + + // DATA + ary::cpp::Class * pScope; +}; + + + + +} // namespace cpp +#endif diff --git a/autodoc/source/parser/cpp/makefile.mk b/autodoc/source/parser/cpp/makefile.mk new file mode 100644 index 000000000000..454713e8c49d --- /dev/null +++ b/autodoc/source/parser/cpp/makefile.mk @@ -0,0 +1,91 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.4 $ +# +# 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=parser_cpp + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + + +OBJFILES= \ + $(OBJ)$/all_toks.obj \ + $(OBJ)$/c_dealer.obj \ + $(OBJ)$/c_rcode.obj \ + $(OBJ)$/cpp_pe.obj \ + $(OBJ)$/cx_base.obj \ + $(OBJ)$/cx_c_pp.obj \ + $(OBJ)$/cx_c_std.obj \ + $(OBJ)$/cx_c_sub.obj \ + $(OBJ)$/cxt2ary.obj \ + $(OBJ)$/defdescr.obj \ + $(OBJ)$/icprivow.obj \ + $(OBJ)$/pe_base.obj \ + $(OBJ)$/pe_class.obj \ + $(OBJ)$/pe_defs.obj \ + $(OBJ)$/pe_expr.obj \ + $(OBJ)$/pe_enum.obj \ + $(OBJ)$/pe_enval.obj \ + $(OBJ)$/pe_file.obj \ + $(OBJ)$/pe_funct.obj \ + $(OBJ)$/pe_ignor.obj \ + $(OBJ)$/pe_namsp.obj \ + $(OBJ)$/pe_param.obj \ + $(OBJ)$/pe_tpltp.obj \ + $(OBJ)$/pe_type.obj \ + $(OBJ)$/pe_tydef.obj \ + $(OBJ)$/pe_vafu.obj \ + $(OBJ)$/pe_vari.obj \ + $(OBJ)$/preproc.obj \ + $(OBJ)$/prs_cpp.obj \ + $(OBJ)$/tkp_cpp.obj + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser/cpp/pe_base.cxx b/autodoc/source/parser/cpp/pe_base.cxx new file mode 100644 index 000000000000..ba4c0c1bf000 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_base.cxx @@ -0,0 +1,227 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_base.cxx,v $ + * $Revision: 1.8 $ + * + * 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 "pe_base.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_type.hxx> +#include "pe_type.hxx" + + + + +namespace cpp +{ + + +static const PE_Base::Base aNullBase_; + + +PE_Base::PE_Base( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati(new PeStatusArray<PE_Base>) + // aBaseIds, + // pSpType, + // pSpuBaseName +{ + Setup_StatusFunctions(); + aBaseIds.reserve(4); + + pSpType = new SP_Type(*this); + pSpuBaseName = new SPU_BaseName(*pSpType, 0, &PE_Base::SpReturn_BaseName); +} + + +PE_Base::~PE_Base() +{ +} + +void +PE_Base::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Base::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Base>::F_Tok F_Tok; + static F_Tok stateF_startOfNext[] = { &PE_Base::On_startOfNext_Identifier, + &PE_Base::On_startOfNext_public, + &PE_Base::On_startOfNext_protected, + &PE_Base::On_startOfNext_private, + &PE_Base::On_startOfNext_virtual, + &PE_Base::On_startOfNext_DoubleColon }; + static INT16 stateT_startOfNext[] = { Tid_Identifier, + Tid_public, + Tid_protected, + Tid_private, + Tid_virtual, + Tid_DoubleColon }; + static F_Tok stateF_inName[] = { &PE_Base::On_inName_Identifier, + &PE_Base::On_inName_virtual, + &PE_Base::On_inName_SwBracket_Left, + &PE_Base::On_inName_DoubleColon, + &PE_Base::On_inName_Comma }; + static INT16 stateT_inName[] = { Tid_Identifier, + Tid_virtual, + Tid_SwBracket_Left, + Tid_DoubleColon, + Tid_Comma }; + + SEMPARSE_CREATE_STATUS(PE_Base, startOfNext, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Base, inName, Hdl_SyntaxError); +} + +void +PE_Base::Hdl_SyntaxError( const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Base::InitData() +{ + pStati->SetCur(startOfNext); + csv::erase_container(aBaseIds); + aBaseIds.push_back(aNullBase_); +} + +void +PE_Base::TransferData() +{ + // Does nothing. +} + +void +PE_Base::SpReturn_BaseName() +{ + CurObject().nId = pSpuBaseName->Child().Result_Type().Id(); + + static StreamStr aBaseName(100); + aBaseName.seekp(0); + pSpuBaseName->Child().Result_Type().Get_Text( aBaseName, Env().AryGate() ); + + Env().Event_Class_FinishedBase(aBaseName.c_str()); +} + +void +PE_Base::On_startOfNext_public(const char *) +{ + SetTokenResult(done, stay); + pStati->SetCur(inName); + + CurObject().eProtection = ary::cpp::PROTECT_public; +} + +void +PE_Base::On_startOfNext_protected(const char *) +{ + SetTokenResult(done, stay); + pStati->SetCur(inName); + + CurObject().eProtection = ary::cpp::PROTECT_protected; +} + +void +PE_Base::On_startOfNext_private(const char *) +{ + SetTokenResult(done, stay); + pStati->SetCur(inName); + + CurObject().eProtection = ary::cpp::PROTECT_private; +} + +void +PE_Base::On_startOfNext_virtual(const char *) +{ + SetTokenResult(done, stay); + + CurObject().eVirtuality = ary::cpp::VIRTUAL_virtual; +} + +void +PE_Base::On_startOfNext_Identifier(const char * ) +{ + pSpuBaseName->Push(not_done); +} + +void +PE_Base::On_startOfNext_DoubleColon(const char *) +{ + pSpuBaseName->Push(not_done); +} + +void +PE_Base::On_inName_Identifier(const char * ) +{ + pSpuBaseName->Push(not_done); +} + +void +PE_Base::On_inName_virtual(const char *) +{ + SetTokenResult(done, stay); + + CurObject().eVirtuality = ary::cpp::VIRTUAL_virtual; +} + +void +PE_Base::On_inName_DoubleColon(const char *) +{ + pSpuBaseName->Push(not_done); +} + +void +PE_Base::On_inName_Comma(const char *) +{ + SetTokenResult(done, stay); + pStati->SetCur(startOfNext); + + aBaseIds.push_back( aNullBase_ ); +} + +void +PE_Base::On_inName_SwBracket_Left(const char *) +{ + SetTokenResult(not_done, pop_success); +} + + +} // namespace cpp + + + + + diff --git a/autodoc/source/parser/cpp/pe_base.hxx b/autodoc/source/parser/cpp/pe_base.hxx new file mode 100644 index 000000000000..c56e40932788 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_base.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_base.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_CPP_PE_BASE_HXX +#define ADC_CPP_PE_BASE_HXX + +// BASE CLASSES +#include "cpp_pe.hxx" +// USED SERVICES +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> +#include <ary/cpp/c_types4cpp.hxx> +#include <ary/cpp/c_slntry.hxx> + + + +namespace cpp +{ + +class PE_Type; + +class PE_Base : public Cpp_PE +{ + public: + enum E_State + { + startOfNext, + inName, + size_of_states + }; + + typedef ary::cpp::List_Bases BaseList; + typedef ary::cpp::S_Classes_Base Base; + + PE_Base( + Cpp_PE * i_pParent ); + ~PE_Base(); + + const BaseList & Result_BaseIds() const; + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + private: + typedef SubPe< PE_Base, PE_Type > SP_Type; + typedef SubPeUse< PE_Base, PE_Type> SPU_BaseName; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void SpReturn_BaseName(); + + void On_startOfNext_Identifier(const char *); + void On_startOfNext_public(const char *); + void On_startOfNext_protected(const char *); + void On_startOfNext_private(const char *); + void On_startOfNext_virtual(const char *); + void On_startOfNext_DoubleColon(const char *); + + void On_inName_Identifier(const char *); + void On_inName_virtual(const char *); + void On_inName_SwBracket_Left(const char *); + void On_inName_DoubleColon(const char *); + void On_inName_Comma(const char *); + + Base & CurObject(); + + // DATA + Dyn< PeStatusArray<PE_Base> > + pStati; + + Dyn<SP_Type> pSpType; /// till "{" incl. + Dyn<SPU_BaseName> pSpuBaseName; + + BaseList aBaseIds; +}; + + + +// IMPLEMENTATION + +inline const PE_Base::BaseList & +PE_Base::Result_BaseIds() const + { return aBaseIds; } + + +inline PE_Base::Base & +PE_Base::CurObject() + { return aBaseIds.back(); } + + + + + +} // namespace cpp +#endif diff --git a/autodoc/source/parser/cpp/pe_class.cxx b/autodoc/source/parser/cpp/pe_class.cxx new file mode 100644 index 000000000000..f43f55fc704a --- /dev/null +++ b/autodoc/source/parser/cpp/pe_class.cxx @@ -0,0 +1,506 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_class.cxx,v $ + * $Revision: 1.11 $ + * + * 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 "pe_class.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <all_toks.hxx> +#include "pe_base.hxx" +#include "pe_defs.hxx" +#include "pe_enum.hxx" +#include "pe_tydef.hxx" +#include "pe_vafu.hxx" +#include "pe_ignor.hxx" + + +namespace cpp { + +// using ary::Cid; + +PE_Class::PE_Class(Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Class> ), + // pSpBase, + // pSpTypedef, + // pSpVarFunc, + // pSpIgnore, + // pSpuBase, + // pSpuTypedef, + // pSpuVarFunc, + // pSpuUsing, + // pSpuIgnoreFailure, + // sLocalName, + eClassKey(ary::cpp::CK_class), + pCurObject(0), + // aBases, + eResult_KindOf(is_declaration) +{ + Setup_StatusFunctions(); + + pSpBase = new SP_Base(*this); + pSpTypedef = new SP_Typedef(*this); + pSpVarFunc = new SP_VarFunc(*this); + pSpIgnore = new SP_Ignore(*this); + pSpDefs = new SP_Defines(*this); + + pSpuBase = new SPU_Base(*pSpBase, 0, &PE_Class::SpReturn_Base); + pSpuTypedef = new SPU_Typedef(*pSpTypedef, 0, 0); + pSpuVarFunc = new SPU_VarFunc(*pSpVarFunc, 0, 0); + + pSpuTemplate= new SPU_Ignore(*pSpIgnore, 0, 0); + pSpuUsing = new SPU_Ignore(*pSpIgnore, 0, 0); + pSpuIgnoreFailure + = new SPU_Ignore(*pSpIgnore, 0, 0); + pSpuDefs = new SPU_Defines(*pSpDefs, 0, 0); +} + + +PE_Class::~PE_Class() +{ +} + +void +PE_Class::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +Cpp_PE * +PE_Class::Handle_ChildFailure() +{ + SetCurSPU(pSpuIgnoreFailure.Ptr()); + return &pSpuIgnoreFailure->Child(); +} + +void +PE_Class::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Class>::F_Tok F_Tok; + + static F_Tok stateF_start[] = { &PE_Class::On_start_class, + &PE_Class::On_start_struct, + &PE_Class::On_start_union }; + static INT16 stateT_start[] = { Tid_class, + Tid_struct, + Tid_union }; + + static F_Tok stateF_expectName[] = { &PE_Class::On_expectName_Identifier, + &PE_Class::On_expectName_SwBracket_Left, + &PE_Class::On_expectName_Colon + }; + static INT16 stateT_expectName[] = { Tid_Identifier, + Tid_SwBracket_Left, + Tid_Colon + }; + + static F_Tok stateF_gotName[] = { &PE_Class::On_gotName_SwBracket_Left, + &PE_Class::On_gotName_Semicolon, + &PE_Class::On_gotName_Colon }; + static INT16 stateT_gotName[] = { Tid_SwBracket_Left, + Tid_Semicolon, + Tid_Colon }; + + static F_Tok stateF_bodyStd[] = { &PE_Class::On_bodyStd_VarFunc, + &PE_Class::On_bodyStd_VarFunc, + &PE_Class::On_bodyStd_ClassKey, + &PE_Class::On_bodyStd_ClassKey, + &PE_Class::On_bodyStd_ClassKey, + + &PE_Class::On_bodyStd_enum, + &PE_Class::On_bodyStd_typedef, + &PE_Class::On_bodyStd_public, + &PE_Class::On_bodyStd_protected, + &PE_Class::On_bodyStd_private, + + &PE_Class::On_bodyStd_template, + &PE_Class::On_bodyStd_VarFunc, + &PE_Class::On_bodyStd_friend, + &PE_Class::On_bodyStd_VarFunc, + &PE_Class::On_bodyStd_VarFunc, + + &PE_Class::On_bodyStd_VarFunc, + &PE_Class::On_bodyStd_VarFunc, + &PE_Class::On_bodyStd_VarFunc, + &PE_Class::On_bodyStd_VarFunc, + &PE_Class::On_bodyStd_VarFunc, + + &PE_Class::On_bodyStd_using, + &PE_Class::On_bodyStd_SwBracket_Right, + &PE_Class::On_bodyStd_VarFunc, + &PE_Class::On_bodyStd_DefineName, + &PE_Class::On_bodyStd_MacroName, + + &PE_Class::On_bodyStd_VarFunc, + &PE_Class::On_bodyStd_VarFunc, + &PE_Class::On_bodyStd_VarFunc, }; + + static INT16 stateT_bodyStd[] = { Tid_Identifier, + Tid_operator, + Tid_class, + Tid_struct, + Tid_union, + + Tid_enum, + Tid_typedef, + Tid_public, + Tid_protected, + Tid_private, + + Tid_template, + Tid_virtual, + Tid_friend, + Tid_Tilde, + Tid_const, + + Tid_volatile, + Tid_static, + Tid_mutable, + Tid_inline, + Tid_explicit, + + Tid_using, + Tid_SwBracket_Right, + Tid_DoubleColon, + Tid_typename, + Tid_DefineName, + + Tid_MacroName, + Tid_BuiltInType, + Tid_TypeSpecializer }; + + static F_Tok stateF_inProtection[] = { &PE_Class::On_inProtection_Colon }; + static INT16 stateT_inProtection[] = { Tid_Colon }; + + static F_Tok stateF_afterDecl[] = { &PE_Class::On_afterDecl_Semicolon }; + static INT16 stateT_afterDecl[] = { Tid_Semicolon }; + + SEMPARSE_CREATE_STATUS(PE_Class, start, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Class, expectName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Class, gotName, On_gotName_Return2Type); + SEMPARSE_CREATE_STATUS(PE_Class, bodyStd, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Class, inProtection, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Class, afterDecl, On_afterDecl_Return2Type); + +#if 0 + static F_Tok stateF_inFriend[] = { On_inFriend_class, + On_inFriend_struct, + On_inFriend_union }; + // Default: On_inFriend_Function + static INT16 stateT_inFriend[] = { Tid_class, + Tid_struct, + Tid_union }; +#endif // 0 +} + +void +PE_Class::InitData() +{ + pStati->SetCur(start); + sLocalName.clear(); + eClassKey = ary::cpp::CK_class; + pCurObject = 0; + csv::erase_container(aBases); + eResult_KindOf = is_declaration; +} + +void +PE_Class::TransferData() +{ + pStati->SetCur(size_of_states); +} + +void +PE_Class::Hdl_SyntaxError( const char * i_sText) +{ + if ( *i_sText == ';' ) + { + Cerr() << Env().CurFileName() << ", line " + << Env().LineCount() + << ": Sourcecode warning: ';' as a toplevel declaration is deprecated." + << Endl(); + SetTokenResult(done,stay); + return; + } + + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Class::Init_CurObject() +{ + // KORR_FUTURE + // This will have to be done before parsing base classes, because of + // possible inline documentation for base classes. + pCurObject = & Env().AryGate().Ces().Store_Class( Env().Context(), sLocalName, eClassKey ); + + for ( PE_Base::BaseList::const_iterator it = aBases.begin(); + it != aBases.end(); + ++it ) + { + pCurObject->Add_BaseClass( *it ); + } // end for + + Dyn< StringVector > + pTplParams( Env().Get_CurTemplateParameters() ); + if ( pTplParams ) + { + for ( StringVector::const_iterator it = pTplParams->begin(); + it != pTplParams->end(); + ++it ) + { + pCurObject->Add_TemplateParameterType( *it, ary::cpp::Type_id(0) ); + } // end for + } +} + +void +PE_Class::SpReturn_Base() +{ + aBases = pSpuBase->Child().Result_BaseIds(); + pStati->SetCur(gotName); +} + +void +PE_Class::On_start_class( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(expectName); + eClassKey = ary::cpp::CK_class; +} + +void +PE_Class::On_start_struct( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(expectName); + eClassKey = ary::cpp::CK_struct; +} + +void +PE_Class::On_start_union( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(expectName); + eClassKey = ary::cpp::CK_union; +} + +void +PE_Class::On_expectName_Identifier( const char * i_sText ) +{ + SetTokenResult(done, stay); + pStati->SetCur(gotName); + sLocalName = i_sText; +} + +void +PE_Class::On_expectName_SwBracket_Left( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(bodyStd); + + sLocalName = ""; + Init_CurObject(); + sLocalName = pCurObject->LocalName(); + + Env().OpenClass(*pCurObject); +} + +void +PE_Class::On_expectName_Colon( const char * ) +{ + pStati->SetCur(gotName); + sLocalName = ""; + + pSpuBase->Push(done); +} + +void +PE_Class::On_gotName_SwBracket_Left( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(bodyStd); + + Init_CurObject(); + if ( sLocalName.empty() ) + sLocalName = pCurObject->LocalName(); + + Env().OpenClass(*pCurObject); +} + +void +PE_Class::On_gotName_Semicolon( const char * ) +{ + SetTokenResult(not_done, pop_success); + + eResult_KindOf = is_predeclaration; +} + +void +PE_Class::On_gotName_Colon( const char * ) +{ + pSpuBase->Push(done); +} + +void +PE_Class::On_gotName_Return2Type( const char * ) +{ + SetTokenResult(not_done, pop_success); + + eResult_KindOf = is_qualified_typename; +} + +void +PE_Class::On_bodyStd_VarFunc( const char * ) +{ + pSpuVarFunc->Push(not_done); +} + +void +PE_Class::On_bodyStd_ClassKey( const char * ) +{ + pSpuVarFunc->Push(not_done); // This is correct, + // classes are parsed via PE_Type. +} + +void +PE_Class::On_bodyStd_enum( const char * ) +{ + pSpuVarFunc->Push(not_done); // This is correct, + // enums are parsed via PE_Type. +} + +void +PE_Class::On_bodyStd_typedef( const char * ) +{ + pSpuTypedef->Push(not_done); +} + +void +PE_Class::On_bodyStd_public( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(inProtection); + + Env().SetCurProtection(ary::cpp::PROTECT_public); +} + +void +PE_Class::On_bodyStd_protected( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(inProtection); + + Env().SetCurProtection(ary::cpp::PROTECT_protected); +} + +void +PE_Class::On_bodyStd_private( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(inProtection); + + Env().SetCurProtection(ary::cpp::PROTECT_private); +} + +void +PE_Class::On_bodyStd_template( const char * ) +{ + pSpuTemplate->Push(done); +} + +void +PE_Class::On_bodyStd_friend( const char * ) +{ + // KORR_FUTURE + pSpuUsing->Push(done); +} + +void +PE_Class::On_bodyStd_using( const char * ) +{ + pSpuUsing->Push(done); +} + +void +PE_Class::On_bodyStd_SwBracket_Right( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterDecl); + + Env().CloseClass(); +} + +void +PE_Class::On_bodyStd_DefineName(const char * ) +{ + pSpuDefs->Push(not_done); +} + +void +PE_Class::On_bodyStd_MacroName(const char * ) +{ + pSpuDefs->Push(not_done); +} + + +void +PE_Class::On_inProtection_Colon( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(bodyStd); +} + +void +PE_Class::On_afterDecl_Semicolon( const char * ) +{ + SetTokenResult(not_done, pop_success); + eResult_KindOf = is_declaration; +} + +void +PE_Class::On_afterDecl_Return2Type( const char * ) +{ + SetTokenResult(not_done, pop_success); + eResult_KindOf = is_implicit_declaration; +} + + +} // namespace cpp + + + + diff --git a/autodoc/source/parser/cpp/pe_class.hxx b/autodoc/source/parser/cpp/pe_class.hxx new file mode 100644 index 000000000000..86b13d5b415a --- /dev/null +++ b/autodoc/source/parser/cpp/pe_class.hxx @@ -0,0 +1,259 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_class.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_PE_CLASS_HXX +#define ADC_CPP_PE_CLASS_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // OTHER +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> +#include <ary/cpp/c_types4cpp.hxx> +#include <ary/cpp/c_slntry.hxx> +#include "all_toks.hxx" + +namespace ary +{ +namespace cpp +{ + class Class; +} +} + + +namespace cpp +{ + + +using ary::cpp::E_Protection; +using ary::cpp::E_Virtuality; + + +class PE_Base; +class PE_Enum; +class PE_Typedef; +class PE_VarFunc; +class PE_Ignore; +class PE_Defines; + + +class PE_Class : public cpp::Cpp_PE +{ + public: + enum E_State + { + start, /// before class, struct or union + expectName, /// after class, struct or union + gotName, /// after name, before : or { + bodyStd, /// after { + inProtection, /// after public, protected or private and before ":" + afterDecl, /// after ending } + size_of_states + }; + + enum E_KindOfResult + { + is_declaration, // normal + is_implicit_declaration, // like in: class Abc { public int n; } aAbc; + is_predeclaration, // like: class Abc; + is_qualified_typename // like in: class Abc * fx(); + + }; + + PE_Class( + Cpp_PE * i_pParent ); + ~PE_Class(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + virtual Cpp_PE * Handle_ChildFailure(); + + E_KindOfResult Result_KindOf() const; + const String & Result_LocalName() const; + const String & Result_FirstNameSegment() const; + + private: + typedef SubPe< PE_Class, PE_Base > SP_Base; +// typedef SubPe< PE_Class, PE_Enum> SP_Enum; + typedef SubPe< PE_Class, PE_Typedef> SP_Typedef; + typedef SubPe< PE_Class, PE_VarFunc> SP_VarFunc; + typedef SubPe< PE_Class, PE_Ignore > SP_Ignore; + typedef SubPe< PE_Class, PE_Defines> SP_Defines; + + typedef SubPeUse< PE_Class, PE_Base> SPU_Base; +// typedef SubPeUse< PE_Class, PE_Enum> SPU_Enum; + typedef SubPeUse< PE_Class, PE_Typedef> SPU_Typedef; + typedef SubPeUse< PE_Class, PE_VarFunc> SPU_VarFunc; + typedef SubPeUse< PE_Class, PE_Ignore> SPU_Ignore; + typedef SubPeUse< PE_Class, PE_Defines> SPU_Defines; + + typedef ary::cpp::List_Bases BaseList; + typedef ary::cpp::S_Classes_Base Base; + typedef ary::cpp::E_Protection E_Protection; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + void Init_CurObject(); + + void SpReturn_Base(); + + void On_start_class( const char * ); + void On_start_struct( const char * ); + void On_start_union( const char * ); + + void On_expectName_Identifier( const char * ); + void On_expectName_SwBracket_Left( const char * ); + void On_expectName_Colon( const char * ); + + void On_gotName_SwBracket_Left( const char * ); + void On_gotName_Semicolon( const char * ); + void On_gotName_Colon( const char * ); + void On_gotName_Return2Type( const char * ); + + void On_bodyStd_VarFunc( const char * ); + void On_bodyStd_ClassKey( const char * ); + void On_bodyStd_enum( const char * ); + void On_bodyStd_typedef( const char * ); + void On_bodyStd_public( const char * ); + void On_bodyStd_protected( const char * ); + void On_bodyStd_private( const char * ); + void On_bodyStd_template( const char * ); + void On_bodyStd_friend( const char * ); + void On_bodyStd_using( const char * ); + void On_bodyStd_SwBracket_Right( const char * ); + void On_bodyStd_DefineName(const char * ); + void On_bodyStd_MacroName(const char * ); + + void On_inProtection_Colon( const char * ); + + void On_afterDecl_Semicolon( const char * ); + void On_afterDecl_Return2Type( const char * ); + + // DATA + Dyn< PeStatusArray<PE_Class> > + pStati; + + Dyn<SP_Base> pSpBase; +// Dyn<SP_Enum> pSpEnum; + Dyn<SP_Typedef> pSpTypedef; + Dyn<SP_VarFunc> pSpVarFunc; + Dyn<SP_Ignore> pSpIgnore; + Dyn<SP_Defines> pSpDefs; + + Dyn<SPU_Base> pSpuBase; +// Dyn<SPU_Enum> pSpuEnum; + Dyn<SPU_Typedef> pSpuTypedef; + Dyn<SPU_VarFunc> pSpuVarFunc; + + Dyn<SPU_Ignore> pSpuTemplate; + Dyn<SPU_Ignore> pSpuUsing; + Dyn<SPU_Ignore> pSpuIgnoreFailure; + Dyn<SPU_Defines> pSpuDefs; + + + + String sLocalName; + ary::cpp::E_ClassKey + eClassKey; + ary::cpp::Class * pCurObject; + BaseList aBases; + + E_KindOfResult eResult_KindOf; +}; + + + +// IMPLEMENTATION + +inline PE_Class::E_KindOfResult +PE_Class::Result_KindOf() const +{ + return eResult_KindOf; +} + +inline const String & +PE_Class::Result_LocalName() const +{ + return sLocalName; +} + +inline const String & +PE_Class::Result_FirstNameSegment() const +{ + return sLocalName; +} + + + + +} // namespace cpp + + +#if 0 // Branches + +class struct union + -> Class + -> Predeclaration + +typedef + -> Typedef + +enum + -> Enum + +TypeDeclaration + -> Function In Class + -> Variable + +public, protected, private + -> Protection declaration + +friend + -> Friend Class + -> Friend Function + +virtual + -> Function In Class + +using + -> Using Declaration + + +#endif // 0 + + +#endif + diff --git a/autodoc/source/parser/cpp/pe_defs.cxx b/autodoc/source/parser/cpp/pe_defs.cxx new file mode 100644 index 000000000000..da56265e7730 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_defs.cxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_defs.cxx,v $ + * $Revision: 1.8 $ + * + * 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 "pe_defs.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_define.hxx> +#include <ary/cpp/c_macro.hxx> +#include <ary/cpp/cp_def.hxx> +#include "all_toks.hxx" + + +namespace cpp +{ + + +PE_Defines::PE_Defines( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Defines> ), + // sName, + // aParameters, + // sDefinition, + bIsMacro(false) +{ + Setup_StatusFunctions(); +} + + +PE_Defines::~PE_Defines() +{ +} + +void +PE_Defines::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Defines::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Defines>::F_Tok F_Tok; + static F_Tok stateF_expectName[] = { &PE_Defines::On_expectName_DefineName, + &PE_Defines::On_expectName_MacroName + }; + static INT16 stateT_expectName[] = { Tid_DefineName, + Tid_MacroName + }; + + static F_Tok stateF_gotDefineName[] = { &PE_Defines::On_gotDefineName_PreProDefinition }; + static INT16 stateT_gotDefineName[] = { Tid_PreProDefinition }; + + static F_Tok stateF_expectMacroParameters[] = + { &PE_Defines::On_expectMacroParameters_MacroParameter, + &PE_Defines::On_expectMacroParameters_PreProDefinition + }; + static INT16 stateT_expectMacroParameters[] = + { Tid_MacroParameter, + Tid_PreProDefinition + }; + + SEMPARSE_CREATE_STATUS(PE_Defines, expectName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Defines, gotDefineName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Defines, expectMacroParameters, Hdl_SyntaxError); +} + +void +PE_Defines::InitData() +{ + pStati->SetCur(expectName); + + sName.clear(); + csv::erase_container( aParameters ); + csv::erase_container( aDefinition ); + bIsMacro = false; +} + +void +PE_Defines::TransferData() +{ + if (NOT bIsMacro) + { + if (aDefinition.empty() OR aDefinition.front().empty()) + return; + + ary::cpp::Define & + rNew = Env().AryGate().Defs().Store_Define( + Env().Context(), sName, aDefinition ); + Env().Event_Store_CppDefinition(rNew); + } + else + { + ary::cpp::Macro & + rNew = Env().AryGate().Defs().Store_Macro( + Env().Context(), sName, aParameters, aDefinition ); + Env().Event_Store_CppDefinition(rNew); + } + pStati->SetCur(size_of_states); +} + +void +PE_Defines::Hdl_SyntaxError( const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Defines::On_expectName_DefineName( const char * i_sText ) +{ + SetTokenResult(done, stay); + pStati->SetCur(gotDefineName); + + sName = i_sText; + bIsMacro = false; +} + +void +PE_Defines::On_expectName_MacroName( const char * i_sText ) +{ + SetTokenResult(done, stay); + pStati->SetCur(expectMacroParameters); + + sName = i_sText; + bIsMacro = true; +} + +void +PE_Defines::On_gotDefineName_PreProDefinition( const char * i_sText ) +{ + SetTokenResult(done, pop_success); + + aDefinition.push_back( String (i_sText) ); +} + +void +PE_Defines::On_expectMacroParameters_MacroParameter( const char * i_sText ) +{ + SetTokenResult(done, stay); + aParameters.push_back( String (i_sText) ); +} + +void +PE_Defines::On_expectMacroParameters_PreProDefinition( const char * i_sText ) +{ + SetTokenResult(done, pop_success); + + aDefinition.push_back( String (i_sText) ); +} + + +} // namespace cpp + diff --git a/autodoc/source/parser/cpp/pe_defs.hxx b/autodoc/source/parser/cpp/pe_defs.hxx new file mode 100644 index 000000000000..6341701a5ebc --- /dev/null +++ b/autodoc/source/parser/cpp/pe_defs.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_defs.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_PE_DEFS_HXX +#define ADC_CPP_PE_DEFS_HXX + + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS + + +namespace cpp +{ + + + +class PE_Defines : public cpp::Cpp_PE +{ + public: + enum E_State + { + expectName, + gotDefineName, + expectMacroParameters, + size_of_states + }; + + PE_Defines( + Cpp_PE * i_pParent ); + ~PE_Defines(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + private: + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void On_expectName_DefineName( const char * ); + void On_expectName_MacroName( const char * ); + + void On_gotDefineName_PreProDefinition( const char * ); + + void On_expectMacroParameters_MacroParameter( const char * ); + void On_expectMacroParameters_PreProDefinition( const char * ); + + // DATA + Dyn< PeStatusArray<PE_Defines> > + pStati; + + String sName; + StringVector aParameters; + StringVector aDefinition; + bool bIsMacro; +}; + + + +} //namespace cpp +#endif + diff --git a/autodoc/source/parser/cpp/pe_enum.cxx b/autodoc/source/parser/cpp/pe_enum.cxx new file mode 100644 index 000000000000..79aba8aef878 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_enum.cxx @@ -0,0 +1,192 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_enum.cxx,v $ + * $Revision: 1.9 $ + * + * 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 "pe_enum.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <all_toks.hxx> +#include "pe_enval.hxx" + + +namespace cpp { + + +PE_Enum::PE_Enum(Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Enum> ), + // pSpValue, + // pSpuValue, + // sLocalName, + pCurObject(0), + eResult_KindOf(is_declaration) +{ + Setup_StatusFunctions(); + + pSpValue = new SP_EnumValue(*this); + pSpuValue = new SPU_EnumValue(*pSpValue, 0, 0); +} + + +PE_Enum::~PE_Enum() +{ +} + +void +PE_Enum::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Enum::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Enum>::F_Tok F_Tok; + static F_Tok stateF_expectName[] = { &PE_Enum::On_expectName_Identifier, + &PE_Enum::On_expectName_SwBracket_Left + }; + static INT16 stateT_expectName[] = { Tid_Identifier, + Tid_SwBracket_Left + }; + + static F_Tok stateF_gotName[] = { &PE_Enum::On_gotName_SwBracket_Left }; + static INT16 stateT_gotName[] = { Tid_SwBracket_Left }; + + static F_Tok stateF_bodyStd[] = { &PE_Enum::On_bodyStd_Identifier, + &PE_Enum::On_bodyStd_SwBracket_Right }; + static INT16 stateT_bodyStd[] = { Tid_Identifier, + Tid_SwBracket_Right }; + + static F_Tok stateF_afterBlock[] = { &PE_Enum::On_afterBlock_Semicolon }; + static INT16 stateT_afterBlock[] = { Tid_Semicolon }; + + SEMPARSE_CREATE_STATUS(PE_Enum, expectName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Enum, gotName, On_gotName_Return2Type); + SEMPARSE_CREATE_STATUS(PE_Enum, bodyStd, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Enum, afterBlock, On_afterBlock_Return2Type); +} + +void +PE_Enum::InitData() +{ + pStati->SetCur(expectName); + pCurObject = 0; + sLocalName.clear(); + eResult_KindOf = is_declaration; +} + +void +PE_Enum::TransferData() +{ + pStati->SetCur(size_of_states); +} + +void +PE_Enum::Hdl_SyntaxError( const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Enum::On_expectName_Identifier( const char * i_sText ) +{ + SetTokenResult(done, stay); + pStati->SetCur(gotName); + + sLocalName = i_sText; + pCurObject = & Env().AryGate().Ces().Store_Enum( Env().Context(), sLocalName ); +} + +void +PE_Enum::On_expectName_SwBracket_Left( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(bodyStd); + + sLocalName = ""; + pCurObject = & Env().AryGate().Ces().Store_Enum( Env().Context(), sLocalName ); + sLocalName = pCurObject->LocalName(); + + Env().OpenEnum(*pCurObject); +} + +void +PE_Enum::On_gotName_SwBracket_Left( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(bodyStd); + Env().OpenEnum(*pCurObject); +} + +void +PE_Enum::On_gotName_Return2Type( const char * ) +{ + SetTokenResult(not_done, pop_success); + + eResult_KindOf = is_qualified_typename; +} + +void +PE_Enum::On_bodyStd_Identifier( const char * ) +{ + pSpuValue->Push(not_done); +} + +void +PE_Enum::On_bodyStd_SwBracket_Right( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterBlock); + + Env().CloseEnum(); +} + +void +PE_Enum::On_afterBlock_Semicolon( const char * ) +{ + SetTokenResult(not_done, pop_success); + eResult_KindOf = is_declaration; +} + +void +PE_Enum::On_afterBlock_Return2Type( const char * ) +{ + SetTokenResult(not_done, pop_success); + eResult_KindOf = is_implicit_declaration; +} + +} // namespace cpp + + + diff --git a/autodoc/source/parser/cpp/pe_enum.hxx b/autodoc/source/parser/cpp/pe_enum.hxx new file mode 100644 index 000000000000..75adfe269573 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_enum.hxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_enum.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_PE_ENUM_HXX +#define ADC_CPP_PE_ENUM_HXX + + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS +// #include "all_toks.hxx" + + +namespace cpp { + + +class PE_EnumValue; + +class PE_Enum : public cpp::Cpp_PE +{ + public: + enum E_State + { + expectName, /// after "enum" + gotName, /// after name, before : or { + bodyStd, /// after { + afterBlock, /// after ending } + size_of_states + }; + + enum E_KindOfResult + { + is_declaration, // normal + is_implicit_declaration, // like in: enum Abc { rot, gelb, blau } aAbc; + is_qualified_typename // like in: enum Abc * fx(); + + }; + PE_Enum( + Cpp_PE * i_pParent ); + ~PE_Enum(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + E_KindOfResult Result_KindOf() const; + const String & Result_LocalName() const; + const String & Result_FirstNameSegment() const; + + private: + typedef SubPe< PE_Enum, PE_EnumValue > SP_EnumValue; + typedef SubPeUse< PE_Enum, PE_EnumValue> SPU_EnumValue; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void On_expectName_Identifier( const char * ); + void On_expectName_SwBracket_Left( const char * ); + + void On_gotName_SwBracket_Left( const char * ); + void On_gotName_Return2Type( const char * ); + + void On_bodyStd_Identifier( const char * ); + void On_bodyStd_SwBracket_Right( const char * ); + + void On_afterBlock_Semicolon( const char * ); + void On_afterBlock_Return2Type( const char * ); + + // DATA + Dyn< PeStatusArray<PE_Enum> > + pStati; + Dyn<SP_EnumValue> pSpValue; + Dyn<SPU_EnumValue> pSpuValue; + + String sLocalName; + ary::cpp::Enum * pCurObject; + + E_KindOfResult eResult_KindOf; +}; + + + +// IMPLEMENTATION +inline PE_Enum::E_KindOfResult +PE_Enum::Result_KindOf() const +{ + return eResult_KindOf; +} + +inline const String & +PE_Enum::Result_LocalName() const +{ + return sLocalName; +} + +inline const String & +PE_Enum::Result_FirstNameSegment() const +{ + return sLocalName; +} + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/pe_enval.cxx b/autodoc/source/parser/cpp/pe_enval.cxx new file mode 100644 index 000000000000..b29f740c08a2 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_enval.cxx @@ -0,0 +1,171 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_enval.cxx,v $ + * $Revision: 1.8 $ + * + * 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 "pe_enval.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/cp_ce.hxx> +#include "pe_expr.hxx" + + + +namespace cpp { + + +PE_EnumValue::PE_EnumValue( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_EnumValue> ) + // pSpExpression, + // pSpuInitExpression +{ + Setup_StatusFunctions(); + + pSpExpression = new SP_Expression(*this); + pSpuInitExpression = new SPU_Expression(*pSpExpression, 0, &PE_EnumValue::SpReturn_InitExpression); +} + +PE_EnumValue::~PE_EnumValue() +{ +} + +void +PE_EnumValue::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_EnumValue::Setup_StatusFunctions() +{ + typedef CallFunction<PE_EnumValue>::F_Tok F_Tok; + + static F_Tok stateF_start[] = { &PE_EnumValue::On_start_Identifier }; + static INT16 stateT_start[] = { Tid_Identifier }; + + static F_Tok stateF_afterName[] = { &PE_EnumValue::On_afterName_SwBracket_Right, + &PE_EnumValue::On_afterName_Comma, + &PE_EnumValue::On_afterName_Assign }; + static INT16 stateT_afterName[] = { Tid_SwBracket_Right, + Tid_Comma, + Tid_Assign }; + + static F_Tok stateF_expectFinish[] = { &PE_EnumValue::On_expectFinish_SwBracket_Right, + &PE_EnumValue::On_expectFinish_Comma }; + static INT16 stateT_expectFinish[] = { Tid_SwBracket_Right, + Tid_Comma }; + + SEMPARSE_CREATE_STATUS(PE_EnumValue, start, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_EnumValue, afterName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_EnumValue, expectFinish, Hdl_SyntaxError); +} + +void +PE_EnumValue::InitData() +{ + pStati->SetCur(start); + + sName.clear(); + sInitExpression.clear(); +} + +void +PE_EnumValue::TransferData() +{ + pStati->SetCur(size_of_states); + + ary::cpp::EnumValue & + rEnVal = Env().AryGate().Ces().Store_EnumValue( + Env().Context(), sName, sInitExpression ); + Env().Event_Store_EnumValue(rEnVal); +} + +void +PE_EnumValue::Hdl_SyntaxError( const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_EnumValue::SpReturn_InitExpression() +{ + pStati->SetCur(expectFinish); + + sInitExpression = pSpuInitExpression->Child().Result_Text(); +} + +void +PE_EnumValue::On_start_Identifier(const char * i_sText) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterName); + + sName = i_sText; +} + +void +PE_EnumValue::On_afterName_SwBracket_Right(const char *) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_EnumValue::On_afterName_Comma(const char * ) +{ + SetTokenResult(done, pop_success); +} + +void +PE_EnumValue::On_afterName_Assign(const char * ) +{ + pSpuInitExpression->Push(done); +} + +void +PE_EnumValue::On_expectFinish_SwBracket_Right(const char * ) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_EnumValue::On_expectFinish_Comma(const char * ) +{ + SetTokenResult(done, pop_success); +} + + +} // namespace cpp + + + + diff --git a/autodoc/source/parser/cpp/pe_enval.hxx b/autodoc/source/parser/cpp/pe_enval.hxx new file mode 100644 index 000000000000..a66ae2dc8613 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_enval.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_enval.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_PE_ENVAL_HXX +#define ADC_CPP_PE_ENVAL_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS + + +namespace cpp { + +class PE_Expression; + + +class PE_EnumValue : public Cpp_PE +{ + public: + enum E_State + { + start, // before name + afterName, + expectFinish, // after init-expression + size_of_states + }; + PE_EnumValue( + Cpp_PE * i_pParent ); + ~PE_EnumValue(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + private: + typedef SubPe< PE_EnumValue, PE_Expression > SP_Expression; + typedef SubPeUse< PE_EnumValue, PE_Expression> SPU_Expression; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError(const char *); + + void SpReturn_InitExpression(); + + void On_start_Identifier(const char * ); + + void On_afterName_SwBracket_Right(const char * ); + void On_afterName_Comma(const char * ); + void On_afterName_Assign(const char * ); + + void On_expectFinish_SwBracket_Right(const char * ); + void On_expectFinish_Comma(const char * ); + + // DATA + Dyn< PeStatusArray<PE_EnumValue> > + pStati; + Dyn<SP_Expression> pSpExpression; + Dyn<SPU_Expression> pSpuInitExpression; + + String sName; + String sInitExpression; +}; + + + + +} // namespace cpp +#endif + diff --git a/autodoc/source/parser/cpp/pe_expr.cxx b/autodoc/source/parser/cpp/pe_expr.cxx new file mode 100644 index 000000000000..d79551dd61e2 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_expr.cxx @@ -0,0 +1,207 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_expr.cxx,v $ + * $Revision: 1.7 $ + * + * 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 "pe_expr.hxx" + + +// NOT FULLY DECLARED SERVICES + + +namespace cpp { + + + +PE_Expression::PE_Expression( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Expression> ), + aResult_Text(100), + nBracketCounter(0) +{ + Setup_StatusFunctions(); +} + + +PE_Expression::~PE_Expression() +{ +} + +void +PE_Expression::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); + +#if 0 + switch (i_rTok.TypeId()) + { + case Tid_SwBracket_Left: SetTokenResult(done, stay); + nBracketCounter++; + bBlockOpened = true; + break; + case Tid_SwBracket_Right: SetTokenResult(done, stay); + nBracketCounter--; + break; + case Tid_Semicolon: if (nBracketCounter == 0) + SetTokenResult(done, pop_success); + else + SetTokenResult(done, stay); + break; + default: + if ( bBlockOpened AND nBracketCounter == 0 ) + { + SetTokenResult(not_done, pop_success); + } + else + { + SetTokenResult(done, stay); + } + } // end switch +#endif // 0 +} + +void +PE_Expression::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Expression>::F_Tok F_Tok; + + static F_Tok stateF_std[] = { &PE_Expression::On_std_SwBracket_Left, + &PE_Expression::On_std_SwBracket_Right, + &PE_Expression::On_std_ArrayBracket_Left, + &PE_Expression::On_std_ArrayBracket_Right, + &PE_Expression::On_std_Bracket_Left, + &PE_Expression::On_std_Bracket_Right, + &PE_Expression::On_std_Semicolon, + &PE_Expression::On_std_Comma }; + static INT16 stateT_std[] = { Tid_SwBracket_Left, + Tid_SwBracket_Right, + Tid_ArrayBracket_Left, + Tid_ArrayBracket_Right, + Tid_Bracket_Left, + Tid_Bracket_Right, + Tid_Semicolon, + Tid_Comma }; + + SEMPARSE_CREATE_STATUS(PE_Expression, std, On_std_Default); +} + +void +PE_Expression::InitData() +{ + pStati->SetCur(std); + aResult_Text.seekp(0); + nBracketCounter = 0; +} + +void +PE_Expression::TransferData() +{ + pStati->SetCur(size_of_states); + if ( aResult_Text.tellp() > 0) + aResult_Text.pop_back(1); +} + +void +PE_Expression::On_std_Default( const char * i_sText) +{ + SetTokenResult(done, stay); + aResult_Text << i_sText << " "; +} + +void +PE_Expression::On_std_SwBracket_Left( const char *) +{ + SetTokenResult(done, stay); + nBracketCounter++; +} + +void +PE_Expression::On_std_SwBracket_Right( const char *) +{ + nBracketCounter--; + if ( nBracketCounter >= 0 ) + SetTokenResult(done, stay); + else + SetTokenResult(not_done, pop_success); +} + +void +PE_Expression::On_std_ArrayBracket_Left( const char *) +{ + SetTokenResult(done, stay); + nBracketCounter++; +} + +void +PE_Expression::On_std_ArrayBracket_Right( const char *) +{ + nBracketCounter--; + if ( nBracketCounter >= 0 ) + SetTokenResult(done, stay); + else + SetTokenResult(not_done, pop_success); +} + +void +PE_Expression::On_std_Bracket_Left( const char *) +{ + SetTokenResult(done, stay); + nBracketCounter++; +} + +void +PE_Expression::On_std_Bracket_Right( const char *) +{ + nBracketCounter--; + if ( nBracketCounter >= 0 ) + SetTokenResult(done, stay); + else + SetTokenResult(not_done, pop_success); +} + +void +PE_Expression::On_std_Semicolon( const char *) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Expression::On_std_Comma( const char *) +{ + SetTokenResult(not_done, pop_success); +} + + +} // namespace cpp + + + + + + diff --git a/autodoc/source/parser/cpp/pe_expr.hxx b/autodoc/source/parser/cpp/pe_expr.hxx new file mode 100644 index 000000000000..54bf7bc4f106 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_expr.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_expr.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_CPP_PE_EXPR_HXX +#define ADC_CPP_PE_EXPR_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS + + +namespace cpp { + + +class PE_Expression : public Cpp_PE +{ + public: + enum E_State + { + std, + size_of_states + }; + PE_Expression( + Cpp_PE * i_pParent ); + ~PE_Expression(); + + const char * Result_Text() const; + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + private: + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void On_std_Default( const char *); + + void On_std_SwBracket_Left( const char *); + void On_std_SwBracket_Right( const char *); + void On_std_ArrayBracket_Left( const char *); + void On_std_ArrayBracket_Right( const char *); + void On_std_Bracket_Left( const char *); + void On_std_Bracket_Right( const char *); + void On_std_Semicolon( const char *); + void On_std_Comma( const char *); + + // DATA + Dyn< PeStatusArray<PE_Expression> > + pStati; + + csv::StreamStr aResult_Text; + + intt nBracketCounter; +}; + + + +// IMPLEMENTATION + +inline const char * +PE_Expression::Result_Text() const +{ + return aResult_Text.c_str(); +} + + +} // namespace cpp + + + + +#endif + + diff --git a/autodoc/source/parser/cpp/pe_file.cxx b/autodoc/source/parser/cpp/pe_file.cxx new file mode 100644 index 000000000000..af2924d8adeb --- /dev/null +++ b/autodoc/source/parser/cpp/pe_file.cxx @@ -0,0 +1,320 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_file.cxx,v $ + * $Revision: 1.12 $ + * + * 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 "pe_file.hxx" + +// NOT FULLY DECLARED SERVICES +#include "pe_defs.hxx" +#include "pe_enum.hxx" +#include "pe_namsp.hxx" +#include "pe_tpltp.hxx" +#include "pe_tydef.hxx" +#include "pe_vafu.hxx" +#include "pe_ignor.hxx" + + +// NOT FULLY DECLARED SERVICES + + +namespace cpp +{ + +PE_File::PE_File( cpp::PeEnvironment & io_rEnv) + : Cpp_PE(io_rEnv), + pEnv(&io_rEnv), + pStati( new PeStatusArray<PE_File> ), + // pSpNamespace, + // pSpTypedef, + // pSpVarFunc, + // pSpIgnore, + // pSpuNamespace, + // pSpuClass, + // pSpuTypedef, + // pSpuVarFunc, + // pSpuTemplate, + // pSpuUsing, + // pSpuIgnoreFailure, + bWithinSingleExternC(false) +{ + Setup_StatusFunctions(); + + pSpNamespace = new SP_Namespace(*this); + pSpTypedef = new SP_Typedef(*this); + pSpVarFunc = new SP_VarFunc(*this); + pSpTemplate = new SP_Template(*this); + pSpDefs = new SP_Defines(*this); + pSpIgnore = new SP_Ignore(*this); + + pSpuNamespace = new SPU_Namespace(*pSpNamespace, 0, 0); + pSpuTypedef = new SPU_Typedef(*pSpTypedef, 0, 0); + pSpuVarFunc = new SPU_VarFunc(*pSpVarFunc, 0, &PE_File::SpReturn_VarFunc); + pSpuTemplate = new SPU_Template(*pSpTemplate, 0, &PE_File::SpReturn_Template); + pSpuDefs = new SPU_Defines(*pSpDefs, 0, 0); + pSpuUsing = new SPU_Ignore(*pSpIgnore, 0, 0); + pSpuIgnoreFailure + = new SPU_Ignore(*pSpIgnore, 0, 0); +} + +PE_File::~PE_File() +{ +} + +void +PE_File::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +Cpp_PE * +PE_File::Handle_ChildFailure() +{ + SetCurSPU(pSpuIgnoreFailure.Ptr()); + return &pSpuIgnoreFailure->Child(); +} + +void +PE_File::Setup_StatusFunctions() +{ + typedef CallFunction<PE_File>::F_Tok F_Tok; + static F_Tok stateF_std[] = { &PE_File::On_std_VarFunc, + &PE_File::On_std_ClassKey, + &PE_File::On_std_ClassKey, + &PE_File::On_std_ClassKey, + &PE_File::On_std_enum, + + &PE_File::On_std_typedef, + &PE_File::On_std_template, + &PE_File::On_std_VarFunc, + &PE_File::On_std_VarFunc, + &PE_File::On_std_extern, + + &PE_File::On_std_VarFunc, + &PE_File::On_std_VarFunc, + &PE_File::On_std_VarFunc, + &PE_File::On_std_namespace, + &PE_File::On_std_using, + + &PE_File::On_std_SwBracketRight, + &PE_File::On_std_VarFunc, + &PE_File::On_std_VarFunc, + &PE_File::On_std_DefineName, + &PE_File::On_std_MacroName, + + &PE_File::On_std_VarFunc, + &PE_File::On_std_VarFunc }; + + static INT16 stateT_std[] = { Tid_Identifier, + Tid_class, + Tid_struct, + Tid_union, + Tid_enum, + + Tid_typedef, + Tid_template, + Tid_const, + Tid_volatile, + Tid_extern, + + Tid_static, + Tid_register, + Tid_inline, + Tid_namespace, + Tid_using, + + Tid_SwBracket_Right, + Tid_DoubleColon, + Tid_typename, + Tid_DefineName, + Tid_MacroName, + + Tid_BuiltInType, + Tid_TypeSpecializer }; + + static F_Tok stateF_in_extern[] = { &PE_File::On_in_extern_Constant }; + static INT16 stateT_in_extern[] = { Tid_Constant }; + + static F_Tok stateF_in_externC[] = { &PE_File::On_in_externC_SwBracket_Left }; + static INT16 stateT_in_externC[] = { Tid_SwBracket_Left }; + + + SEMPARSE_CREATE_STATUS(PE_File, std, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_File, in_extern, On_in_extern_Ignore); + SEMPARSE_CREATE_STATUS(PE_File, in_externC, On_in_externC_NoBlock); +} + +void +PE_File::InitData() +{ + pStati->SetCur(std); +} + +void +PE_File::TransferData() +{ + pStati->SetCur(size_of_states); +} + +void +PE_File::Hdl_SyntaxError( const char * i_sText) +{ + if ( *i_sText == ';' ) + { + Cerr() << Env().CurFileName() << ", line " + << Env().LineCount() + << ": Sourcecode warning: ';' as a toplevel declaration is deprecated." + << Endl(); + SetTokenResult(done,stay); + return; + } + + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_File::SpReturn_VarFunc() +{ + if (bWithinSingleExternC) + { + access_Env().CloseBlock(); + bWithinSingleExternC = false; + } +} + +void +PE_File::SpReturn_Template() +{ + access_Env().OpenTemplate( pSpuTemplate->Child().Result_Parameters() ); +} + +void +PE_File::On_std_namespace(const char * ) +{ + pSpuNamespace->Push(done); +} + +void +PE_File::On_std_ClassKey(const char * ) +{ + pSpuVarFunc->Push(not_done); // This is correct, + // classes are parsed via PE_Type. +} + +void +PE_File::On_std_typedef(const char * ) +{ + pSpuTypedef->Push(not_done); +} + +void +PE_File::On_std_enum(const char * ) +{ + pSpuVarFunc->Push(not_done); // This is correct, + // enums are parsed via PE_Type. +} + +void +PE_File::On_std_VarFunc(const char * ) +{ + pSpuVarFunc->Push(not_done); +} + +void +PE_File::On_std_template(const char * ) +{ + pSpuTemplate->Push(done); +} + +void +PE_File::On_std_extern(const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(in_extern); +} + +void +PE_File::On_std_using(const char * ) +{ + pSpuUsing->Push(done); +} + +void +PE_File::On_std_SwBracketRight(const char * ) +{ + SetTokenResult(done,stay); + access_Env().CloseBlock(); +} + +void +PE_File::On_std_DefineName(const char * ) +{ + pSpuDefs->Push(not_done); +} + +void +PE_File::On_std_MacroName(const char * ) +{ + pSpuDefs->Push(not_done); +} + +void +PE_File::On_in_extern_Constant(const char * ) +{ + SetTokenResult(done,stay); + pStati->SetCur(in_externC); + + access_Env().OpenExternC(); +} + +void +PE_File::On_in_extern_Ignore(const char * ) +{ + SetTokenResult(not_done, stay); + pStati->SetCur(std); +} + +void +PE_File::On_in_externC_SwBracket_Left(const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(std); +} + +void +PE_File::On_in_externC_NoBlock(const char * ) +{ + SetTokenResult(not_done, stay); + pStati->SetCur(std); + + bWithinSingleExternC = true; +} + + +} // namespace cpp diff --git a/autodoc/source/parser/cpp/pe_file.hxx b/autodoc/source/parser/cpp/pe_file.hxx new file mode 100644 index 000000000000..b24c2ee292cf --- /dev/null +++ b/autodoc/source/parser/cpp/pe_file.hxx @@ -0,0 +1,212 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_file.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_CPP_PE_FILE_HXX +#define ADC_CPP_PE_FILE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS + + +namespace cpp { + + class PeEnvironment; + + class PE_Namespace; + class PE_Enum; + class PE_Typedef; + class PE_VarFunc; + class PE_TemplateTop; + class PE_Defines; + class PE_Ignore; + +#if 0 +class PE_Template; +class PE_Extern; +#endif + + +class PE_File : public Cpp_PE +{ + public: + enum E_State + { + std, /// before class, struct or union + in_extern, + in_externC, + size_of_states + }; + + PE_File( + PeEnvironment & io_rEnv ); + ~PE_File(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + virtual Cpp_PE * Handle_ChildFailure(); + + private: + typedef SubPe< PE_File, PE_Namespace> SP_Namespace; + typedef SubPe< PE_File, PE_Typedef> SP_Typedef; + typedef SubPe< PE_File, PE_VarFunc> SP_VarFunc; + typedef SubPe< PE_File, PE_TemplateTop> SP_Template; + typedef SubPe< PE_File, PE_Defines> SP_Defines; + typedef SubPe< PE_File, PE_Ignore > SP_Ignore; +#if 0 + typedef SubPe< PE_File, PE_Using> SP_Using; +#endif // 0 + + typedef SubPeUse< PE_File, PE_Namespace> SPU_Namespace; + typedef SubPeUse< PE_File, PE_Typedef> SPU_Typedef; + typedef SubPeUse< PE_File, PE_VarFunc> SPU_VarFunc; + typedef SubPeUse< PE_File, PE_TemplateTop> SPU_Template; + typedef SubPeUse< PE_File, PE_Defines> SPU_Defines; + typedef SubPeUse< PE_File, PE_Ignore> SPU_Ignore; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void SpReturn_VarFunc(); + void SpReturn_Template(); + + void On_std_namespace(const char * i_sText); + void On_std_ClassKey(const char * i_sText); + void On_std_typedef(const char * i_sText); + void On_std_enum(const char * i_sText); + void On_std_VarFunc(const char * i_sText); + void On_std_template(const char * i_sText); + void On_std_extern(const char * i_sText); + void On_std_using(const char * i_sText); + void On_std_SwBracketRight(const char * i_sText); + + void On_std_DefineName(const char * i_sText); + void On_std_MacroName(const char * i_sText); + + void On_in_extern_Constant(const char * i_sText); + void On_in_extern_Ignore(const char * i_sText); + void On_in_externC_SwBracket_Left(const char * i_sText); + void On_in_externC_NoBlock(const char * i_sText); + + PeEnvironment & access_Env() { return *pEnv; } + + + // DATA + PeEnvironment * pEnv; + + Dyn< PeStatusArray<PE_File> > + pStati; + + Dyn<SP_Namespace> pSpNamespace; + Dyn<SP_Typedef> pSpTypedef; + Dyn<SP_VarFunc> pSpVarFunc; + Dyn<SP_Template> pSpTemplate; + Dyn<SP_Defines> pSpDefs; + + Dyn<SP_Ignore> pSpIgnore; +#if 0 + SP_Using aSpUsing; +#endif // 0 + + Dyn<SPU_Namespace> pSpuNamespace; + Dyn<SPU_Typedef> pSpuTypedef; + Dyn<SPU_VarFunc> pSpuVarFunc; + Dyn<SPU_Template> pSpuTemplate; + Dyn<SPU_Defines> pSpuDefs; + + Dyn<SPU_Ignore> pSpuUsing; + Dyn<SPU_Ignore> pSpuIgnoreFailure; + + bool bWithinSingleExternC; /** After 'extern "C"' without following '{', + waiting for the next function or variable to + set back to false. + */ +}; + +} // namespace cpp + + + +#if 0 // Branches + +namespace + -> Named Namespace declaration + -> Unnamed Namespace declaration + -> Namespace alias definition + +class struct union + -> Class + -> Predeclaration + +typedef + -> Typedef + +enum + -> Enum + +extern + -> Extern-"C" + -> TypeDeclaration + +TypeDeclaration + -> FunctionDecl + -> FunctionDef + -> Variable + +template + -> TemplateClass + -> TemplateFunction + -> TemplateFunction/Method-Implementation + -> TemplatePredeclaration + +} + -> End of Namespace + -> End of Extern-"C" + +asm + -> AssemblerDeclaration + +using + -> Using-Declaration + -> Using-Directive + +#endif // 0 + + +#endif + diff --git a/autodoc/source/parser/cpp/pe_funct.cxx b/autodoc/source/parser/cpp/pe_funct.cxx new file mode 100644 index 000000000000..d3fd7509f767 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_funct.cxx @@ -0,0 +1,613 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_funct.cxx,v $ + * $Revision: 1.13 $ + * + * 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 "pe_funct.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_type.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <ary/cpp/cp_type.hxx> +#include <ary/cpp/inpcontx.hxx> +#include "pe_type.hxx" +#include "pe_param.hxx" + + + + +namespace cpp +{ + + +inline void +PE_Function::PerformFinishingPunctuation() +{ + SetTokenResult(not_done,pop_success); +} + + +PE_Function::PE_Function( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Function> ), + // pSpParameter, + // pSpuParameter, + // pSpType, + // pSpuException, + // pSpuCastOperatorType, + nResult(0), + bResult_WithImplementation(false), + aName(60), + eVirtuality(ary::cpp::VIRTUAL_none), + eConVol(ary::cpp::CONVOL_none), + // aFlags, + nReturnType(0), + // aParameters + // aExceptions, + bThrow(false), + nBracketCounterInImplementation(0) +{ + Setup_StatusFunctions(); + + pSpParameter = new SP_Parameter(*this); + pSpType = new SP_Type(*this); + + pSpuParameter = new SPU_Parameter(*pSpParameter, 0, &PE_Function::SpReturn_Parameter); + pSpuException = new SPU_Type(*pSpType, 0, &PE_Function::SpReturn_Exception); + pSpuCastOperatorType = new SPU_Type(*pSpType, &PE_Function::SpInit_CastOperatorType, &PE_Function::SpReturn_CastOperatorType); +} + +PE_Function::~PE_Function() +{ + +} + +void +PE_Function::Init_Std( const String & i_sName, + ary::cpp::Type_id i_nReturnType, + bool i_bVirtual, + ary::cpp::FunctionFlags i_aFlags ) +{ + aName << i_sName; + eVirtuality = i_bVirtual ? ary::cpp::VIRTUAL_virtual : ary::cpp::VIRTUAL_none; + aFlags = i_aFlags; + nReturnType = i_nReturnType; + pStati->SetCur(afterName); +} + +void +PE_Function::Init_Ctor( const String & i_sName, + ary::cpp::FunctionFlags i_aFlags ) +{ + aName << i_sName; + eVirtuality = ary::cpp::VIRTUAL_none; + aFlags = i_aFlags; + nReturnType = 0; + pStati->SetCur(afterName); +} + +void +PE_Function::Init_Dtor( const String & i_sName, + bool i_bVirtual, + ary::cpp::FunctionFlags i_aFlags ) +{ + aName << "~" << i_sName; + eVirtuality = i_bVirtual ? ary::cpp::VIRTUAL_virtual : ary::cpp::VIRTUAL_none; + aFlags = i_aFlags; + nReturnType = 0; + pStati->SetCur(afterName); +} + +void +PE_Function::Init_CastOperator( bool i_bVirtual, + ary::cpp::FunctionFlags i_aFlags ) +{ + aName << "operator "; + eVirtuality = i_bVirtual ? ary::cpp::VIRTUAL_virtual : ary::cpp::VIRTUAL_none; + aFlags = i_aFlags; + nReturnType = 0; + pStati->SetCur(afterCastOperator); +} + +void +PE_Function::Init_NormalOperator( ary::cpp::Type_id i_nReturnType, + bool i_bVirtual, + ary::cpp::FunctionFlags i_aFlags ) +{ + aName << "operator"; + eVirtuality = i_bVirtual ? ary::cpp::VIRTUAL_virtual : ary::cpp::VIRTUAL_none; + aFlags = i_aFlags; + nReturnType = i_nReturnType; + pStati->SetCur(afterStdOperator); +} + +ary::cpp::Ce_id +PE_Function::Result_Id() const +{ + return nResult; +} + +void +PE_Function::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Function::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Function>::F_Tok F_Tok; + + static F_Tok stateF_afterStdOperator[] = + { &PE_Function::On_afterOperator_Std_Operator, + &PE_Function::On_afterOperator_Std_LeftBracket, + &PE_Function::On_afterOperator_Std_LeftBracket, + &PE_Function::On_afterOperator_Std_Operator, + &PE_Function::On_afterOperator_Std_Operator, + &PE_Function::On_afterOperator_Std_Operator, + &PE_Function::On_afterOperator_Std_Operator, + &PE_Function::On_afterOperator_Std_Operator, + &PE_Function::On_afterOperator_Std_Operator }; + static INT16 stateT_afterStdOperator[] = + { Tid_Operator, + Tid_ArrayBracket_Left, + Tid_Bracket_Left, + Tid_Comma, + Tid_Assign, + Tid_Less, + Tid_Greater, + Tid_Asterix, + Tid_AmpersAnd }; + + static F_Tok stateF_afterStdOperatorLeftBracket[] = + { &PE_Function::On_afterStdOperatorLeftBracket_RightBracket, + &PE_Function::On_afterStdOperatorLeftBracket_RightBracket }; + static INT16 stateT_afterStdOperatorLeftBracket[] = + { Tid_ArrayBracket_Right, + Tid_Bracket_Right }; + + static F_Tok stateF_afterCastOperator[] = + { &PE_Function::On_afterOperator_Cast_Type, + &PE_Function::On_afterOperator_Cast_Type, + &PE_Function::On_afterOperator_Cast_Type, + &PE_Function::On_afterOperator_Cast_Type, + &PE_Function::On_afterOperator_Cast_Type, + &PE_Function::On_afterOperator_Cast_Type, + &PE_Function::On_afterOperator_Cast_Type, + &PE_Function::On_afterOperator_Cast_Type, + &PE_Function::On_afterOperator_Cast_Type, + &PE_Function::On_afterOperator_Cast_Type, + &PE_Function::On_afterOperator_Cast_Type }; + static INT16 stateT_afterCastOperator[] = + { Tid_Identifier, + Tid_class, + Tid_struct, + Tid_union, + Tid_enum, + Tid_const, + Tid_volatile, + Tid_DoubleColon, + Tid_typename, + Tid_BuiltInType, + Tid_TypeSpecializer }; + + static F_Tok stateF_afterName[] = { &PE_Function::On_afterName_Bracket_Left }; + static INT16 stateT_afterName[] = { Tid_Bracket_Left }; + + static F_Tok stateF_expectParameterSeparator[] = + { &PE_Function::On_expectParameterSeparator_BracketRight, + &PE_Function::On_expectParameterSeparator_Comma }; + static INT16 stateT_expectParameterSeparator[] = + { Tid_Bracket_Right, + Tid_Comma }; + + static F_Tok stateF_afterParameters[] = { &PE_Function::On_afterParameters_const, + &PE_Function::On_afterParameters_volatile, + &PE_Function::On_afterParameters_throw, + &PE_Function::On_afterParameters_SwBracket_Left, + &PE_Function::On_afterParameters_Semicolon, + &PE_Function::On_afterParameters_Comma, + &PE_Function::On_afterParameters_Colon, + &PE_Function::On_afterParameters_Assign }; + static INT16 stateT_afterParameters[] = { Tid_const, + Tid_volatile, + Tid_throw, + Tid_SwBracket_Left, + Tid_Semicolon, + Tid_Comma, + Tid_Colon, + Tid_Assign }; + + static F_Tok stateF_afterThrow[] = { &PE_Function::On_afterThrow_Bracket_Left }; + static INT16 stateT_afterThrow[] = { Tid_Bracket_Left }; + + static F_Tok stateF_expectExceptionSeparator[] = + { &PE_Function::On_expectExceptionSeparator_BracketRight, + &PE_Function::On_expectExceptionSeparator_Comma }; + static INT16 stateT_expectExceptionSeparator[] = + { Tid_Bracket_Right, + Tid_Comma }; + + static F_Tok stateF_afterExceptions[] = { &PE_Function::On_afterExceptions_SwBracket_Left, + &PE_Function::On_afterExceptions_Semicolon, + &PE_Function::On_afterExceptions_Comma, + &PE_Function::On_afterExceptions_Colon, + &PE_Function::On_afterExceptions_Assign }; + static INT16 stateT_afterExceptions[] = { Tid_SwBracket_Left, + Tid_Semicolon, + Tid_Comma, + Tid_Colon, + Tid_Assign }; + + static F_Tok stateF_expectZero[] = { &PE_Function::On_expectZero_Constant }; + static INT16 stateT_expectZero[] = { Tid_Constant }; + + static F_Tok stateF_inImplementation[] = + { &PE_Function::On_inImplementation_SwBracket_Left, + &PE_Function::On_inImplementation_SwBracket_Right }; + static INT16 stateT_inImplementation[] = + { Tid_SwBracket_Left, + Tid_SwBracket_Right }; + + SEMPARSE_CREATE_STATUS(PE_Function, afterStdOperator, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, afterStdOperatorLeftBracket, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, afterCastOperator, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, afterName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, expectParameterSeparator, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, afterParameters, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, afterThrow, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, expectExceptionSeparator, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, afterExceptions, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, expectZero, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, inImplementation, On_inImplementation_Default ); +} + +void +PE_Function::InitData() +{ + pStati->SetCur( afterName ), + nResult = 0; + bResult_WithImplementation = false; + aName.seekp(0); + eVirtuality = ary::cpp::VIRTUAL_none; + eConVol = ary::cpp::CONVOL_none; + aFlags.Reset(); + nReturnType = 0; + csv::erase_container(aParameters); + csv::erase_container(aExceptions); + bThrow = false; +} + +void +PE_Function::TransferData() +{ + String sName( aName.c_str() ); + ary::cpp::Function * + pFunction = Env().AryGate().Ces().Store_Operation( + Env().Context(), + sName, + nReturnType, + aParameters, + eVirtuality, + eConVol, + aFlags, + bThrow, + aExceptions ); + if (pFunction != 0) + { + // KORR_FUTURE: How to handle differing documentation? + + Dyn< StringVector > + pTplParams ( Env().Get_CurTemplateParameters() ); + if ( pTplParams ) + { + for ( StringVector::const_iterator it = pTplParams->begin(); + it != pTplParams->end(); + ++it ) + { + pFunction->Add_TemplateParameterType( *it, ary::cpp::Type_id(0) ); + } // end for + } + + Env().Event_Store_Function(*pFunction); + } + + pStati->SetCur(size_of_states); +} + +void +PE_Function::Hdl_SyntaxError(const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Function::SpInit_CastOperatorType() +{ + pSpuCastOperatorType->Child().Init_AsCastOperatorType(); +} + +void +PE_Function::SpReturn_Parameter() +{ + pStati->SetCur(expectParameterSeparator); + + ary::cpp::Type_id nParamType = pSpuParameter->Child().Result_FrontType(); + if ( nParamType.IsValid() ) // Check, if there was a parameter, or only the closing ')'. + { + aParameters.push_back( pSpuParameter->Child().Result_ParamInfo() ); + } +} + +void +PE_Function::SpReturn_Exception() +{ + pStati->SetCur(expectExceptionSeparator); + + ary::cpp::Type_id + nException = pSpuException->Child().Result_Type().TypeId(); + if ( nException.IsValid() AND pSpuException->Child().Result_KindOf() == PE_Type::is_type ) + { + aExceptions.push_back( nException ); + } +} + +void +PE_Function::SpReturn_CastOperatorType() +{ + pStati->SetCur(afterName); + + Env().AryGate().Types().Get_TypeText( + aName, pSpuCastOperatorType->Child().Result_Type().TypeId() ); +} + +void +PE_Function::On_afterOperator_Std_Operator(const char * i_sText) +{ + SetTokenResult(done,stay); + pStati->SetCur(afterName); + + if ( 'a' <= *i_sText AND *i_sText <= 'z' ) + aName << ' '; + aName << i_sText; +} + +void +PE_Function::On_afterOperator_Std_LeftBracket(const char * i_sText) +{ + SetTokenResult(done,stay); + pStati->SetCur(afterStdOperatorLeftBracket); + + aName << i_sText; +} + +void +PE_Function::On_afterStdOperatorLeftBracket_RightBracket(const char * i_sText) +{ + SetTokenResult(done,stay); + pStati->SetCur(afterName); + + aName << i_sText; +} + +void +PE_Function::On_afterOperator_Cast_Type(const char *) +{ + pSpuCastOperatorType->Push(not_done); +} + +void +PE_Function::On_afterName_Bracket_Left(const char *) +{ + pSpuParameter->Push(done); +} + +void +PE_Function::On_expectParameterSeparator_BracketRight(const char *) +{ + SetTokenResult(done,stay); + pStati->SetCur(afterParameters); +} + +void +PE_Function::On_expectParameterSeparator_Comma(const char *) +{ + pSpuParameter->Push(done); +} + +void +PE_Function::On_afterParameters_const(const char *) +{ + SetTokenResult(done,stay); + eConVol = static_cast<E_ConVol>( + static_cast<int>(eConVol) | static_cast<int>(ary::cpp::CONVOL_const) ); +} + +void +PE_Function::On_afterParameters_volatile(const char *) +{ + SetTokenResult(done,stay); + eConVol = static_cast<E_ConVol>( + static_cast<int>(eConVol) | static_cast<int>(ary::cpp::CONVOL_volatile) ); +} + +void +PE_Function::On_afterParameters_throw(const char *) +{ + SetTokenResult(done,stay); + pStati->SetCur(afterThrow); + bThrow = true; +} + +void +PE_Function::On_afterParameters_SwBracket_Left(const char *) +{ + EnterImplementation(1); +} + +void +PE_Function::On_afterParameters_Semicolon(const char *) +{ + PerformFinishingPunctuation(); +} + +void +PE_Function::On_afterParameters_Comma(const char *) +{ + PerformFinishingPunctuation(); +} + +void +PE_Function::On_afterParameters_Colon(const char *) +{ + EnterImplementation(0); +} + +void +PE_Function::On_afterParameters_Assign(const char *) +{ + SetTokenResult(done,stay); + pStati->SetCur(expectZero); +} + +void +PE_Function::On_afterThrow_Bracket_Left(const char *) +{ + pSpuException->Push(done); +} + +void +PE_Function::On_expectExceptionSeparator_BracketRight(const char *) +{ + SetTokenResult(done,stay); + pStati->SetCur(afterExceptions); +} + +void +PE_Function::On_expectExceptionSeparator_Comma(const char *) +{ + pSpuException->Push(done); +} + +void +PE_Function::On_afterExceptions_SwBracket_Left(const char *) +{ + EnterImplementation(1); +} + +void +PE_Function::On_afterExceptions_Semicolon(const char *) +{ + PerformFinishingPunctuation(); +} + +void +PE_Function::On_afterExceptions_Comma(const char *) +{ + PerformFinishingPunctuation(); +} + +void +PE_Function::On_afterExceptions_Colon(const char *) +{ + EnterImplementation(0); +} + +void +PE_Function::On_afterExceptions_Assign(const char *) +{ + SetTokenResult(done,stay); + pStati->SetCur(expectZero); +} + +void +PE_Function::On_expectZero_Constant(const char * i_sText) +{ + if ( strcmp(i_sText,"0") != 0 ) + Hdl_SyntaxError(i_sText); + + SetTokenResult(done,stay); + pStati->SetCur(afterExceptions); + + eVirtuality = ary::cpp::VIRTUAL_abstract; +} + +void +PE_Function::On_inImplementation_SwBracket_Left(const char *) +{ + SetTokenResult(done,stay); + nBracketCounterInImplementation++; +} + +void +PE_Function::On_inImplementation_SwBracket_Right(const char *) +{ + nBracketCounterInImplementation--; + if (nBracketCounterInImplementation == 0) + { + SetTokenResult(done,pop_success); + } + else + { + SetTokenResult(done,stay); + } +} + +void +PE_Function::On_inImplementation_Default(const char *) +{ + SetTokenResult(done,stay); +} + +void +PE_Function::EnterImplementation( intt i_nBracketCountStart ) +{ + SetTokenResult(done,stay); + pStati->SetCur(inImplementation); + + bResult_WithImplementation = true; + nBracketCounterInImplementation = i_nBracketCountStart; + if ( Env().Context().CurClass() != 0 ) + { + aFlags.SetInline(); + } +} + + + +} // namespace cpp + + + + + diff --git a/autodoc/source/parser/cpp/pe_funct.hxx b/autodoc/source/parser/cpp/pe_funct.hxx new file mode 100644 index 000000000000..1c37df6a657a --- /dev/null +++ b/autodoc/source/parser/cpp/pe_funct.hxx @@ -0,0 +1,284 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_funct.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_PE_FUNCT_HXX +#define ADC_CPP_PE_FUNCT_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> +#include <ary/cpp/c_types4cpp.hxx> +#include <ary/cpp/c_vfflag.hxx> + // PARAMETERS + + +namespace ary +{ +namespace cpp +{ +class Function; +struct S_VariableInfo; +} +} + +namespace cpp +{ + +class PE_Type; +class PE_Parameter; + +class PE_Function : public Cpp_PE +{ + public: + enum E_State + { + afterStdOperator, // if initializes as operator + afterStdOperatorLeftBracket, + // if initializes as operator with ( or [ + afterCastOperator, // if initializes as operator + afterName, // undecided + expectParameterSeparator, // + afterParameters, // before const, volatile throw or = 0. + afterThrow, // expect ( + expectExceptionSeparator, // + afterExceptions, // = 0 oder ; oder , + expectZero, // after '=' + inImplementation, // after { + size_of_states + }; + typedef ary::cpp::E_Protection E_Protection; + typedef ary::cpp::E_Virtuality E_Virtuality; + typedef ary::cpp::E_ConVol E_ConVol; + + PE_Function( + Cpp_PE * i_pParent ); + ~PE_Function(); + + void Init_Std( + const String & i_sName, + ary::cpp::Type_id i_nReturnType, + bool i_bVirtual, + ary::cpp::FunctionFlags + i_aFlags ); + void Init_Ctor( + const String & i_sName, + ary::cpp::FunctionFlags + i_aFlags ); + void Init_Dtor( + const String & i_sName, + bool i_bVirtual, + ary::cpp::FunctionFlags + i_aFlags ); + void Init_CastOperator( + bool i_bVirtual, + ary::cpp::FunctionFlags + i_aFlags ); + void Init_NormalOperator( + ary::cpp::Type_id i_nReturnType, + bool i_bVirtual, + ary::cpp::FunctionFlags + i_aFlags ); + + ary::cpp::Ce_id Result_Id() const; + bool Result_WithImplementation() const; + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + private: + typedef SubPe< PE_Function, PE_Type > SP_Type; + typedef SubPeUse< PE_Function, PE_Type > SPU_Type; + typedef SubPe< PE_Function, PE_Parameter> SP_Parameter; + typedef SubPeUse<PE_Function, PE_Parameter> SPU_Parameter; + + typedef std::vector<ary::cpp::S_Parameter> ParameterList; + typedef std::vector<ary::cpp::Type_id> ExceptionTypeList; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError(const char * i_sText); + + void SpInit_CastOperatorType(); + + void SpReturn_Parameter(); + void SpReturn_Exception(); + void SpReturn_CastOperatorType(); + + void On_afterOperator_Std_Operator(const char * i_sText); // Operator+() etc. + void On_afterOperator_Std_LeftBracket(const char * i_sText); // operator [] or () + void On_afterStdOperatorLeftBracket_RightBracket(const char * i_sText); + void On_afterOperator_Cast_Type(const char * i_sText); // Type + + void On_afterName_Bracket_Left(const char * i_sText); + + void On_expectParameterSeparator_BracketRight(const char * i_sText); + void On_expectParameterSeparator_Comma(const char * i_sText); + + void On_afterParameters_const(const char * i_sText); + void On_afterParameters_volatile(const char * i_sText); + void On_afterParameters_throw(const char * i_sText); + void On_afterParameters_SwBracket_Left(const char * i_sText); + void On_afterParameters_Semicolon(const char * i_sText); + void On_afterParameters_Comma(const char * i_sText); + void On_afterParameters_Colon(const char * i_sText); + void On_afterParameters_Assign(const char * i_sText); + + void On_afterThrow_Bracket_Left(const char * i_sText); + + void On_expectExceptionSeparator_BracketRight(const char * i_sText); + void On_expectExceptionSeparator_Comma(const char * i_sText); + + void On_afterExceptions_SwBracket_Left(const char * i_sText); + void On_afterExceptions_Semicolon(const char * i_sText); + void On_afterExceptions_Comma(const char * i_sText); + void On_afterExceptions_Colon(const char * i_sText); + void On_afterExceptions_Assign(const char * i_sText); + + void On_expectZero_Constant(const char * i_sText); + + void On_inImplementation_SwBracket_Left(const char * i_sText); + void On_inImplementation_SwBracket_Right(const char * i_sText); + void On_inImplementation_Default(const char * i_sText); + + void PerformFinishingPunctuation(); + void EnterImplementation( + intt i_nBracketCountStart ); /// 1 normally, 0 in initialisation section of c'tors. + + // DATA + Dyn< PeStatusArray<PE_Function> > + pStati; + + Dyn< SP_Parameter > pSpParameter; + Dyn< SPU_Parameter> pSpuParameter; + Dyn< SP_Type > pSpType; + Dyn< SPU_Type > pSpuException; + Dyn< SPU_Type > pSpuCastOperatorType; // in "operator int()" or "operator ThatClass *()" + + ary::cpp::Ce_id nResult; + bool bResult_WithImplementation; // Necessary for the parent ParseEnvironment + // to know, there is no semicolon or comma following. + // Pre results + StreamStr aName; + E_Virtuality eVirtuality; + E_ConVol eConVol; + ary::cpp::FunctionFlags + aFlags; + ary::cpp::Type_id nReturnType; + ParameterList aParameters; + ExceptionTypeList aExceptions; + bool bThrow; // Indicates, if there is a throw - important, if there are 0 exceptions listed. + intt nBracketCounterInImplementation; +}; + + + + +// IMPLEMENTATION +inline bool +PE_Function::Result_WithImplementation() const + { return bResult_WithImplementation; } + + + + +} // namespace cpp +#endif + + + + + +/* // Overview of Stati + +Undecided +--------- + +start // vor und whrend storage class specifiern + +->Typ + +expectName // Typ ist da + +afterName + + + + +Variable +-------- + +start // vor und whrend storage class specifiern + +->Typ + +expectName // Typ ist da -> im Falle von '(': notyetimplemented +afterName + +expectSize // after [ +expectFinish + // vor ; oder , +expectNextVarName // anders als bei expectName kann hier auch * oder & kommen + + + + + +Function +-------- + +start // vor und whrend storage class specifiern + +->Typ + +expectName // Typ ist da +expectBracket // Nach Name +expectParameter // nach ( oder , +-> Parameter +after Parameters // before const, volatile throw or = 0. +after throw // expect ( +expectException // after ( +after exceptions // = 0 oder ; oder , + + +expectNextVarName // anders als bei expectName kann hier auch * oder & kommen + + + + + + + +*/ diff --git a/autodoc/source/parser/cpp/pe_ignor.cxx b/autodoc/source/parser/cpp/pe_ignor.cxx new file mode 100644 index 000000000000..27563edd0d7c --- /dev/null +++ b/autodoc/source/parser/cpp/pe_ignor.cxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_ignor.cxx,v $ + * $Revision: 1.5 $ + * + * 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 "pe_ignor.hxx" + + +// NOT FULLY DECLARED SERVICES + + +namespace cpp { + + + +PE_Ignore::PE_Ignore( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + nBracketCounter(0), + bBlockOpened(false) +{ + Setup_StatusFunctions(); +} + + +PE_Ignore::~PE_Ignore() +{ +} + +void +PE_Ignore::Call_Handler( const cpp::Token & i_rTok ) +{ + if ( NOT bBlockOpened ) + { + switch (i_rTok.TypeId()) + { + case Tid_SwBracket_Left: SetTokenResult(done, stay); + nBracketCounter++; + bBlockOpened = true; + break; + case Tid_Semicolon: SetTokenResult(done, pop_success); + break; + default: + SetTokenResult(done, stay); + } // end switch + } + else if ( nBracketCounter > 0 ) + { + SetTokenResult(done, stay); + + switch (i_rTok.TypeId()) + { + case Tid_SwBracket_Left: nBracketCounter++; + break; + case Tid_SwBracket_Right: nBracketCounter--; + break; + } // end switch + } + else if ( i_rTok.TypeId() == Tid_Semicolon ) + { + SetTokenResult(done, pop_success); + } + else + { + SetTokenResult(not_done, pop_success); + } +} + +void +PE_Ignore::Setup_StatusFunctions() +{ + // Does nothing. +} + +void +PE_Ignore::InitData() +{ + nBracketCounter = 0; + bBlockOpened = false; +} + +void +PE_Ignore::TransferData() +{ + // Does nothing. +} + + +} // namespace cpp + + + + + diff --git a/autodoc/source/parser/cpp/pe_ignor.hxx b/autodoc/source/parser/cpp/pe_ignor.hxx new file mode 100644 index 000000000000..936bec871750 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_ignor.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_ignor.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_CPP_PE_IGNOR_HXX +#define ADC_CPP_PE_IGNOR_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <cpp_pe.hxx> + // COMPONENTS + // PARAMETERS + + +namespace cpp { + + +class PE_Ignore : public Cpp_PE +{ + public: + PE_Ignore( + Cpp_PE * i_pParent ); + ~PE_Ignore(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + private: + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + + // DATA + uintt nBracketCounter; + bool bBlockOpened; +}; + + + +// IMPLEMENTATION + + +} // namespace cpp + + + + +#endif + + diff --git a/autodoc/source/parser/cpp/pe_namsp.cxx b/autodoc/source/parser/cpp/pe_namsp.cxx new file mode 100644 index 000000000000..a0b789326390 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_namsp.cxx @@ -0,0 +1,166 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_namsp.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <pe_namsp.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <all_toks.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <semantic/callf.hxx> +#include "x_parse.hxx" + + + + +namespace cpp +{ + +PE_Namespace::PE_Namespace( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Namespace> ), + // sLocalname + bPush(false) +{ + Setup_StatusFunctions(); +} + +PE_Namespace::~PE_Namespace() +{ +} + +void +PE_Namespace::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Namespace>::F_Tok F_Tok; + static F_Tok stateF_start[] = { &PE_Namespace::On_start_Identifier, + &PE_Namespace::On_start_SwBracket_Left }; + static INT16 stateT_start[] = { Tid_Identifier, + Tid_SwBracket_Left }; + static F_Tok stateF_gotName[] = { &PE_Namespace::On_gotName_SwBracket_Left, + &PE_Namespace::On_gotName_Assign }; + static INT16 stateT_gotName[] = { Tid_SwBracket_Left, + Tid_Assign }; + static F_Tok stateF_expectSemicolon[] = { &PE_Namespace::On_expectSemicolon_Semicolon }; + static INT16 stateT_expectSemicolon[] = { Tid_Semicolon }; + + SEMPARSE_CREATE_STATUS(PE_Namespace, start, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Namespace, gotName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Namespace, expectSemicolon, Hdl_SyntaxError); +} + +void +PE_Namespace::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Namespace::InitData() +{ + pStati->SetCur(start); + sLocalName = ""; + bPush = false; +} + +void +PE_Namespace::TransferData() +{ + if (bPush) + { + ary::cpp::Namespace & + rNew = Env().AryGate().Ces().CheckIn_Namespace( + Env().Context(), + sLocalName ); + Env().OpenNamespace(rNew); + } +} + +void +PE_Namespace::Hdl_SyntaxError( const char * i_sText) +{ + throw X_Parser( X_Parser::x_UnexpectedToken, + i_sText != 0 ? i_sText : "", + Env().CurFileName(), + Env().LineCount() ); +} + +void +PE_Namespace::On_start_Identifier(const char * i_sText) +{ + SetTokenResult(done, stay); + pStati->SetCur(gotName); + + sLocalName = i_sText; +} + +void +PE_Namespace::On_start_SwBracket_Left(const char * ) +{ + SetTokenResult(done, pop_success); + pStati->SetCur(size_of_states); + + sLocalName = ""; // Anonymous namespace, a name is created in + // Gate().CheckIn_Namespace() . + + bPush = true; +} + +void +PE_Namespace::On_gotName_SwBracket_Left(const char * ) +{ + SetTokenResult(done, pop_success); + pStati->SetCur(size_of_states); + + bPush = true; +} + +void +PE_Namespace::On_gotName_Assign(const char * ) +{ + // KORR_FUTURE + Hdl_SyntaxError(0); +} + +void +PE_Namespace::On_expectSemicolon_Semicolon(const char * ) +{ + SetTokenResult(done,pop_success); + pStati->SetCur(size_of_states); +} + +} // namespace cpp + + + + diff --git a/autodoc/source/parser/cpp/pe_namsp.hxx b/autodoc/source/parser/cpp/pe_namsp.hxx new file mode 100644 index 000000000000..18b2943c14f4 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_namsp.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_namsp.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_CPP_PE_NAMSP_HXX +#define ADC_CPP_PE_NAMSP_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_pe.hxx> + // PARAMETERS + +namespace ary +{ +namespace cpp +{ +class Namespace; +} +} + + +namespace cpp +{ + + +class PE_Namespace : public Cpp_PE +{ + public: + enum E_State + { + start, + gotName, + expectSemicolon, /// after namespace assignment + size_of_states + }; + PE_Namespace( + Cpp_PE * i_pParent ); + ~PE_Namespace(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + ary::cpp::Namespace * + Result_OpenedNamespace() const; + private: + void Setup_StatusFunctions(); + + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void On_start_Identifier(const char * i_sText); + void On_start_SwBracket_Left(const char * i_sText); + void On_gotName_SwBracket_Left(const char * i_sText); + void On_gotName_Assign(const char * i_sText); + void On_expectSemicolon_Semicolon(const char * i_sText); + + // DATA + Dyn< PeStatusArray<PE_Namespace> > + pStati; + + String sLocalName; + bool bPush; +}; + + + + +} // namespace cpp +#endif + diff --git a/autodoc/source/parser/cpp/pe_param.cxx b/autodoc/source/parser/cpp/pe_param.cxx new file mode 100644 index 000000000000..9a5d88c2fa06 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_param.cxx @@ -0,0 +1,283 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_param.cxx,v $ + * $Revision: 1.11 $ + * + * 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 "pe_param.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/cp_type.hxx> +#include "pe_type.hxx" +#include "pe_vari.hxx" + + +namespace cpp { + + + +//*********************** PE_Parameter ***********************// + + +PE_Parameter::PE_Parameter( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Parameter> ) + // pSpType, + // pSpuType, + // pSpVariable, + // pSpuVariable, + // aResultParamInfo +{ + Setup_StatusFunctions(); + + pSpType = new SP_Type(*this); + pSpuType = new SPU_Type(*pSpType, &PE_Parameter::SpInit_Type, &PE_Parameter::SpReturn_Type); + pSpVariable = new SP_Variable(*this); + pSpuVariable = new SPU_Variable(*pSpVariable, &PE_Parameter::SpInit_Variable, &PE_Parameter::SpReturn_Variable); +} + +PE_Parameter::~PE_Parameter() +{ +} + +void +PE_Parameter::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Parameter::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Parameter>::F_Tok F_Tok; + static F_Tok stateF_start[] = { &PE_Parameter::On_start_Type, + &PE_Parameter::On_start_Type, + &PE_Parameter::On_start_Type, + &PE_Parameter::On_start_Type, + &PE_Parameter::On_start_Type, + + &PE_Parameter::On_start_Type, + &PE_Parameter::On_start_Type, + &PE_Parameter::On_start_Bracket_Right, + &PE_Parameter::On_start_Type, + &PE_Parameter::On_start_Ellipse, + + &PE_Parameter::On_start_Type, + &PE_Parameter::On_start_Type, + &PE_Parameter::On_start_Type }; + static INT16 stateT_start[] = { Tid_Identifier, + Tid_class, + Tid_struct, + Tid_union, + Tid_enum, + + Tid_const, + Tid_volatile, + Tid_Bracket_Right, + Tid_DoubleColon, + Tid_Ellipse, + + Tid_typename, + Tid_BuiltInType, + Tid_TypeSpecializer }; + + static F_Tok stateF_expectName[] = { &PE_Parameter::On_expectName_Identifier, + &PE_Parameter::On_expectName_ArrayBracket_Left, + &PE_Parameter::On_expectName_Bracket_Right, + &PE_Parameter::On_expectName_Comma, + &PE_Parameter::On_afterName_Assign }; + static INT16 stateT_expectName[] = { Tid_Identifier, + Tid_ArrayBracket_Left, + Tid_Bracket_Right, + Tid_Comma, + Tid_Assign }; + static F_Tok stateF_afterName[] = { &PE_Parameter::On_afterName_ArrayBracket_Left, + &PE_Parameter::On_afterName_Bracket_Right, + &PE_Parameter::On_afterName_Comma, + &PE_Parameter::On_afterName_Assign }; + static INT16 stateT_afterName[] = { Tid_ArrayBracket_Left, + Tid_Bracket_Right, + Tid_Comma, + Tid_Assign }; + static F_Tok stateF_finished[] = { &PE_Parameter::On_finished_Comma, + &PE_Parameter::On_finished_Bracket_Right }; + static INT16 stateT_finished[] = { Tid_Bracket_Right, + Tid_Comma }; + + SEMPARSE_CREATE_STATUS(PE_Parameter, start, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Parameter, expectName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Parameter, afterName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Parameter, finished, Hdl_SyntaxError); +} + + +void +PE_Parameter::InitData() +{ + pStati->SetCur(start); + aResultParamInfo.Empty(); +} + +void +PE_Parameter::TransferData() +{ + pStati->SetCur(size_of_states); +} + +void +PE_Parameter::Hdl_SyntaxError( const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Parameter::SpInit_Type() +{ + // Does nothing. +} + +void +PE_Parameter::SpInit_Variable() +{ + // Does nothing. +} + +void +PE_Parameter::SpReturn_Type() +{ + aResultParamInfo.nType = pSpuType->Child().Result_Type().Id(); + pStati->SetCur(expectName); +} + +void +PE_Parameter::SpReturn_Variable() +{ + if (pSpuVariable->Child().Result_Pattern() > 0) + { + aResultParamInfo.sSizeExpression = pSpuVariable->Child().Result_SizeExpression(); + aResultParamInfo.sInitExpression = pSpuVariable->Child().Result_InitExpression(); + } +} + +void +PE_Parameter::On_start_Type(const char *) +{ + pSpuType->Push(not_done); +} + +void +PE_Parameter::On_start_Bracket_Right(const char *) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Parameter::On_start_Ellipse(const char *) +{ + SetTokenResult(done, pop_success); + + aResultParamInfo.nType = Env().AryGate().Types().Tid_Ellipse(); +} + +void +PE_Parameter::On_expectName_Identifier(const char * i_sText) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterName); + + aResultParamInfo.sName = i_sText; +} + +void +PE_Parameter::On_expectName_ArrayBracket_Left(const char * i_sText) +{ + On_afterName_ArrayBracket_Left(i_sText); +} + +void +PE_Parameter::On_expectName_Bracket_Right(const char * i_sText) +{ + On_afterName_Bracket_Right(i_sText); +} + +void +PE_Parameter::On_expectName_Comma(const char * i_sText) +{ + On_afterName_Comma(i_sText); +} + +void +PE_Parameter::On_afterName_ArrayBracket_Left(const char *) +{ + pSpuVariable->Push(not_done); +} + +void +PE_Parameter::On_afterName_Bracket_Right(const char *) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Parameter::On_afterName_Comma(const char *) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Parameter::On_afterName_Assign(const char *) +{ + pSpuVariable->Push(not_done); +} + +void +PE_Parameter::On_finished_Bracket_Right(const char *) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Parameter::On_finished_Comma(const char *) +{ + SetTokenResult(not_done, pop_success); +} + + +} // namespace cpp + + + + + + + + + diff --git a/autodoc/source/parser/cpp/pe_param.hxx b/autodoc/source/parser/cpp/pe_param.hxx new file mode 100644 index 000000000000..40a4bf85f714 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_param.hxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_param.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_PE_PARAM_HXX +#define ADC_CPP_PE_PARAM_HXX + +// BASE CLASSES +#include "cpp_pe.hxx" +// USED SERVICES +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> +#include <ary/cpp/c_vfflag.hxx> + + + + +namespace cpp +{ + class PE_Type; + class PE_Variable; + + + + +class PE_Parameter : public Cpp_PE +{ + public: + enum E_State + { + start, + expectName, + afterName, + finished, + size_of_states + }; + typedef ary::cpp::S_Parameter S_ParamInfo; + + explicit PE_Parameter( + Cpp_PE * i_pParent ); + ~PE_Parameter(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + ary::cpp::Type_id Result_FrontType() const; + const S_ParamInfo & Result_ParamInfo() const; + + private: + typedef SubPe< PE_Parameter, PE_Type > SP_Type; + typedef SubPeUse< PE_Parameter, PE_Type > SPU_Type; + typedef SubPe< PE_Parameter, PE_Variable > SP_Variable; + typedef SubPeUse< PE_Parameter, PE_Variable > SPU_Variable; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void SpInit_Type(); // Type and Ignore. + void SpInit_Variable(); + void SpReturn_Type(); + void SpReturn_Variable(); + + void On_start_Type(const char * i_sText); + void On_start_Bracket_Right(const char * i_sText); + void On_start_Ellipse(const char * i_sText); + + void On_expectName_Identifier(const char * i_sText); + void On_expectName_ArrayBracket_Left(const char * i_sText); + void On_expectName_Bracket_Right(const char * i_sText); + void On_expectName_Comma(const char * i_sText); + + void On_afterName_ArrayBracket_Left(const char * i_sText); + void On_afterName_Bracket_Right(const char * i_sText); + void On_afterName_Comma(const char * i_sText); + void On_afterName_Assign(const char * i_sText); + + void On_finished_Bracket_Right(const char * i_sText); + void On_finished_Comma(const char * i_sText); + + // DATA + Dyn< PeStatusArray<PE_Parameter> > + pStati; + + Dyn<SP_Type> pSpType; + Dyn<SPU_Type> pSpuType; + Dyn<SP_Variable> pSpVariable; + Dyn<SPU_Variable> pSpuVariable; + + S_ParamInfo aResultParamInfo; +}; + + + + +// IMPLEMENTATION +inline ary::cpp::Type_id +PE_Parameter::Result_FrontType() const +{ + return aResultParamInfo.nType; +} + +inline const PE_Parameter::S_ParamInfo & +PE_Parameter::Result_ParamInfo() const +{ + return aResultParamInfo; +} + + + + +} // namespace cpp +#endif diff --git a/autodoc/source/parser/cpp/pe_tpltp.cxx b/autodoc/source/parser/cpp/pe_tpltp.cxx new file mode 100644 index 000000000000..6c86d40ab239 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_tpltp.cxx @@ -0,0 +1,178 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_tpltp.cxx,v $ + * $Revision: 1.10 $ + * + * 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 "pe_tpltp.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <cosv/tpl/tpltools.hxx> + + + +namespace cpp { + + + +PE_TemplateTop::PE_TemplateTop( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_TemplateTop> ), + // aResult_Parameters, + bCurIsConstant(false) +{ + Setup_StatusFunctions(); +} + + +PE_TemplateTop::~PE_TemplateTop() +{ +} + +void +PE_TemplateTop::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_TemplateTop::Setup_StatusFunctions() +{ + typedef CallFunction<PE_TemplateTop>::F_Tok F_Tok; + + static F_Tok stateF_start[] = { &PE_TemplateTop::On_start_Less }; + static INT16 stateT_start[] = { Tid_Less }; + + static F_Tok stateF_expect_qualifier[]= { &PE_TemplateTop::On_expect_qualifier_ClassOrTypename, + &PE_TemplateTop::On_expect_qualifier_Greater, + &PE_TemplateTop::On_expect_qualifier_ClassOrTypename }; + static INT16 stateT_expect_qualifier[]= { Tid_class, + Tid_Greater, + Tid_typename }; + + static F_Tok stateF_expect_name[] = { &PE_TemplateTop::On_expect_name_Identifier }; + static INT16 stateT_expect_name[] = { Tid_Identifier }; + + static F_Tok stateF_expect_separator[]= { &PE_TemplateTop::On_expect_separator_Comma, + &PE_TemplateTop::On_expect_separator_Greater }; + static INT16 stateT_expect_separator[]= { Tid_Comma, + Tid_Greater }; + + SEMPARSE_CREATE_STATUS(PE_TemplateTop, start, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_TemplateTop, expect_qualifier, On_expect_qualifier_Other); + SEMPARSE_CREATE_STATUS(PE_TemplateTop, expect_name, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_TemplateTop, expect_separator, Hdl_SyntaxError); +} + +void +PE_TemplateTop::InitData() +{ + pStati->SetCur(start); + csv::erase_container(aResult_Parameters); + bCurIsConstant = false; +} + +void +PE_TemplateTop::TransferData() +{ + pStati->SetCur(size_of_states); +} + +void +PE_TemplateTop::Hdl_SyntaxError(const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_TemplateTop::On_start_Less( const char *) +{ + SetTokenResult(done, stay); + pStati->SetCur(expect_qualifier); +} + +void +PE_TemplateTop::On_expect_qualifier_ClassOrTypename( const char *) +{ + SetTokenResult(done, stay); + pStati->SetCur(expect_name); +} + +void +PE_TemplateTop::On_expect_qualifier_Greater(const char *) +{ + SetTokenResult(done, pop_success); +} + +void +PE_TemplateTop::On_expect_qualifier_Other( const char *) +{ + SetTokenResult(done, stay); + pStati->SetCur(expect_name); + + bCurIsConstant = true; +} + +void +PE_TemplateTop::On_expect_name_Identifier( const char * i_sText) +{ + SetTokenResult(done, stay); + pStati->SetCur(expect_separator); + + StreamLock sl(50); + if ( NOT bCurIsConstant ) + { + String sText( sl() << "typename " << i_sText << c_str ); + aResult_Parameters.push_back(sText); + } + else // + { + String sText( sl() << "constant " << i_sText << c_str ); + aResult_Parameters.push_back(sText); + bCurIsConstant = false; + } // endif +} + +void +PE_TemplateTop::On_expect_separator_Comma( const char *) +{ + SetTokenResult(done, stay); + pStati->SetCur(expect_qualifier); +} + +void +PE_TemplateTop::On_expect_separator_Greater( const char *) +{ + SetTokenResult(done, pop_success); +} + + + + +} // namespace cpp diff --git a/autodoc/source/parser/cpp/pe_tpltp.hxx b/autodoc/source/parser/cpp/pe_tpltp.hxx new file mode 100644 index 000000000000..3517eaf54701 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_tpltp.hxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_tpltp.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_CPP_PE_TPLTP_HXX +#define ADC_CPP_PE_TPLTP_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS + + +namespace cpp { + + + +class PE_TemplateTop : public cpp::Cpp_PE +{ + public: + enum E_State + { + start, + expect_qualifier, + expect_name, + expect_separator, + size_of_states + }; + PE_TemplateTop( + Cpp_PE * i_pParent ); + ~PE_TemplateTop(); + + const StringVector & + Result_Parameters() const; + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + private: + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError(const char *); + + + void On_start_Less(const char *); + + void On_expect_qualifier_ClassOrTypename(const char *); + void On_expect_qualifier_Greater(const char *); + void On_expect_qualifier_Other(const char *); + + void On_expect_name_Identifier(const char *); + + void On_expect_separator_Comma(const char *); + void On_expect_separator_Greater(const char *); + + // DATA + Dyn< PeStatusArray<PE_TemplateTop> > + pStati; + + StringVector + aResult_Parameters; + bool bCurIsConstant; +}; + + + +// IMPLEMENTATION + +inline const StringVector & +PE_TemplateTop::Result_Parameters() const + { return aResult_Parameters; } + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/pe_tydef.cxx b/autodoc/source/parser/cpp/pe_tydef.cxx new file mode 100644 index 000000000000..450844c9bcaa --- /dev/null +++ b/autodoc/source/parser/cpp/pe_tydef.cxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_tydef.cxx,v $ + * $Revision: 1.8 $ + * + * 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 "pe_tydef.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_type.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <all_toks.hxx> +#include "pe_type.hxx" + + +namespace cpp { + + +PE_Typedef::PE_Typedef(Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Typedef> ), + // pSpType, + // pSpuType, + // sName + nType(0) +{ + Setup_StatusFunctions(); + + pSpType = new SP_Type(*this); + pSpuType = new SPU_Type(*pSpType, 0, &PE_Typedef::SpReturn_Type); +} + +PE_Typedef::~PE_Typedef() +{ +} + +void +PE_Typedef::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Typedef::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Typedef>::F_Tok F_Tok; + static F_Tok stateF_start[] = { &PE_Typedef::On_start_typedef }; + static INT16 stateT_start[] = { Tid_typedef }; + + static F_Tok stateF_expectName[] = { &PE_Typedef::On_expectName_Identifier }; + static INT16 stateT_expectName[] = { Tid_Identifier }; + + static F_Tok stateF_afterName[] = { &PE_Typedef::On_afterName_Semicolon }; + static INT16 stateT_afterName[] = { Tid_Semicolon }; + + SEMPARSE_CREATE_STATUS(PE_Typedef, start, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Typedef, expectName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Typedef, afterName, Hdl_SyntaxError); +} + +void +PE_Typedef::InitData() +{ + pStati->SetCur(start); + + sName.clear(); + nType = 0; +} + +void +PE_Typedef::TransferData() +{ + pStati->SetCur(size_of_states); + + ary::cpp::Typedef & + rTypedef = Env().AryGate().Ces().Store_Typedef( + Env().Context(), sName, nType ); + Env().Event_Store_Typedef(rTypedef); +} + +void +PE_Typedef::Hdl_SyntaxError( const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Typedef::SpReturn_Type() +{ + pStati->SetCur(expectName); + + nType = pSpuType->Child().Result_Type().Id(); +} + +void +PE_Typedef::On_start_typedef( const char * ) +{ + pSpuType->Push(done); +} + +void +PE_Typedef::On_expectName_Identifier( const char * i_sText ) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterName); + + sName = i_sText; +} + +void +PE_Typedef::On_afterName_Semicolon( const char * ) +{ + SetTokenResult(done, pop_success); +} + +} // namespace cpp + + + diff --git a/autodoc/source/parser/cpp/pe_tydef.hxx b/autodoc/source/parser/cpp/pe_tydef.hxx new file mode 100644 index 000000000000..8c183c7cdbf9 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_tydef.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_tydef.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_PE_TYDEF_HXX +#define ADC_CPP_PE_TYDEF_HXX + +// BASE CLASSES +#include "cpp_pe.hxx" +// USED SERVICES +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + + +namespace cpp +{ + class PE_Type; + + + + +class PE_Typedef : public cpp::Cpp_PE +{ + public: + enum E_State + { + start, + expectName, + afterName, + size_of_states + }; + PE_Typedef( + Cpp_PE * i_pParent ); + ~PE_Typedef(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + private: + typedef SubPe< PE_Typedef, PE_Type > SP_Type; + typedef SubPeUse< PE_Typedef, PE_Type> SPU_Type; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void SpReturn_Type(); + + void On_start_typedef( const char * ); + void On_expectName_Identifier( const char * ); + void On_afterName_Semicolon( const char * ); + + // DATA + Dyn< PeStatusArray<PE_Typedef> > + pStati; + Dyn<SP_Type> pSpType; + Dyn<SPU_Type> pSpuType; + + String sName; + ary::cpp::Type_id nType; +}; + + + + +} // namespace cpp +#endif diff --git a/autodoc/source/parser/cpp/pe_type.cxx b/autodoc/source/parser/cpp/pe_type.cxx new file mode 100644 index 000000000000..44aa2223bd05 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_type.cxx @@ -0,0 +1,557 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_type.cxx,v $ + * $Revision: 1.11 $ + * + * 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 "pe_type.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/inpcontx.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/cp_type.hxx> +#include "pe_class.hxx" +#include "pe_enum.hxx" +#include <x_parse.hxx> + + + +class NullType : public ary::cpp::Type +{ + private: + virtual void do_Accept( + csv::ProcessorIfc & io_processor ) const; + virtual ary::ClassId + get_AryClass() const; + virtual bool inq_IsConst() const; + virtual void inq_Get_Text( + StreamStr & o_rPreName, + StreamStr & o_rName, + StreamStr & o_rPostName, + const ary::cpp::Gate & + i_rGate ) const; +}; + +void +NullType::do_Accept(csv::ProcessorIfc & ) const +{ + // Does nothing. +} + +ary::ClassId +NullType::get_AryClass() const +{ + return 0; +} + +bool +NullType::inq_IsConst() const +{ + return true; +} + +void +NullType::inq_Get_Text( StreamStr & , + StreamStr & , + StreamStr & , + const ary::cpp::Gate & ) const +{ + // Does nothing. +} + + + + +namespace cpp +{ + + +inline bool +PE_Type::IsType() const + { return eResult_KindOf == is_type; } + + +PE_Type::PE_Type( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Type> ), + pSpType(0), + pSpuType_TemplateParameter(0), + // pSpClass, + // pSpuClass, + // pSpEnum, + // pSpuEnum, + pType(0), + pCurTemplate_ParameterList(0), + // sOwningClassName, + // sParsedClass_Name, + pResult_Type(0), + eResult_KindOf(is_none), + bIsCastOperatorType(false) +{ + Setup_StatusFunctions(); + + pSpType = new SP_Type(*this); + pSpClass = new SP_Class(*this); + pSpEnum = new SP_Enum(*this); + + pSpuType_TemplateParameter + = new SPU_Type( *pSpType, 0, + &PE_Type::SpReturn_Type_TemplateParameter ); + pSpuClass = new SPU_Class( *pSpClass, 0, + & PE_Type::SpReturn_Class ); + pSpuEnum = new SPU_Enum( *pSpEnum, 0, + & PE_Type::SpReturn_Enum ); +} + +PE_Type::~PE_Type() +{ +} + +void +PE_Type::Init_AsCastOperatorType() +{ + bIsCastOperatorType = true; +} + +void +PE_Type::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Type::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Type>::F_Tok F_Tok; + static F_Tok stateF_start[] = { &PE_Type::On_start_Identifier, + &PE_Type::On_start_class, + &PE_Type::On_start_class, + &PE_Type::On_start_class, + &PE_Type::On_start_enum, + &PE_Type::On_start_const, + &PE_Type::On_start_volatile, + &PE_Type::On_start_Bracket_Right, + &PE_Type::On_start_DoubleColon, + &PE_Type::On_start_typename, + &PE_Type::On_start_BuiltInType, + &PE_Type::On_start_TypeSpecializer }; + static INT16 stateT_start[] = { Tid_Identifier, + Tid_class, + Tid_struct, + Tid_union, + Tid_enum, + Tid_const, + Tid_volatile, + Tid_Bracket_Right, + Tid_DoubleColon, + Tid_typename, + Tid_BuiltInType, + Tid_TypeSpecializer }; + + static F_Tok stateF_expect_namesegment[] = { &PE_Type::On_expect_namesegment_Identifier, + &PE_Type::On_expect_namesegment_Identifier }; + static INT16 stateT_expect_namesegment[] = { Tid_Identifier, + Tid_BuiltInType }; + + static F_Tok stateF_after_namesegment[] = { &PE_Type::On_after_namesegment_const, + &PE_Type::On_after_namesegment_volatile, + &PE_Type::On_after_namesegment_Bracket_Left, + &PE_Type::On_after_namesegment_DoubleColon, + &PE_Type::On_after_namesegment_Less, + &PE_Type::On_after_namesegment_Asterix, + &PE_Type::On_after_namesegment_AmpersAnd }; + static INT16 stateT_after_namesegment[] = { Tid_const, + Tid_volatile, + Tid_Bracket_Left, + Tid_DoubleColon, + Tid_Less, + Tid_Asterix, + Tid_AmpersAnd }; + + static F_Tok stateF_afterclass_expect_semicolon[] = + { &PE_Type::On_afterclass_expect_semicolon_Semicolon }; + static INT16 stateT_afterclass_expect_semicolon[] = + { Tid_Semicolon }; + + static F_Tok stateF_within_template[] = { &PE_Type::On_within_template_Comma, + &PE_Type::On_within_template_Greater, + &PE_Type::On_within_template_Constant }; + static INT16 stateT_within_template[] = { Tid_Comma, + Tid_Greater, + Tid_Constant }; + + static F_Tok stateF_within_indirection[] = { &PE_Type::On_within_indirection_const, + &PE_Type::On_within_indirection_volatile, + &PE_Type::On_within_indirection_Asterix, + &PE_Type::On_within_indirection_AmpersAnd }; + static INT16 stateT_within_indirection[] = { Tid_const, + Tid_volatile, + Tid_Asterix, + Tid_AmpersAnd }; + + SEMPARSE_CREATE_STATUS(PE_Type, start, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Type, expect_namesegment, On_EndOfType); + SEMPARSE_CREATE_STATUS(PE_Type, after_namesegment, On_EndOfType); + SEMPARSE_CREATE_STATUS(PE_Type, afterclass_expect_semicolon, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Type, within_template, On_within_template_TypeStart); + SEMPARSE_CREATE_STATUS(PE_Type, within_indirection, On_EndOfType); +} + +void +PE_Type::InitData() +{ + pStati->SetCur(start); + + ary::cpp::Ce_id + scope_id = Env().Context().CurClass() != 0 + ? Env().Context().CurClass()->CeId() + : Env().Context().CurNamespace().CeId(); + + pType = new ary::cpp::UsedType(scope_id); + pCurTemplate_ParameterList = 0; + sOwningClassName + = Env().Context().CurClass() != 0 + ? Env().Context().CurClass()->LocalName().c_str() + : ""; + sParsedClass_Name.clear(); + pResult_Type = 0; + eResult_KindOf = is_type; + bIsCastOperatorType = false; +} + +void +PE_Type::TransferData() +{ + pStati->SetCur(size_of_states); + + if ( IsType() ) + pResult_Type = & Env().AryGate().Types().CheckIn_UsedType( + Env().Context(), + *pType.Release() ); + else + pResult_Type = new NullType; +} + +void +PE_Type::Hdl_SyntaxError( const char * i_sText ) +{ + StdHandlingOfSyntaxError( i_sText ); +} + +void +PE_Type::SpReturn_Type_TemplateParameter() +{ + if ( pSpuType_TemplateParameter->Child().Result_KindOf() != is_type ) + throw X_Parser(X_Parser::x_UnspecifiedSyntaxError, "", String::Null_(), 0); + + pCurTemplate_ParameterList->AddParam_Type( + pSpuType_TemplateParameter->Child().Result_Type().TypeId() ); +} + +void +PE_Type::SpReturn_Class() +{ + switch ( pSpuClass->Child().Result_KindOf() ) + { + case PE_Class::is_declaration: + pStati->SetCur(afterclass_expect_semicolon); + eResult_KindOf = is_explicit_class_declaration; + break; + case PE_Class::is_implicit_declaration: + pStati->SetCur(after_namesegment); + pType->Add_NameSegment( + pSpuClass->Child().Result_LocalName() ); + break; + case PE_Class::is_predeclaration: + pStati->SetCur(afterclass_expect_semicolon); + eResult_KindOf = is_class_predeclaration; + break; + case PE_Class::is_qualified_typename: + pStati->SetCur(after_namesegment); + pType->Add_NameSegment( + pSpuClass->Child().Result_FirstNameSegment() ); + break; + default: + csv_assert(false); + } +} + +void +PE_Type::SpReturn_Enum() +{ + switch ( pSpuEnum->Child().Result_KindOf() ) + { + case PE_Enum::is_declaration: + pStati->SetCur(afterclass_expect_semicolon); + eResult_KindOf = is_explicit_enum_declaration; + break; + case PE_Enum::is_implicit_declaration: + pStati->SetCur(after_namesegment); + pType->Add_NameSegment( + pSpuEnum->Child().Result_LocalName() ); + break; + case PE_Enum::is_qualified_typename: + pStati->SetCur(after_namesegment); + pType->Add_NameSegment( + pSpuEnum->Child().Result_FirstNameSegment() ); + break; + default: + csv_assert(false); + } +} + +void +PE_Type::On_EndOfType(const char *) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Type::On_start_Identifier( const char * i_sText ) +{ + SetTokenResult(done,stay); + pStati->SetCur(after_namesegment); + + pType->Add_NameSegment(i_sText); +} + +void +PE_Type::On_start_class(const char *) +{ + pSpuClass->Push(not_done); +} + +void +PE_Type::On_start_enum(const char *) +{ + pSpuEnum->Push(done); +} + +void +PE_Type::On_start_const(const char *) +{ + SetTokenResult(done,stay); + pType->Set_Const(); +} + +void +PE_Type::On_start_volatile(const char *) +{ + SetTokenResult(done,stay); + pType->Set_Volatile(); +} + +void +PE_Type::On_start_Bracket_Right(const char *) +{ + SetTokenResult(not_done,pop_success); + + eResult_KindOf = is_none; +} + +void +PE_Type::On_start_DoubleColon(const char *) +{ + SetTokenResult(done,stay); + pType->Set_Absolute(); +} + +void +PE_Type::On_start_BuiltInType(const char * i_sText) +{ + SetTokenResult(done, stay); + pStati->SetCur(after_namesegment); + pType->Set_BuiltIn(i_sText); +} + +void +PE_Type::On_start_TypeSpecializer(const char * i_sText) +{ + SetTokenResult(done,stay); + if (*i_sText == 'u') { + pType->Set_Unsigned(); + } + else if (*i_sText == 's') { + pType->Set_Signed(); + } + else { + csv_assert(false); + } +} + +void +PE_Type::On_start_typename(const char *) +{ + SetTokenResult(done,stay); +} + +void +PE_Type::On_expect_namesegment_Identifier(const char * i_sText) +{ + SetTokenResult(done,stay); + pStati->SetCur(after_namesegment); + pType->Add_NameSegment(i_sText); +} + +void +PE_Type::On_after_namesegment_const(const char *) +{ + SetTokenResult(done,stay); + pType->Set_Const(); +} + +void +PE_Type::On_after_namesegment_volatile(const char *) +{ + SetTokenResult(done,stay); + pType->Set_Volatile(); +} + +void +PE_Type::On_after_namesegment_Bracket_Left(const char * i_sText) +{ + if ( bIsCastOperatorType ) + { + SetTokenResult(not_done, pop_success); + } + else if ( pType->LocalName() == sOwningClassName ) + { + SetTokenResult(not_done,pop_success); + eResult_KindOf = is_constructor; + + } + else // + { + On_EndOfType(i_sText); + } // endif +} + +void +PE_Type::On_after_namesegment_DoubleColon(const char *) +{ + SetTokenResult(done,stay); + pStati->SetCur(expect_namesegment); +} + +void +PE_Type::On_after_namesegment_Less(const char *) +{ + SetTokenResult(done,stay); + pStati->SetCur(within_template); + + pCurTemplate_ParameterList = & pType->Enter_Template(); +} + +void +PE_Type::On_after_namesegment_Asterix(const char *) +{ + SetTokenResult(done,stay); + pStati->SetCur(within_indirection); + pType->Add_PtrLevel(); +} + +void +PE_Type::On_after_namesegment_AmpersAnd(const char *) +{ + SetTokenResult(done,pop_success); + pType->Set_Reference(); +} + +void +PE_Type::On_afterclass_expect_semicolon_Semicolon(const char *) +{ + csv_assert( NOT IsType() ); + SetTokenResult(not_done,pop_success); +} + +void +PE_Type::On_within_template_Comma(const char *) +{ + SetTokenResult(done,stay); +} + +void +PE_Type::On_within_template_Greater(const char *) +{ + SetTokenResult(done,stay); + pStati->SetCur(after_namesegment); + + pCurTemplate_ParameterList = 0; +} + +void +PE_Type::On_within_template_Constant(const char * i_sText) +{ + // KORR_FUTURE + Cerr() << "Templates with constants as parameters are not yet supported by Autodoc" << Endl(); + Hdl_SyntaxError(i_sText); +} + +void +PE_Type::On_within_template_TypeStart(const char *) +{ + pSpuType_TemplateParameter->Push(not_done); +} + +void +PE_Type::On_within_indirection_const(const char *) +{ + SetTokenResult(done,stay); + pType->Set_Const(); +} + +void +PE_Type::On_within_indirection_volatile(const char *) +{ + SetTokenResult(done,stay); + pType->Set_Volatile(); +} + +void +PE_Type::On_within_indirection_Asterix(const char *) +{ + SetTokenResult(done,stay); + pType->Add_PtrLevel(); +} + +void +PE_Type::On_within_indirection_AmpersAnd(const char *) +{ + SetTokenResult(done,pop_success); + pType->Set_Reference(); +} + +} // namespace cpp + + + + + diff --git a/autodoc/source/parser/cpp/pe_type.hxx b/autodoc/source/parser/cpp/pe_type.hxx new file mode 100644 index 000000000000..7806f5335023 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_type.hxx @@ -0,0 +1,188 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_type.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_CPP_PE_TYPE_HXX +#define ADC_CPP_PE_TYPE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <ary/cpp/usedtype.hxx> +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS +#include <ary/cpp/c_types4cpp.hxx> + + + +namespace cpp { + +class PE_Class; +class PE_Enum; +class PE_Expression; + +class PE_Type : public Cpp_PE +{ + public: + enum E_State + { + start, + expect_namesegment, + after_namesegment, + afterclass_expect_semicolon, + within_template, + within_indirection, + size_of_states + }; + enum E_KindOfResult + { + is_none, + is_type, + is_constructor, + is_explicit_class_declaration, + is_class_predeclaration, + is_explicit_enum_declaration + }; + + PE_Type( + Cpp_PE * i_pParent ); + ~PE_Type(); + + void Init_AsCastOperatorType(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + E_KindOfResult Result_KindOf() const; + const ary::cpp::Type & + Result_Type() const; + private: + typedef SubPe< PE_Type, PE_Type > SP_Type; + typedef SubPe< PE_Type, PE_Class > SP_Class; + typedef SubPe< PE_Type, PE_Enum > SP_Enum; + typedef SubPeUse< PE_Type, PE_Type > SPU_Type; + typedef SubPeUse< PE_Type, PE_Class > SPU_Class; + typedef SubPeUse< PE_Type, PE_Enum > SPU_Enum; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void SpReturn_Type_TemplateParameter(); + void SpReturn_Class(); + void SpReturn_Enum(); + + void On_EndOfType(const char *); + + void On_start_Identifier(const char *); + void On_start_class(const char *); + void On_start_enum(const char *); + void On_start_const(const char *); + void On_start_volatile(const char *); + void On_start_Bracket_Right(const char *); + void On_start_DoubleColon(const char *); + void On_start_BuiltInType(const char *); + void On_start_TypeSpecializer(const char *); + void On_start_typename(const char *); + + void On_expect_namesegment_Identifier(const char *); + + void On_after_namesegment_const(const char *); + void On_after_namesegment_volatile(const char *); + void On_after_namesegment_Bracket_Left(const char *); + void On_after_namesegment_DoubleColon(const char *); + void On_after_namesegment_Less(const char *); + void On_after_namesegment_Asterix(const char *); + void On_after_namesegment_AmpersAnd(const char *); + + void On_afterclass_expect_semicolon_Semicolon(const char *); + + void On_within_template_Comma(const char *); + void On_within_template_Greater(const char *); + void On_within_template_Constant(const char *); + void On_within_template_TypeStart(const char *); + + void On_within_indirection_const(const char *); + void On_within_indirection_volatile(const char *); + void On_within_indirection_Asterix(const char *); + void On_within_indirection_AmpersAnd(const char *); + + bool IsType() const; + + // DATA + Dyn< PeStatusArray<PE_Type> > + pStati; + + Dyn<SP_Type> pSpType; + Dyn<SPU_Type> pSpuType_TemplateParameter; + Dyn<SP_Class> pSpClass; + Dyn<SPU_Class> pSpuClass; + Dyn<SP_Enum> pSpEnum; + Dyn<SPU_Enum> pSpuEnum; + + Dyn<ary::cpp::UsedType> + pType; + ary::cpp::ut::List_TplParameter * + pCurTemplate_ParameterList; + String sOwningClassName; + String sParsedClass_Name; + + const ary::cpp::Type * + pResult_Type; + E_KindOfResult eResult_KindOf; + bool bIsCastOperatorType; +}; + + + +// IMPLEMENTATION + + +inline const ary::cpp::Type & +PE_Type::Result_Type() const + { csv_assert(pResult_Type != 0); + return *pResult_Type; } +inline PE_Type::E_KindOfResult +PE_Type::Result_KindOf() const + { return eResult_KindOf; } + + +} // namespace cpp + + +#endif + + + diff --git a/autodoc/source/parser/cpp/pe_vafu.cxx b/autodoc/source/parser/cpp/pe_vafu.cxx new file mode 100644 index 000000000000..265b5a6665ba --- /dev/null +++ b/autodoc/source/parser/cpp/pe_vafu.cxx @@ -0,0 +1,652 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_vafu.cxx,v $ + * $Revision: 1.12 $ + * + * 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 "pe_vafu.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_vari.hxx> +#include <ary/cpp/c_vfflag.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <ary/cpp/inpcontx.hxx> +#include "pe_type.hxx" +#include "pe_vari.hxx" +#include "pe_funct.hxx" +#include "pe_ignor.hxx" +#include <x_parse.hxx> + + + + +namespace cpp { + + + +//*********************** PE_VarFunc ***********************// + + +PE_VarFunc::PE_VarFunc( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_VarFunc> ), + // pSpType, + // pSpuType, + // pSpVariable, + // pSpuVariable, + // pSpFunction, + // pSpuFunctionStd, + // pSpuFunctionCtor, + // pSpuFunctionDtor, + // pSpuFunctionCastOperator, + // pSpuFunctionNormalOperator + // pSpIgnore, + // pSpuIgnore, + nCounter_TemplateBrackets(0), + bInDestructor(false), + // aResultIds, + nResultFrontType(0), + eResultType(result_unknown), + bVirtual(false), + bStatic(false), + bExtern(false), + bExternC(false), + bMutable(false), + bInline(false), + bRegister(false), + bExplicit(false) +{ + Setup_StatusFunctions(); + + pSpType = new SP_Type(*this); + pSpuType = new SPU_Type(*pSpType, 0, &PE_VarFunc::SpReturn_Type); + pSpVariable = new SP_Variable(*this); + pSpuVariable = new SPU_Variable(*pSpVariable, 0, &PE_VarFunc::SpReturn_Variable); + pSpFunction = new SP_Function(*this); + pSpuFunctionStd = new SPU_Function(*pSpFunction, &PE_VarFunc::SpInit_FunctionStd, &PE_VarFunc::SpReturn_FunctionStd); + pSpuFunctionCtor = new SPU_Function(*pSpFunction, &PE_VarFunc::SpInit_FunctionCtor, &PE_VarFunc::SpReturn_FunctionStd); + pSpuFunctionDtor = new SPU_Function(*pSpFunction, &PE_VarFunc::SpInit_FunctionDtor, &PE_VarFunc::SpReturn_FunctionStd); + pSpuFunctionCastOperator + = new SPU_Function(*pSpFunction, &PE_VarFunc::SpInit_FunctionCastOperator, &PE_VarFunc::SpReturn_FunctionStd); + pSpuFunctionNormalOperator + = new SPU_Function(*pSpFunction, &PE_VarFunc::SpInit_FunctionNormalOperator, &PE_VarFunc::SpReturn_FunctionStd); + pSpIgnore = new SP_Ignore(*this); + pSpuIgnore = new SPU_Ignore(*pSpIgnore, 0, &PE_VarFunc::SpReturn_Ignore); +} + +PE_VarFunc::~PE_VarFunc() +{ +} + +void +PE_VarFunc::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_VarFunc::Setup_StatusFunctions() +{ + typedef CallFunction<PE_VarFunc>::F_Tok F_Tok; + + static F_Tok stateF_start[] = { &PE_VarFunc::On_start_Identifier, + &PE_VarFunc::On_start_operator, + &PE_VarFunc::On_start_TypeKey, + &PE_VarFunc::On_start_TypeKey, + &PE_VarFunc::On_start_TypeKey, + &PE_VarFunc::On_start_TypeKey, + &PE_VarFunc::On_start_virtual, + &PE_VarFunc::On_start_Tilde, + &PE_VarFunc::On_start_const, + &PE_VarFunc::On_start_volatile, + &PE_VarFunc::On_start_extern, + &PE_VarFunc::On_start_static, + &PE_VarFunc::On_start_mutable, + &PE_VarFunc::On_start_register, + &PE_VarFunc::On_start_inline, + &PE_VarFunc::On_start_explicit, + &PE_VarFunc::On_start_Bracket_Right, + &PE_VarFunc::On_start_Identifier, + &PE_VarFunc::On_start_typename, + &PE_VarFunc::On_start_Identifier, + &PE_VarFunc::On_start_Identifier }; + static INT16 stateT_start[] = { Tid_Identifier, + Tid_operator, + Tid_class, + Tid_struct, + Tid_union, + Tid_enum, + Tid_virtual, + Tid_Tilde, + Tid_const, + Tid_volatile, + Tid_extern, + Tid_static, + Tid_mutable, + Tid_register, + Tid_inline, + Tid_explicit, + Tid_Bracket_Right, + Tid_DoubleColon, + Tid_typename, + Tid_BuiltInType, + Tid_TypeSpecializer }; + + static F_Tok stateF_expectCtor[] = { &PE_VarFunc::On_expectCtor_Bracket_Left }; + static INT16 stateT_expectCtor[] = { Tid_Bracket_Left }; + + static F_Tok stateF_afterClassDecl[] = { &PE_VarFunc::On_afterClassDecl_Semicolon }; + static INT16 stateT_afterClassDecl[] = { Tid_Semicolon }; + + static F_Tok stateF_expectName[] = { &PE_VarFunc::On_expectName_Identifier, + &PE_VarFunc::On_expectName_operator, + &PE_VarFunc::On_expectName_Bracket_Left }; + static INT16 stateT_expectName[] = { Tid_Identifier, + Tid_operator, + Tid_Bracket_Left }; + + static F_Tok stateF_afterName[] = { &PE_VarFunc::On_afterName_ArrayBracket_Left, + &PE_VarFunc::On_afterName_Bracket_Left, + &PE_VarFunc::On_afterName_DoubleColon, + &PE_VarFunc::On_afterName_Semicolon, + &PE_VarFunc::On_afterName_Comma, + &PE_VarFunc::On_afterName_Assign, + &PE_VarFunc::On_afterName_Less }; + static INT16 stateT_afterName[] = { Tid_ArrayBracket_Left, + Tid_Bracket_Left, + Tid_DoubleColon, + Tid_Semicolon, + Tid_Comma, + Tid_Assign, + Tid_Less }; + + static F_Tok stateF_afterName_inErraneousTemplate[] = + { &PE_VarFunc::On_afterName_inErraneousTemplate_Less, + &PE_VarFunc::On_afterName_inErraneousTemplate_Greater }; + static INT16 stateT_afterName_inErraneousTemplate[] = + { Tid_Less, + Tid_Greater }; + + static F_Tok stateF_finished[] = { &PE_VarFunc::On_finished_Semicolon, + &PE_VarFunc::On_finished_Comma }; + static INT16 stateT_finished[] = { Tid_Semicolon, + Tid_Comma }; + + static F_Tok stateF_finishedIncludingFunctionImplementation[] = + { &PE_VarFunc::On_finishedIncludingFunctionImplementation_Default + }; + static INT16 stateT_finishedIncludingFunctionImplementation[] = + { Tid_BuiltInType // Just to have one entry, but it is default handled, too. + }; + + SEMPARSE_CREATE_STATUS(PE_VarFunc, start, Hdl_UnknownToken); + SEMPARSE_CREATE_STATUS(PE_VarFunc, expectCtor, Hdl_UnknownToken); + SEMPARSE_CREATE_STATUS(PE_VarFunc, afterClassDecl, Hdl_UnknownToken); + SEMPARSE_CREATE_STATUS(PE_VarFunc, expectName, Hdl_UnknownToken); + SEMPARSE_CREATE_STATUS(PE_VarFunc, afterName, Hdl_UnknownToken); + SEMPARSE_CREATE_STATUS(PE_VarFunc, afterName_inErraneousTemplate, On_afterName_inErraneousTemplate_Default); + SEMPARSE_CREATE_STATUS(PE_VarFunc, finished, On_finished_Default); + SEMPARSE_CREATE_STATUS(PE_VarFunc, finishedIncludingFunctionImplementation, On_finishedIncludingFunctionImplementation_Default); +} + +void +PE_VarFunc::InitData() +{ + pStati->SetCur(start); + csv::erase_container(aResultIds); + + nCounter_TemplateBrackets = 0; + bInDestructor = false; + + nResultFrontType = 0; + eResultType = result_unknown; + sName.clear(); + bVirtual = ary::cpp::VIRTUAL_none; + bStatic = false; + bExtern = false; + bExternC = false; + bMutable = false; + bInline = false; + bRegister = false; + bExplicit = false; +} + +void +PE_VarFunc::TransferData() +{ + pStati->SetCur(size_of_states); +} + +void +PE_VarFunc::Hdl_UnknownToken( const char *) +{ + pSpuIgnore->Push(not_done); +} + +void +PE_VarFunc::SpInit_FunctionStd() +{ + if ( nResultFrontType.IsValid() AND sName.length() > 0 ) + { + pSpuFunctionStd->Child().Init_Std( + sName, + nResultFrontType, + bVirtual, + CreateFunctionFlags() ); + } + else + { + throw X_Parser( X_Parser::x_UnexpectedToken, + "", + Env().CurFileName(), + Env().LineCount() ); + } +} + +void +PE_VarFunc::SpInit_FunctionCtor() +{ + ary::cpp::Class * pOwnerClass = Env().Context().CurClass(); + csv_assert( pOwnerClass != 0 ); + pSpuFunctionStd->Child().Init_Ctor( pOwnerClass->LocalName(), + CreateFunctionFlags() ); +} + +void +PE_VarFunc::SpInit_FunctionDtor() +{ + pSpuFunctionStd->Child().Init_Dtor( sName, + bVirtual, + CreateFunctionFlags() ); +} + +void +PE_VarFunc::SpInit_FunctionCastOperator() +{ + pSpuFunctionStd->Child().Init_CastOperator( bVirtual, + CreateFunctionFlags() ); +} + +void +PE_VarFunc::SpInit_FunctionNormalOperator() +{ + pSpuFunctionStd->Child().Init_NormalOperator( nResultFrontType, + bVirtual, + CreateFunctionFlags() ); +} + +void +PE_VarFunc::SpReturn_Type() +{ + switch ( pSpuType->Child().Result_KindOf() ) + { + case PE_Type::is_type: + pStati->SetCur(expectName); + nResultFrontType + = pSpuType->Child().Result_Type().Id(); + break; + case PE_Type::is_constructor: + pStati->SetCur(expectCtor); + eResultType = result_function; + break; + case PE_Type::is_explicit_class_declaration: + case PE_Type::is_explicit_enum_declaration: + pStati->SetCur(afterClassDecl); + eResultType = result_ignore; + break; + case PE_Type::is_class_predeclaration: + pStati->SetCur(afterClassDecl); + eResultType = result_ignore; + break; + default: + ; + } +} + +void +PE_VarFunc::SpReturn_Variable() +{ + typedef ary::cpp::VariableFlags VarFlags; + + if ( NOT bExtern ) + { + VarFlags aFlags( UINT16( + ( bStatic AND Env().Context().CurClass() == 0 ? VarFlags::f_static_local : 0 ) + | ( bStatic AND Env().Context().CurClass() != 0 ? VarFlags::f_static_member : 0 ) + | ( bMutable ? VarFlags::f_mutable : 0 ) ) + ); + +// ary::S_InitData aData( 0, Env().CurCeSpace().Id(), i_sName, 0 ); + ary::cpp::Variable & rCurParsedVariable + = Env().AryGate().Ces().Store_Variable( Env().Context(), + sName, + nResultFrontType, + aFlags, + pSpuVariable->Child().Result_SizeExpression(), + pSpuVariable->Child().Result_InitExpression() ); + Env().Event_Store_Variable(rCurParsedVariable); + aResultIds.push_back( rCurParsedVariable.CeId() ); + eResultType = result_variable; + } + else if (bExtern) + { + eResultType = result_ignore; + } + + pStati->SetCur(finished); +} + +void +PE_VarFunc::SpReturn_FunctionStd() +{ + if ( (NOT bExtern) OR bExternC ) + { + aResultIds.push_back(pSpuFunctionStd->Child().Result_Id()); + eResultType = result_function; + } + else + { + eResultType = result_ignore; + } + + if ( NOT pSpuFunctionStd->Child().Result_WithImplementation() ) + pStati->SetCur(finished); + else + pStati->SetCur(finishedIncludingFunctionImplementation); +} + +void +PE_VarFunc::SpReturn_Ignore() +{ + pStati->SetCur(finished); +} + +void +PE_VarFunc::On_start_Identifier(const char *) +{ + pSpuType->Push(not_done); +} + +void +PE_VarFunc::On_start_operator(const char *) +{ + pSpuFunctionCastOperator->Push(done); +} + +void +PE_VarFunc::On_start_TypeKey(const char *) +{ + pSpuType->Push(not_done); +} + +void +PE_VarFunc::On_start_virtual(const char *) +{ + SetTokenResult(done, stay); + bVirtual = true; +} + +void +PE_VarFunc::On_start_Tilde(const char *) +{ + SetTokenResult(done, stay); + pStati->SetCur(expectName); + + bInDestructor = true; +} + +void +PE_VarFunc::On_start_const(const char *) +{ + pSpuType->Push(not_done); +} + +void +PE_VarFunc::On_start_volatile(const char *) +{ + pSpuType->Push(not_done); +} + +void +PE_VarFunc::On_start_extern(const char *) +{ + SetTokenResult(done, stay); + bExtern = true; +} + +void +PE_VarFunc::On_start_static(const char *) +{ + SetTokenResult(done, stay); + bStatic = true; +} + +void +PE_VarFunc::On_start_mutable(const char *) +{ + SetTokenResult(done, stay); + bMutable = true; +} + +void +PE_VarFunc::On_start_register(const char *) +{ + SetTokenResult(done, stay); + bRegister = true; +} + +void +PE_VarFunc::On_start_inline(const char *) +{ + SetTokenResult(done, stay); + + bInline = true; +} + +void +PE_VarFunc::On_start_explicit(const char *) +{ + SetTokenResult(done, stay); + bExplicit = true; +} + +void +PE_VarFunc::On_start_Bracket_Right(const char *) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_VarFunc::On_start_typename(const char *) +{ + pSpuType->Push(not_done); +} + +void +PE_VarFunc::On_expectCtor_Bracket_Left(const char *) +{ + pSpuFunctionCtor->Push(not_done); +} + +void +PE_VarFunc::On_afterClassDecl_Semicolon(const char *) +{ + SetTokenResult(done, pop_success); +} + +void +PE_VarFunc::On_expectName_Identifier(const char * i_sText) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterName); + sName = i_sText; +} + +void +PE_VarFunc::On_expectName_operator(const char *) +{ + pSpuFunctionNormalOperator->Push(done); +} + +void +PE_VarFunc::On_expectName_Bracket_Left(const char *) +{ + // Function pointer declaration + pSpuIgnore->Push(not_done); + // TODO +} + + +void +PE_VarFunc::On_afterName_ArrayBracket_Left(const char *) +{ + pSpuVariable->Push(not_done); +} + +void +PE_VarFunc::On_afterName_Bracket_Left(const char *) +{ + if ( NOT bInDestructor) + pSpuFunctionStd->Push(not_done); + else + pSpuFunctionDtor->Push(not_done); +} + +void +PE_VarFunc::On_afterName_DoubleColon(const char *) +{ + pSpuIgnore->Push(done); // This seems to be only an implementation. + + // This may have been a template. + // In that case, the declaration needs to be closed. + Env().Close_OpenTemplate(); +} + +void +PE_VarFunc::On_afterName_Semicolon(const char *) +{ + pSpuVariable->Push(not_done); +} + +void +PE_VarFunc::On_afterName_Comma(const char *) +{ + pSpuVariable->Push(not_done); +} + +void +PE_VarFunc::On_afterName_Assign(const char * ) +{ + pSpuVariable->Push(not_done); +} + +void +PE_VarFunc::On_afterName_Less(const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterName_inErraneousTemplate); + + nCounter_TemplateBrackets = 1; +} + +void +PE_VarFunc::On_afterName_inErraneousTemplate_Less(const char * ) +{ + SetTokenResult(done, stay); + + nCounter_TemplateBrackets++; +} + +void +PE_VarFunc::On_afterName_inErraneousTemplate_Greater(const char * ) +{ + SetTokenResult(done, stay); + + nCounter_TemplateBrackets--; + if ( nCounter_TemplateBrackets == 0 ) + pStati->SetCur(afterName); +} + +void +PE_VarFunc::On_afterName_inErraneousTemplate_Default(const char * ) +{ + SetTokenResult(done, stay); +} + +void +PE_VarFunc::On_finished_Semicolon(const char * ) // Should be Semicolon !!! +{ + SetTokenResult(done, pop_success); +} + +void +PE_VarFunc::On_finished_Comma(const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(expectName); +} + +void +PE_VarFunc::On_finished_Default(const char * ) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_VarFunc::On_finishedIncludingFunctionImplementation_Default(const char * ) +{ + SetTokenResult(not_done, pop_success); +} + +ary::cpp::FunctionFlags +PE_VarFunc::CreateFunctionFlags() +{ + typedef ary::cpp::FunctionFlags FuncFlags; + + return FuncFlags( UINT16( + ( bStatic AND Env().Context().CurClass() == 0 ? FuncFlags::f_static_local : 0 ) + | ( bStatic AND Env().Context().CurClass() != 0 ? FuncFlags::f_static_member : 0 ) + | ( bExtern ? FuncFlags::f_extern : 0 ) + | ( Env().IsExternC() ? FuncFlags::f_externC : 0 ) + | ( bMutable ? FuncFlags::f_mutable : 0 ) + | ( bInline ? FuncFlags::f_inline : 0 ) + | ( bRegister ? FuncFlags::f_register : 0 ) + | ( bExplicit ? FuncFlags::f_explicit : 0 ) ) + ); + +} + + +} // namespace cpp + + + diff --git a/autodoc/source/parser/cpp/pe_vafu.hxx b/autodoc/source/parser/cpp/pe_vafu.hxx new file mode 100644 index 000000000000..1d22d67d0082 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_vafu.hxx @@ -0,0 +1,292 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_vafu.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_CPP_PE_VAFU_HXX +#define ADC_CPP_PE_VAFU_HXX + +// BASE CLASSES +#include "cpp_pe.hxx" +// USED SERVICES +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> +#include <ary/cpp/c_types4cpp.hxx> +#include <ary/cpp/c_vfflag.hxx> + + + +namespace cpp +{ + +class PE_Type; +class PE_Variable; +class PE_Function; +class PE_Ignore; + + + + +class PE_VarFunc : public Cpp_PE +{ + public: + enum E_State + { + start, + expectCtor, + afterClassDecl, // Also used for after enum declaration. + expectName, + afterName, + afterName_inErraneousTemplate, + finished, + finishedIncludingFunctionImplementation, + size_of_states + }; + enum E_ResultType + { + result_unknown = 0, + result_ignore, /// Used for class and enum declarations and predeclarations and for extern variables and functions. + result_variable, + result_function + }; + + typedef ary::cpp::E_Protection E_Protection; + + + PE_VarFunc( + Cpp_PE * i_pParent ); + ~PE_VarFunc(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + const std::vector<ary::cpp::Ce_id> & + Result_Ids() const; + ary::cpp::Type_id Result_FrontType() const; + const StringVector & + Result_Names() const; + E_ResultType Result_CeType() const; + + private: + typedef SubPe< PE_VarFunc, PE_Type > SP_Type; + typedef SubPeUse< PE_VarFunc, PE_Type > SPU_Type; + typedef SubPe< PE_VarFunc, PE_Variable > SP_Variable; + typedef SubPeUse< PE_VarFunc, PE_Variable > SPU_Variable; + typedef SubPe< PE_VarFunc, PE_Function > SP_Function; + typedef SubPeUse< PE_VarFunc, PE_Function > SPU_Function; + typedef SubPe< PE_VarFunc, PE_Ignore > SP_Ignore; + typedef SubPeUse< PE_VarFunc, PE_Ignore > SPU_Ignore; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_UnknownToken( const char *); + + void SpInit_FunctionStd(); + void SpInit_FunctionCtor(); + void SpInit_FunctionDtor(); + void SpInit_FunctionCastOperator(); + void SpInit_FunctionNormalOperator(); + void SpReturn_Type(); + void SpReturn_Variable(); + void SpReturn_FunctionStd(); + void SpReturn_Ignore(); + + void On_start_Identifier(const char * i_sText); + void On_start_operator(const char * i_sText); + void On_start_TypeKey(const char * i_sText); + void On_start_virtual(const char * i_sText); + void On_start_Tilde(const char * i_sText); + void On_start_const(const char * i_sText); + void On_start_volatile(const char * i_sText); + void On_start_extern(const char * i_sText); + void On_start_static(const char * i_sText); + void On_start_mutable(const char * i_sText); + void On_start_register(const char * i_sText); + void On_start_inline(const char * i_sText); + void On_start_explicit(const char * i_sText); + void On_start_Bracket_Right(const char * i_sText); + void On_start_typename(const char * i_sText); + + void On_expectCtor_Bracket_Left(const char * i_sText); + + void On_afterClassDecl_Semicolon(const char * i_sText); + + void On_expectName_Identifier(const char * i_sText); + void On_expectName_operator(const char * i_sText); + void On_expectName_Bracket_Left(const char * i_sText); + + void On_afterName_ArrayBracket_Left(const char * i_sText); + void On_afterName_Bracket_Left(const char * i_sText); + void On_afterName_DoubleColon(const char * i_sText); + void On_afterName_Semicolon(const char * i_sText); + void On_afterName_Comma(const char * i_sText); + void On_afterName_Assign(const char * i_sText); + void On_afterName_Less(const char * i_sText); + + void On_afterName_inErraneousTemplate_Less(const char * i_sText); + void On_afterName_inErraneousTemplate_Greater(const char * i_sText); + void On_afterName_inErraneousTemplate_Default(const char * i_sText); + + void On_finished_Semicolon(const char * i_sText); + void On_finished_Comma(const char * i_sText); + void On_finished_Default(const char * i_sText); + + void On_finishedIncludingFunctionImplementation_Default(const char * i_sText); + + ary::cpp::FunctionFlags + CreateFunctionFlags(); + + // DATA + Dyn< PeStatusArray<PE_VarFunc> > + pStati; + + Dyn<SP_Type> pSpType; + Dyn<SPU_Type> pSpuType; + Dyn<SP_Variable> pSpVariable; + Dyn<SPU_Variable> pSpuVariable; + Dyn<SP_Function> pSpFunction; + Dyn<SPU_Function> pSpuFunctionStd; + Dyn<SPU_Function> pSpuFunctionCtor; + Dyn<SPU_Function> pSpuFunctionDtor; + Dyn<SPU_Function> pSpuFunctionCastOperator; + Dyn<SPU_Function> pSpuFunctionNormalOperator; + Dyn<SP_Ignore> pSpIgnore; + Dyn<SPU_Ignore> pSpuIgnore; + + intt nCounter_TemplateBrackets; + bool bInDestructor; + + std::vector<ary::cpp::Ce_id> + aResultIds; + ary::cpp::Type_id nResultFrontType; + E_ResultType eResultType; + + // Pre-Results + String sName; + + bool bVirtual; + bool bStatic; + bool bExtern; + bool bExternC; + bool bMutable; + bool bInline; + bool bRegister; + bool bExplicit; +}; + + + +// IMPLEMENTATION + +inline const std::vector<ary::cpp::Ce_id> & +PE_VarFunc::Result_Ids() const + { return aResultIds; } +inline ary::cpp::Type_id +PE_VarFunc::Result_FrontType() const + { return nResultFrontType; } +inline PE_VarFunc::E_ResultType +PE_VarFunc::Result_CeType() const + { return eResultType; } + + + +} // namespace cpp + + + + +#endif + + +/* // Overview of Stati + +Undecided +--------- + +start // vor und whrend storage class specifiern + any ->stay + operaator ->goto Function + +->Typ + +expectName + Identifier ->stay + operator ->goto Function + +afterName ->goto Variable or Function + + + + +Variable +-------- + +start // vor und whrend storage class specifiern + +->Typ + +expectName // Typ ist da -> im Falle von '(': notyetimplemented +afterName + +expectSize // after [ +expectFinish + // vor ; oder , +expectNextVarName // anders als bei expectName kann hier auch * oder & kommen + + + + + +Function +-------- + +start // vor und whrend storage class specifiern + +->Typ + +expectName // Typ ist da +expectBracket // Nach Name +expectParameter // nach ( oder , +-> Parameter +after Parameters // before const, volatile throw or = 0. +after throw // expect ( +expectException // after ( +after exceptions // = 0 oder ; oder , + + +expectNextVarName // anders als bei expectName kann hier auch * oder & kommen + + + + + + + +*/ diff --git a/autodoc/source/parser/cpp/pe_vari.cxx b/autodoc/source/parser/cpp/pe_vari.cxx new file mode 100644 index 000000000000..9d3ba37c43db --- /dev/null +++ b/autodoc/source/parser/cpp/pe_vari.cxx @@ -0,0 +1,190 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_vari.cxx,v $ + * $Revision: 1.9 $ + * + * 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 "pe_vari.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include "pe_expr.hxx" + + + + +namespace cpp { + + +PE_Variable::PE_Variable( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Variable> ) + // pSpExpression, + // pSpuArraySizeExpression, + // pSpuInitExpression, + // sResultSizeExpression, + // sResultInitExpression +{ + Setup_StatusFunctions(); + + pSpExpression = new SP_Expression(*this); + + pSpuArraySizeExpression = new SPU_Expression(*pSpExpression, 0, &PE_Variable::SpReturn_ArraySizeExpression); + pSpuInitExpression = new SPU_Expression(*pSpExpression, 0, &PE_Variable::SpReturn_InitExpression); +} + +PE_Variable::~PE_Variable() +{ +} + +void +PE_Variable::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Variable::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Variable>::F_Tok F_Tok; + + static F_Tok stateF_afterName[] = { &PE_Variable::On_afterName_ArrayBracket_Left, + &PE_Variable::On_afterName_Semicolon, + &PE_Variable::On_afterName_Comma, + &PE_Variable::On_afterName_Assign }; + static INT16 stateT_afterName[] = { Tid_ArrayBracket_Left, + Tid_Semicolon, + Tid_Comma, + Tid_Assign }; + static F_Tok stateF_afterSize[] = { &PE_Variable::On_afterSize_ArrayBracket_Right }; + static INT16 stateT_afterSize[] = { Tid_ArrayBracket_Right }; + static F_Tok stateF_expectFinish[] = { &PE_Variable::On_expectFinish_Bracket_Right, + &PE_Variable::On_expectFinish_Semicolon, + &PE_Variable::On_expectFinish_Comma }; + static INT16 stateT_expectFinish[] = { Tid_Bracket_Right, + Tid_Semicolon, + Tid_Comma }; + + SEMPARSE_CREATE_STATUS(PE_Variable, afterName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Variable, afterSize, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Variable, expectFinish, Hdl_SyntaxError); +} + +void +PE_Variable::InitData() +{ + pStati->SetCur(afterName); + + sResultSizeExpression.clear(); + sResultInitExpression.clear(); +} + +void +PE_Variable::TransferData() +{ + pStati->SetCur(size_of_states); +} + +void +PE_Variable::Hdl_SyntaxError( const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Variable::SpReturn_ArraySizeExpression() +{ + pStati->SetCur(afterSize); + + sResultSizeExpression = pSpuArraySizeExpression->Child().Result_Text(); +} + +void +PE_Variable::SpReturn_InitExpression() +{ + pStati->SetCur(expectFinish); + + sResultInitExpression = pSpuInitExpression->Child().Result_Text(); +} + +void +PE_Variable::On_afterName_ArrayBracket_Left(const char *) +{ + pSpuArraySizeExpression->Push(done); +} + +void +PE_Variable::On_afterName_Semicolon(const char *) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Variable::On_afterName_Comma(const char *) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Variable::On_afterName_Assign(const char *) +{ + pSpuInitExpression->Push(done); +} + +void +PE_Variable::On_afterSize_ArrayBracket_Right(const char *) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterName); +} + +void +PE_Variable::On_expectFinish_Semicolon(const char *) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Variable::On_expectFinish_Comma(const char *) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Variable::On_expectFinish_Bracket_Right(const char *) +{ + SetTokenResult(not_done, pop_success); +} + + +} // namespace cpp + + + + diff --git a/autodoc/source/parser/cpp/pe_vari.hxx b/autodoc/source/parser/cpp/pe_vari.hxx new file mode 100644 index 000000000000..42896e5fa418 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_vari.hxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_vari.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_PE_VARI_HXX +#define ADC_CPP_PE_VARI_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> +#include <ary/cpp/c_types4cpp.hxx> +#include <ary/cpp/c_vfflag.hxx> + // PARAMETERS + + +namespace cpp { + +class PE_Expression; + + +class PE_Variable : public Cpp_PE +{ + public: + enum E_State + { + afterName, // + afterSize, // after ] + expectFinish, // after InitExpression + size_of_states + }; + PE_Variable( + Cpp_PE * i_pParent ); + ~PE_Variable(); + + /** @return + Bit 0x0001 != 0, if there is a size and + bit 0x0002 != 0, if there is an initialisation. + */ + UINT16 Result_Pattern() const; + const String & Result_SizeExpression() const; + const String & Result_InitExpression() const; + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + private: + typedef SubPe< PE_Variable, PE_Expression > SP_Expression; + typedef SubPeUse< PE_Variable, PE_Expression> SPU_Expression; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError(const char *); + + void SpReturn_ArraySizeExpression(); + void SpReturn_InitExpression(); + + void On_afterName_ArrayBracket_Left(const char * i_sText); + void On_afterName_Semicolon(const char * i_sText); + void On_afterName_Comma(const char * i_sText); + void On_afterName_Assign(const char * i_sText); + + void On_afterSize_ArrayBracket_Right(const char * i_sText); + + void On_expectFinish_Semicolon(const char * i_sText); + void On_expectFinish_Comma(const char * i_sText); + void On_expectFinish_Bracket_Right(const char * i_sText); + + // DATA + Dyn< PeStatusArray<PE_Variable> > + pStati; + + Dyn<SP_Expression> pSpExpression; + Dyn<SPU_Expression> pSpuArraySizeExpression; + Dyn<SPU_Expression> pSpuInitExpression; + + String sResultSizeExpression; + String sResultInitExpression; +}; + + + +// IMPLEMENTATION + + +inline UINT16 +PE_Variable::Result_Pattern() const + { return ( sResultSizeExpression.length() > 0 ? 1 : 0 ) + + ( sResultInitExpression.length() > 0 ? 2 : 0 ); } +inline const String & +PE_Variable::Result_SizeExpression() const + { return sResultSizeExpression; } +inline const String & +PE_Variable::Result_InitExpression() const + { return sResultInitExpression; } + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/pev.hxx b/autodoc/source/parser/cpp/pev.hxx new file mode 100644 index 000000000000..c97db44503da --- /dev/null +++ b/autodoc/source/parser/cpp/pev.hxx @@ -0,0 +1,307 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pev.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_CPP_PEV_HXX +#define ADC_CPP_PEV_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <tokens/tokproct.hxx> + // COMPONENTS + // PARAMETERS +#include <ary/cpp/c_types4cpp.hxx> + +namespace ary +{ + namespace cpp + { + class Gate; + class InputContext; + + class Namespace; + class Class; + class Enum; + class Typedef; + class Function; + class Variable; + class EnumValue; + + class DefineEntity; + } + + class Documentation; +} + + +namespace cpp +{ + + +class PeEnvironment : protected TokenProcessing_Types +{ + public: + // INQUIRY + virtual ~PeEnvironment() {} + + // OPERATIONS + // Token results + void SetTokenResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + ParseEnvironment * i_pParseEnv2Push = 0 ); + + // Owner stack + void OpenNamespace( + ary::cpp::Namespace & + io_rOpenedNamespace ); + void OpenExternC( + bool i_bOnlyForOneDeclaration = false ); + void OpenClass( + ary::cpp::Class & io_rOpenedClass ); + void OpenEnum( + ary::cpp::Enum & io_rOpenedEnum ); + void CloseBlock(); /// Handles a '}' on file scope. + void CloseClass(); + void CloseEnum(); + void SetCurProtection( /// Handles 'public:', 'protected:' and 'private:' on class scope. + ary::cpp::E_Protection + i_eProtection ); + void OpenTemplate( + const StringVector & + i_rParameters ); + /// Removes parameters from this object. + DYN StringVector * Get_CurTemplateParameters(); + /// Checks, if a template is still open, and if yes, closes it. + void Close_OpenTemplate(); + + // Special events + void Event_Class_FinishedBase( + const String & i_sParameterName ); + + void Event_Store_Typedef( + ary::cpp::Typedef & io_rTypedef ); + void Event_Store_EnumValue( + ary::cpp::EnumValue & + io_rEnumValue ); + void Event_Store_CppDefinition( + ary::cpp::DefineEntity & + io_rDefinition ); + + void Event_EnterFunction_ParameterList(); + void Event_Function_FinishedParameter( + const String & i_sParameterName ); + void Event_LeaveFunction_ParameterList(); + void Event_EnterFunction_Implementation(); + void Event_LeaveFunction_Implementation(); + + void Event_Store_Function( + ary::cpp::Function & + io_rFunction ); + void Event_Store_Variable( + ary::cpp::Variable & + io_rVariable ); + // Error recovery + void StartWaitingFor_Recovery(); + + // INQUIRY + ary::cpp::Gate & AryGate() const; + const ary::cpp::InputContext & + Context() const; + String CurFileName() const; + uintt LineCount() const; + bool IsWaitingFor_Recovery() const; + bool IsExternC() const; + + private: + virtual void do_SetTokenResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + ParseEnvironment * i_pParseEnv2Push ) = 0; + virtual void do_OpenNamespace( + ary::cpp::Namespace & + io_rOpenedNamespace ) = 0; + virtual void do_OpenExternC( + bool i_bOnlyForOneDeclaration ) = 0; + virtual void do_OpenClass( + ary::cpp::Class & io_rOpenedClass ) = 0; + virtual void do_OpenEnum( + ary::cpp::Enum & io_rOpenedEnum ) = 0; + virtual void do_CloseBlock() = 0; + virtual void do_CloseClass() = 0; + virtual void do_CloseEnum() = 0; + virtual void do_SetCurProtection( + ary::cpp::E_Protection + i_eProtection ) = 0; + virtual void do_OpenTemplate( + const StringVector & + i_rParameters ) = 0; + virtual DYN StringVector * + do_Get_CurTemplateParameters() = 0; + virtual void do_Close_OpenTemplate() = 0; + virtual void do_Event_Class_FinishedBase( + const String & i_sBaseName ) = 0; + + virtual void do_Event_Store_Typedef( + ary::cpp::Typedef & io_rTypedef ) = 0; + virtual void do_Event_Store_EnumValue( + ary::cpp::EnumValue & + io_rEnumValue ) = 0; + virtual void do_Event_Store_CppDefinition( + ary::cpp::DefineEntity & + io_rDefinition ) = 0; + virtual void do_Event_EnterFunction_ParameterList() = 0; + virtual void do_Event_Function_FinishedParameter( + const String & i_sParameterName ) = 0; + virtual void do_Event_LeaveFunction_ParameterList() = 0; + virtual void do_Event_EnterFunction_Implementation() = 0; + virtual void do_Event_LeaveFunction_Implementation() = 0; + virtual void do_Event_Store_Function( + ary::cpp::Function & + io_rFunction ) = 0; + virtual void do_Event_Store_Variable( + ary::cpp::Variable & + io_rVariable ) = 0; + virtual void do_StartWaitingFor_Recovery() = 0; + virtual ary::cpp::Gate & + inq_AryGate() const = 0; + virtual const ary::cpp::InputContext & + inq_Context() const = 0; + virtual String inq_CurFileName() const = 0; + virtual uintt inq_LineCount() const = 0; + virtual bool inq_IsWaitingFor_Recovery() const = 0; + virtual bool inq_IsExternC() const = 0; +}; + + + +// IMPLEMENTATION + +inline void +PeEnvironment::SetTokenResult( E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + ParseEnvironment * i_pParseEnv2Push ) + { do_SetTokenResult(i_eDone, i_eWhat2DoWithEnvStack, i_pParseEnv2Push); } +inline void +PeEnvironment::OpenNamespace( ary::cpp::Namespace & io_rOpenedNamespace ) + { do_OpenNamespace(io_rOpenedNamespace); } +inline void +PeEnvironment::OpenExternC( bool i_bOnlyForOneDeclaration ) + { do_OpenExternC(i_bOnlyForOneDeclaration); } +inline void +PeEnvironment::OpenClass( ary::cpp::Class & io_rOpenedClass ) + { do_OpenClass(io_rOpenedClass); } +inline void +PeEnvironment::OpenEnum( ary::cpp::Enum & io_rOpenedEnum ) + { do_OpenEnum(io_rOpenedEnum); } +inline void +PeEnvironment::CloseBlock() + { do_CloseBlock(); } +inline void +PeEnvironment::CloseClass() + { do_CloseClass(); } +inline void +PeEnvironment::CloseEnum() + { do_CloseEnum(); } +inline void +PeEnvironment::SetCurProtection( ary::cpp::E_Protection i_eProtection ) + { do_SetCurProtection(i_eProtection); } +inline void +PeEnvironment::OpenTemplate( const StringVector & i_rParameters ) + { do_OpenTemplate(i_rParameters); } +inline DYN StringVector * +PeEnvironment::Get_CurTemplateParameters() + { return do_Get_CurTemplateParameters(); } +inline void +PeEnvironment::Close_OpenTemplate() + { do_Close_OpenTemplate(); } +inline void +PeEnvironment::Event_Class_FinishedBase( const String & i_sBaseName ) + { do_Event_Class_FinishedBase(i_sBaseName); } +inline void +PeEnvironment::Event_Store_Typedef( ary::cpp::Typedef & io_rTypedef ) + { do_Event_Store_Typedef(io_rTypedef); } +inline void +PeEnvironment::Event_Store_EnumValue( ary::cpp::EnumValue & io_rEnumValue ) + { do_Event_Store_EnumValue(io_rEnumValue); } +inline void +PeEnvironment::Event_Store_CppDefinition( ary::cpp::DefineEntity & io_rDefinition ) + { do_Event_Store_CppDefinition(io_rDefinition); } +inline void +PeEnvironment::Event_EnterFunction_ParameterList() + { do_Event_EnterFunction_ParameterList(); } +inline void +PeEnvironment::Event_Function_FinishedParameter( const String & i_sParameterName ) + { do_Event_Function_FinishedParameter(i_sParameterName); } +inline void +PeEnvironment::Event_LeaveFunction_ParameterList() + { do_Event_LeaveFunction_ParameterList(); } +inline void +PeEnvironment::Event_EnterFunction_Implementation() + { do_Event_EnterFunction_Implementation(); } +inline void +PeEnvironment::Event_LeaveFunction_Implementation() + { do_Event_LeaveFunction_Implementation(); } +inline void +PeEnvironment::Event_Store_Function( ary::cpp::Function & io_rFunction ) + { do_Event_Store_Function(io_rFunction); } +inline void +PeEnvironment::Event_Store_Variable( ary::cpp::Variable & io_rVariable ) + { do_Event_Store_Variable(io_rVariable); } +inline void +PeEnvironment::StartWaitingFor_Recovery() + { do_StartWaitingFor_Recovery(); } +inline ary::cpp::Gate & +PeEnvironment::AryGate() const + { return inq_AryGate(); } +inline const ary::cpp::InputContext & +PeEnvironment::Context() const + { return inq_Context(); } +inline String +PeEnvironment::CurFileName() const + { return inq_CurFileName(); } +inline uintt +PeEnvironment::LineCount() const + { return inq_LineCount(); } +inline bool +PeEnvironment::IsWaitingFor_Recovery() const + { return inq_IsWaitingFor_Recovery(); } +inline bool +PeEnvironment::IsExternC() const + { return inq_IsExternC(); } + + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/preproc.cxx b/autodoc/source/parser/cpp/preproc.cxx new file mode 100644 index 000000000000..4643551481be --- /dev/null +++ b/autodoc/source/parser/cpp/preproc.cxx @@ -0,0 +1,234 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: preproc.cxx,v $ + * $Revision: 1.9 $ + * + * 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 "preproc.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include "all_toks.hxx" +#include "defdescr.hxx" +#include <tools/tkpchars.hxx> +#include "c_rcode.hxx" + + +namespace cpp +{ + + +PreProcessor::F_TOKENPROC PreProcessor::aTokProcs[PreProcessor::state_MAX] = + { + &PreProcessor::On_plain, + &PreProcessor::On_expect_macro_bracket_left, + &PreProcessor::On_expect_macro_param + }; + + +PreProcessor::PreProcessor() + : pCppExplorer(0), + pSourceText(0), + pCurValidDefines(0), + // aTokens, + eState(plain), + pCurMacro(0), + dpCurMacroName(0), + // aCurMacroParams, + aCurParamText(60000), + nBracketInParameterCounter(0) + // aBlockedMacroNames +{ +} + +PreProcessor::~PreProcessor() +{ +} + +void +PreProcessor::AssignPartners( CodeExplorer & o_rCodeExplorer, + CharacterSource & o_rCharSource, + const MacroMap & i_rCurValidDefines ) +{ + pCppExplorer = &o_rCodeExplorer; + pSourceText = &o_rCharSource; + pCurValidDefines = &i_rCurValidDefines; +} + +void +PreProcessor::Process_Token( cpp::Token & let_drToken ) +{ + csv_assert(pCppExplorer != 0); // Implies pSourceText and pCurValidDefines. + + (this->*aTokProcs[eState])(let_drToken); +} + +void +PreProcessor::On_plain( cpp::Token & let_drToken ) +{ + if ( let_drToken.TypeId() == Tid_Identifier ) + { + if (CheckForDefine(let_drToken)) + return; + } + + pCppExplorer->Process_Token(let_drToken); +} + +void +PreProcessor::On_expect_macro_bracket_left( cpp::Token & let_drToken ) +{ + if ( let_drToken.TypeId() == Tid_Bracket_Left ) + { + aCurParamText.seekp(0); + eState = expect_macro_param; + } + else + { + pCppExplorer->Process_Token(*dpCurMacroName); + dpCurMacroName = 0; + pCppExplorer->Process_Token(let_drToken); + eState = plain; + } +} + +void +PreProcessor::On_expect_macro_param( cpp::Token & let_drToken ) +{ + if ( let_drToken.TypeId() == Tid_Bracket_Left ) + nBracketInParameterCounter++; + else if ( let_drToken.TypeId() == Tid_Bracket_Right ) + { + if ( nBracketInParameterCounter > 0 ) + nBracketInParameterCounter--; + else + { + if ( NOT csv::no_str(aCurParamText.c_str()) ) + { + aCurMacroParams.push_back( String(aCurParamText.c_str()) ); + } + csv_assert( aCurMacroParams.size() == pCurMacro->ParamCount() ); + + InterpretMacro(); + eState = plain; + return; + } + } + else if ( let_drToken.TypeId() == Tid_Comma AND nBracketInParameterCounter == 0 ) + { + aCurMacroParams.push_back( String (aCurParamText.c_str()) ); + aCurParamText.seekp(0); + return; + } + + // KORR_FUTURE: + // If in future whitespace is parsed also, that should match exactly and the + // safety spaces, " ", here should be removed. + aCurParamText << let_drToken.Text() << " "; +} + +bool +PreProcessor::CheckForDefine( cpp::Token & let_drToken ) +{ + String sTokenText(let_drToken.Text()); + pCurMacro = csv::value_from_map( *pCurValidDefines, sTokenText ); + if (pCurMacro == 0 ) + return false; + for ( StringVector::const_iterator it = aBlockedMacroNames.begin(); + it != aBlockedMacroNames.end(); + ++it ) + { + if ( strcmp( (*it).c_str(), let_drToken.Text() ) == 0 ) + return false; + } + + if ( pCurMacro->DefineType() == DefineDescription::type_define ) + { + delete &let_drToken; + + aCurParamText.seekp(0); + pCurMacro->GetDefineText(aCurParamText); + + if ( aCurParamText.tellp() > 1 ) + pSourceText->InsertTextAtCurPos(aCurParamText.c_str()); + } + else // ( pCurMacro->DefineType() == DefineDescription::type_macro ) + { + dpCurMacroName = &let_drToken; + eState = expect_macro_bracket_left; + csv::erase_container( aCurMacroParams ); + aCurParamText.seekp(0); + nBracketInParameterCounter = 0; + } // endif + + return true; +} + +void +PreProcessor::UnblockMacro( const char * i_sMacroName ) +{ + for ( StringVector::iterator it = aBlockedMacroNames.begin(); + it != aBlockedMacroNames.end(); + ++it ) + { + if ( strcmp( (*it), i_sMacroName ) == 0 ) + { + aBlockedMacroNames.erase(it); + break; + } + } /// end for +} + +void +PreProcessor::InterpretMacro() +{ + aCurParamText.seekp(0); + pCurMacro->GetMacroText(aCurParamText, aCurMacroParams); + + if ( NOT csv::no_str(aCurParamText.c_str()) ) + { + aCurParamText.seekp(-1, csv::cur); + aCurParamText << " #unblock-" << dpCurMacroName->Text() << " "; + + pSourceText->InsertTextAtCurPos(aCurParamText.c_str()); + String sCurMacroName(dpCurMacroName->Text()); + aBlockedMacroNames.insert( aBlockedMacroNames.begin(), sCurMacroName ); + } + + delete dpCurMacroName; + dpCurMacroName = 0; + pCurMacro = 0; + csv::erase_container(aCurMacroParams); + aCurParamText.seekp(0); +} + + +} // end namespace cpp + + diff --git a/autodoc/source/parser/cpp/preproc.hxx b/autodoc/source/parser/cpp/preproc.hxx new file mode 100644 index 000000000000..618c9dba4693 --- /dev/null +++ b/autodoc/source/parser/cpp/preproc.hxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: preproc.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_PREPROC_HXX +#define ADC_CPP_PREPROC_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <deque> + // PARAMETERS + +class CharacterSource; + + +namespace cpp +{ + +class Token; +class CodeExplorer; +class DefineDescription; + + +class PreProcessor +{ + public: + typedef std::map< String, DefineDescription* > MacroMap; + + // LIFECYCLE + PreProcessor(); + ~PreProcessor(); + // OPERATONS + void AssignPartners( + CodeExplorer & o_rCodeExplorer, + CharacterSource & o_rCharSource, + const MacroMap & i_rCurValidDefines ); + void Process_Token( + cpp::Token & let_drToken ); + void UnblockMacro( + const char * i_sMacroName ); + private: + public: // Necessary for instantiation of static variable: + enum E_State + { + plain = 0, + expect_macro_bracket_left, + expect_macro_param, + state_MAX + }; + typedef void (PreProcessor::* F_TOKENPROC )(cpp::Token &); + void On_plain( cpp::Token & ); + void On_expect_macro_bracket_left( cpp::Token & ); + void On_expect_macro_param( cpp::Token & ); + + private: // Reprivate again: + typedef std::deque< DYN cpp::Token * > TokenQueue; + typedef StringVector List_MacroParams; + + + bool CheckForDefine( + cpp::Token & let_drToken ); + void InterpretMacro(); + + // DATA + static F_TOKENPROC aTokProcs[state_MAX]; + // Referenced extern objects + CodeExplorer * pCppExplorer; + CharacterSource * pSourceText; + const MacroMap * pCurValidDefines; + + // internal data + TokenQueue aTokens; + + E_State eState; + + DefineDescription * pCurMacro; + DYN Token * dpCurMacroName; + List_MacroParams aCurMacroParams; + csv::StreamStr aCurParamText; + + intt nBracketInParameterCounter; + StringVector aBlockedMacroNames; +}; + + + +} // end namespace cpp + +#endif + diff --git a/autodoc/source/parser/cpp/prs_cpp.cxx b/autodoc/source/parser/cpp/prs_cpp.cxx new file mode 100644 index 000000000000..92ada96328b2 --- /dev/null +++ b/autodoc/source/parser/cpp/prs_cpp.cxx @@ -0,0 +1,251 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: prs_cpp.cxx,v $ + * $Revision: 1.7 $ + * + * 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 <cpp/prs_cpp.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <cosv/file.hxx> +#include <ary/ary.hxx> +#include <ary/cpp/c_gate.hxx> +#include <autodoc/prs_docu.hxx> +#include <autodoc/filecoli.hxx> +#include <autodoc/x_parsing.hxx> +#include <tools/tkpchars.hxx> +#include <adc_cl.hxx> +#include "c_dealer.hxx" +#include "defdescr.hxx" +#include "tkp_cpp.hxx" + + +// Helper function +static bool Local_LoadFile( + CharacterSource & o_rTextBuffer, + const String & i_rFullFilePath ); + + + + +namespace cpp +{ + +// This class is used for the UDK as workaround for the missing +// feature of parsing #define s. + +class Udk_MacroMap +{ + public: + typedef std::map< String , DefineDescription* > Data; + + Udk_MacroMap(); + ~Udk_MacroMap(); + + const Data & GetData() const { return aData; } + + private: + Data aData; +}; + +struct S_RunningData +{ + CharacterSource aFileContent; + ary::cpp::Gate & rCppGate; + Udk_MacroMap aMacros; + Distributor aDealer; + TokenParser_Cpp aTkp; + + S_RunningData( + ary::Repository & o_rRepository, + const autodoc::DocumentationParser_Ifc & + i_rDocumentationInterpreter ); +}; + + + + +Cpluplus_Parser::Cpluplus_Parser() +// : pRunningData +{ +} + +Cpluplus_Parser::~Cpluplus_Parser() +{ +} + +void +Cpluplus_Parser::Setup( ary::Repository & o_rRepository, + const autodoc::DocumentationParser_Ifc & i_rDocumentationInterpreter ) +{ + pRunningData = new S_RunningData(o_rRepository, i_rDocumentationInterpreter); +} + +void +Cpluplus_Parser::Run( const autodoc::FileCollector_Ifc & i_rFiles ) +{ + for ( autodoc::FileCollector_Ifc::const_iterator iter = i_rFiles.Begin(); + iter != i_rFiles.End(); + ++iter ) + { + csv::ploc::Path + aFilePath(*iter); + + try + { + if ( NOT Local_LoadFile(pRunningData->aFileContent, *iter) ) + continue; + for ( pRunningData->aTkp.StartNewFile(aFilePath); + pRunningData->aTkp.HasMore(); + pRunningData->aTkp.GetNextToken() ) + ; + } + catch (autodoc::X_Parser_Ifc & rX_Parse) + { + if ( DEBUG_ShowStoring() OR DEBUG_ShowText() ) + Cerr() << rX_Parse << Endl(); + } + catch (...) + { + if ( DEBUG_ShowStoring() OR DEBUG_ShowText() ) + Cerr() << "Error: Unknown exception." << Endl(); + } + } // end for (iter) +} + +S_RunningData::S_RunningData( ary::Repository & o_rRepository, + const autodoc::DocumentationParser_Ifc & i_rDocumentationInterpreter ) + : aFileContent(), + rCppGate( o_rRepository.Gate_Cpp() ), + aMacros(), + aDealer(o_rRepository.Gate_Cpp()), + aTkp( * i_rDocumentationInterpreter.Create_DocuContext() ) +{ + aDealer.AssignPartners( aFileContent, + aMacros.GetData() ); + aTkp.AssignPartners( aFileContent, aDealer ); +} + + +Udk_MacroMap::Udk_MacroMap() +{ + String sSAL_CALL("SAL_CALL"); + String sSAL_CALL_ELLIPSE("SAL_CALL_ELLIPSE"); + String sSAL_NO_VTABLE("SAL_NO_VTABLE"); + String sREGISTRY_CALLTYPE("REGISTRY_CALLTYPE"); + String sSAL_THROW("SAL_THROW"); + String sSAL_THROW_EXTERN_C("SAL_THROW_EXTERN_C"); + + String s__DEF_COMPIMPLHELPER_A("__DEF_COMPIMPLHELPER_A"); + String s__DEF_COMPIMPLHELPER_B("__DEF_COMPIMPLHELPER_B"); + String s__DEF_COMPIMPLHELPER("__DEF_COMPIMPLHELPER"); + + String s__DEF_IMPLHELPER_PRE("__DEF_IMPLHELPER_PRE"); + String s__IFC_WRITEOFFSET("__IFC_WRITEOFFSET"); + String s__DEF_IMPLHELPER_POST("__DEF_IMPLHELPER_POST"); + + String sSAL_EXCEPTION_DLLPUBLIC_EXPORT("SAL_EXCEPTION_DLLPUBLIC_EXPORT"); + String sSAL_EXCEPTION_DLLPRIVATE("SAL_EXCEPTION_DLLPRIVATE"); + + + StringVector aEmpty; + + StringVector aParamsSAL_THROW; + aParamsSAL_THROW.push_back( String ("exc") ); + StringVector aDefSAL_THROW; + aDefSAL_THROW.push_back( String ("throw") ); + aDefSAL_THROW.push_back( String ("exc") ); + + StringVector aCompImplHelperParams; + aCompImplHelperParams.push_back(String ("N")); + + + // filling up the list + + + aData[sSAL_CALL] = new DefineDescription(sSAL_CALL, aEmpty); + aData[sSAL_CALL_ELLIPSE] = new DefineDescription(sSAL_CALL_ELLIPSE, aEmpty); + aData[sSAL_NO_VTABLE] = new DefineDescription(sSAL_NO_VTABLE, aEmpty); + aData[sREGISTRY_CALLTYPE] = new DefineDescription(sREGISTRY_CALLTYPE, aEmpty); + + aData[sSAL_THROW] = new DefineDescription(sSAL_THROW, aParamsSAL_THROW, aDefSAL_THROW); + aData[sSAL_THROW_EXTERN_C] = new DefineDescription(sSAL_THROW_EXTERN_C, aEmpty, aEmpty); + + aData[s__DEF_COMPIMPLHELPER_A] + = new DefineDescription( s__DEF_COMPIMPLHELPER_A, aCompImplHelperParams, aEmpty); + aData[s__DEF_COMPIMPLHELPER_B] + = new DefineDescription(s__DEF_COMPIMPLHELPER_B, aCompImplHelperParams, aEmpty); + aData[s__DEF_COMPIMPLHELPER] + = new DefineDescription(s__DEF_COMPIMPLHELPER, aCompImplHelperParams, aEmpty); + + aData[s__DEF_IMPLHELPER_PRE] + = new DefineDescription(s__DEF_IMPLHELPER_PRE, aCompImplHelperParams, aEmpty); + aData[s__IFC_WRITEOFFSET] + = new DefineDescription(s__IFC_WRITEOFFSET, aCompImplHelperParams, aEmpty); + aData[s__DEF_IMPLHELPER_POST] + = new DefineDescription(s__DEF_IMPLHELPER_POST, aCompImplHelperParams, aEmpty); + + aData[sSAL_EXCEPTION_DLLPUBLIC_EXPORT] + = new DefineDescription(sSAL_EXCEPTION_DLLPUBLIC_EXPORT, aEmpty); + aData[sSAL_EXCEPTION_DLLPRIVATE] + = new DefineDescription(sSAL_EXCEPTION_DLLPRIVATE, aEmpty); +} + +Udk_MacroMap::~Udk_MacroMap() +{ + for ( Data::iterator it = aData.begin(); it != aData.end(); ++it ) + { + delete (*it).second; + } +} + + + +} // namespace cpp + + +bool +Local_LoadFile( CharacterSource & o_rTextBuffer, + const String & i_rFullFilePath ) +{ + Cout() << "Parse " << i_rFullFilePath << " ..." << Endl(); + + csv::File aFile( i_rFullFilePath, csv::CFM_READ ); + if (NOT aFile.open()) + { + Cerr() << " could not be opened.\n" << Endl(); + return false; + } + o_rTextBuffer.LoadText(aFile); + aFile.close(); + return true; +} + + + diff --git a/autodoc/source/parser/cpp/sdocdist.hxx b/autodoc/source/parser/cpp/sdocdist.hxx new file mode 100644 index 000000000000..55295297740d --- /dev/null +++ b/autodoc/source/parser/cpp/sdocdist.hxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdocdist.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_SDOCDIST_HXX +#define ADC_CPP_SDOCDIST_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cxt2ary.hxx" +#include <ary/info/docstore.hxx> + // COMPONENTS + // PARAMETERS + +namespace cpp +{ + +using ary::Documentation; + +/** Implementation struct for cpp::ContextForAry. +*/ + +struct ContextForAry::S_DocuDistributor : public ary::info::DocuStore +{ + public: + S_DocuDistributor() : pCurRe(0) {} + ~S_DocuDistributor() {} + + void Reset() { pCurRe = 0; pLastStoredDocu = 0; } + + void SetCurrentlyStoredRe( + ary::cpp::CppEntity & + io_rRe ); + void Event_LineBreak(); + + private: + // Interface ary::info::DocuStore + virtual void do_Store2CurFile( + DYN ary::doc::Node& let_drDocu ); + virtual void do_Store2CurNamespace( + DYN ary::doc::Node& let_drDocu ); + + virtual void do_Store2ConnectedDeclaration( + DYN ary::doc::Node& let_drDocu ); + + virtual void do_Store2Glossary( + DYN ary::doc::Node& let_drDocu, + const String & i_sExplainedTerm ); + virtual void do_Store2GlobalTexts( + DYN ary::doc::Node& let_drDocu, + ary::info::GlobalTextId + i_nId ); + // DATA + ary::cpp::CppEntity * + pCurRe; + Dyn<ary::doc::Node> pLastStoredDocu; +}; + + +// IMPLEMENTATION + +/* The implementation is in header, though not all inline, because this file + is included in cxt2ary.cxx only! +*/ + + +void +ContextForAry:: +S_DocuDistributor::SetCurrentlyStoredRe( ary::cpp::CppEntity & io_rRe ) +{ + pCurRe = &io_rRe; + if ( pLastStoredDocu ) + pCurRe->Set_Docu( *pLastStoredDocu.Release() ); +} + +inline void +ContextForAry:: +S_DocuDistributor::Event_LineBreak() +{ + pCurRe = 0; +} + +void +ContextForAry:: +S_DocuDistributor::do_Store2CurFile( DYN ary::doc::Node & let_drDocu ) +{ + // KORR_FUTURE + delete &let_drDocu; +} + +void +ContextForAry:: +S_DocuDistributor::do_Store2CurNamespace( DYN ary::doc::Node & let_drDocu ) +{ + // KORR_FUTURE + delete &let_drDocu; +} + +void +ContextForAry:: +S_DocuDistributor::do_Store2ConnectedDeclaration( DYN ary::doc::Node & let_drDocu ) +{ + if ( pCurRe != 0 ) + pCurRe->Set_Docu(let_drDocu); + else + pLastStoredDocu = &let_drDocu; +} + +void +ContextForAry:: +S_DocuDistributor::do_Store2Glossary( DYN ary::doc::Node & let_drDocu, + const String & // i_sExplainedTerm + ) +{ + // KORR_FUTURE + delete &let_drDocu; +} + +void +ContextForAry:: +S_DocuDistributor::do_Store2GlobalTexts( DYN ary::doc::Node & let_drDocu, + ary::info::GlobalTextId // i_nId + ) +{ + // KORR_FUTURE + delete &let_drDocu; +} + + + + +} // namespace cpp +#endif diff --git a/autodoc/source/parser/cpp/sfscope.hxx b/autodoc/source/parser/cpp/sfscope.hxx new file mode 100644 index 000000000000..cfca4ba203e1 --- /dev/null +++ b/autodoc/source/parser/cpp/sfscope.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sfscope.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_SFSCOPE_HXX +#define ADC_CPP_SFSCOPE_HXX + +// USED SERVICES +#include "cxt2ary.hxx" + + + + +namespace cpp +{ + + +/** Implementation struct for cpp::ContextForAry. +*/ +struct ContextForAry::S_FileScopeInfo +{ + ary::loc::File * pCurFile; + uintt nLineCount; + Dyn<StringVector> pCurTemplateParameters; + + S_FileScopeInfo(); +}; + + + + +// IMPLEMENTATION +inline +ContextForAry:: +S_FileScopeInfo::S_FileScopeInfo() + : pCurFile(0), + nLineCount(0), + pCurTemplateParameters(0) +{ +} + + + + +} // namespace cpp +#endif diff --git a/autodoc/source/parser/cpp/sownstck.hxx b/autodoc/source/parser/cpp/sownstck.hxx new file mode 100644 index 000000000000..ef5ccfc5d803 --- /dev/null +++ b/autodoc/source/parser/cpp/sownstck.hxx @@ -0,0 +1,328 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sownstck.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_CPP_SOWNSTCK_HXX +#define ADC_CPP_SOWNSTCK_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cxt2ary.hxx" + // COMPONENTS +#include <ary/cpp/c_types4cpp.hxx> +#include <estack.hxx> + // PARAMETERS +#include <ary/cpp/c_namesp.hxx> +#include <x_parse.hxx> + + +namespace cpp +{ + +using ary::cpp::E_Protection; + + +/** Implementation struct for cpp::ContextForAry. +*/ +struct ContextForAry::S_OwnerStack +{ + public: + S_OwnerStack(); + void SetGlobalNamespace( + ary::cpp::Namespace & + io_rGlobalNamespace ); + ~S_OwnerStack(); + + void Reset(); + + void OpenNamespace( + ary::cpp::Namespace & + io_rOpenedNamespace ); + void OpenExternC(); + void OpenClass( + ary::cpp::Class & io_rOpenedClass ); + void OpenEnum( + ary::cpp::Enum & io_rOpenedEnum ); + void CloseBlock(); + void CloseClass(); + void CloseEnum(); + void SetCurProtection( + ary::cpp::E_Protection + i_eProtection ); + ary::cpp::Namespace & + CurNamespace() const; + ary::cpp::Class * CurClass() const; + ary::cpp::Enum * CurEnum() const; + + Owner & CurOwner() const; + ary::cpp::E_Protection + CurProtection() const; + bool IsExternC() const { return nExternC > 0; } + + private: + typedef std::pair< ary::cpp::Class*, E_Protection > ClassEnv; + typedef EStack< ary::cpp::Namespace* > Stack_Namespaces; + typedef EStack< ClassEnv > Stack_Classes; + typedef ary::cpp::InputContext::Owner Ifc_Owner; + + void SetOwner_2CurNamespace(); + void SetOwner_2CurClass(); + void SetOwner_2None(); + + // DATA + Stack_Namespaces aStack_Namespaces; + Stack_Classes aStack_Classes; + ary::cpp::Enum * pCurEnum; + uintt nExternC; /// This is a number, for the case that extern "C" blocks are nested. + + Dyn<Owner_Namespace> + pOwner_Namespace; + Dyn<Owner_Class> pOwner_Class; + Ifc_Owner * pOwner_Cur; +}; + + +// IMPLEMENTATION + +/* The implementation is in header, though not inline, because this file is included + in cxt2ary.cxx only! +*/ + +inline ary::cpp::Namespace & +ContextForAry:: +S_OwnerStack::CurNamespace() const +{ + csv_assert( aStack_Namespaces.size() > 0 ); + return *aStack_Namespaces.top(); +} + +inline ary::cpp::Class * +ContextForAry:: +S_OwnerStack::CurClass() const +{ + return aStack_Classes.size() > 0 + ? aStack_Classes.top().first + : (ary::cpp::Class *) 0; +} + +inline void +ContextForAry:: +S_OwnerStack::SetOwner_2CurNamespace() +{ + csv_assert( aStack_Namespaces.size() > 0 ); + pOwner_Cur = pOwner_Namespace.MutablePtr(); + pOwner_Namespace->SetAnotherNamespace( CurNamespace() ); +} + +inline void +ContextForAry:: +S_OwnerStack::SetOwner_2CurClass() +{ + csv_assert( aStack_Classes.size() > 0 ); + pOwner_Cur = pOwner_Class.MutablePtr(); + pOwner_Class->SetAnotherClass( *CurClass() ); +} + +ContextForAry:: +S_OwnerStack::S_OwnerStack() + : // aStack_Namespaces, + // aStack_Classes, + pCurEnum(0), + nExternC(0), + pOwner_Namespace(new Owner_Namespace), + pOwner_Class(new Owner_Class), + pOwner_Cur(0) +{ +} + +void +ContextForAry:: +S_OwnerStack::Reset() +{ + while ( aStack_Namespaces.top()->Owner().IsValid() ) + aStack_Namespaces.pop(); + while ( NOT aStack_Classes.empty() ) + aStack_Classes.pop(); + pCurEnum = 0; + nExternC = 0; + SetOwner_2CurNamespace(); +} + +inline void +ContextForAry:: +S_OwnerStack::SetGlobalNamespace( ary::cpp::Namespace & io_rGlobalNamespace ) +{ + csv_assert( aStack_Namespaces.size() == 0 ); + aStack_Namespaces.push(&io_rGlobalNamespace); + SetOwner_2CurNamespace(); +} + +ContextForAry:: +S_OwnerStack::~S_OwnerStack() +{ +} + +inline void +ContextForAry:: +S_OwnerStack::OpenNamespace( ary::cpp::Namespace & io_rOpenedNamespace ) +{ + csv_assert( aStack_Namespaces.size() > 0 OR io_rOpenedNamespace.Parent() == 0 ); + aStack_Namespaces.push(&io_rOpenedNamespace); + SetOwner_2CurNamespace(); +} + +inline void +ContextForAry:: +S_OwnerStack::OpenExternC() +{ + ++nExternC; +// SetOwner_2None(); +} + +inline void +ContextForAry:: +S_OwnerStack::SetCurProtection( ary::cpp::E_Protection i_eProtection ) +{ + csv_assert( aStack_Classes.size() > 0 ); + aStack_Classes.top().second = i_eProtection; +} + +inline ary::cpp::Enum * +ContextForAry:: +S_OwnerStack::CurEnum() const +{ + return pCurEnum; +} + + +inline ary::cpp::InputContext::Owner & +ContextForAry:: +S_OwnerStack::CurOwner() const +{ + csv_assert( pOwner_Cur != 0 ); + return *pOwner_Cur; +} + +inline E_Protection +ContextForAry:: +S_OwnerStack::CurProtection() const +{ + return aStack_Classes.size() > 0 + ? aStack_Classes.top().second + : ary::cpp::PROTECT_global; +} + +inline void +ContextForAry:: +S_OwnerStack::SetOwner_2None() +{ + pOwner_Cur = 0; +} + +void +ContextForAry:: +S_OwnerStack::OpenClass( ary::cpp::Class & io_rOpenedClass ) +{ + E_Protection eDefaultProtection + = io_rOpenedClass.ClassKey() == ary::cpp::CK_class + ? ary::cpp::PROTECT_private + : ary::cpp::PROTECT_public; + aStack_Classes.push( ClassEnv(&io_rOpenedClass, eDefaultProtection) ); + SetOwner_2CurClass(); +} + +inline void +ContextForAry:: +S_OwnerStack::OpenEnum( ary::cpp::Enum & io_rOpenedEnum ) +{ + csv_assert( pCurEnum == 0 ); + pCurEnum = &io_rOpenedEnum; + SetOwner_2None(); +} + +void +ContextForAry:: +S_OwnerStack::CloseBlock() +{ + if (nExternC > 0) + { + --nExternC; + } + else + { + // csv_assert( aStack_Classes.size() == 0 ); + if ( aStack_Classes.size() > 0 ) + throw X_Parser(X_Parser::x_UnspecifiedSyntaxError, "", String::Null_(), 0); + + csv_assert( pCurEnum == 0 ); + aStack_Namespaces.pop(); + + // csv_assert( aStack_Namespaces.size() > 0 ); + if( aStack_Namespaces.size() == 0 ) + throw X_Parser(X_Parser::x_UnspecifiedSyntaxError, "", String::Null_(), 0); + + } + SetOwner_2CurNamespace(); +} + +void +ContextForAry:: +S_OwnerStack::CloseClass() +{ + // csv_assert( aStack_Classes.size() > 0 ); + if ( aStack_Classes.size() == 0 ) + throw X_Parser(X_Parser::x_UnspecifiedSyntaxError, "", String::Null_(), 0); + + aStack_Classes.pop(); + if ( aStack_Classes.size() > 0 ) + SetOwner_2CurClass(); + else + SetOwner_2CurNamespace(); +} + +void +ContextForAry:: +S_OwnerStack::CloseEnum() +{ + csv_assert( pCurEnum != 0 ); + pCurEnum = 0; + if ( aStack_Classes.size() > 0 ) + SetOwner_2CurClass(); + else + SetOwner_2CurNamespace(); +} + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/srecover.hxx b/autodoc/source/parser/cpp/srecover.hxx new file mode 100644 index 000000000000..f8f754fd9487 --- /dev/null +++ b/autodoc/source/parser/cpp/srecover.hxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: srecover.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_CPP_SRECOVER_HXX +#define ADC_CPP_SRECOVER_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cxt2ary.hxx" +#include <ary/info/docstore.hxx> + // COMPONENTS + // PARAMETERS + +namespace cpp +{ + +/** Implementation struct for cpp::ContextForAry. +*/ +struct ContextForAry::S_RecoveryGuard +{ + public: + S_RecoveryGuard(); + ~S_RecoveryGuard(); + + void Reset() { bIsWithinRecovery = false; nBlockBracketsCounter = 0; } + + void StartWaitingFor_Recovery(); + + void Hdl_SwBracketOpen(); + void Hdl_SwBracketClose(); + void Hdl_Semicolon(); + + bool IsWithinRecovery() const; + + private: + // DATA + bool bIsWithinRecovery; + intt nBlockBracketsCounter; +}; + + + +// IMPLEMENTATION + +/* The implementation is in header, though not all inline, because this file + is included in cxt2ary.cxx only! +*/ + +ContextForAry:: +S_RecoveryGuard::S_RecoveryGuard() + : bIsWithinRecovery(false), + nBlockBracketsCounter(0) +{ +} + +ContextForAry:: +S_RecoveryGuard::~S_RecoveryGuard() +{ +} + +inline void +ContextForAry:: +S_RecoveryGuard::StartWaitingFor_Recovery() +{ + bIsWithinRecovery = true; + nBlockBracketsCounter = 0; +} + +void +ContextForAry:: +S_RecoveryGuard::Hdl_SwBracketOpen() +{ + if ( bIsWithinRecovery ) + ++nBlockBracketsCounter; +} + +void +ContextForAry:: +S_RecoveryGuard::Hdl_SwBracketClose() +{ + if ( bIsWithinRecovery ) + --nBlockBracketsCounter; +} + +inline void +ContextForAry:: +S_RecoveryGuard::Hdl_Semicolon() +{ + if (bIsWithinRecovery AND nBlockBracketsCounter == 0) + bIsWithinRecovery = false; +} + +inline bool +ContextForAry:: +S_RecoveryGuard::IsWithinRecovery() const +{ + return bIsWithinRecovery; +} + + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/tkp_cpp.cxx b/autodoc/source/parser/cpp/tkp_cpp.cxx new file mode 100644 index 000000000000..7cf6271c80f8 --- /dev/null +++ b/autodoc/source/parser/cpp/tkp_cpp.cxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkp_cpp.cxx,v $ + * $Revision: 1.6 $ + * + * 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 "tkp_cpp.hxx" + +// NOT FULLY DECLARED SERVICES +#include "cx_c_std.hxx" +#include "c_dealer.hxx" + + +namespace cpp { + + + + +TokenParser_Cpp::TokenParser_Cpp( DYN autodoc::TkpDocuContext & let_drDocuContext ) + : pBaseContext( new Context_CppStd( let_drDocuContext ) ), + pCurContext(0), + pDealer(0), + pCharacterSource(0) +{ + SetStartContext(); +} + +TokenParser_Cpp::~TokenParser_Cpp() +{ +} + +void +TokenParser_Cpp::AssignPartners( CharacterSource & io_rCharacterSource, + cpp::Distributor & o_rDealer ) +{ + pDealer = &o_rDealer; + pBaseContext->AssignDealer(o_rDealer); + pCharacterSource = &io_rCharacterSource; +} + +void +TokenParser_Cpp::StartNewFile( const csv::ploc::Path & i_file ) +{ + csv_assert(pDealer != 0); + pDealer->StartNewFile(i_file); + + csv_assert(pCharacterSource != 0); + Start(*pCharacterSource); +} + +void +TokenParser_Cpp::SetStartContext() +{ + pCurContext = pBaseContext.Ptr(); +} + +void +TokenParser_Cpp::SetCurrentContext( TkpContext & io_rContext ) +{ + pCurContext = &io_rContext; +} + +TkpContext & +TokenParser_Cpp::CurrentContext() +{ + return *pCurContext; +} + +} // namespace cpp + diff --git a/autodoc/source/parser/cpp/tkp_cpp.hxx b/autodoc/source/parser/cpp/tkp_cpp.hxx new file mode 100644 index 000000000000..82e3f89fd025 --- /dev/null +++ b/autodoc/source/parser/cpp/tkp_cpp.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkp_cpp.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_TKP_CPP_HXX +#define ADC_TKP_CPP_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkp.hxx> + // COMPONENTS + // PARAMETRS + +namespace autodoc +{ + class TkpDocuContext; +} + +namespace csv +{ + namespace ploc + { + class Path; + class DirectoryChain; + } +} + + +namespace cpp { + +class Context_CppStd; +class DefineDescription; +class Distributor; + + +/** This is a TokenParser which is able to parse tokens from + C++ source code. +*/ +class TokenParser_Cpp : public TokenParser +{ + public: + typedef std::map< String, DefineDescription* > MacroMap; + + // LIFECYCLE + TokenParser_Cpp( + DYN autodoc::TkpDocuContext & + let_drDocuContext ); + virtual ~TokenParser_Cpp(); + + // OPERATIONS + void AssignPartners( + CharacterSource & io_rCharacterSource, + cpp::Distributor & o_rDealer ); + void StartNewFile( + const csv::ploc::Path & + i_file ); + private: + virtual void SetStartContext(); + virtual void SetCurrentContext( + TkpContext & io_rContext ); + virtual TkpContext & + CurrentContext(); + // DATA + Dyn<Context_CppStd> pBaseContext; + TkpContext * pCurContext; + Distributor * pDealer; + CharacterSource * pCharacterSource; +}; + + +} // namespace cpp + + +#endif + + diff --git a/autodoc/source/parser/cpp/tokintpr.hxx b/autodoc/source/parser/cpp/tokintpr.hxx new file mode 100644 index 000000000000..a697cc75a6d0 --- /dev/null +++ b/autodoc/source/parser/cpp/tokintpr.hxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tokintpr.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_TOKINTPR_HXX +#define ADC_CPP_TOKINTPR_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <all_toks.hxx> + // COMPONENTS + // PARAMETERS + +namespace cpp { + + + +#define DECL_TOK_HANDLER(token) \ + void Hdl_##token( \ + const Tok_##token & i_rTok ) { Call_Handler(i_rTok); } + +class TokenInterpreter +{ + public: + virtual ~TokenInterpreter() {} + + DECL_TOK_HANDLER(Identifier) + DECL_TOK_HANDLER(Operator) + DECL_TOK_HANDLER(operator) + DECL_TOK_HANDLER(class) + DECL_TOK_HANDLER(struct) + DECL_TOK_HANDLER(union) + DECL_TOK_HANDLER(enum) + DECL_TOK_HANDLER(typedef) + DECL_TOK_HANDLER(public) + DECL_TOK_HANDLER(protected) + DECL_TOK_HANDLER(private) + DECL_TOK_HANDLER(template) + DECL_TOK_HANDLER(virtual) + DECL_TOK_HANDLER(friend) + DECL_TOK_HANDLER(Tilde) + DECL_TOK_HANDLER(const) + DECL_TOK_HANDLER(volatile) + DECL_TOK_HANDLER(extern) + DECL_TOK_HANDLER(static) + DECL_TOK_HANDLER(mutable) + DECL_TOK_HANDLER(register) + DECL_TOK_HANDLER(inline) + DECL_TOK_HANDLER(explicit) + DECL_TOK_HANDLER(namespace) + DECL_TOK_HANDLER(using) + DECL_TOK_HANDLER(throw) + DECL_TOK_HANDLER(SwBracket_Left) + DECL_TOK_HANDLER(SwBracket_Right) + DECL_TOK_HANDLER(ArrayBracket_Left) + DECL_TOK_HANDLER(ArrayBracket_Right) + DECL_TOK_HANDLER(Bracket_Left) + DECL_TOK_HANDLER(Bracket_Right) + DECL_TOK_HANDLER(DoubleColon) + DECL_TOK_HANDLER(Semicolon) + DECL_TOK_HANDLER(Comma) + DECL_TOK_HANDLER(Colon) + DECL_TOK_HANDLER(Assign) + DECL_TOK_HANDLER(Less) + DECL_TOK_HANDLER(Greater) + DECL_TOK_HANDLER(Asterix) + DECL_TOK_HANDLER(AmpersAnd) + DECL_TOK_HANDLER(Ellipse) + DECL_TOK_HANDLER(typename) + DECL_TOK_HANDLER(DefineName) + DECL_TOK_HANDLER(MacroName) + DECL_TOK_HANDLER(MacroParameter) + DECL_TOK_HANDLER(PreProDefinition) + DECL_TOK_HANDLER(BuiltInType) + DECL_TOK_HANDLER(TypeSpecializer) + DECL_TOK_HANDLER(Constant) + + protected: + virtual void Call_Handler( + const cpp::Token & i_rTok ) = 0; +}; + +#undef DECL_TOK_HANDLER + + +// IMPLEMENTATION + + +} // namespace cpp + + +#endif diff --git a/autodoc/source/parser/inc/adoc/a_rdocu.hxx b/autodoc/source/parser/inc/adoc/a_rdocu.hxx new file mode 100644 index 000000000000..32265a2c564d --- /dev/null +++ b/autodoc/source/parser/inc/adoc/a_rdocu.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: a_rdocu.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_ADOC_A_RDOCU_HXX +#define ADC_ADOC_A_RDOCU_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + +class DocuDealer; + + + +namespace adoc +{ + +class Token; +class Adoc_PE; + +class DocuExplorer + +{ + public: + DocuExplorer(); + ~DocuExplorer(); + void StartNewFile( + DocuDealer & o_rDocuDistributor ); + + void Process_Token( + DYN adoc::Token & let_drToken ); + private: + DocuDealer * pDocuDistributor; + Dyn<Adoc_PE> pPE; + bool bIsPassedFirstDocu; +}; + + +} // namespace adoc + + +#endif + + diff --git a/autodoc/source/parser/inc/adoc/adoc_tok.hxx b/autodoc/source/parser/inc/adoc/adoc_tok.hxx new file mode 100644 index 000000000000..77b53cb1cce2 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/adoc_tok.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adoc_tok.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_ADOC_ADOC_TOK_HXX +#define ADC_ADOC_ADOC_TOK_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/token.hxx> + // COMPONENTS + // PARAMETERS + + +namespace adoc { + + +class TokenInterpreter; + + +class Token : public TextToken +{ + public: + // LIFECYCLE + virtual ~Token() {} + + // OPERATIONS + virtual void DealOut( + ::TokenDealer & o_rDealer ); + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const = 0; +}; + + +} // namespace adoc + +#endif + + diff --git a/autodoc/source/parser/inc/adoc/atokdeal.hxx b/autodoc/source/parser/inc/adoc/atokdeal.hxx new file mode 100644 index 000000000000..2b3ca53a3a8d --- /dev/null +++ b/autodoc/source/parser/inc/adoc/atokdeal.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: atokdeal.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_ADOC_ATOKDEAL_HXX +#define ADC_ADOC_ATOKDEAL_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <tokens/tokdeal.hxx> + // COMPONENTS + // PARAMETERS + + + +namespace adoc +{ + +class Token; + +class TokenDealer : virtual public ::TokenDealer +{ + public: + + virtual void Deal_AdcDocu( + adoc::Token & let_drToken ) = 0; +}; + + +} // namespace adoc + + + +#endif + diff --git a/autodoc/source/parser/inc/adoc/cx_a_std.hxx b/autodoc/source/parser/inc/adoc/cx_a_std.hxx new file mode 100644 index 000000000000..189cc3f2321e --- /dev/null +++ b/autodoc/source/parser/inc/adoc/cx_a_std.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_a_std.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_ADOC_CX_A_STD_HXX +#define ADC_ADOC_CX_A_STD_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcontx.hxx> + // COMPONENTS +#include <tokens/tkpstama.hxx> + // PARAMETERS + +class TextToken; + + +namespace adoc { + +class Cx_LineStart; +class Cx_CheckStar; +class Cx_AtTagCompletion; + + +/** +@descr +*/ +class Context_AdocStd : public autodoc::TkpDocuContext, + private StateMachineContext +{ + public: + // LIFECYCLE + Context_AdocStd(); + virtual void SetParentContext( + TkpContext & io_rParentContext, + const char * i_sMultiLineEndToken ); + ~Context_AdocStd(); + + // OPERATIONS + virtual void AssignDealer( + TokenDealer & o_rDealer ); + + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual bool PassNewToken(); + virtual void SetMode_IsMultiLine( + bool i_bTrue ); + // INQUIRY + virtual TkpContext & + FollowUpContext(); + private: + // SERVICE FUNCTIONS + virtual void PerformStatusFunction( + uintt i_nStatusSignal, + F_CRTOK i_fTokenCreateFunction, + CharacterSource & io_rText ); + + void SetupStateMachine(); + + // DATA + StateMachine aStateMachine; + TokenDealer * pDealer; + + // Contexts + TkpContext * pParentContext; + TkpContext * pFollowUpContext; + Dyn<Cx_LineStart> pCx_LineStart; + Dyn<Cx_CheckStar> pCx_CheckStar; + Dyn<Cx_AtTagCompletion> + pCx_AtTagCompletion; + + // Temporary data, used during ReadCharChain() + Dyn<TextToken> pNewToken; + bool bIsMultiline; +}; + + +} // namespace adoc + + +#endif + diff --git a/autodoc/source/parser/inc/adoc/cx_a_sub.hxx b/autodoc/source/parser/inc/adoc/cx_a_sub.hxx new file mode 100644 index 000000000000..1691cfe79fcc --- /dev/null +++ b/autodoc/source/parser/inc/adoc/cx_a_sub.hxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_a_sub.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_ADOC_CX_A_SUB_HXX +#define ADC_ADOC_CX_A_SUB_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcontx.hxx> + // COMPONENTS +#include <tokens/tkpstama.hxx> + // PARAMETERS +#include <tokens/token.hxx> + + +namespace adoc { + + + + +class Cx_LineStart : public TkpContext +{ + public: + Cx_LineStart( + TkpContext & i_rFollowUpContext ); + + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual bool PassNewToken(); + virtual TkpContext & + FollowUpContext(); + + void SetCurToken( + TextToken::F_CRTOK i_fTokenCreateFunction ) + { fCur_TokenCreateFunction = i_fTokenCreateFunction; } + void AssignDealer( + TokenDealer & o_rDealer ) + { pDealer = &o_rDealer; } + private: + // DATA + TokenDealer * pDealer; + TkpContext * pFollowUpContext; + + Dyn<TextToken> pNewToken; + + TextToken::F_CRTOK fCur_TokenCreateFunction; +}; + + +/** +@descr +*/ + +class Cx_CheckStar : public TkpContext +{ + public: + // LIFECYCLE + Cx_CheckStar( + TkpContext & i_rFollowUpContext ); + void Set_End_FollowUpContext( + TkpContext & i_rEnd_FollowUpContext ) + { pEnd_FollowUpContext = &i_rEnd_FollowUpContext; } + + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual bool PassNewToken(); + + void SetCanBeEnd( + bool i_bCanBeEnd ) + { bCanBeEnd = i_bCanBeEnd; } + virtual TkpContext & + FollowUpContext(); + void AssignDealer( + TokenDealer & o_rDealer ) + { pDealer = &o_rDealer; } + private: + // DATA + TokenDealer * pDealer; + TkpContext * pFollowUpContext; + TkpContext * pEnd_FollowUpContext; + + Dyn<TextToken> pNewToken; + + bool bCanBeEnd; + bool bEndTokenFound; +}; + + +class Cx_AtTagCompletion : public TkpContext +{ + public: + Cx_AtTagCompletion( + TkpContext & i_rFollowUpContext ); + + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual bool PassNewToken(); + virtual TkpContext & + FollowUpContext(); + + void SetCurToken( + TextToken::F_CRTOK i_fTokenCreateFunction ) + { fCur_TokenCreateFunction = i_fTokenCreateFunction; } + void AssignDealer( + TokenDealer & o_rDealer ) + { pDealer = &o_rDealer; } + private: + // DATA + TokenDealer * pDealer; + TkpContext * pFollowUpContext; + + Dyn<TextToken> pNewToken; + + TextToken::F_CRTOK fCur_TokenCreateFunction; +}; + + +} // namespace adoc + + +#endif + diff --git a/autodoc/source/parser/inc/adoc/docu_pe.hxx b/autodoc/source/parser/inc/adoc/docu_pe.hxx new file mode 100644 index 000000000000..171074e244d5 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/docu_pe.hxx @@ -0,0 +1,195 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: docu_pe.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_DOCU_PE_HXX +#define ADC_DOCU_PE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <adoc/tokintpr.hxx> + // COMPONENTS + // PARAMETERS + +namespace ary +{ +namespace doc +{ + class OldCppDocu; +} +namespace info +{ + class AtTag; +} +} + + + +namespace adoc +{ + + +class Adoc_PE : public TokenInterpreter +{ + public: + Adoc_PE(); + ~Adoc_PE(); + + virtual void Hdl_at_std( + const Tok_at_std & i_rTok ); + virtual void Hdl_at_base( + const Tok_at_base & i_rTok ); + virtual void Hdl_at_exception( + const Tok_at_exception & + i_rTok ); + virtual void Hdl_at_impl( + const Tok_at_impl & i_rTok ); + virtual void Hdl_at_key( + const Tok_at_key & i_rTok ); + virtual void Hdl_at_param( + const Tok_at_param & + i_rTok ); + virtual void Hdl_at_see( + const Tok_at_see & i_rTok ); + virtual void Hdl_at_template( + const Tok_at_template & + i_rTok ); + virtual void Hdl_at_interface( + const Tok_at_interface & + i_rTok ); + virtual void Hdl_at_internal( + const Tok_at_internal & + i_rTok ); + virtual void Hdl_at_obsolete( + const Tok_at_obsolete & + i_rTok ); + virtual void Hdl_at_module( + const Tok_at_module & + i_rTok ); + virtual void Hdl_at_file( + const Tok_at_file & i_rTok ); + virtual void Hdl_at_gloss( + const Tok_at_gloss & + i_rTok ); + virtual void Hdl_at_global( + const Tok_at_global & + i_rTok ); + virtual void Hdl_at_include( + const Tok_at_include & + i_rTok ); + virtual void Hdl_at_label( + const Tok_at_label & + i_rTok ); + virtual void Hdl_at_since( + const Tok_at_since & + i_rTok ); + virtual void Hdl_at_HTML( + const Tok_at_HTML & + i_rTok ); + virtual void Hdl_at_NOHTML( + const Tok_at_NOHTML & + i_rTok ); + + virtual void Hdl_DocWord( + const Tok_DocWord & i_rTok ); + + virtual void Hdl_Whitespace( + const Tok_Whitespace & + i_rTok ); + virtual void Hdl_LineStart( + const Tok_LineStart & + i_rTok ); + virtual void Hdl_Eol( + const Tok_Eol & i_rTok ); + + virtual void Hdl_EoDocu( + const Tok_EoDocu & i_rTok ); + + + DYN ary::doc::OldCppDocu * + ReleaseJustParsedDocu(); + + bool IsComplete() const; + + private: + void InstallAtTag( + DYN ary::info::AtTag * + let_dpTag, + bool i_bImplicit = false ); /// True for implicit @short and @descr. + ary::doc::OldCppDocu & + CurDocu(); + ary::info::AtTag & CurAtTag(); + bool UsesHtmlInDocuText(); + + void RenameCurShortTag(); + void FinishCurShortTag(); + + + // DATA + enum E_TagState + { + ts_new, + ts_std + }; + enum E_DocuState + { + ds_wait_for_short = 0, + ds_in_short, + ds_1newline_after_short, + ds_in_descr, + ds_std + }; + + Dyn<ary::doc::OldCppDocu> + pCurDocu; + ary::info::AtTag * pCurAtTag; + uintt nLineCountInDocu; + UINT8 nCurSpecialMeaningTokens; + UINT8 nCurSubtractFromLineStart; + E_TagState eCurTagState; + E_DocuState eDocuState; + bool bIsComplete; + bool bUsesHtmlInDocuText; +}; + + +// IMPLEMENTATION +inline bool +Adoc_PE::IsComplete() const +{ + return bIsComplete; +} + + + + +} // namespace adoc +#endif diff --git a/autodoc/source/parser/inc/adoc/prs_adoc.hxx b/autodoc/source/parser/inc/adoc/prs_adoc.hxx new file mode 100644 index 000000000000..549180071b40 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/prs_adoc.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: prs_adoc.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_ADOC_PRS_ADOC_HXX +#define ADC_ADOC_PRS_ADOC_HXX + + + +#include <autodoc/prs_docu.hxx> + +namespace adoc +{ + + +class DocuParser_AutodocStyle : public autodoc::DocumentationParser_Ifc +{ + public: + DocuParser_AutodocStyle(); + virtual ~DocuParser_AutodocStyle(); + + virtual DYN autodoc::TkpDocuContext * + Create_DocuContext() const; +}; + + + +} // namespace adoc + + +#endif + diff --git a/autodoc/source/parser/inc/adoc/tk_attag.hxx b/autodoc/source/parser/inc/adoc/tk_attag.hxx new file mode 100644 index 000000000000..323a8d96a712 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/tk_attag.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_attag.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_ADOC_TK_ATTAG_HXX +#define ADC_ADOC_TK_ATTAG_HXX + +// USED SERVICES + // BASE CLASSES +#include <adoc/adoc_tok.hxx> + // COMPONENTS + // PARAMETERS +#include <ary/info/inftypes.hxx> + +namespace adoc { + +typedef ary::info::E_AtTagId E_AtTagId; + + +class Tok_at_std : public Token +{ + public: + Tok_at_std( + E_AtTagId i_nId ) + : eId(i_nId) {} + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; + E_AtTagId Id() const { return eId; } + + private: + E_AtTagId eId; +}; + + +#define DECL_TOKEN_CLASS(name) \ +class Tok_##name : public Token \ +{ public: \ + virtual void Trigger( \ + TokenInterpreter & io_rInterpreter ) const; \ + virtual const char * \ + Text() const; \ +} + + +DECL_TOKEN_CLASS(at_base); +DECL_TOKEN_CLASS(at_exception); +DECL_TOKEN_CLASS(at_impl); +DECL_TOKEN_CLASS(at_key); +DECL_TOKEN_CLASS(at_param); +DECL_TOKEN_CLASS(at_see); +DECL_TOKEN_CLASS(at_template); +DECL_TOKEN_CLASS(at_interface); +DECL_TOKEN_CLASS(at_internal); +DECL_TOKEN_CLASS(at_obsolete); +DECL_TOKEN_CLASS(at_module); +DECL_TOKEN_CLASS(at_file); +DECL_TOKEN_CLASS(at_gloss); +DECL_TOKEN_CLASS(at_global); +DECL_TOKEN_CLASS(at_include); +DECL_TOKEN_CLASS(at_label); +DECL_TOKEN_CLASS(at_HTML); +DECL_TOKEN_CLASS(at_NOHTML); +DECL_TOKEN_CLASS(at_since); + + +#undef DECL_TOKEN_CLASS + + + +} // namespace adoc + +#endif + diff --git a/autodoc/source/parser/inc/adoc/tk_docw.hxx b/autodoc/source/parser/inc/adoc/tk_docw.hxx new file mode 100644 index 000000000000..eceaa67e92c9 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/tk_docw.hxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_docw.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_ADOC_TK_DOCW_HXX +#define ADC_ADOC_TK_DOCW_HXX + +// USED SERVICES + // BASE CLASSES +#include <adoc/adoc_tok.hxx> + // COMPONENTS + // PARAMETERS + +namespace adoc { + + +class Tok_DocWord : public Token +{ + public: + // Spring and Fall + Tok_DocWord( + const char * i_sText ) + : sText(i_sText) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + uintt Length() const { return sText.length(); } + + private: + // DATA + String sText; +}; + +class Tok_Whitespace : public Token +{ + public: + // Spring and Fall + Tok_Whitespace( + UINT8 i_nSize ) + : nSize(i_nSize) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + UINT8 Size() const { return nSize; } + + private: + // DATA + UINT8 nSize; +}; + +class Tok_LineStart : public Token +{ + public: + // Spring and Fall + Tok_LineStart( + UINT8 i_nSize ) + : nSize(i_nSize) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + UINT8 Size() const { return nSize; } + + private: + // DATA + UINT8 nSize; +}; + +class Tok_Eol : public Token +{ public: + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; +}; + +class Tok_EoDocu : public Token +{ public: + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; +}; + + +} // namespace adoc + +#endif + diff --git a/autodoc/source/parser/inc/adoc/tokintpr.hxx b/autodoc/source/parser/inc/adoc/tokintpr.hxx new file mode 100644 index 000000000000..a593761a611e --- /dev/null +++ b/autodoc/source/parser/inc/adoc/tokintpr.hxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tokintpr.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_ADOC_TOKINTPR_HXX +#define ADC_ADOC_TOKINTPR_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + +namespace adoc { + + +class Tok_at_std; +class Tok_at_base; +class Tok_at_exception; +class Tok_at_impl; +class Tok_at_key; +class Tok_at_param; +class Tok_at_see; +class Tok_at_template; +class Tok_at_interface; +class Tok_at_internal; +class Tok_at_obsolete; +class Tok_at_module; +class Tok_at_file; +class Tok_at_gloss; +class Tok_at_global; +class Tok_at_include; +class Tok_at_label; +class Tok_at_since; +class Tok_at_HTML; // Sets default to: Use HTML in DocuText +class Tok_at_NOHTML; // Sets default to: Don't use HTML in DocuText + +class Tok_DocWord; +class Tok_LineStart; +class Tok_Whitespace; +class Tok_Eol; +class Tok_EoDocu; + + +#define DECL_TOK_HANDLER(token) \ + virtual void Hdl_##token( \ + const Tok_##token & i_rTok ) = 0 + + + +class TokenInterpreter +{ + public: + virtual ~TokenInterpreter() {} + + DECL_TOK_HANDLER(at_std); + DECL_TOK_HANDLER(at_base); + DECL_TOK_HANDLER(at_exception); + DECL_TOK_HANDLER(at_impl); + DECL_TOK_HANDLER(at_key); + DECL_TOK_HANDLER(at_param); + DECL_TOK_HANDLER(at_see); + DECL_TOK_HANDLER(at_template); + DECL_TOK_HANDLER(at_interface); + DECL_TOK_HANDLER(at_internal); + DECL_TOK_HANDLER(at_obsolete); + DECL_TOK_HANDLER(at_module); + DECL_TOK_HANDLER(at_file); + DECL_TOK_HANDLER(at_gloss); + DECL_TOK_HANDLER(at_global); + DECL_TOK_HANDLER(at_include); + DECL_TOK_HANDLER(at_label); + DECL_TOK_HANDLER(at_since); + DECL_TOK_HANDLER(at_HTML); + DECL_TOK_HANDLER(at_NOHTML); + DECL_TOK_HANDLER(DocWord); + DECL_TOK_HANDLER(Whitespace); + DECL_TOK_HANDLER(LineStart); + DECL_TOK_HANDLER(Eol); + DECL_TOK_HANDLER(EoDocu); +}; + +#undef DECL_TOK_HANDLER + + +// IMPLEMENTATION + + +} // namespace adoc + + +#endif + diff --git a/autodoc/source/parser/inc/cpp/ctokdeal.hxx b/autodoc/source/parser/inc/cpp/ctokdeal.hxx new file mode 100644 index 000000000000..82330d465c82 --- /dev/null +++ b/autodoc/source/parser/inc/cpp/ctokdeal.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ctokdeal.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CPP_CTOKDEAL_HXX +#define ADC_CPP_CTOKDEAL_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <tokens/tokdeal.hxx> + // COMPONENTS + // PARAMETERS + + +namespace cpp +{ + +class Token; +class Tok_UnblockMacro; + + +class TokenDealer : virtual public ::TokenDealer +{ + public: + + virtual void Deal_CppCode( + cpp::Token & let_drToken ) = 0; + + /** This is to be used only by the internal macro expander + ( ::cpp::PreProcessor ). + These tokens are inserted into the source text temporary to make clear, + where a specific macro replacement ends and therefore the macro's name + becomes valid again. + + @see ::cpp::Tok_UnblockMacro + @see ::cpp::PreProcessor + */ + virtual void Deal_Cpp_UnblockMacro( + Tok_UnblockMacro & let_drToken ) = 0; +}; + + + +} // namespace cpp + + + +#endif + diff --git a/autodoc/source/parser/inc/cpp/prs_cpp.hxx b/autodoc/source/parser/inc/cpp/prs_cpp.hxx new file mode 100644 index 000000000000..665b0e2ef23a --- /dev/null +++ b/autodoc/source/parser/inc/cpp/prs_cpp.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: prs_cpp.hxx,v $ + * $Revision: 1.6 $ + * + * 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 ADC_CPP_PRS_CPP_HXX +#define ADC_CPP_PRS_CPP_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <autodoc/prs_code.hxx> + // COMPONENTS + // PARAMETERS + +namespace cpp +{ + +struct S_RunningData; + +class Cpluplus_Parser : public autodoc::CodeParser_Ifc +{ + public: + Cpluplus_Parser(); + virtual ~Cpluplus_Parser(); + + + virtual void Setup( + ary::Repository & o_rRepository, + const autodoc::DocumentationParser_Ifc & + i_rDocumentationInterpreter ); + + virtual void Run( + const autodoc::FileCollector_Ifc & + i_rFiles ); + private: + Dyn<S_RunningData> pRunningData; +}; + + + + +} // namespace cpp +#endif diff --git a/autodoc/source/parser/inc/doc_deal.hxx b/autodoc/source/parser/inc/doc_deal.hxx new file mode 100644 index 000000000000..8e21051de8fe --- /dev/null +++ b/autodoc/source/parser/inc/doc_deal.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: doc_deal.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DOC_DEAL_HXX +#define ADC_DOC_DEAL_HXX + +// BASE CLASSES +#include <tokens/tokproct.hxx> +// USED SERVICES +#include <ary/cpp/c_types4cpp.hxx> + +namespace ary +{ +namespace doc +{ + class OldCppDocu; +} +} + + + + +class DocuDealer +{ + public: + // INQUIRY + virtual ~DocuDealer() {} + + // OPERATIONS + /** @descr + This distributes the let_drDocu to the matching ary::RepositoryEntity . + + If the docu is not inline, it will be saved and later given to the next + ary::CodeEntity. Or it will be discarded, if there does not come a matching + ary::CodeEntity . + + If the docu is inline after a function header or after an enum value + or after a function parameter or after a base class, it will be stored + together with the matching function, enum value, parameter or base class. + + If the documentation is @file or @project or @glos(sary) it will be + stored at the matching ary::cpp::FileGroup, ary::cpp::ProjectGroup + or ary::Glossary. + */ + void TakeDocu( + DYN ary::doc::OldCppDocu & + let_drInfo ); + private: + virtual void do_TakeDocu( + DYN ary::doc::OldCppDocu & + let_drInfo ) = 0; +}; + + + + +// IMPLEMENTATION +inline void +DocuDealer::TakeDocu( DYN ary::doc::OldCppDocu & let_drInfo ) + { do_TakeDocu(let_drInfo); } + + + + +#endif diff --git a/autodoc/source/parser/inc/semantic/callf.hxx b/autodoc/source/parser/inc/semantic/callf.hxx new file mode 100644 index 000000000000..5739e93c2b10 --- /dev/null +++ b/autodoc/source/parser/inc/semantic/callf.hxx @@ -0,0 +1,290 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: callf.hxx,v $ + * $Revision: 1.6 $ + * + * 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 ADC_CPP_CALLF_HXX +#define ADC_CPP_CALLF_HXX + +// USED SERVICES + + + + +/** This represents a function to be called, if a specific kind of token + arrives in the semantic parser. + + @descr This class is only to be used as member of PeStatus<PE>. + @template PE + The owning ParseEnvironment. + @see PeStatus, ParseEnvironment +*/ +template <class PE> +class CallFunction +{ + public: + typedef void (PE::*F_Tok)(const char *); + + CallFunction( + F_Tok i_f2Call, + INT16 i_nTokType ); + + F_Tok GetF() const; + INT16 TokType() const; + + private: + // DATA + F_Tok f2Call; + INT16 nTokType; +}; + + +/** One state within a ParseEnvironment. + + @template PE + The owning ParseEnvironment. +*/ +template <class PE> +class PeStatus +{ + public: + typedef typename CallFunction<PE>::F_Tok F_Tok; + + PeStatus( + PE & i_rMyPE, + uintt i_nSize, + F_Tok * i_pFuncArray, + INT16 * i_pTokTypeArray, + F_Tok i_pDefault ); + virtual ~PeStatus(); + + virtual void Call_Handler( + INT16 i_nTokTypeId, + const char * i_sTokenText ) const; + + private: + bool CheckForCall( + uintt i_nPos, + INT16 i_nTokTypeId, + const char * i_sTokenText ) const; + + PE * pMyPE; + std::vector< CallFunction<PE> > + aBranches; + F_Tok fDefault; +}; + + +template <class PE> +class PeStatusArray +{ + public: + typedef typename PE::E_State State; + + PeStatusArray(); + void InsertState( + State i_ePosition, + DYN PeStatus<PE> & let_drState ); + ~PeStatusArray(); + + const PeStatus<PE> & + operator[]( + State i_ePosition ) const; + + void SetCur( + State i_eCurState ); + const PeStatus<PE> & + Cur() const; + + private: + DYN PeStatus<PE> * aStati[PE::size_of_states]; + State eState; +}; + + + +// IMPLEMENTATION + + +// CallFunction + +template <class PE> +CallFunction<PE>::CallFunction( F_Tok i_f2Call, + INT16 i_nTokType ) + : f2Call(i_f2Call), + nTokType(i_nTokType) +{ +} + +template <class PE> +inline typename CallFunction<PE>::F_Tok +CallFunction<PE>::GetF() const +{ + return f2Call; +} + +template <class PE> +inline INT16 +CallFunction<PE>::TokType() const +{ + return nTokType; +} + + + +// PeStatus + +template <class PE> +PeStatus<PE>::PeStatus( PE & i_rMyPE, + uintt i_nSize, + F_Tok * i_pFuncArray, + INT16 * i_pTokTypeArray, + F_Tok i_fDefault ) + : pMyPE(&i_rMyPE), + fDefault(i_fDefault) +{ + aBranches.reserve(i_nSize); + for ( uintt i = 0; i < i_nSize; ++i ) + { +// csv_assert(i > 0 ? i_pTokTypeArray[i] > i_pTokTypeArray[i-1] : true); + aBranches.push_back( CallFunction<PE>( i_pFuncArray[i], i_pTokTypeArray[i]) ); + } // end for +} + +template <class PE> +PeStatus<PE>::~PeStatus() +{ + +} + +template <class PE> +void +PeStatus<PE>::Call_Handler( INT16 i_nTokTypeId, + const char * i_sTokenText ) const +{ + uintt nSize = aBranches.size(); + uintt nPos = nSize / 2; + + if ( i_nTokTypeId < aBranches[nPos].TokType() ) + { + for ( --nPos; intt(nPos) >= 0; --nPos ) + { + if (CheckForCall(nPos, i_nTokTypeId, i_sTokenText)) + return; + } + } + else + { + for ( ; nPos < nSize; ++nPos ) + { + if (CheckForCall(nPos, i_nTokTypeId, i_sTokenText)) + return; + } + } + + (pMyPE->*fDefault)(i_sTokenText); +} + +template <class PE> +bool +PeStatus<PE>::CheckForCall( uintt i_nPos, + INT16 i_nTokTypeId, + const char * i_sTokenText ) const +{ + if ( aBranches[i_nPos].TokType() == i_nTokTypeId ) + { + (pMyPE->*aBranches[i_nPos].GetF())(i_sTokenText); + return true; + } + return false; +} + +// PeStatusArray + +template <class PE> +PeStatusArray<PE>::PeStatusArray() + : eState(PE::size_of_states) +{ + memset(aStati, 0, sizeof aStati); +} + +template <class PE> +void +PeStatusArray<PE>::InsertState( State i_ePosition, + DYN PeStatus<PE> & let_drState ) +{ + csv_assert(aStati[i_ePosition] == 0); + aStati[i_ePosition] = &let_drState; +} + +template <class PE> +PeStatusArray<PE>::~PeStatusArray() +{ + int i_max = PE::size_of_states; + for (int i = 0; i < i_max; i++) + { + delete aStati[i]; + } // end for +} + +template <class PE> +inline const PeStatus<PE> & +PeStatusArray<PE>::operator[]( State i_ePosition ) const +{ + csv_assert( uintt(i_ePosition) < PE::size_of_states ); + csv_assert( aStati[i_ePosition] != 0 ); + return *aStati[i_ePosition]; +} + +template <class PE> +inline void +PeStatusArray<PE>::SetCur( State i_eCurState ) +{ + eState = i_eCurState; +} + + +template <class PE> +const PeStatus<PE> & +PeStatusArray<PE>::Cur() const +{ + return (*this)[eState]; +} + +#define SEMPARSE_CREATE_STATUS(penv, state, default_function) \ + pStati->InsertState( state, \ + *new PeStatus<penv>( \ + *this, \ + sizeof( stateT_##state ) / sizeof (INT16), \ + stateF_##state, \ + stateT_##state, \ + &penv::default_function ) ) + + +#endif + diff --git a/autodoc/source/parser/inc/semantic/parseenv.hxx b/autodoc/source/parser/inc/semantic/parseenv.hxx new file mode 100644 index 000000000000..a001a6f1f80c --- /dev/null +++ b/autodoc/source/parser/inc/semantic/parseenv.hxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: parseenv.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_PARSEENV_HXX +#define ADC_PARSEENV_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <tokens/tokproct.hxx> + // COMPONENTS + // PARAMETERS + + +namespace ary +{ +namespace info +{ +class CodeInfo; +} // namespace info +} // namespace ary) + + + +class SubPeUseIfc; + + +class ParseEnvironment : protected TokenProcessing_Types +{ + public: + virtual ~ParseEnvironment() {} + + // Parsing + void Enter( + E_EnvStackAction i_eWayOfEntering ); + void Leave( + E_EnvStackAction i_eWayOfLeaving ); + void SetCurSPU( + const SubPeUseIfc * i_pCurSPU ); + + ParseEnvironment * Parent() const; + + + // ACCESS + protected: + ParseEnvironment( + ParseEnvironment * i_pParent ); + const SubPeUseIfc * CurSubPeUse() const; + private: + virtual void InitData() = 0; + virtual void TransferData() = 0; + + ParseEnvironment * pParent; + const SubPeUseIfc * pCurSubPe; +}; + +class SubPeUseIfc +{ + public: + virtual ~SubPeUseIfc() {} + + virtual void InitParse() const = 0; + virtual void GetResults() const = 0; +}; + + + +// IMPLEMENTATION + +inline void +ParseEnvironment::SetCurSPU( const SubPeUseIfc * i_pCurSPU ) + { pCurSubPe = i_pCurSPU; } + +inline ParseEnvironment * +ParseEnvironment::Parent() const + { return pParent; } + +inline const SubPeUseIfc * +ParseEnvironment::CurSubPeUse() const + { return pCurSubPe; } + + + +#endif + diff --git a/autodoc/source/parser/inc/semantic/sub_pe.hxx b/autodoc/source/parser/inc/semantic/sub_pe.hxx new file mode 100644 index 000000000000..0dca38060ddb --- /dev/null +++ b/autodoc/source/parser/inc/semantic/sub_pe.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sub_pe.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_CPP_SUB_PE_HXX +#define ADC_CPP_SUB_PE_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + + +class ParseEnvironment; + +template <class PE, class SUB> +class SubPe +{ + public: + typedef SubPe< PE, SUB > self; + + SubPe( + PE & i_rParent ); + PE & Parent() const; + SUB & Child() const; + + ParseEnvironment & Get() const; + + private: + SUB & CreateChild() const; + + PE & rParent; + Dyn<SUB> pChild; +}; + + + +// IMPLEMENTATION + + +// SubPe + +template <class PE, class SUB> +SubPe<PE,SUB>::SubPe( PE & i_rParent ) + : rParent(i_rParent) +{ +} + +template <class PE, class SUB> +PE & +SubPe<PE,SUB>::Parent() const +{ + return rParent; +} + +template <class PE, class SUB> +inline SUB & +SubPe<PE,SUB>::Child() const +{ + return pChild ? *pChild.MutablePtr() : CreateChild(); +} + +template <class PE, class SUB> +ParseEnvironment & +SubPe<PE,SUB>::Get() const +{ + return Child(); +} + +template <class PE, class SUB> +SUB & +SubPe<PE,SUB>::CreateChild() const +{ + self * pThis = const_cast< self* >(this); + + SUB * pNewChild = new SUB( &rParent); + + pThis->pChild = pNewChild; + + return *pChild.MutablePtr(); +} + + + + +#endif + diff --git a/autodoc/source/parser/inc/semantic/sub_peu.hxx b/autodoc/source/parser/inc/semantic/sub_peu.hxx new file mode 100644 index 000000000000..13d891d9c483 --- /dev/null +++ b/autodoc/source/parser/inc/semantic/sub_peu.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sub_peu.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_CPP_SUB_PEU_HXX +#define ADC_CPP_SUB_PEU_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <semantic/parseenv.hxx> +#include <tokens/tokproct.hxx> + // COMPONENTS + // PARAMETERS +#include <semantic/sub_pe.hxx> + + + +template <class PE, class SUB> +class SubPeUse : public SubPeUseIfc, + private TokenProcessing_Types +{ + public: + typedef void (PE::*F_INIT)(); + typedef void (PE::*F_RETURN)(); + + SubPeUse( + SubPe<PE,SUB> & i_rSubPeCreator, + F_INIT i_fInit, + F_RETURN i_fReturn ); + ~SubPeUse(); + + void Push( + E_TokenDone i_eDone ); + virtual void InitParse() const; + virtual void GetResults() const; + + PE & Parent() const; + SUB & Child() const; + + private: + // DATA + SubPe<PE,SUB> & rSubPeCreator; + F_INIT fInit; + F_RETURN fReturn; +}; + + +// IMPLEMENTATION + + +template <class PE, class SUB> +SubPeUse<PE,SUB>::SubPeUse( SubPe<PE,SUB> & i_rSubPeCreator, + F_INIT i_fInit, + F_RETURN i_fReturn ) + : rSubPeCreator(i_rSubPeCreator), + fInit(i_fInit), + fReturn(i_fReturn) +{ +} + +template <class PE, class SUB> +SubPeUse<PE,SUB>::~SubPeUse() +{ +} + +template <class PE, class SUB> +void +SubPeUse<PE,SUB>::Push( E_TokenDone i_eDone ) +{ + Parent().SetTokenResult( i_eDone, push, &rSubPeCreator.Get() ); + Parent().SetCurSPU(this); +} + +template <class PE, class SUB> +void +SubPeUse<PE,SUB>::InitParse() const +{ + if (fInit != 0) + (Parent().*fInit)(); +} + +template <class PE, class SUB> +void +SubPeUse<PE,SUB>::GetResults() const +{ + if (fReturn != 0) + (Parent().*fReturn)(); +} + +template <class PE, class SUB> +inline PE & +SubPeUse<PE,SUB>::Parent() const +{ + return rSubPeCreator.Parent(); +} + +template <class PE, class SUB> +inline SUB & +SubPeUse<PE,SUB>::Child() const +{ + return rSubPeCreator.Child(); +} + + +#endif + diff --git a/autodoc/source/parser/inc/tokens/parseinc.hxx b/autodoc/source/parser/inc/tokens/parseinc.hxx new file mode 100644 index 000000000000..9b2d6d512f77 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/parseinc.hxx @@ -0,0 +1,206 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: parseinc.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_PARSEINC_HXX +#define ADC_PARSEINC_HXX + + +#include <tools/tkpchars.hxx> + +inline char +jumpOver( CharacterSource & io_rText, + char in_c ) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + cNext == in_c; + cNext = io_rText.MoveOn() ) + { } + + return cNext; +} + +inline char +jumpTo( CharacterSource & io_rText, + char in_c ) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + cNext != in_c AND cNext != 0; + cNext = io_rText.MoveOn() ) + { } + + return cNext; +} + +inline char +jumpTo( CharacterSource & io_rText, + char in_c1, + char in_c2 ) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + cNext != in_c1 AND cNext != in_c2 AND cNext != 0; + cNext = io_rText.MoveOn() ) + { } + + return cNext; +} + +inline char +jumpTo( CharacterSource & io_rText, + char in_c1, + char in_c2, + char in_c3 ) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + cNext != in_c1 AND cNext != in_c2 AND cNext != in_c3 AND cNext != 0; + cNext = io_rText.MoveOn() ) + { } + + return cNext; +} + +inline char +jumpTo( CharacterSource & io_rText, + char in_c1, + char in_c2, + char in_c3, + char in_c4 ) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + cNext != in_c1 AND cNext != in_c2 AND cNext != in_c3 + AND cNext != in_c4 AND cNext != 0; + cNext = io_rText.MoveOn() ) + { } + + return cNext; +} + +inline char +jumpOverWhite(CharacterSource & io_rText) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + static_cast<UINT8>(cNext) < 33 + AND cNext != 0 AND cNext != 13 AND cNext != 10; + cNext = io_rText.MoveOn() ) + { } + + return cNext; +} + +inline char +jumpToWhite(CharacterSource & io_rText) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + static_cast<UINT8>(cNext) > 32; + cNext = io_rText.MoveOn() ) + { } + + return cNext; +} + +inline char +jumpToEol(CharacterSource & io_rText, int & o_rCount_BackslashedLineBreaks ) +{ + o_rCount_BackslashedLineBreaks = 0; + char cNext; + for ( cNext = io_rText.CurChar(); + cNext != 13 AND cNext != 10 AND cNext != NULCH; + cNext = io_rText.MoveOn() ) + { + if ( cNext == '\\') + { + cNext = io_rText.MoveOn(); + if ( cNext == 13 ) + io_rText.MoveOn(); + if ( cNext == 10 ) + ++o_rCount_BackslashedLineBreaks; + } + } + return cNext; +} + +inline char +jumpToEol(CharacterSource & io_rText) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + cNext != 13 AND cNext != 10 AND cNext != NULCH; + cNext = io_rText.MoveOn() ) + { + if ( cNext == '\\') + io_rText.MoveOn(); + } + return cNext; +} + +inline char +jumpOverEol(CharacterSource & io_rText) +{ + char cNext = io_rText.CurChar(); + + if (cNext == 13) + io_rText.MoveOn(); + if (cNext == 10) + io_rText.MoveOn(); + return cNext; +} + + +inline char // Finds a matching closing bracket after the opening one is passed +jumpToMatchingBracket( CharacterSource & io_rText, + char in_cBegin, + char in_cEnd ) +{ + intt nCounter = 1; + char cNext; + for ( cNext = io_rText.CurChar(); + nCounter - (cNext == in_cEnd ? 1 : 0) > 0 AND cNext != NULCH; + cNext = io_rText.MoveOn() ) + { + if (cNext == in_cEnd) + nCounter++; + else if (cNext == in_cBegin) + nCounter--; + } + + return cNext; +} + + + + +#endif + diff --git a/autodoc/source/parser/inc/tokens/stmstarr.hxx b/autodoc/source/parser/inc/tokens/stmstarr.hxx new file mode 100644 index 000000000000..cf6586729e82 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/stmstarr.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstarr.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_STMSTARR_HXX +#define ADC_STMSTARR_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/stmstate.hxx> + // COMPONENTS + // PARAMETERS +#include <tokens/token.hxx> + + +class StmArrayStatus : public StmStatus +{ + public: + typedef TextToken::F_CRTOK F_CRTOK; + + // LIFECYCLE + StmArrayStatus( + intt i_nStatusSize, + const INT16 * in_aArrayModel, + F_CRTOK i_fTokenCreateFunction, + bool in_bIsDefault ); + ~StmArrayStatus(); + + // INQUIRY + StmStatus::Branch NextBy( + intt in_nFollowersIndex) const; + F_CRTOK TokenCreateFunction() const + { return fTokenCreateFunction; } + virtual bool IsADefault() const; + + // ACCESS + virtual StmArrayStatus * + AsArray(); + bool SetBranch( + intt in_nBranchIx, + StmStatus::Branch in_nBranch ); + void SetTokenCreateFunction( + F_CRTOK i_fTokenCreateFunction ); + private: + StmStatus::Branch * dpBranches; + intt nNrOfBranches; + F_CRTOK fTokenCreateFunction; + bool bIsADefault; +}; + + +// IMPLEMENTATION + +inline void +StmArrayStatus::SetTokenCreateFunction( F_CRTOK i_fTokenCreateFunction ) + { fTokenCreateFunction = i_fTokenCreateFunction; } + + + +#endif + + diff --git a/autodoc/source/parser/inc/tokens/stmstate.hxx b/autodoc/source/parser/inc/tokens/stmstate.hxx new file mode 100644 index 000000000000..fae4fff344a6 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/stmstate.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstate.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_STMSTATE_HXX +#define ADC_STMSTATE_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +class StmArrayStatus; +class StmBoundsStatus; + +/** A StmStatus is a state within a StateMachine. + There are two kinds of it. Either its an array of pointers to + other states within the state machine - an ArrayStatus. + + Or it is a BoundsStatus, which shows, the token cannot be + followed further within the StateMachine. +**/ +class StmStatus // := "State machine status" +{ + public: + typedef intt Branch; /// Values >= 0 give a next #Status' ID. + /// Values <= 0 tell, that a token is finished. + /// a value < 0 returns the status back to an upper level state machine. + // LIFECYCLE + virtual ~StmStatus() {} + + // OPERATIONS + virtual StmArrayStatus * + AsArray(); + virtual StmBoundsStatus * + AsBounds(); + + // INQUIRY + virtual bool IsADefault() const = 0; +}; + + + +#endif + + diff --git a/autodoc/source/parser/inc/tokens/stmstfin.hxx b/autodoc/source/parser/inc/tokens/stmstfin.hxx new file mode 100644 index 000000000000..a8be55e8dbf8 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/stmstfin.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstfin.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_STMSTFIN_HXX +#define ADC_STMSTFIN_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/stmstate.hxx> + // COMPONENTS + // PARAMETERS + + +class TkpContext; +class StateMachineContext; + +/** +**/ +class StmBoundsStatus : public StmStatus +{ + public: + // LIFECYCLE + StmBoundsStatus( + StateMachineContext & + o_rOwner, + TkpContext & i_rFollowUpContext, + uintt i_nStatusFunctionNr, + bool i_bIsDefault ); + // INQUIRY + TkpContext * FollowUpContext(); + uintt StatusFunctionNr() const; + virtual bool IsADefault() const; + + // ACCESS + virtual StmBoundsStatus * + AsBounds(); + + private: + StateMachineContext * + pOwner; + TkpContext * pFollowUpContext; + uintt nStatusFunctionNr; + bool bIsDefault; +}; + +inline TkpContext * +StmBoundsStatus::FollowUpContext() + { return pFollowUpContext; } +inline uintt +StmBoundsStatus::StatusFunctionNr() const + { return nStatusFunctionNr; } + + +#endif + + diff --git a/autodoc/source/parser/inc/tokens/tkp.hxx b/autodoc/source/parser/inc/tokens/tkp.hxx new file mode 100644 index 000000000000..7b2071fc7b5b --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tkp.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkp.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_TKP_HXX +#define ADC_TKP_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +class CharacterSource; +class TkpContext; + // PARAMETRS + + + +/** This is the interface for parser classes, which get a sequence of tokens from + a text. + + Start() starts to parse the text from the given i_rSource. + GetNextToken() returns a Token on the heap as long as there are + still characters in the text left. This can be checked by + HasMore(). + + The algorithms for parsing tokens from the text are an issue of + the derived classes. +*/ +#if 0 +/** + Parsing can be interrupted for a different source by PushSource(). + The parsing before interruption is continued after PopSource(). +*/ +#endif // 0 + +class TokenParser +{ + public: + // LIFECYCLE + TokenParser(); + virtual ~TokenParser() {} + + // OPERATIONS + /** Start parsing a character source. Any previously parsed sources + are discarded. + */ + virtual void Start( + CharacterSource & + i_rSource ); + + /** @short Gets the next identifiable token out of the + source code. + */ + void GetNextToken(); + + /// @return true, if there are more tokens to parse. + bool HasMore() const { return bHasMore; } + + private: + void InitSource( + CharacterSource & + i_rSource ); + + virtual void SetStartContext() = 0; + virtual void SetCurrentContext( + TkpContext & io_rContext ) = 0; + virtual TkpContext & + CurrentContext() = 0; + // DATA + CharacterSource * pChars; + bool bHasMore; +}; + + +#endif + + diff --git a/autodoc/source/parser/inc/tokens/tkpcontx.hxx b/autodoc/source/parser/inc/tokens/tkpcontx.hxx new file mode 100644 index 000000000000..ed2a7d9ec1ca --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tkpcontx.hxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkpcontx.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_TKPCONTX_HXX +#define ADC_TKPCONTX_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +#include <tokens/token.hxx> +class CharacterSource; +class TkpNullContext; + +/** @task + Specifies a context within which tokens are interpreted in a special + way. For example in parsing C++ there could be a context for code, + one for comments and a third one for preprocessor statements, because + each of these would give the same token different meanings. + + The three functions + ReadCharChain() + PassNewToken() + FollowUpContext() + have to be called in this sequence. + +**/ +class TkpContext +{ + public: + // LIFECYCLE + virtual ~TkpContext() {} + + // OPERATIONS + /** @descr + The functions starts to parse with the CurChar() of io_rText. + It leaves io_rText.CurChar() at the first char of the following Token or + the following Context. + + This function returns, when a context has parsed some characterss + and completed a token OR left the context. + If the token is to be ignored, it is cut from io_rText. + + If the token is to be parsed further in a different context, + it is NOT cut from io_rText. + + After this function PassNewToken() has to be called. + + If the function has found a valid and complete token, PassNewToken() + passes the parsed token to the internally known receiver and + returns true. The token is cut from io_rText. + **/ + virtual void ReadCharChain( + CharacterSource & io_rText ) = 0; + /** Has to pass the parsed token to a known receiver. + If the token is to be parsed further in a different context, + PassNewToken() returns false, but the token is NOT cut from io_rText. + + @return true, if a token was passed. + false, if the token was not parsed completely by this context + or if the token is to be ignored. + */ + virtual bool PassNewToken() = 0; + virtual TkpContext & + FollowUpContext() = 0; + + static TkpNullContext & + Null_(); +}; + +class StateMachineContext +{ + public: + typedef TextToken::F_CRTOK F_CRTOK; + + virtual ~StateMachineContext() {} + + /// Is used by StmBoundsStatus only. + virtual void PerformStatusFunction( + uintt i_nStatusSignal, + F_CRTOK i_fTokenCreateFunction, + CharacterSource & io_rText ) = 0; +}; + +class TkpNullContext : public TkpContext +{ + public: + ~TkpNullContext(); + + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual bool PassNewToken(); + virtual TkpContext & + FollowUpContext(); +}; + +namespace autodoc +{ + +class TkpDocuContext : public TkpContext +{ + public: + virtual void SetParentContext( + TkpContext & io_rParentContext, + const char * i_sMultiLineEndToken ) = 0; + virtual void AssignDealer( + TokenDealer & o_rDealer ) = 0; + virtual void SetMode_IsMultiLine( + bool i_bTrue ) = 0; +}; + +} // namespace autodoc + +#endif + + diff --git a/autodoc/source/parser/inc/tokens/tkpstama.hxx b/autodoc/source/parser/inc/tokens/tkpstama.hxx new file mode 100644 index 000000000000..79391154ff72 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tkpstama.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkpstama.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_TKPSTAMA_HXX +#define ADC_TKPSTAMA_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcontx.hxx> + // COMPONENTS +#include <tokens/stmstarr.hxx> +#include <tokens/stmstfin.hxx> + +/** @descr + This state-machine models state transitions from one state to another + per indices of branches. If the indices represent ascii-char-values, + the state-machine can be used for recognising tokens of text. + + The state-machine can be a status itself. + + StateMachine needs the array-size of all stati as a guess, how many stati + the state machine will contain, when at work. + + +**/ +class StateMachine +{ + public: + // Types + typedef StmStatus::Branch Branch; + typedef StmStatus * * StatusList; + + //# Interface self + // LIFECYCLE + StateMachine( + intt in_nStatusSize, + intt in_nInitial_StatusListSize ); /// The user of the constructor should guess + /// the approximate number of stati here to + /// avoid multiple reallocations. + /// @#AddStatus + intt AddStatus( /// @return the new #Status' ID + DYN StmStatus * let_dpStatus); + /// @#AddToken + void AddToken( + const char * in_sToken, + TextToken::F_CRTOK in_fTokenCreateFunction, + const INT16 * in_aBranches, + INT16 in_nBoundsStatus ); + ~StateMachine(); + + + // OPERATIONS + StmBoundsStatus & + GetCharChain( + TextToken::F_CRTOK & + o_nTokenCreateFunction, + CharacterSource & io_rText ); + private: + // SERVICE FUNCTIONS + StmStatus & Status( + intt in_nStatusNr) const; + StmArrayStatus & + CurrentStatus() const; + StmBoundsStatus * + BoundsStatus() const; + + /// Sets the PeekedStatus. + void Peek( + intt in_nBranch); + + void ResizeStati(); // Adds space for 32 stati. + + // DATA + StatusList pStati; /// List of Status, implemented as simple C-array of length #nStatiSpace + /// with nStatiLength valid members (beginning from zero). + intt nCurrentStatus; + intt nPeekedStatus; + + intt nStatusSize; /// Size of the branch array of a single status. + + intt nNrofStati; /// Nr of Stati so far. + intt nStatiSpace; /// Size of allocated array for #pStati (size in items). +}; + + + +/** @#AddToken + @descr + Adds a token, which will be recogniszeds by the + statemachine. + + +**/ + + + +#endif + + diff --git a/autodoc/source/parser/inc/tokens/tokdeal.hxx b/autodoc/source/parser/inc/tokens/tokdeal.hxx new file mode 100644 index 000000000000..72eaa0a23cb6 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tokdeal.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tokdeal.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_TOKDEAL_HXX +#define ADC_TOKDEAL_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + +namespace cpp +{ + class Distributor; +} + + +class TokenDealer + +{ + public: + virtual ~TokenDealer() {} + + virtual void Deal_Eol() = 0; + virtual void Deal_Eof() = 0; + virtual cpp::Distributor * + AsDistributor() = 0; +}; + + +#if 0 +class TokenDealer + +{ + public: + virtual void Deal_IdlCode( + idl::Token & let_drToken ); + virtual void Deal_UdkDocu( + udoc::Token & let_drToken ); + virtual void Deal_JavaCode( + java::Token & let_drToken ); + virtual void Deal_SBasicCode( + sbasic::Token & let_drToken ); +}; + +#endif // 0 + + + +#endif + diff --git a/autodoc/source/parser/inc/tokens/token.hxx b/autodoc/source/parser/inc/tokens/token.hxx new file mode 100644 index 000000000000..deed6083205b --- /dev/null +++ b/autodoc/source/parser/inc/tokens/token.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: token.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_TOKEN_HXX +#define ADC_TOKEN_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETRS + + +class TokenDealer; + +/** +*/ +class TextToken +{ + public: + typedef TextToken * (*F_CRTOK)(const char*); + + // LIFECYCLE + virtual ~TextToken() {} + + + // INQUIRY + virtual const char* Text() const = 0; + + virtual void DealOut( + ::TokenDealer & o_rDealer ) = 0; +}; + +class Tok_Eof : public TextToken +{ + virtual void DealOut( // Implemented in tokdeal.cxx + TokenDealer & o_rDealer ); + virtual const char* Text() const; +}; + +#endif + + diff --git a/autodoc/source/parser/inc/tokens/tokproct.hxx b/autodoc/source/parser/inc/tokens/tokproct.hxx new file mode 100644 index 000000000000..8ab16ef41234 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tokproct.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tokproct.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_CPP_TOKPROCT_HXX +#define ADC_CPP_TOKPROCT_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + + +class ParseEnvironment; + +/** is a parent class for classes, which take part in parsing tokens semantically. + It provides some types for them. +*/ +class TokenProcessing_Types +{ + public: + enum E_TokenDone + { + not_done = 0, + done = 1 + }; + + enum E_EnvStackAction + { + stay, // same parse environment + push, // push sub environment + pop_success, // return to parent environment, parsing was successful + pop_failure // return to parent environment, but an error occured. + }; + + struct TokenProcessing_Result + { + E_TokenDone eDone; + E_EnvStackAction eStackAction; + ParseEnvironment * pEnv2Push; + + TokenProcessing_Result() + : eDone(not_done), eStackAction(stay), pEnv2Push(0) {} + void Reset() { eDone = not_done; eStackAction = stay; pEnv2Push = 0; } + }; + + enum E_ParseResult + { + res_error, + res_complete, + res_predeclaration + }; +}; + + + +#endif + diff --git a/autodoc/source/parser/inc/x_docu.hxx b/autodoc/source/parser/inc/x_docu.hxx new file mode 100644 index 000000000000..36185dbac4ab --- /dev/null +++ b/autodoc/source/parser/inc/x_docu.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: x_parse.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_X_DOCU_HXX +#define ADC_X_DOCU_HXX + +// BASE CLASSES +#include <autodoc/x_parsing.hxx> + + + + +class X_Docu : public autodoc::X_Parser_Ifc +{ + public: + // LIFECYCLE + X_Docu( + const char * i_tag, + const char * i_explanation ); + ~X_Docu(); + // INQUIRY + virtual E_Event GetEvent() const; + virtual void GetInfo( + std::ostream & o_rOutputMedium ) const; + + private: + String sTagName; + String sExplanation; +}; + + + + +#endif diff --git a/autodoc/source/parser/inc/x_parse.hxx b/autodoc/source/parser/inc/x_parse.hxx new file mode 100644 index 000000000000..6cee49494f5b --- /dev/null +++ b/autodoc/source/parser/inc/x_parse.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: x_parse.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_X_PARSE_HXX +#define ADC_X_PARSE_HXX + +// BASE CLASSES +#include <autodoc/x_parsing.hxx> + + + + +class X_Parser : public autodoc::X_Parser_Ifc +{ + public: + // LIFECYCLE + X_Parser( + E_Event i_eEvent, + const char * i_sObject, + const String & i_sCausingFile_FullPath, + uintt i_nCausingLineNr ); + ~X_Parser(); + // INQUIRY + virtual E_Event GetEvent() const; + virtual void GetInfo( + std::ostream & o_rOutputMedium ) const; + + private: + E_Event eEvent; + String sObject; + String sCausingFile_FullPath; + uintt nCausingLineNr; + +}; + + + + +#endif diff --git a/autodoc/source/parser/kernel/makefile.mk b/autodoc/source/parser/kernel/makefile.mk new file mode 100644 index 000000000000..340136565c7d --- /dev/null +++ b/autodoc/source/parser/kernel/makefile.mk @@ -0,0 +1,62 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# 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=parser_kernel +TARGETTYPE=CUI + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/parsefct.obj \ + $(OBJ)$/x_docu.obj \ + $(OBJ)$/x_parse.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser/kernel/parsefct.cxx b/autodoc/source/parser/kernel/parsefct.cxx new file mode 100644 index 000000000000..e0a60ae17c54 --- /dev/null +++ b/autodoc/source/parser/kernel/parsefct.cxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: parsefct.cxx,v $ + * $Revision: 1.5 $ + * + * 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 "parsefct.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <cpp/prs_cpp.hxx> +#include <adoc/prs_adoc.hxx> +#include <tools/filecoll.hxx> + + +DYN ParseToolsFactory * ParseToolsFactory::dpTheInstance_ = 0; + + +namespace autodoc +{ + +ParseToolsFactory_Ifc & +ParseToolsFactory_Ifc::GetIt_() +{ + if ( ParseToolsFactory::dpTheInstance_ == 0 ) + ParseToolsFactory::dpTheInstance_ = new ParseToolsFactory; + return *ParseToolsFactory::dpTheInstance_; +} + +} // namespace autodoc + + +ParseToolsFactory::ParseToolsFactory() +{ +} + +ParseToolsFactory::~ParseToolsFactory() +{ +} + +DYN autodoc::CodeParser_Ifc * +ParseToolsFactory::Create_Parser_Cplusplus() const +{ + return new cpp::Cpluplus_Parser; +} + +DYN autodoc::DocumentationParser_Ifc * +ParseToolsFactory::Create_DocuParser_AutodocStyle() const +{ + return new adoc::DocuParser_AutodocStyle; +} + +DYN autodoc::FileCollector_Ifc * +ParseToolsFactory::Create_FileCollector( uintt i_nEstimatedNrOfFiles ) const +{ + return new FileCollector(i_nEstimatedNrOfFiles); +} + + diff --git a/autodoc/source/parser/kernel/parsefct.hxx b/autodoc/source/parser/kernel/parsefct.hxx new file mode 100644 index 000000000000..caa2f6077409 --- /dev/null +++ b/autodoc/source/parser/kernel/parsefct.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: parsefct.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_PARSER_PARSEFCT_HXX +#define ADC_PARSER_PARSEFCT_HXX + + +#include <autodoc/parsing.hxx> + + +/** Interface for parsing code of a programming language and + delivering the information into an Autodoc Repository. +**/ +class ParseToolsFactory : public autodoc::ParseToolsFactory_Ifc +{ + public: + ParseToolsFactory(); + virtual ~ParseToolsFactory(); + + virtual DYN autodoc::CodeParser_Ifc * + Create_Parser_Cplusplus() const; + virtual DYN autodoc::DocumentationParser_Ifc * + Create_DocuParser_AutodocStyle() const; + virtual DYN autodoc::FileCollector_Ifc * + Create_FileCollector( + uintt i_nEstimatedNrOfFiles ) const; + private: + static DYN ParseToolsFactory * + dpTheInstance_; + + friend class autodoc::ParseToolsFactory_Ifc; +}; + + +#endif + diff --git a/autodoc/source/parser/kernel/x_docu.cxx b/autodoc/source/parser/kernel/x_docu.cxx new file mode 100644 index 000000000000..992d1cb511d0 --- /dev/null +++ b/autodoc/source/parser/kernel/x_docu.cxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: x_parse.cxx,v $ + * $Revision: 1.7 $ + * + * 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 <x_docu.hxx> + +// NOT FULLY DECLARED SERVICES + + + +X_Docu::X_Docu( const char * i_tag, + const char * i_explanation ) + : sTagName(i_tag), + sExplanation(i_explanation) +{ +} + +X_Docu::~X_Docu() +{ +} + +X_Docu::E_Event +X_Docu::GetEvent() const +{ + return x_Any; +} + +void +X_Docu::GetInfo( std::ostream & o_rOutputMedium ) const +{ + o_rOutputMedium + << "Error in tag '" + << sTagName + << "': " + << sExplanation + << Endl(); +} diff --git a/autodoc/source/parser/kernel/x_parse.cxx b/autodoc/source/parser/kernel/x_parse.cxx new file mode 100644 index 000000000000..72eee3a60ef7 --- /dev/null +++ b/autodoc/source/parser/kernel/x_parse.cxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: x_parse.cxx,v $ + * $Revision: 1.7 $ + * + * 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 <x_parse.hxx> + +// NOT FULLY DECLARED SERVICES + + + +X_Parser::X_Parser( E_Event i_eEvent, + const char * i_sObject, + const String & i_sCausingFile_FullPath, + uintt i_nCausingLineNr ) + : eEvent(i_eEvent), + sObject(i_sObject), + sCausingFile_FullPath(i_sCausingFile_FullPath), + nCausingLineNr(i_nCausingLineNr) +{ +} + +X_Parser::~X_Parser() +{ +} + +X_Parser::E_Event +X_Parser::GetEvent() const +{ + return eEvent; +} + +void +X_Parser::GetInfo( std::ostream & o_rOutputMedium ) const +{ + o_rOutputMedium << "Error in file " + << sCausingFile_FullPath + << " in line " + << nCausingLineNr + << ": "; + + + switch (eEvent) + { + case x_InvalidChar: + o_rOutputMedium << "Unknown character '" + << sObject + << "'"; + break; + case x_UnexpectedToken: + o_rOutputMedium << "Unexpected token \"" + << sObject + << "\""; + break; + case x_UnexpectedEOF: + o_rOutputMedium << "Unexpected end of file."; + break; + case x_UnspecifiedSyntaxError: + o_rOutputMedium << "Unspecified syntax problem in file."; + break; + case x_Any: + default: + o_rOutputMedium << "Unspecified parsing exception."; + } // end switch + o_rOutputMedium << Endl(); +} + + +std::ostream & +operator<<( std::ostream & o_rOut, + const autodoc::X_Parser_Ifc & i_rException ) +{ + i_rException.GetInfo(o_rOut); + return o_rOut; +} diff --git a/autodoc/source/parser/semantic/makefile.mk b/autodoc/source/parser/semantic/makefile.mk new file mode 100644 index 000000000000..d1bcfbd4532e --- /dev/null +++ b/autodoc/source/parser/semantic/makefile.mk @@ -0,0 +1,62 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# 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=parser_semantic + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + + +OBJFILES= \ + $(OBJ)$/parseenv.obj + + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser/semantic/parseenv.cxx b/autodoc/source/parser/semantic/parseenv.cxx new file mode 100644 index 000000000000..5ba364086944 --- /dev/null +++ b/autodoc/source/parser/semantic/parseenv.cxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: parseenv.cxx,v $ + * $Revision: 1.6 $ + * + * 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 <semantic/parseenv.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <ary/doc/d_oldcppdocu.hxx> +#include <x_parse.hxx> + + +void +ParseEnvironment::Enter( E_EnvStackAction i_eWayOfEntering ) +{ + switch (i_eWayOfEntering) + { + case push: + InitData(); + if ( Parent() != 0 ) + { + csv_assert( Parent()->CurSubPeUse() != 0 ); + Parent()->CurSubPeUse()->InitParse(); + } + break; + case pop_success: + break; + case pop_failure: + break; + default: + csv_assert(false); + } // end switch +} + +void +ParseEnvironment::Leave( E_EnvStackAction i_eWayOfLeaving ) +{ + switch (i_eWayOfLeaving) + { + case push: + break; + case pop_success: + TransferData(); + if ( Parent() != 0 ) + { + csv_assert( Parent()->CurSubPeUse() != 0 ); + Parent()->CurSubPeUse()->GetResults(); + } + break; + case pop_failure: + break; + default: + csv_assert(false); + } // end switch +} + +ParseEnvironment::ParseEnvironment( ParseEnvironment * i_pParent ) + : pParent(i_pParent), + // pDocu, + pCurSubPe(0) +{ +} diff --git a/autodoc/source/parser/tokens/makefile.mk b/autodoc/source/parser/tokens/makefile.mk new file mode 100644 index 000000000000..596357c5d8af --- /dev/null +++ b/autodoc/source/parser/tokens/makefile.mk @@ -0,0 +1,66 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# 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=garden +TARGET=parser_tokens +TARGETTYPE=CUI + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/stmstarr.obj \ + $(OBJ)$/stmstate.obj \ + $(OBJ)$/stmstfin.obj \ + $(OBJ)$/tkpstama.obj \ + $(OBJ)$/tkp.obj \ + $(OBJ)$/tkpcontx.obj \ + $(OBJ)$/tokdeal.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser/tokens/stmstarr.cxx b/autodoc/source/parser/tokens/stmstarr.cxx new file mode 100644 index 000000000000..fe9444375e70 --- /dev/null +++ b/autodoc/source/parser/tokens/stmstarr.cxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstarr.cxx,v $ + * $Revision: 1.6 $ + * + * 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 <tokens/stmstarr.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <x_parse.hxx> + + + +StmArrayStatus::StmArrayStatus( intt i_nStatusSize, + const INT16 * in_aArrayModel, + F_CRTOK i_fTokenCreateFunction, + bool in_bIsDefault ) + : dpBranches(new StmStatus::Branch[i_nStatusSize]), + nNrOfBranches(i_nStatusSize), + fTokenCreateFunction(i_fTokenCreateFunction), + bIsADefault(in_bIsDefault) +{ + if (in_aArrayModel != 0) + { + intt count = 0; + for (const INT16 * get = in_aArrayModel; count < nNrOfBranches; count++, get++) + dpBranches[count] = *get; + } + else // + { + memset(dpBranches, 0, nNrOfBranches); + } // endif +} + +StmArrayStatus::~StmArrayStatus() +{ + delete [] dpBranches; +} + +bool +StmArrayStatus::SetBranch( intt in_nBranchIx, + StmStatus::Branch in_nBranch ) +{ + if ( csv::in_range(intt(0), in_nBranchIx, intt(nNrOfBranches) ) ) + { + dpBranches[in_nBranchIx] = in_nBranch; + return true; + } + return false; +} + + +StmStatus::Branch +StmArrayStatus::NextBy(intt in_nIndex) const +{ + if (in_nIndex < 0) + throw X_Parser(X_Parser::x_InvalidChar, "", String::Null_(), 0); + + return in_nIndex < nNrOfBranches + ? dpBranches[in_nIndex] + : dpBranches[nNrOfBranches - 1]; +} + + +bool +StmArrayStatus::IsADefault() const +{ + return bIsADefault; +} + +StmArrayStatus * +StmArrayStatus::AsArray() +{ + return this; +} + diff --git a/autodoc/source/parser/tokens/stmstate.cxx b/autodoc/source/parser/tokens/stmstate.cxx new file mode 100644 index 000000000000..8f065235db4b --- /dev/null +++ b/autodoc/source/parser/tokens/stmstate.cxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstate.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <tokens/stmstate.hxx> + + +// NOT FULLY DECLARED SERVICES + +StmArrayStatus * +StmStatus::AsArray() +{ + return 0; +} + +StmBoundsStatus * +StmStatus::AsBounds() +{ + return 0; +} + + diff --git a/autodoc/source/parser/tokens/stmstfin.cxx b/autodoc/source/parser/tokens/stmstfin.cxx new file mode 100644 index 000000000000..5a0c1309f660 --- /dev/null +++ b/autodoc/source/parser/tokens/stmstfin.cxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstfin.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <tokens/stmstfin.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <tokens/tkpcontx.hxx> + + +StmBoundsStatus::StmBoundsStatus( StateMachineContext & + o_rOwner, + TkpContext & i_rFollowUpContext, + uintt i_nStatusFunctionNr, + bool i_bIsDefault ) + : pOwner(&o_rOwner), + pFollowUpContext(&i_rFollowUpContext), + nStatusFunctionNr(i_nStatusFunctionNr), + bIsDefault(i_bIsDefault) +{ +} + +bool +StmBoundsStatus::IsADefault() const +{ + return bIsDefault; +} + +StmBoundsStatus * +StmBoundsStatus::AsBounds() +{ + return this; +} + + + diff --git a/autodoc/source/parser/tokens/tkp.cxx b/autodoc/source/parser/tokens/tkp.cxx new file mode 100644 index 000000000000..d4a1258ea47d --- /dev/null +++ b/autodoc/source/parser/tokens/tkp.cxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkp.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <tokens/tkp.hxx> + +// NOT FULLY DECLARED SERVICES +#include <tools/tkpchars.hxx> +#include <tokens/tkpcontx.hxx> + + + +TokenParser::TokenParser() + : pChars(0), + bHasMore(false) +{ +} + +void +TokenParser::Start( CharacterSource & i_rSource ) +{ + InitSource(i_rSource); +} + +void +TokenParser::GetNextToken() +{ + csv_assert(pChars != 0); + + bHasMore = NOT pChars->IsFinished(); + + for ( bool bDone = NOT bHasMore; NOT bDone; ) + { + CurrentContext().ReadCharChain(*pChars); + bDone = CurrentContext().PassNewToken(); + SetCurrentContext(CurrentContext().FollowUpContext()); + } +} + +void +TokenParser::InitSource( CharacterSource & i_rSource ) +{ + pChars = &i_rSource; + bHasMore = true; + SetStartContext(); +} + + diff --git a/autodoc/source/parser/tokens/tkpcontx.cxx b/autodoc/source/parser/tokens/tkpcontx.cxx new file mode 100644 index 000000000000..0f7703a9921a --- /dev/null +++ b/autodoc/source/parser/tokens/tkpcontx.cxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkpcontx.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <tokens/tkpcontx.hxx> + +// NOT FULLY DECLARED SERVICES + + + +TkpNullContext G_aNullContext; + +TkpNullContext & +TkpContext::Null_() +{ + return G_aNullContext; +} + +TkpNullContext::~TkpNullContext() +{ +} + +void +TkpNullContext::ReadCharChain( CharacterSource & ) +{ +} + +bool +TkpNullContext::PassNewToken() +{ + return false; +} + +TkpContext & +TkpNullContext::FollowUpContext() +{ + return *this; +} + + + + + + diff --git a/autodoc/source/parser/tokens/tkpstama.cxx b/autodoc/source/parser/tokens/tkpstama.cxx new file mode 100644 index 000000000000..8a141a16eb3f --- /dev/null +++ b/autodoc/source/parser/tokens/tkpstama.cxx @@ -0,0 +1,180 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkpstama.cxx,v $ + * $Revision: 1.9 $ + * + * 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 <tokens/tkpstama.hxx> + +// NOT FULLY DECLARED SERVICES +// #include <srcfind.hxx> +#include <tokens/stmstarr.hxx> +//#include <parseinc.hxx> +#include <tools/tkpchars.hxx> + + +const intt C_nStatuslistResizeValue = 32; +const intt C_nTopStatus = 0; + +StateMachine::StateMachine( intt in_nStatusSize, + intt in_nInitial_StatusListSize ) + : pStati(new StmStatus*[in_nInitial_StatusListSize]), + nCurrentStatus(C_nTopStatus), + nPeekedStatus(C_nTopStatus), + nStatusSize(in_nStatusSize), + nNrofStati(0), + nStatiSpace(in_nInitial_StatusListSize) +{ + csv_assert(in_nStatusSize > 0); + csv_assert(in_nInitial_StatusListSize > 0); + + memset(pStati, 0, sizeof(StmStatus*) * nStatiSpace); +} + +intt +StateMachine::AddStatus(StmStatus * let_dpStatus) +{ + if (nNrofStati == nStatiSpace) + { + ResizeStati(); + } + pStati[nNrofStati] = let_dpStatus; + return nNrofStati++; +} + +void +StateMachine::AddToken( const char * in_sToken, + TextToken::F_CRTOK in_fTokenCreateFunction, + const INT16 * in_aBranches, + INT16 in_nBoundsStatus ) +{ + if (csv::no_str(in_sToken)) + return; + + // Durch existierende Stati durchhangeln: + nCurrentStatus = 0; + nPeekedStatus = 0; + + for ( const char * pChar = in_sToken; + *pChar != NULCH; + ++pChar ) + { + Peek(*pChar); + StmStatus & rPst = Status(nPeekedStatus); + if ( rPst.IsADefault() OR rPst.AsBounds() != 0 ) + { + nPeekedStatus = AddStatus( new StmArrayStatus(nStatusSize, in_aBranches, 0, false ) ); + CurrentStatus().SetBranch( *pChar, nPeekedStatus ); + } + nCurrentStatus = nPeekedStatus; + } // end for + StmArrayStatus & rLastStatus = CurrentStatus(); + rLastStatus.SetTokenCreateFunction(in_fTokenCreateFunction); + for (intt i = 0; i < nStatusSize; i++) + { + if (Status(rLastStatus.NextBy(i)).AsBounds() != 0) + rLastStatus.SetBranch(i,in_nBoundsStatus); + } // end for +} + +StateMachine::~StateMachine() +{ + for (intt i = 0; i < nNrofStati; i++) + { + delete pStati[i]; + } + delete [] pStati; +} + +StmBoundsStatus & +StateMachine::GetCharChain( TextToken::F_CRTOK & o_nTokenCreateFunction, + CharacterSource & io_rText ) +{ + nCurrentStatus = C_nTopStatus; + + Peek(io_rText.CurChar()); + while (BoundsStatus() == 0) + { + nCurrentStatus = nPeekedStatus; + Peek(io_rText.MoveOn()); + } + o_nTokenCreateFunction = CurrentStatus().TokenCreateFunction(); + + return *BoundsStatus(); +} + +void +StateMachine::ResizeStati() +{ + intt nNewSize = nStatiSpace + C_nStatuslistResizeValue; + intt i = 0; + StatusList pNewStati = new StmStatus*[nNewSize]; + + for ( ; i < nNrofStati; i++) + { + pNewStati[i] = pStati[i]; + } + memset( pNewStati+i, + 0, + (nNewSize-i) * sizeof(StmStatus*) ); + + delete [] pStati; + pStati = pNewStati; + nStatiSpace = nNewSize; +} + +StmStatus & +StateMachine::Status(intt in_nStatusNr) const +{ + csv_assert( csv::in_range(intt(0), in_nStatusNr, intt(nNrofStati)) ); + return *pStati[in_nStatusNr]; +} + +StmArrayStatus & +StateMachine::CurrentStatus() const +{ + StmArrayStatus * pCurSt = Status(nCurrentStatus).AsArray(); + + csv_assert(pCurSt != 0); +// if(pCurSt == 0) +// csv_assert(false); + return *pCurSt; +} + +StmBoundsStatus * +StateMachine::BoundsStatus() const +{ + return Status(nPeekedStatus).AsBounds(); +} + +void +StateMachine::Peek(intt in_nBranch) +{ + StmArrayStatus & rSt = CurrentStatus(); + nPeekedStatus = rSt.NextBy(in_nBranch); +} diff --git a/autodoc/source/parser/tokens/tokdeal.cxx b/autodoc/source/parser/tokens/tokdeal.cxx new file mode 100644 index 000000000000..801d4dda2552 --- /dev/null +++ b/autodoc/source/parser/tokens/tokdeal.cxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tokdeal.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <tokens/tokdeal.hxx> +#include <tokens/token.hxx> + + +// NOT FULLY DEFINED SERVICES + + + +void +Tok_Eof::DealOut( TokenDealer & o_rDealer ) +{ + o_rDealer.Deal_Eof(); +}; + +const char * +Tok_Eof::Text() const +{ + return ""; +} + + + diff --git a/autodoc/source/parser_i/idl/cx_idlco.cxx b/autodoc/source/parser_i/idl/cx_idlco.cxx new file mode 100644 index 000000000000..e8dec0c0b714 --- /dev/null +++ b/autodoc/source/parser_i/idl/cx_idlco.cxx @@ -0,0 +1,548 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_idlco.cxx,v $ + * $Revision: 1.12 $ + * + * 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 <s2_luidl/cx_idlco.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <s2_luidl/cx_sub.hxx> +#include <s2_dsapi/cx_dsapi.hxx> +#include <tools/tkpchars.hxx> +#include <tokens/tkpstam2.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_luidl/tokrecv.hxx> +#include <x_parse2.hxx> + + +namespace csi +{ +namespace uidl +{ + + +const intt C_nCppInitialNrOfStati = 400; +const intt C_nStatusSize = 128; + + + +const uintt nF_fin_Error = 1; +const uintt nF_fin_Ignore = 2; +const uintt nF_fin_Identifier = 3; +const uintt nF_fin_Keyword = 4; +const uintt nF_fin_Punctuation = 5; +const uintt nF_fin_EOL = 6; +const uintt nF_fin_EOF = 7; + +const uintt nF_goto_MLDocu = 10; +const uintt nF_goto_SLDocu = 11; +const uintt nF_goto_MLComment = 12; +const uintt nF_goto_SLComment = 13; +const uintt nF_goto_Praeprocessor = 14; +const uintt nF_goto_Assignment = 15; + + + +const UINT16 nTok_bty_any = 100 + TokBuiltInType::bty_any; +const UINT16 nTok_bty_boolean = 100 + TokBuiltInType::bty_boolean; +const UINT16 nTok_bty_byte = 100 + TokBuiltInType::bty_byte; +const UINT16 nTok_bty_char = 100 + TokBuiltInType::bty_char; +const UINT16 nTok_bty_double = 100 + TokBuiltInType::bty_double; +const UINT16 nTok_bty_hyper = 100 + TokBuiltInType::bty_hyper; +const UINT16 nTok_bty_long = 100 + TokBuiltInType::bty_long; +const UINT16 nTok_bty_short = 100 + TokBuiltInType::bty_short; +const UINT16 nTok_bty_string = 100 + TokBuiltInType::bty_string; +const UINT16 nTok_bty_void = 100 + TokBuiltInType::bty_void; +const UINT16 nTok_bty_ellipse = 100 + TokBuiltInType::bty_ellipse; + +const UINT16 nTok_tmod_unsigned = 200 + TokTypeModifier::tmod_unsigned; +const UINT16 nTok_tmod_sequence = 200 + TokTypeModifier::tmod_sequence; + +const UINT16 nTok_ph_in = 250 + TokParameterHandling::ph_in; +const UINT16 nTok_ph_out = 250 + TokParameterHandling::ph_out; +const UINT16 nTok_ph_inout = 250 + TokParameterHandling::ph_inout; + +const UINT16 nTok_mt_attribute = 300 + TokMetaType::mt_attribute; +const UINT16 nTok_mt_constants = 300 + TokMetaType::mt_constants; +const UINT16 nTok_mt_enum = 300 + TokMetaType::mt_enum; +const UINT16 nTok_mt_exception = 300 + TokMetaType::mt_exception; +const UINT16 nTok_mt_ident = 300 + TokMetaType::mt_ident; +const UINT16 nTok_mt_interface = 300 + TokMetaType::mt_interface; +const UINT16 nTok_mt_module = 300 + TokMetaType::mt_module; +const UINT16 nTok_mt_property = 300 + TokMetaType::mt_property; +const UINT16 nTok_mt_service = 300 + TokMetaType::mt_service; +const UINT16 nTok_mt_singleton = 300 + TokMetaType::mt_singleton; +const UINT16 nTok_mt_struct = 300 + TokMetaType::mt_struct; +const UINT16 nTok_mt_typedef = 300 + TokMetaType::mt_typedef; +const UINT16 nTok_mt_uik = 300 + TokMetaType::mt_uik; + +const UINT16 nTok_ste_bound = 400 + TokStereotype::ste_bound; +const UINT16 nTok_ste_constrained = 400 + TokStereotype::ste_constrained; +const UINT16 nTok_ste_const = 400 + TokStereotype::ste_const; +const UINT16 nTok_ste_maybeambiguous = 400 + TokStereotype::ste_maybeambiguous; +const UINT16 nTok_ste_maybedefault = 400 + TokStereotype::ste_maybedefault; +const UINT16 nTok_ste_maybevoid = 400 + TokStereotype::ste_maybevoid; +const UINT16 nTok_ste_oneway = 400 + TokStereotype::ste_oneway; +const UINT16 nTok_ste_optional = 400 + TokStereotype::ste_optional; +const UINT16 nTok_ste_readonly = 400 + TokStereotype::ste_readonly; +const UINT16 nTok_ste_removable = 400 + TokStereotype::ste_removable; +const UINT16 nTok_ste_virtual = 400 + TokStereotype::ste_virtual; +const UINT16 nTok_ste_transient = 400 + TokStereotype::ste_transient; +const UINT16 nTok_ste_published = 400 + TokStereotype::ste_published; + +const UINT16 nTok_raises = 501; +const UINT16 nTok_needs = 502; +const UINT16 nTok_observes = 503; + +const UINT16 nTok_assignment = 550; + +const UINT16 nTok_ignore = 600; +const UINT16 nTok_none_MLCommentBegin = 601; +const UINT16 nTok_none_SLCommentBegin = 602; +const UINT16 nTok_none_MLDocuBegin = 603; +const UINT16 nTok_none_SLDocuBegin = 604; +const UINT16 nTok_none_PraeprocessorBegin = 605; + + +const UINT16 nTok_punct_BracketOpen = 700 + TokPunctuation::BracketOpen; +const UINT16 nTok_punct_BracketClose = 700 + TokPunctuation::BracketClose; +const UINT16 nTok_punct_ArrayBracketOpen = 700 + TokPunctuation::ArrayBracketOpen; +const UINT16 nTok_punct_ArrayBracketClose = 700 + TokPunctuation::ArrayBracketClose; +const UINT16 nTok_punct_CurledBracketOpen = 700 + TokPunctuation::CurledBracketOpen; +const UINT16 nTok_punct_CurledBracketClose = 700 + TokPunctuation::CurledBracketClose; +const UINT16 nTok_punct_Semicolon = 700 + TokPunctuation::Semicolon; +const UINT16 nTok_punct_Colon = 700 + TokPunctuation::Colon; +const UINT16 nTok_punct_DoubleColon = 700 + TokPunctuation::DoubleColon; +const UINT16 nTok_punct_Comma = 700 + TokPunctuation::Comma; +const UINT16 nTok_punct_Minus = 700 + TokPunctuation::Minus; +const UINT16 nTok_punct_Fullstop = 700 + TokPunctuation::Fullstop; +const UINT16 nTok_punct_Lesser = 700 + TokPunctuation::Lesser; +const UINT16 nTok_punct_Greater = 700 + TokPunctuation::Greater; + +const UINT16 nTok_EOL = 801; +const UINT16 nTok_EOF = 802; + + + +Context_UidlCode::Context_UidlCode( Token_Receiver & o_rReceiver, + DYN TkpDocuContext & let_drContext_Docu ) + : aStateMachine(C_nStatusSize,C_nCppInitialNrOfStati), + pReceiver(&o_rReceiver), + pDocuContext(&let_drContext_Docu), + dpContext_MLComment(0), + dpContext_SLComment(0), + dpContext_Preprocessor(0), + dpContext_Assignment(0), + pNewToken(0), + pFollowUpContext(0) +{ + dpContext_MLComment = new Context_MLComment(o_rReceiver,*this), + dpContext_SLComment = new Context_SLComment(o_rReceiver,*this), + dpContext_Preprocessor = new Context_Praeprocessor(o_rReceiver,*this), + dpContext_Assignment = new Context_Assignment(o_rReceiver,*this), + + pDocuContext->SetParentContext(*this,"*/"); + SetupStateMachine(); +} + +Context_UidlCode::~Context_UidlCode() +{ +} + +void +Context_UidlCode::ReadCharChain( CharacterSource & io_rText ) +{ + pNewToken = 0; + + UINT16 nTokenId = 0; + StmBoundsStatu2 & rBound = aStateMachine.GetCharChain(nTokenId, io_rText); + + // !!! + // The order of the next two lines is essential, because + // pFollowUpContext may be changed by PerformStatusFunction() also, + // which then MUST override the previous assignment. + pFollowUpContext = rBound.FollowUpContext(); + PerformStatusFunction(rBound.StatusFunctionNr(), nTokenId, io_rText); +} + +bool +Context_UidlCode::PassNewToken() +{ + if (pNewToken) + { + pReceiver->Receive(*pNewToken.Release()); + return true; + } + return false; +} + +TkpContext & +Context_UidlCode::FollowUpContext() +{ + csv_assert(pFollowUpContext != 0); + return *pFollowUpContext; +} + +void +Context_UidlCode::PerformStatusFunction( uintt i_nStatusSignal, + UINT16 i_nTokenId, + CharacterSource & io_rText ) +{ + switch (i_nStatusSignal) + { + case nF_fin_Error: + // KORR_FUTURE + throw X_AutodocParser(X_AutodocParser::x_InvalidChar); + // no break, because of throw + case nF_fin_Ignore: + pNewToken = 0; + io_rText.CutToken(); + break; + case nF_fin_Identifier: + pNewToken = new TokIdentifier(io_rText.CutToken()); + break; + case nF_fin_Keyword: + io_rText.CutToken(); + switch ( i_nTokenId / 50 ) + { + case 2: + pNewToken = new TokBuiltInType(i_nTokenId - 100); + break; + case 4: + pNewToken = new TokTypeModifier(i_nTokenId - 200); + break; + case 5: + pNewToken = new TokParameterHandling(i_nTokenId - 250); + break; + case 6: + pNewToken = new TokMetaType(i_nTokenId - 300); + break; + case 8: + pNewToken = new TokStereotype(i_nTokenId - 400); + break; + case 10: + switch (i_nTokenId-500) + { + case 1: + pNewToken = new TokRaises; + break; + case 2: + pNewToken = new TokNeeds; + break; + case 3: + pNewToken = new TokObserves; + break; + default: + csv_assert(false); + } + break; + default: + csv_assert(false); + } // end switch ( i_nTokenId / 50 ) + break; + case nF_fin_Punctuation: + io_rText.CutToken(); + if (i_nTokenId == nTok_punct_DoubleColon) + pNewToken = new TokNameSeparator; + else + pNewToken = new TokPunctuation(i_nTokenId - 700); + break; + case nF_fin_EOL: + io_rText.CutToken(); + pNewToken = new Tok_EOL; + pReceiver->Increment_CurLine(); + break; + case nF_fin_EOF: + pNewToken = new Tok_EOF; + break; + case nF_goto_MLDocu: + while ( io_rText.CurChar() == '*') + io_rText.MoveOn(); + io_rText.CutToken(); + pDocuContext->SetMode_IsMultiLine(true); + break; + case nF_goto_SLDocu: + io_rText.CutToken(); + pDocuContext->SetMode_IsMultiLine(false); + break; + case nF_goto_MLComment: + break; + case nF_goto_SLComment: + break; + case nF_goto_Praeprocessor: + break; + case nF_goto_Assignment: + break; + default: + csv_assert(false); + } // end switch (i_nStatusSignal) +} + +void +Context_UidlCode::SetupStateMachine() +{ + // Besondere Array-Stati (kein Tokenabschluss oder Kontextwechsel): +// const INT16 top = 0; // Top-Status + const INT16 wht = 1; // Whitespace-berlese-Status + const INT16 bez = 2; // Bezeichner-lese-Status + + // Tokenfinish-Stati: + const INT16 finErr = 3; + const INT16 finIgn = 4; + const INT16 finBez = 5; + const INT16 finKeyw = 6; + const INT16 finPunct = 7; + const INT16 finEOL = 8; + const INT16 finEOF = 9; + + // Kontextwechsel-Stati: + const INT16 gotoMld = 10; + const INT16 gotoSld = 11; + const INT16 gotoMlc = 12; + const INT16 gotoSlc = 13; + const INT16 gotoPrp = 14; + const INT16 gotoAsg = 15; + + // Konstanten zur Benutzung in der Tabelle: + const INT16 err = finErr; + const INT16 fbz = finBez; + const INT16 fig = finIgn; + const INT16 fof = finEOF; +// const INT16 fkw = finKeyw; +// const INT16 fpc = finPunct; + + /// Die '0'en werden spaeter durch AddToken() ersetzt. + + const INT16 A_nTopStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht, 0,wht,wht, 0,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // 16 ... + wht,err,wht, 0,err,err,err,err, 0, 0,err,err, 0, 0, 0,err, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,err,err,err,err,err,err, // 48 ... + err,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 0,err, 0,err,bez, // 80 ... + err,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 0,err, 0,err,err, // 112 ... + }; + + const INT16 A_nWhitespaceStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht,fig,wht,wht,fig,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // 16 ... + wht,fig,wht,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, // 48 ... + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, // 80 ... + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,err // 112 ... + }; + + const INT16 A_nBezeichnerStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fbz,err,err,err,err,err,err,err,err,fbz,fbz,fbz,fbz,fbz,err,err, + err,err,err,err,err,err,err,err,err,err,fbz,err,err,err,err,err, // 16 ... + fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,fbz,fbz, // 48 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,bez, // 80 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,err // 112 ... + }; + + const INT16 A_nPunctDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 16 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 48 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 80 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err // 112 ... + }; + + const INT16 A_nKeywordDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fbz,err,err,err,err,err,err,err,err,fbz,fbz,fbz,fbz,fbz,err,err, + err,err,err,err,err,err,err,err,err,err,fbz,err,err,err,err,err, // 16 ... + fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,fbz,fbz, // 48 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,bez, // 80 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,err // 112 ... + }; + + DYN StmArrayStatu2 * dpStatusTop + = new StmArrayStatu2( C_nStatusSize, A_nTopStatus, 0, true); + DYN StmArrayStatu2 * dpStatusWhite + = new StmArrayStatu2( C_nStatusSize, A_nWhitespaceStatus, 0, true); + DYN StmArrayStatu2 * dpStatusBez + = new StmArrayStatu2( C_nStatusSize, A_nBezeichnerStatus, 0, true); + + DYN StmBoundsStatu2 * dpBst_finErr + = new StmBoundsStatu2( *this, TkpContext_Null2_(), nF_fin_Error, true ); + DYN StmBoundsStatu2 * dpBst_finIgn + = new StmBoundsStatu2( *this, *this, nF_fin_Ignore, true ); + DYN StmBoundsStatu2 * dpBst_finBez + = new StmBoundsStatu2( *this, *this, nF_fin_Identifier, true ); + DYN StmBoundsStatu2 * dpBst_finKeyw + = new StmBoundsStatu2( *this, *this, nF_fin_Keyword, false ); + DYN StmBoundsStatu2 * dpBst_finPunct + = new StmBoundsStatu2( *this, *this, nF_fin_Punctuation, false ); + DYN StmBoundsStatu2 * dpBst_finEOL + = new StmBoundsStatu2( *this, *this, nF_fin_EOL, false ); + DYN StmBoundsStatu2 * dpBst_finEOF + = new StmBoundsStatu2( *this, TkpContext_Null2_(), nF_fin_EOF, false ); + + DYN StmBoundsStatu2 * dpBst_gotoMld + = new StmBoundsStatu2( *this, *pDocuContext, nF_goto_MLDocu, false ); + DYN StmBoundsStatu2 * dpBst_gotoSld + = new StmBoundsStatu2( *this, *pDocuContext, nF_goto_SLDocu, false ); + DYN StmBoundsStatu2 * dpBst_gotoMlc + = new StmBoundsStatu2( *this, *dpContext_MLComment, nF_goto_MLComment, false ); + DYN StmBoundsStatu2 * dpBst_gotoSlc + = new StmBoundsStatu2( *this, *dpContext_SLComment, nF_goto_SLComment, false ); + DYN StmBoundsStatu2 * dpBst_gotoPrp + = new StmBoundsStatu2( *this, *dpContext_Preprocessor, nF_goto_Praeprocessor, false ); + DYN StmBoundsStatu2 * dpBst_gotoAsg + = new StmBoundsStatu2( *this, *dpContext_Assignment, nF_goto_Assignment, false ); + + // dpMain aufbauen: + aStateMachine.AddStatus(dpStatusTop); + + aStateMachine.AddStatus(dpStatusWhite); + aStateMachine.AddStatus(dpStatusBez); + + aStateMachine.AddStatus(dpBst_finErr); + aStateMachine.AddStatus(dpBst_finIgn); + aStateMachine.AddStatus(dpBst_finBez); + aStateMachine.AddStatus(dpBst_finKeyw); + aStateMachine.AddStatus(dpBst_finPunct); + aStateMachine.AddStatus(dpBst_finEOL); + aStateMachine.AddStatus(dpBst_finEOF); + + aStateMachine.AddStatus(dpBst_gotoMld); + aStateMachine.AddStatus(dpBst_gotoSld); + aStateMachine.AddStatus(dpBst_gotoMlc); + aStateMachine.AddStatus(dpBst_gotoSlc); + aStateMachine.AddStatus(dpBst_gotoPrp); + aStateMachine.AddStatus(dpBst_gotoAsg); + + aStateMachine.AddToken("any", nTok_bty_any, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("attribute", nTok_mt_attribute, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("boolean", nTok_bty_boolean, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("bound", nTok_ste_bound, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("byte", nTok_bty_byte, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("char", nTok_bty_char, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("const", nTok_ste_const, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("constants", nTok_mt_constants, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("constrained", + nTok_ste_constrained, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("double", nTok_bty_double, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("enum", nTok_mt_enum, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("exception", nTok_mt_exception, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("hyper", nTok_bty_hyper, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("ident", nTok_mt_ident, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("in", nTok_ph_in, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("inout", nTok_ph_inout, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("interface", nTok_mt_interface, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("long", nTok_bty_long, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("maybeambiguous", + nTok_ste_maybeambiguous,A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("maybedefault", + nTok_ste_maybedefault, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("maybevoid", nTok_ste_maybevoid, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("module", nTok_mt_module, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("needs", nTok_needs, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("observes", nTok_observes, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("oneway", nTok_ste_oneway, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("optional", nTok_ste_optional, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("out", nTok_ph_out, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("property", nTok_mt_property, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("published", nTok_ste_published, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("raises", nTok_raises, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("readonly", nTok_ste_readonly, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("removable", nTok_ste_removable, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("sequence", nTok_tmod_sequence, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("service", nTok_mt_service, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("short", nTok_bty_short, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("singleton", nTok_mt_singleton, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("string", nTok_bty_string, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("struct", nTok_mt_struct, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("transient", nTok_ste_transient, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("typedef", nTok_mt_typedef, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("uik", nTok_mt_uik, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("unsigned", nTok_tmod_unsigned, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("virtual", nTok_ste_virtual, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("void", nTok_bty_void, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("...", nTok_bty_ellipse, A_nPunctDefStatus, finKeyw); + + aStateMachine.AddToken("=", nTok_assignment, A_nPunctDefStatus, gotoAsg); + + aStateMachine.AddToken("(", nTok_punct_BracketOpen, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken(")", nTok_punct_BracketClose,A_nPunctDefStatus, finPunct); + aStateMachine.AddToken("[", nTok_punct_ArrayBracketOpen, + A_nPunctDefStatus, finIgn); + aStateMachine.AddToken("]", nTok_punct_ArrayBracketClose, + A_nPunctDefStatus, finIgn); + aStateMachine.AddToken("{", nTok_punct_CurledBracketOpen, + A_nPunctDefStatus, finPunct); + aStateMachine.AddToken("}", nTok_punct_CurledBracketClose, + A_nPunctDefStatus, finPunct); + aStateMachine.AddToken("<", nTok_punct_Lesser, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken(">", nTok_punct_Greater, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken(";", nTok_punct_Semicolon, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken(":", nTok_punct_Colon, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken("::", nTok_punct_DoubleColon, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken(",", nTok_punct_Comma, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken("-", nTok_punct_Minus, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken(".", nTok_punct_Fullstop, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken("/**", nTok_none_MLDocuBegin, A_nPunctDefStatus, gotoMld); + aStateMachine.AddToken("///", nTok_none_SLDocuBegin, A_nPunctDefStatus, gotoSld); + aStateMachine.AddToken("/*", nTok_none_MLCommentBegin, + A_nPunctDefStatus, gotoMlc); + aStateMachine.AddToken("//", nTok_none_SLCommentBegin, + A_nPunctDefStatus, gotoSlc); + aStateMachine.AddToken("/**/", nTok_ignore, A_nPunctDefStatus, finIgn); + aStateMachine.AddToken("#", nTok_none_PraeprocessorBegin, + A_nPunctDefStatus, gotoPrp); + aStateMachine.AddToken("\r\n", nTok_EOL, A_nPunctDefStatus, finEOL); + aStateMachine.AddToken("\r", nTok_EOL, A_nPunctDefStatus, finEOL); + aStateMachine.AddToken("\n", nTok_EOL, A_nPunctDefStatus, finEOL); + aStateMachine.AddToken("\n\r", nTok_EOL, A_nPunctDefStatus, finEOL); +}; + + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/cx_sub.cxx b/autodoc/source/parser_i/idl/cx_sub.cxx new file mode 100644 index 000000000000..a6efcf508ed1 --- /dev/null +++ b/autodoc/source/parser_i/idl/cx_sub.cxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_sub.cxx,v $ + * $Revision: 1.6 $ + * + * 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 <s2_luidl/cx_sub.hxx> + + + +// NOT FULLY DECLARED SERVICES +#include <s2_luidl/tokrecv.hxx> +#include <../../parser/inc/tokens/parseinc.hxx> +#include <x_parse2.hxx> +#include <s2_luidl/tk_const.hxx> + + + +namespace csi +{ +namespace uidl +{ + +bool +Cx_Base::PassNewToken() +{ + if (pNewToken) + { + rReceiver.Receive(*pNewToken.Release()); + return true; + } + return false; +} + +TkpContext & +Cx_Base::FollowUpContext() +{ + csv_assert(pFollowUpContext != 0); + return *pFollowUpContext; +} + +void +Context_MLComment::ReadCharChain( CharacterSource & io_rText ) +{ + char cNext = NULCH; + + do { + do { + cNext = jumpTo(io_rText,'*','\n'); + if (cNext == '\n') + { + Receiver().Increment_CurLine(); + cNext = io_rText.MoveOn(); + } + else if (cNext == NULCH) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + } while (cNext != '*'); + + cNext = jumpOver(io_rText,'*'); + if (cNext == NULCH) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + } while (cNext != '/'); + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken(0); +} + +void +Context_SLComment::ReadCharChain( CharacterSource & io_rText ) +{ + jumpToEol(io_rText); + if (io_rText.CurChar() != NULCH) + jumpOverEol(io_rText); + io_rText.CutToken(); + SetToken(0); + + Receiver().Increment_CurLine(); +} + +void +Context_Praeprocessor::ReadCharChain( CharacterSource & io_rText ) +{ + jumpToEol(io_rText); + if (io_rText.CurChar() != NULCH) + jumpOverEol(io_rText); + io_rText.CutToken(); + SetToken(0); + + Receiver().Increment_CurLine(); +} + +void +Context_Assignment::ReadCharChain( CharacterSource & io_rText ) +{ + // KORR_FUTURE + // How to handle new lines within this, so he y get realised by + // ParserInfo? + + char cNext = NULCH; + do { + if ( (cNext = jumpTo(io_rText,';',',','"','}')) == NULCH ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + if (cNext == '"') + { + cNext = io_rText.MoveOn(); + while (cNext != '"') + { + if ( (cNext = jumpTo(io_rText,'"','\\')) == NULCH ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + if (cNext == '\\') + io_rText.MoveOn(); + } + cNext = io_rText.MoveOn(); + } // endif (cNext == '"') + } while (cNext != ';' AND cNext != ',' AND cNext != '}'); + + if (cNext == ',' OR cNext == ';') + io_rText.MoveOn(); + SetToken(new TokAssignment(io_rText.CutToken())); +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/distrib.cxx b/autodoc/source/parser_i/idl/distrib.cxx new file mode 100644 index 000000000000..ced4dec7a2e0 --- /dev/null +++ b/autodoc/source/parser_i/idl/distrib.cxx @@ -0,0 +1,267 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: distrib.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <s2_luidl/distrib.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <ary/doc/d_oldidldocu.hxx> +#include <parser/parserinfo.hxx> +#include <s2_luidl/tkp_uidl.hxx> +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_dsapi/docu_pe2.hxx> +#include <adc_cl.hxx> +#include <x_parse2.hxx> + + + +const uintt C_nNO_TRY = uintt(-1); + + +namespace csi +{ +namespace uidl +{ + +TokenDistributor::TokenDistributor( ary::Repository & io_rRepository, + ParserInfo & io_rParserInfo ) + : pTokenSource(0), + aDocumentation(io_rParserInfo), + aProcessingData( io_rRepository, aDocumentation, io_rParserInfo ) +{ +} + +TokenDistributor::~TokenDistributor() +{ +} + +void +TokenDistributor::TradeToken() +{ + bool bGoon = true; + while (bGoon AND NOT aProcessingData.NextTokenExists()) + { + bGoon = pTokenSource->GetNextToken(); + } + if (bGoon) + aProcessingData.ProcessCurToken(); +} + +TokenDistributor::ProcessingData::ProcessingData( + ary::Repository & io_rRepository, + Documentation & i_rDocuProcessor, + ParserInfo & io_rParserInfo ) + : // aEnvironments + // aTokenQueue + // itCurToken + // aCurResult + nTryCount(0), + bFinished(false), + rRepository(io_rRepository), + rParserInfo(io_rParserInfo), + pDocuProcessor(&i_rDocuProcessor), + bPublishedRecentlyOn(false) +{ + itCurToken = aTokenQueue.end(); +} + +TokenDistributor::ProcessingData::~ProcessingData() +{ +} + +void +TokenDistributor::ProcessingData::SetTopParseEnvironment( UnoIDL_PE & io_pTopParseEnvironment ) +{ + csv::erase_container(aEnvironments); + aEnvironments.push_back( EnvironmentInfo( &io_pTopParseEnvironment, 0 ) ); + io_pTopParseEnvironment.EstablishContacts(0,rRepository,aCurResult); +} + +void +TokenDistributor::ProcessingData::Receive( DYN csi::uidl::Token & let_drToken ) +{ + aTokenQueue.push_back( &let_drToken ); + itCurToken = aTokenQueue.end()-1; +} + +void +TokenDistributor::ProcessingData::Increment_CurLine() +{ + rParserInfo.Increment_CurLine(); +} + +void +TokenDistributor::ProcessingData::ProcessCurToken() +{ + +if (DEBUG_ShowTokens()) +{ + Cout() << (*itCurToken)->Text() << Endl(); +} + + aCurResult.reset(); + + CurEnvironment().ProcessToken( CurToken() ); + AcknowledgeResult(); +} + + +UnoIDL_PE & +TokenDistributor::ProcessingData::CurEnvironment() const +{ + csv_assert(aEnvironments.size() > 0); + csv_assert(aEnvironments.back().first != 0); + + return *aEnvironments.back().first; +} + +bool +TokenDistributor::ProcessingData::NextTokenExists() const +{ + return itCurToken != aTokenQueue.end(); +} + +void +TokenDistributor::ProcessingData::AcknowledgeResult() +{ + if (aCurResult.eDone == done) + ++itCurToken; + + switch ( aCurResult.eStackAction ) + { + case stay: + if (aCurResult.eDone != done) + { + csv_assert(false); + } + break; + case push_sure: + CurEnv().Leave(push_sure); + aEnvironments.push_back( EnvironmentInfo(&PushEnv(), C_nNO_TRY) ); + PushEnv().Enter(push_sure); + PushEnv().SetDocu(pDocuProcessor->ReleaseLastParsedDocu()); + if (bPublishedRecentlyOn) + { + PushEnv().SetPublished(); + bPublishedRecentlyOn = false; + } + + break; + case push_try: + Cout() << "TestInfo: Environment tried." << Endl(); + CurEnv().Leave(push_try); + aEnvironments.push_back( EnvironmentInfo(&PushEnv(), CurTokenPosition()) ); + nTryCount++; + PushEnv().Enter(push_try); + break; + case pop_success: + CurEnv().Leave(pop_success); + if ( CurEnv_TriedTokenPosition() > 0 ) + DecrementTryCount(); + aEnvironments.pop_back(); + CurEnv().Enter(pop_success); + break; + case pop_failure: + { + CurEnv().Leave(pop_failure); + if (aCurResult.eDone == done) + { + csv_assert(false); + } + + if ( CurEnv_TriedTokenPosition() == C_nNO_TRY ) + throw X_AutodocParser( X_AutodocParser::x_UnexpectedToken, (*itCurToken)->Text() ); + + itCurToken = aTokenQueue.begin() + CurEnv_TriedTokenPosition(); + DecrementTryCount(); + aEnvironments.pop_back(); + CurEnv().Enter(pop_failure); + } break; + default: + csv_assert(false); + } // end switch(aCurResult.eStackAction) +} + +void +TokenDistributor::ProcessingData::DecrementTryCount() +{ + nTryCount--; + if (nTryCount == 0) + { + aTokenQueue.erase(aTokenQueue.begin(), itCurToken); + itCurToken = aTokenQueue.begin(); + } +} + +TokenDistributor:: +Documentation::Documentation(ParserInfo & io_rParserInfo) + : pDocuParseEnv(new csi::dsapi::SapiDocu_PE(io_rParserInfo)), + rParserInfo(io_rParserInfo), + pMostRecentDocu(0), + bIsPassedFirstDocu(false) +{ +} + +TokenDistributor:: +Documentation::~Documentation() +{ +} + +void +TokenDistributor:: +Documentation::Receive( DYN csi::dsapi::Token & let_drToken ) +{ + csv_assert(pDocuParseEnv); + + pDocuParseEnv->ProcessToken(let_drToken); + if ( pDocuParseEnv->IsComplete() ) + { + pMostRecentDocu = pDocuParseEnv->ReleaseJustParsedDocu(); + if (NOT bIsPassedFirstDocu) + { + pMostRecentDocu = 0; // Deletes the most recent docu. + bIsPassedFirstDocu = true; + } + } +} + +void +TokenDistributor:: +Documentation::Increment_CurLine() +{ + rParserInfo.Increment_CurLine(); +} + + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/makefile.mk b/autodoc/source/parser_i/idl/makefile.mk new file mode 100644 index 000000000000..e39b74b075af --- /dev/null +++ b/autodoc/source/parser_i/idl/makefile.mk @@ -0,0 +1,88 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.5 $ +# +# 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=parser2_s2_luidl + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + + +OBJFILES= \ + $(OBJ)$/cx_idlco.obj \ + $(OBJ)$/cx_sub.obj \ + $(OBJ)$/distrib.obj \ + $(OBJ)$/parsenv2.obj \ + $(OBJ)$/pe_attri.obj \ + $(OBJ)$/pe_const.obj \ + $(OBJ)$/pe_enum2.obj \ + $(OBJ)$/pe_evalu.obj \ + $(OBJ)$/pe_excp.obj \ + $(OBJ)$/pe_file2.obj \ + $(OBJ)$/pe_func2.obj \ + $(OBJ)$/pe_iface.obj \ + $(OBJ)$/pe_property.obj \ + $(OBJ)$/pe_selem.obj \ + $(OBJ)$/pe_servi.obj \ + $(OBJ)$/pe_singl.obj \ + $(OBJ)$/pe_struc.obj \ + $(OBJ)$/pe_tydf2.obj \ + $(OBJ)$/pe_type2.obj \ + $(OBJ)$/pe_vari2.obj \ + $(OBJ)$/pestate.obj \ + $(OBJ)$/semnode.obj \ + $(OBJ)$/tk_const.obj \ + $(OBJ)$/tk_ident.obj \ + $(OBJ)$/tk_keyw.obj \ + $(OBJ)$/tk_punct.obj \ + $(OBJ)$/tkp_uidl.obj \ + $(OBJ)$/unoidl.obj + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser_i/idl/parsenv2.cxx b/autodoc/source/parser_i/idl/parsenv2.cxx new file mode 100644 index 000000000000..bb77ba8aa1d6 --- /dev/null +++ b/autodoc/source/parser_i/idl/parsenv2.cxx @@ -0,0 +1,215 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: parsenv2.cxx,v $ + * $Revision: 1.14 $ + * + * 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 <s2_luidl/parsenv2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/ary.hxx> +#include <ary/getncast.hxx> +#include <ary/qualiname.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_enum.hxx> +#include <ary/idl/i_enumvalue.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/ip_ce.hxx> +#include <parser/parserinfo.hxx> +#include <adc_msg.hxx> +#include <s2_luidl/uidl_tok.hxx> +#include <x_parse2.hxx> + + + + +namespace csi +{ +namespace uidl +{ + + +UnoIDL_PE::~UnoIDL_PE() +{ +} + +void +UnoIDL_PE::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + pRepository = &io_rRepository; + aMyNode.EstablishContacts(io_pParentPE, io_rRepository.Gate_Idl(), o_rResult); +} + +//void +//UnoIDL_PE::EstablishContacts( UnoIDL_PE * io_pParentPE, +// ary::idl::Gate & io_rGate, +// TokenProcessing_Result & o_rResult ) +//{ +// aMyNode.EstablishContacts(io_pParentPE, io_rGate, o_rResult); +//} + +void +UnoIDL_PE::Enter( E_EnvStackAction i_eWayOfEntering ) +{ + switch (i_eWayOfEntering) + { + case push_sure: + InitData(); + break; + case push_try: + csv_assert(false); + break; + case pop_success: + ReceiveData(); + break; + case pop_failure: + throw X_AutodocParser(X_AutodocParser::x_Any); + // no break because of throw + default: + csv_assert(false); + } // end switch +} + +void +UnoIDL_PE::Leave( E_EnvStackAction i_eWayOfLeaving ) +{ + switch (i_eWayOfLeaving) + { + case push_sure: + break; + case push_try: + csv_assert(false); + break; + case pop_success: + TransferData(); + break; + case pop_failure: + throw X_AutodocParser(X_AutodocParser::x_Any); + // no break because of throw + default: + csv_assert(false); + } // end switch +} + +void +UnoIDL_PE::SetDocu( DYN ary::doc::OldIdlDocu * let_dpDocu ) +{ + pDocu = let_dpDocu; +} + +void +UnoIDL_PE::SetPublished() +{ + if (NOT pDocu) + { + pDocu = new ary::doc::OldIdlDocu; + } + pDocu->SetPublished(); +} + +void +UnoIDL_PE::SetOptional() +{ + if (NOT pDocu) + { + pDocu = new ary::doc::OldIdlDocu; + } + pDocu->SetOptional(); +} + +void +UnoIDL_PE::PassDocuAt( ary::idl::CodeEntity & io_rCe ) +{ + if (pDocu) + { + io_rCe.Set_Docu(*pDocu.Release()); + } + else if // KORR_FUTURE + // Re-enable doc-warning for Enum Values, as soon as there is a + // @option -no-doc-for-enumvalues. + ( NOT ary::is_type<ary::idl::Module>(io_rCe) + AND NOT ary::is_type<ary::idl::Enum>(io_rCe) ) + { + TheMessages().Out_MissingDoc( + io_rCe.LocalName(), + ParseInfo().CurFile(), + ParseInfo().CurLine() ); + } +} + +void +UnoIDL_PE::InitData() +{ + // Needs not anything to do. +} + +void +UnoIDL_PE::ReceiveData() +{ + // Needs not anything to do. +} + +const ary::idl::Module & +UnoIDL_PE::CurNamespace() const +{ + if ( Parent() != 0 ) + return Parent()->CurNamespace(); + else + { + csv_assert(false); + return *(const ary::idl::Module*)0; + } +} + +const ParserInfo & +UnoIDL_PE::ParseInfo() const +{ + if ( Parent() != 0 ) + return Parent()->ParseInfo(); + else + { + csv_assert(false); + return *(const ParserInfo*)0; + } +} + +UnoIDL_PE::UnoIDL_PE() + : aMyNode(), + pDocu(), + pRepository(0) +{ +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_attri.cxx b/autodoc/source/parser_i/idl/pe_attri.cxx new file mode 100644 index 000000000000..096a7bd7269d --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_attri.cxx @@ -0,0 +1,297 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_attri.cxx,v $ + * $Revision: 1.8 $ + * + * 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 <s2_luidl/pe_attri.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_attribute.hxx> +#include <ary/idl/i_service.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/pe_vari2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> + + + +namespace csi +{ +namespace uidl +{ + + + +PE_Attribute::PE_Attribute( const Ce_id & i_rCurOwner ) + : eState(e_none), + pCurOwner(&i_rCurOwner), + pPE_Variable(0), + pPE_Exception(0), + pCurAttribute(0), + nCurParsedType(0), + sCurParsedName(), + bReadOnly(false), + bBound(false) +{ + pPE_Variable = new PE_Variable(nCurParsedType, sCurParsedName); + pPE_Exception = new PE_Type(nCurParsedType); +} + +void +PE_Attribute::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Variable->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Exception->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Attribute::~PE_Attribute() +{ +} + +void +PE_Attribute::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Attribute::Process_Identifier( const TokIdentifier & i_rToken ) +{ + switch (eState) + { + case e_start: + SetResult(not_done, push_sure, pPE_Variable.Ptr()); + eState = in_variable; + break; + case in_raise_std: + if (strcmp(i_rToken.Text(),"get") == 0) + { + SetResult(done, stay); + eState = in_get; + } + else if (strcmp(i_rToken.Text(),"set") == 0) + { + SetResult(done, stay); + eState = in_set; + } + else + { + SetResult(not_done, pop_failure); + eState = e_none; + } + break; + case in_get: + case in_set: + SetResult(not_done, push_sure, pPE_Exception.Ptr()); + break; + default: + SetResult(not_done, pop_failure); + } // end switch +} + +void +PE_Attribute::Process_Stereotype( const TokStereotype & i_rToken ) +{ + if (eState != e_start) + { + SetResult(not_done, pop_failure); + eState = e_none; + return; + } + + switch (i_rToken.Id()) + { + case TokStereotype::ste_readonly: + bReadOnly = true; + break; + case TokStereotype::ste_bound: + bBound = true; + break; + default: + SetResult(not_done, pop_failure); + eState = e_none; + return; + } // end switch + + SetResult(done, stay); +} + +void +PE_Attribute::Process_MetaType( const TokMetaType & i_rToken ) +{ + if (eState != e_start OR i_rToken.Id() != TokMetaType::mt_attribute) + { + SetResult(not_done, pop_failure); + eState = e_none; + return; + } + + SetResult(done, stay); +} + +void +PE_Attribute::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + switch (eState) + { + case e_start: + SetResult(done, stay); + break; + case expect_end: + switch(i_rToken.Id()) + { + case TokPunctuation::Semicolon: + SetResult(done, pop_success); + eState = e_none; + break; + case TokPunctuation::Comma: + SetResult(not_done, pop_failure); + Cerr() << "Autodoc does not support comma separated attributes, because those are discouraged by IDL policies." << Endl(); + break; + case TokPunctuation::CurledBracketOpen: + SetResult(done, stay); + eState = in_raise_std; + break; + default: + SetResult(not_done, pop_failure); + } // end switch + break; + case in_raise_std: + SetResult(done, stay); + if (i_rToken.Id() == TokPunctuation::CurledBracketClose) + { + eState = expect_end; + } + break; + case in_get: + case in_set: + SetResult(done, stay); + if (i_rToken.Id() == TokPunctuation::Semicolon) + { + eState = in_raise_std; + } + break; + default: + csv_assert(false); + } +} + +void +PE_Attribute::Process_Raises() +{ + if (eState == in_get OR eState == in_set) + { + SetResult(done, stay); + } + else + SetResult(not_done, pop_failure); +} + +void +PE_Attribute::Process_Default() +{ + if (eState == e_start) + { + SetResult(not_done, push_sure, pPE_Variable.Ptr()); + eState = in_variable; + } + else if (eState == in_get OR eState == in_set) + SetResult(not_done, push_sure, pPE_Exception.Ptr()); + else + SetResult(not_done, pop_failure); +} + +void +PE_Attribute::InitData() +{ + eState = e_start; + + pCurAttribute = 0; + nCurParsedType = 0; + sCurParsedName = ""; + bReadOnly = false; + bBound = false; +} + +void +PE_Attribute::TransferData() +{ + eState = e_none; +} + +void +PE_Attribute::ReceiveData() +{ + switch (eState) + { + case in_variable: + csv_assert(pCurOwner->IsValid()); + pCurAttribute = &Gate().Ces().Store_Attribute( + *pCurOwner, + sCurParsedName, + nCurParsedType, + bReadOnly, + bBound ); + PassDocuAt(*pCurAttribute); + nCurParsedType = 0; + eState = expect_end; + break; + case in_get: + csv_assert(pCurAttribute != 0); + pCurAttribute->Add_GetException(nCurParsedType); + nCurParsedType = 0; + break; + case in_set: + csv_assert(pCurAttribute != 0); + pCurAttribute->Add_SetException(nCurParsedType); + nCurParsedType = 0; + break; + default: + csv_assert(false); + } // end switch +} + + +UnoIDL_PE & +PE_Attribute::MyPE() +{ + return *this; +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_const.cxx b/autodoc/source/parser_i/idl/pe_const.cxx new file mode 100644 index 000000000000..bb7c65517b6b --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_const.cxx @@ -0,0 +1,283 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_const.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <s2_luidl/pe_const.hxx> + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_constant.hxx> +#include <ary/idl/i_constgroup.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/pe_evalu.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_keyw.hxx> + + +namespace csi +{ +namespace uidl +{ + + +#ifdef DF +#undef DF +#endif +#define DF &PE_Constant::On_Default + +PE_Constant::F_TOK +PE_Constant::aDispatcher[PE_Constant::e_STATES_MAX][PE_Constant::tt_MAX] = + { { DF, DF, DF }, // e_none + { DF, &PE_Constant::On_expect_name_Identifier, + DF }, // expect_name + { DF, DF, &PE_Constant::On_expect_curl_bracket_open_Punctuation }, // expect_curl_bracket_open + { &PE_Constant::On_expect_const_Stereotype, + DF, &PE_Constant::On_expect_const_Punctuation }, // expect_const + { DF, &PE_Constant::On_expect_value_Identifier, + DF }, // expect_value + { DF, DF, &PE_Constant::On_expect_finish_Punctuation } // expect_finish + }; + + + +inline void +PE_Constant::CallHandler( const char * i_sTokenText, + E_TokenType i_eTokenType ) + { (this->*aDispatcher[eState][i_eTokenType])(i_sTokenText); } + + + + +PE_Constant::PE_Constant() + : eState(e_none), + sData_Name(), + nDataId(0), + pPE_Type(0), + nType(0), + pPE_Value(0), + sName(), + sAssignment() +{ + pPE_Type = new PE_Type(nType); + pPE_Value = new PE_Value(sName, sAssignment, true); +} + +void +PE_Constant::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Value->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Constant::~PE_Constant() +{ +} + +void +PE_Constant::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Constant::Process_Identifier( const TokIdentifier & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_identifier); +} + +void +PE_Constant::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_punctuation); +} + +void +PE_Constant::Process_Stereotype( const TokStereotype & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_stereotype); +} + +void +PE_Constant::On_expect_name_Identifier(const char * i_sText) +{ + sName = i_sText; + + SetResult(done,stay); + eState = expect_curl_bracket_open; +} + +void +PE_Constant::On_expect_curl_bracket_open_Punctuation(const char * i_sText) +{ + if ( i_sText[0] == '{') + { + sData_Name = sName; + + ary::idl::ConstantsGroup & + rCe = Gate().Ces(). + Store_ConstantsGroup(CurNamespace().CeId(),sData_Name); + PassDocuAt(rCe); + nDataId = rCe.CeId(); + + SetResult(done,stay); + eState = expect_const; + } + else + { + On_Default(i_sText); + } +} + +void +PE_Constant::On_expect_const_Stereotype(const char *) +{ + SetResult( done, push_sure, pPE_Type.Ptr() ); +} + +void +PE_Constant::On_expect_const_Punctuation(const char * i_sText) +{ + if ( i_sText[0] == '}') + { + SetResult(done,stay); + eState = expect_finish; + } + else + { + On_Default(i_sText); + } +} + +void +PE_Constant::On_expect_value_Identifier(const char *) +{ + SetResult( not_done, push_sure, pPE_Value.Ptr() ); +} + +void +PE_Constant::On_expect_finish_Punctuation(const char * i_sText) +{ + if ( i_sText[0] == ';') + { + SetResult(done,pop_success); + eState = e_none; + } + else + { + On_Default(i_sText); + } +} + +void +PE_Constant::On_Default(const char * ) +{ + SetResult(not_done,pop_failure); + eState = e_none; +} + +void +PE_Constant::EmptySingleConstData() +{ + nType = 0; + sName = ""; + sAssignment = ""; +} + +void +PE_Constant::CreateSingleConstant() +{ + ary::idl::Constant & + rCe = Gate().Ces().Store_Constant( nDataId, + sName, + nType, + sAssignment ); + pPE_Type->PassDocuAt(rCe); +} + +void +PE_Constant::InitData() +{ + eState = expect_name; + + sData_Name.clear(); + nDataId = 0; + + EmptySingleConstData(); +} + +void +PE_Constant::ReceiveData() +{ + switch (eState) + { + case expect_const: + eState = expect_value; + break; + case expect_value: + { + if (sName.length() == 0 OR sAssignment.length() == 0 OR NOT nType.IsValid()) + { + Cerr() << "Constant without value found." << Endl(); + eState = expect_const; + break; + } + + CreateSingleConstant(); + EmptySingleConstData(); + eState = expect_const; + } break; + default: + SetResult(not_done, pop_failure); + eState = e_none; + } // end switch +} + +void +PE_Constant::TransferData() +{ + csv_assert(nDataId.IsValid()); + eState = e_none; +} + +UnoIDL_PE & +PE_Constant::MyPE() +{ + return *this; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pe_enum2.cxx b/autodoc/source/parser_i/idl/pe_enum2.cxx new file mode 100644 index 000000000000..2990830461b9 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_enum2.cxx @@ -0,0 +1,254 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_enum2.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <s2_luidl/pe_enum2.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_enum.hxx> +#include <ary/idl/i_enumvalue.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_evalu.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_keyw.hxx> + + +namespace csi +{ +namespace uidl +{ + + +#ifdef DF +#undef DF +#endif +#define DF &PE_Enum::On_Default + +PE_Enum::F_TOK +PE_Enum::aDispatcher[PE_Enum::e_STATES_MAX][PE_Enum::tt_MAX] = + { { DF, DF }, // e_none + { &PE_Enum::On_expect_name_Identifier, + DF }, // expect_name + { DF, &PE_Enum::On_expect_curl_bracket_open_Punctuation }, // expect_curl_bracket_open + { &PE_Enum::On_expect_value_Identifier, + &PE_Enum::On_expect_value_Punctuation }, // expect_value + { DF, &PE_Enum::On_expect_finish_Punctuation } // expect_finish + }; + + + +inline void +PE_Enum::CallHandler( const char * i_sTokenText, + E_TokenType i_eTokenType ) + { (this->*aDispatcher[eState][i_eTokenType])(i_sTokenText); } + + + + +PE_Enum::PE_Enum() + : eState(e_none), + sData_Name(), + nDataId(0), + pPE_Value(0), + sName(), + sAssignment() +{ + pPE_Value = new PE_Value(sName, sAssignment, false); +} + +void +PE_Enum::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Value->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Enum::~PE_Enum() +{ +} + +void +PE_Enum::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Enum::Process_Identifier( const TokIdentifier & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_identifier); +} + +void +PE_Enum::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_punctuation); +} + +void +PE_Enum::On_expect_name_Identifier(const char * i_sText) +{ + sName = i_sText; + + SetResult(done,stay); + eState = expect_curl_bracket_open; +} + +void +PE_Enum::On_expect_curl_bracket_open_Punctuation(const char * i_sText) +{ + if ( i_sText[0] == '{') + { + sData_Name = sName; + ary::idl::Enum & + rCe = Gate().Ces().Store_Enum(CurNamespace().CeId(), sData_Name); + PassDocuAt(rCe); + nDataId = rCe.CeId(); + + SetResult(done,stay); + eState = expect_value; + } + else + { + On_Default(i_sText); + } +} + +void +PE_Enum::On_expect_value_Punctuation(const char * i_sText) +{ + if ( i_sText[0] == '}' ) + { + SetResult(done,stay); + eState = expect_finish; + } + else + { + On_Default(i_sText); + } +} + +void +PE_Enum::On_expect_value_Identifier(const char *) +{ + SetResult( not_done, push_sure, pPE_Value.Ptr() ); +} + +void +PE_Enum::On_expect_finish_Punctuation(const char * i_sText) +{ + if ( i_sText[0] == ';') + { + SetResult(done,pop_success); + eState = e_none; + } + else + { + On_Default(i_sText); + } +} + +void +PE_Enum::On_Default(const char * ) +{ + SetResult(not_done,pop_failure); + eState = e_none; +} + +void +PE_Enum::EmptySingleValueData() +{ + sName = ""; + sAssignment = ""; +} + +void +PE_Enum::CreateSingleValue() +{ + ary::idl::EnumValue & + rCe = Gate().Ces().Store_EnumValue( nDataId, sName, sAssignment ); + pPE_Value->PassDocuAt(rCe); +} + +void +PE_Enum::InitData() +{ + eState = expect_name; + + sData_Name.clear(); + nDataId = 0; + + EmptySingleValueData(); +} + +void +PE_Enum::ReceiveData() +{ + switch (eState) + { + case expect_value: + { + if (sName.length() == 0) + { + On_Default(""); + break; + } + + CreateSingleValue(); + EmptySingleValueData(); + } break; + default: + SetResult(not_done, pop_failure); + eState = e_none; + } // end switch +} + +void +PE_Enum::TransferData() +{ + csv_assert(sData_Name.length() > 0); + eState = e_none; +} + +UnoIDL_PE & +PE_Enum::MyPE() +{ + return *this; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pe_evalu.cxx b/autodoc/source/parser_i/idl/pe_evalu.cxx new file mode 100644 index 000000000000..623ac93bfd59 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_evalu.cxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_evalu.cxx,v $ + * $Revision: 1.9 $ + * + * 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 <s2_luidl/pe_evalu.hxx> + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_enumvalue.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_luidl/tk_const.hxx> + + +namespace csi +{ +namespace uidl +{ + + +#ifdef DF +#undef DF +#endif +#define DF &PE_Value::On_Default + +PE_Value::F_TOK +PE_Value::aDispatcher[PE_Value::e_STATES_MAX][PE_Value::tt_MAX] = + { { DF, DF, DF }, // e_none + { &PE_Value::On_expect_name_Identifier, + DF, DF }, // expect_name + { DF, &PE_Value::On_got_name_Punctuation, + &PE_Value::On_got_name_Assignment } // got_name + }; + + + +inline void +PE_Value::CallHandler( const char * i_sTokenText, + E_TokenType i_eTokenType ) + { (this->*aDispatcher[eState][i_eTokenType])(i_sTokenText); } + + + + + +PE_Value::PE_Value( String & o_rName, + String & o_rAssignment, + bool i_bIsConst ) + : eState(e_none), + pName(&o_rName), + pAssignment(&o_rAssignment), + bIsConst(i_bIsConst) +{ +} + +void +PE_Value::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); +} + +PE_Value::~PE_Value() +{ +} + +void +PE_Value::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Value::Process_Identifier( const TokIdentifier & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_identifier); +} + +void +PE_Value::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_punctuation); +} + +void +PE_Value::Process_Assignment( const TokAssignment & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_assignment); +} + +void +PE_Value::On_expect_name_Identifier(const char * i_sText) +{ + *pName = i_sText; + SetResult(done,stay); + eState = got_name; +} + +void +PE_Value::On_got_name_Punctuation(const char * i_sText) +{ + if ( (i_sText[0] == ',' AND NOT IsConst()) + OR (i_sText[0] == ';' AND IsConst()) ) + { + SetResult(done,pop_success); + eState = e_none; + } + else if (i_sText[0] == '}' AND NOT IsConst()) + { + SetResult(not_done,pop_success); + eState = e_none; + } + else + On_Default(i_sText); +} + +void +PE_Value::On_got_name_Assignment(const char * i_sText) +{ + *pAssignment = i_sText; + SetResult(done,pop_success); + eState = e_none; +} + +void +PE_Value::On_Default(const char * ) +{ + SetResult(not_done,pop_failure); +} + +void +PE_Value::InitData() +{ + eState = expect_name; + + *pName = ""; + *pAssignment = ""; +} + +void +PE_Value::TransferData() +{ + csv_assert(pName->length() > 0); + eState = e_none; +} + +UnoIDL_PE & +PE_Value::MyPE() +{ + return *this; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pe_excp.cxx b/autodoc/source/parser_i/idl/pe_excp.cxx new file mode 100644 index 000000000000..468faf09c1d6 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_excp.cxx @@ -0,0 +1,301 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_excp.cxx,v $ + * $Revision: 1.8 $ + * + * 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 <s2_luidl/pe_excp.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_exception.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_structelem.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/pe_selem.hxx> + + + +namespace csi +{ +namespace uidl +{ + + +PE_Exception::PE_Exception() + // : aWork, + // pStati +{ + pStati = new S_Stati(*this); +} + +void +PE_Exception::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + Work().pPE_Element->EstablishContacts(this,io_rRepository,o_rResult); + Work().pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Exception::~PE_Exception() +{ +} + +void +PE_Exception::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*Stati().pCurStatus); +} + + +void +PE_Exception::InitData() +{ + Work().InitData(); + Stati().pCurStatus = &Stati().aWaitForName; +} + +void +PE_Exception::TransferData() +{ + if (NOT Work().bIsPreDeclaration) + { + csv_assert(Work().sData_Name.size() > 0); + csv_assert(Work().nCurStruct.IsValid()); + } + Stati().pCurStatus = &Stati().aNone; +} + +void +PE_Exception::ReceiveData() +{ + Stati().pCurStatus->On_SubPE_Left(); +} + +PE_Exception::S_Work::S_Work() + : sData_Name(), + bIsPreDeclaration(false), + nCurStruct(0), + pPE_Element(0), + nCurParsed_ElementRef(0), + pPE_Type(0), + nCurParsed_Base(0) + +{ + pPE_Element = new PE_StructElement(nCurParsed_ElementRef,nCurStruct); + pPE_Type = new PE_Type(nCurParsed_Base); +} + +void +PE_Exception::S_Work::InitData() +{ + sData_Name.clear(); + bIsPreDeclaration = false; + nCurStruct = 0; + + nCurParsed_ElementRef = 0; + nCurParsed_Base = 0; +} + +void +PE_Exception::S_Work::Prepare_PE_QualifiedName() +{ + nCurParsed_ElementRef = 0; +} + +void +PE_Exception::S_Work::Prepare_PE_Element() +{ + nCurParsed_Base = 0; +} + +void +PE_Exception::S_Work::Data_Set_Name( const char * i_sName ) +{ + sData_Name = i_sName; +} + +PE_Exception::S_Stati::S_Stati(PE_Exception & io_rStruct) + : aNone(io_rStruct), + aWaitForName(io_rStruct), + aGotName(io_rStruct), + aWaitForBase(io_rStruct), + aGotBase(io_rStruct), + aWaitForElement(io_rStruct), + aWaitForFinish(io_rStruct), + pCurStatus(0) +{ + pCurStatus = &aNone; +} + + +//*********************** Stati ***************************// + + +UnoIDL_PE & +PE_Exception::PE_StructState::MyPE() +{ + return rStruct; +} + + +void +PE_Exception::State_WaitForName::Process_Identifier( const TokIdentifier & i_rToken ) +{ + Work().Data_Set_Name(i_rToken.Text()); + MoveState( Stati().aGotName ); + SetResult(done,stay); +} + +void +PE_Exception::State_GotName::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if ( i_rToken.Id() != TokPunctuation::Semicolon ) + { + switch (i_rToken.Id()) + { + case TokPunctuation::Colon: + MoveState( Stati().aWaitForBase ); + SetResult(done,push_sure,Work().pPE_Type.Ptr()); + Work().Prepare_PE_QualifiedName(); + break; + case TokPunctuation::CurledBracketOpen: + PE().store_Exception(); + MoveState( Stati().aWaitForElement ); + SetResult(done,stay); + break; + default: + SetResult(not_done,pop_failure); + } // end switch + } + else + { + Work().sData_Name.clear(); + SetResult(done,pop_success); + } +} + +void +PE_Exception::State_WaitForBase::On_SubPE_Left() +{ + MoveState(Stati().aGotBase); +} + +void +PE_Exception::State_GotBase::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if ( i_rToken.Id() == TokPunctuation::CurledBracketOpen ) + { + PE().store_Exception(); + MoveState( Stati().aWaitForElement ); + SetResult(done,stay); + } + else + { + SetResult(not_done,pop_failure); + } +} + +void +PE_Exception::State_WaitForElement::Process_Identifier( const TokIdentifier & ) +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr() ); + Work().Prepare_PE_Element(); +} + +void +PE_Exception::State_WaitForElement::Process_NameSeparator() +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr()); + Work().Prepare_PE_Element(); +} + +void +PE_Exception::State_WaitForElement::Process_BuiltInType( const TokBuiltInType & ) +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr()); + Work().Prepare_PE_Element(); +} + +void +PE_Exception::State_WaitForElement::Process_TypeModifier(const TokTypeModifier & ) +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr()); + Work().Prepare_PE_Element(); +} + +void +PE_Exception::State_WaitForElement::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if ( i_rToken.Id() == TokPunctuation::CurledBracketClose ) + { + MoveState( Stati().aWaitForFinish ); + SetResult( done, stay ); + } + else + { + SetResult( not_done, pop_failure ); + } +} + +void +PE_Exception::State_WaitForFinish::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if (i_rToken.Id() == TokPunctuation::Semicolon) + { + MoveState( Stati().aNone ); + SetResult( done, pop_success ); + } + else + { + SetResult( not_done, pop_failure ); + } +} + +void +PE_Exception::store_Exception() +{ + ary::idl::Exception & + rCe = Gate().Ces().Store_Exception( + CurNamespace().CeId(), + Work().sData_Name, + Work().nCurParsed_Base ); + PassDocuAt(rCe); + Work().nCurStruct = rCe.Id(); +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_file2.cxx b/autodoc/source/parser_i/idl/pe_file2.cxx new file mode 100644 index 000000000000..327952dca04e --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_file2.cxx @@ -0,0 +1,321 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_file2.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <s2_luidl/pe_file2.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/distrib.hxx> +#include <s2_luidl/pe_servi.hxx> +#include <s2_luidl/pe_iface.hxx> +#include <s2_luidl/pe_singl.hxx> +#include <s2_luidl/pe_struc.hxx> +#include <s2_luidl/pe_excp.hxx> +#include <s2_luidl/pe_const.hxx> +#include <s2_luidl/pe_enum2.hxx> +#include <s2_luidl/pe_tydf2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> + + + + +namespace csi +{ +namespace uidl +{ + + +PE_File::PE_File( TokenDistributor & i_rTokenAdmin, + const ParserInfo & i_parseInfo ) + : pTokenAdmin(&i_rTokenAdmin), + pPE_Service(new PE_Service), + pPE_Singleton(new PE_Singleton), + pPE_Interface(new PE_Interface), + pPE_Struct(new PE_Struct), + pPE_Exception(new PE_Exception), + pPE_Constant(new PE_Constant), + pPE_Enum(new PE_Enum), + pPE_Typedef(new PE_Typedef), + pCurNamespace(0), + pParseInfo(&i_parseInfo), + eState(e_none), + nBracketCount_inDefMode(0) +{ +} + +void +PE_File::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Service->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Singleton->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Interface->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Struct->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Exception->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Constant->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Enum->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Typedef->EstablishContacts(this,io_rRepository,o_rResult); + + pCurNamespace = &Gate().Ces().GlobalNamespace(); +} + +PE_File::~PE_File() +{ +} + +void +PE_File::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_File::Process_Identifier( const TokIdentifier & i_rToken ) +{ + switch (eState) + { + case wait_for_module: + { + csv_assert(pCurNamespace != 0); + + ary::idl::Module & rCe = Gate().Ces().CheckIn_Module(pCurNamespace->CeId(), i_rToken.Text()); + pCurNamespace = &rCe; + + // Get docu out of normal: + SetDocu(pTokenAdmin->ReleaseLastParsedDocu()); + PassDocuAt(rCe); + + csv_assert(pCurNamespace != 0); + + SetResult(done, stay); + eState = wait_for_module_bracket; + } break; + case on_default: + SetResult(done, stay); + break; + default: + csv_assert(false); + } +} + +void +PE_File::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + switch (eState) + { + case e_std: + if (i_rToken.Id() == TokPunctuation::CurledBracketClose) + { + csv_assert(pCurNamespace != 0); + + pCurNamespace = &Gate().Ces().Find_Module(pCurNamespace->Owner()); + + SetResult(done, stay); + eState = wait_for_module_semicolon; + } + else + { + csv_assert(false); + } + break; + case wait_for_module_bracket: + if (i_rToken.Id() == TokPunctuation::CurledBracketOpen) + { + SetResult(done, stay); + eState = e_std; + } + else + { + csv_assert(false); + } + break; + case wait_for_module_semicolon: + if (i_rToken.Id() == TokPunctuation::Semicolon) + { + SetResult(done, stay); + eState = e_std; + } + else + { + csv_assert(false); + } + break; + case on_default: + if (i_rToken.Id() == TokPunctuation::CurledBracketClose) + { + nBracketCount_inDefMode--; + } + else if (i_rToken.Id() == TokPunctuation::CurledBracketOpen) + { + nBracketCount_inDefMode++; + } + else if (i_rToken.Id() == TokPunctuation::Semicolon) + { + if (nBracketCount_inDefMode <= 0) + { + eState = e_std; + } + } + SetResult(done, stay); + break; + default: + csv_assert(false); + } +} + +void +PE_File::Process_MetaType( const TokMetaType & i_rToken ) +{ + switch (i_rToken.Id()) + { + case TokMetaType::mt_service: + eState = in_sub_pe; + SetResult( not_done, push_sure, pPE_Service.Ptr()); + break; + case TokMetaType::mt_singleton: + eState = in_sub_pe; + SetResult( not_done, push_sure, pPE_Singleton.Ptr()); + break; + case TokMetaType::mt_uik: + Cerr() << "Syntax error: [uik ....] is obsolete now." << Endl(); + SetResult( not_done, pop_failure); + break; + case TokMetaType::mt_interface: + eState = in_sub_pe; + SetResult( not_done, push_sure, pPE_Interface.Ptr()); + break; + case TokMetaType::mt_module: + eState = wait_for_module; + SetResult( done, stay ); + break; + case TokMetaType::mt_struct: + eState = in_sub_pe; + SetResult( done, push_sure, pPE_Struct.Ptr()); + break; + case TokMetaType::mt_exception: + eState = in_sub_pe; + SetResult( done, push_sure, pPE_Exception.Ptr()); + break; + case TokMetaType::mt_constants: + eState = in_sub_pe; + SetResult( done, push_sure, pPE_Constant.Ptr()); + break; + case TokMetaType::mt_enum: + eState = in_sub_pe; + SetResult( done, push_sure, pPE_Enum.Ptr()); + break; + case TokMetaType::mt_typedef: + eState = in_sub_pe; + SetResult( done, push_sure, pPE_Typedef.Ptr()); + break; + + default: + Process_Default(); + } // end switch +} + +void +PE_File::Process_Stereotype( const TokStereotype & i_rToken ) +{ + if (i_rToken.Id() == TokStereotype::ste_published) + { + pTokenAdmin->Set_PublishedOn(); + + SetResult(done, stay); + } + else + { + Process_Default(); + } +} + +void +PE_File::Process_Default() +{ + if (eState != on_default) + { + eState = on_default; + nBracketCount_inDefMode = 0; + } + SetResult(done, stay); +} + +const ary::idl::Module & +PE_File::CurNamespace() const +{ + csv_assert(pCurNamespace); + return *pCurNamespace; +} + +const ParserInfo & +PE_File::ParseInfo() const +{ + csv_assert(pParseInfo); + return *pParseInfo; +} + +void +PE_File::InitData() +{ + eState = e_std; +} + +void +PE_File::TransferData() +{ + eState = e_none; +} + +void +PE_File::ReceiveData() +{ + eState = e_std; +} + + +UnoIDL_PE & +PE_File::MyPE() +{ + return *this; +} + +} // namespace uidl +} // namespace csi + + diff --git a/autodoc/source/parser_i/idl/pe_func2.cxx b/autodoc/source/parser_i/idl/pe_func2.cxx new file mode 100644 index 000000000000..d41491c9a195 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_func2.cxx @@ -0,0 +1,448 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_func2.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <s2_luidl/pe_func2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_function.hxx> +#include <ary/idl/i_type.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/idl/ip_type.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/pe_vari2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <x_parse2.hxx> + + +namespace csi +{ +namespace uidl +{ + + +PE_Function::PE_Function( const RParent & i_rCurInterface ) + : eState(e_none), + sData_Name(), + nData_ReturnType(0), + bData_Oneway(false), + pCurFunction(0), + pCurParent(&i_rCurInterface), + pPE_Type(0), + nCurParsedType(0), + sName(), + pPE_Variable(0), + eCurParsedParam_Direction(ary::idl::param_in), + nCurParsedParam_Type(0), + sCurParsedParam_Name(), + bIsForConstructors(false) +{ + pPE_Type = new PE_Type(nCurParsedType); + pPE_Variable = new PE_Variable(nCurParsedParam_Type, sCurParsedParam_Name); +} + +PE_Function::PE_Function( const RParent & i_rCurService, + E_Constructor ) + : eState(expect_name), + sData_Name(), + nData_ReturnType(0), + bData_Oneway(false), + pCurFunction(0), + pCurParent(&i_rCurService), + pPE_Type(0), + nCurParsedType(0), + sName(), + pPE_Variable(0), + eCurParsedParam_Direction(ary::idl::param_in), + nCurParsedParam_Type(0), + sCurParsedParam_Name(), + bIsForConstructors(true) +{ + pPE_Type = new PE_Type(nCurParsedType); + pPE_Variable = new PE_Variable(nCurParsedParam_Type, sCurParsedParam_Name); +} + +void +PE_Function::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Variable->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Function::~PE_Function() +{ +} + +void +PE_Function::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Function::Process_Stereotype( const TokStereotype & i_rToken ) +{ + if (eState == e_start) + { + switch (i_rToken.Id()) + { + case TokStereotype::ste_oneway: + bData_Oneway = true; + SetResult(done, stay); + break; + default: + OnDefault(); + } // end switch + } + else + OnDefault(); +} + +void +PE_Function::Process_Identifier( const TokIdentifier & i_rToken ) +{ + switch (eState) + { + case e_start: + GoIntoReturnType(); + break; + case expect_name: + sData_Name = i_rToken.Text(); + SetResult(done,stay); + eState = expect_params_list; + + if (NOT bIsForConstructors) + { + pCurFunction = &Gate().Ces().Store_Function( + *pCurParent, + sData_Name, + nData_ReturnType, + bData_Oneway ); + } + else + { + pCurFunction = &Gate().Ces().Store_ServiceConstructor( + *pCurParent, + sData_Name ); + } + PassDocuAt(*pCurFunction); + break; + case expect_parameter_variable: + GoIntoParameterVariable(); + break; + case expect_exception: + GoIntoException(); + break; + default: + OnDefault(); + } +} + +void +PE_Function::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + switch (eState) + { + case e_start: + SetResult(done,stay); + break; + case expect_params_list: + if (i_rToken.Id() != TokPunctuation::BracketOpen) + { + OnDefault(); + return; + } + SetResult(done,stay); + eState = expect_parameter; + break; + case expect_parameter: + if (i_rToken.Id() == TokPunctuation::BracketClose) + { + SetResult(done,stay); + eState = params_finished; + } + else + { + OnDefault(); + return; + } + break; + case expect_parameter_separator: + if (i_rToken.Id() == TokPunctuation::Comma) + { + SetResult(done,stay); + eState = expect_parameter; + } + else if (i_rToken.Id() == TokPunctuation::BracketClose) + { + SetResult(done,stay); + eState = params_finished; + } + else + { + OnDefault(); + return; + } + break; + case params_finished: + case exceptions_finished: + if (i_rToken.Id() != TokPunctuation::Semicolon) + { + OnDefault(); + return; + } + SetResult(done,pop_success); + eState = e_none; + break; + case expect_exceptions_list: + if (i_rToken.Id() != TokPunctuation::BracketOpen) + { + OnDefault(); + return; + } + SetResult(done,stay); + eState = expect_exception; + break; + case expect_exception_separator: + if (i_rToken.Id() == TokPunctuation::Comma) + { + SetResult(done,stay); + eState = expect_exception; + } + else if (i_rToken.Id() == TokPunctuation::BracketClose) + { + SetResult(done,stay); + eState = exceptions_finished; + } + else + { + OnDefault(); + return; + } + break; + default: + OnDefault(); + } +} + +void +PE_Function::Process_BuiltInType( const TokBuiltInType & i_rToken ) +{ + switch (eState) + { + case e_start: + GoIntoReturnType(); + break; + case expect_parameter_variable: + GoIntoParameterVariable(); + break; + case expect_parameter_separator: + if (i_rToken.Id() != TokBuiltInType::bty_ellipse) + { + OnDefault(); + } + else + { + pCurFunction->Set_Ellipse(); + SetResult(done,stay); + // eState stays the same, because we wait for the closing ")" now. + } + break; + case expect_exception: + GoIntoException(); + break; + default: + OnDefault(); + } // end switch +} + +void +PE_Function::Process_ParameterHandling( const TokParameterHandling & i_rToken ) +{ + if (eState != expect_parameter) + { + OnDefault(); + return; + } + + switch (i_rToken.Id()) + { + case TokParameterHandling::ph_in: + eCurParsedParam_Direction = ary::idl::param_in; + break; + case TokParameterHandling::ph_out: + eCurParsedParam_Direction = ary::idl::param_out; + break; + case TokParameterHandling::ph_inout: + eCurParsedParam_Direction = ary::idl::param_inout; + break; + default: + csv_assert(false); + } + SetResult(done,stay); + eState = expect_parameter_variable; +} + +void +PE_Function::Process_Raises() +{ + if (eState != params_finished) + { + OnDefault(); + return; + } + SetResult(done,stay); + eState = expect_exceptions_list; +} + +void +PE_Function::Process_Default() +{ + switch (eState) + { + case e_start: + GoIntoReturnType(); + break; + case expect_parameter_variable: + GoIntoParameterVariable(); + break; + case expect_exception: + GoIntoException(); + break; + default: + OnDefault(); + } // end switch +} + +void +PE_Function::GoIntoReturnType() +{ + SetResult(not_done, push_sure, pPE_Type.Ptr()); + eState = in_return_type; +} + +void +PE_Function::GoIntoParameterVariable() +{ + SetResult(not_done, push_sure, pPE_Variable.Ptr()); + eState = in_parameter_variable; +} + +void +PE_Function::GoIntoException() +{ + SetResult(not_done, push_sure, pPE_Type.Ptr()); + eState = in_exception; +} + +void +PE_Function::OnDefault() +{ + throw X_AutodocParser(X_AutodocParser::x_Any); +} + +void +PE_Function::InitData() +{ + eState = e_start; + + sData_Name.clear(); + nData_ReturnType = 0; + bData_Oneway = false; + pCurFunction = 0; + + nCurParsedType = 0; + eCurParsedParam_Direction = ary::idl::param_in; + nCurParsedParam_Type = 0; + sCurParsedParam_Name.clear(); + + if (bIsForConstructors) + { + eState = expect_name; + } +} + +void +PE_Function::ReceiveData() +{ + switch (eState) + { + case in_return_type: + nData_ReturnType = nCurParsedType; + nCurParsedType = 0; + eState = expect_name; + break; + case in_parameter_variable: + csv_assert(pCurFunction != 0); + pCurFunction->Add_Parameter( + sCurParsedParam_Name, + nCurParsedParam_Type, + eCurParsedParam_Direction ); + sCurParsedParam_Name = ""; + nCurParsedParam_Type = 0; + eCurParsedParam_Direction = ary::idl::param_in; + eState = expect_parameter_separator; + break; + case in_exception: + csv_assert(pCurFunction != 0); + pCurFunction->Add_Exception(nCurParsedType); + eState = expect_exception_separator; + break; + default: + csv_assert(false); + } // end switch +} + +void +PE_Function::TransferData() +{ + pCurFunction = 0; + eState = e_none; +} + +UnoIDL_PE & +PE_Function::MyPE() +{ + return *this; +} + + + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pe_iface.cxx b/autodoc/source/parser_i/idl/pe_iface.cxx new file mode 100644 index 000000000000..d6418dfcf1d9 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_iface.cxx @@ -0,0 +1,470 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_iface.cxx,v $ + * $Revision: 1.14 $ + * + * 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 <s2_luidl/pe_iface.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_interface.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_func2.hxx> +#include <s2_luidl/pe_attri.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <adc_cl.hxx> + + + +namespace csi +{ +namespace uidl +{ + +#ifdef DF +#undef DF +#endif +#define DF &PE_Interface::On_Default + +PE_Interface::F_TOK +PE_Interface::aDispatcher[PE_Interface::e_STATES_MAX][PE_Interface::tt_MAX] = + { { DF, DF, DF, DF, DF }, // e_none + { &PE_Interface::On_need_uik_MetaType, + DF, DF, DF, DF }, // need_uik + { DF, &PE_Interface::On_uik_Identifier, + &PE_Interface::On_uik_Punctuation, + DF, DF }, // uik + { &PE_Interface::On_need_ident_MetaType, + DF, DF, DF, DF }, // need_ident + { DF, &PE_Interface::On_ident_Identifier, + &PE_Interface::On_ident_Punctuation, + DF, DF }, // ident + { &PE_Interface::On_need_interface_MetaType, + DF, DF, DF, DF }, // need_interface + { DF, &PE_Interface::On_need_name_Identifer, + DF, DF, DF }, // need_name + { DF, DF, &PE_Interface::On_wait_for_base_Punctuation, + DF, DF }, // wait_for_base + { DF, DF, DF, DF, DF }, // in_base + { DF, DF, &PE_Interface::On_need_curlbr_open_Punctuation, + DF, DF }, // need_curlbr_open + { &PE_Interface::On_std_Metatype, + &PE_Interface::On_std_GotoFunction, + &PE_Interface::On_std_Punctuation, + &PE_Interface::On_std_GotoFunction, + &PE_Interface::On_std_Stereotype }, // e_std + { DF, DF, DF, DF, DF }, // in_function + { DF, DF, DF, DF, DF }, // in_attribute + { DF, DF, &PE_Interface::On_need_finish_Punctuation, + DF, DF }, // need_finish + { DF, DF, DF, DF, DF } // in_base_interface + }; + + + +inline void +PE_Interface::CallHandler( const char * i_sTokenText, + E_TokenType i_eTokenType ) + { (this->*aDispatcher[eState][i_eTokenType])(i_sTokenText); } + + + +PE_Interface::PE_Interface() + : eState(e_none), + sData_Name(), + bIsPreDeclaration(false), + pCurInterface(0), + nCurInterface(0), + pPE_Function(0), + pPE_Attribute(0), + pPE_Type(0), + nCurParsed_Base(0), + bOptionalMember(false) +{ + pPE_Function = new PE_Function(nCurInterface); + pPE_Type = new PE_Type(nCurParsed_Base); + pPE_Attribute = new PE_Attribute(nCurInterface); +} + +void +PE_Interface::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Function->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Attribute->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Interface::~PE_Interface() +{ +} + +void +PE_Interface::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + + +void +PE_Interface::Process_MetaType( const TokMetaType & i_rToken ) +{ + CallHandler( i_rToken.Text(), tt_metatype ); +} + +void +PE_Interface::Process_Identifier( const TokIdentifier & i_rToken ) +{ + CallHandler( i_rToken.Text(), tt_identifier ); +} + +void +PE_Interface::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + CallHandler( i_rToken.Text(), tt_punctuation ); +} + +void +PE_Interface::Process_NameSeparator() +{ + CallHandler( "", tt_startoftype ); +} + +void +PE_Interface::Process_BuiltInType( const TokBuiltInType & i_rToken ) +{ + CallHandler( i_rToken.Text(), tt_startoftype ); +} + +void +PE_Interface::Process_TypeModifier( const TokTypeModifier & i_rToken ) +{ + CallHandler( i_rToken.Text(), tt_startoftype ); +} + +void +PE_Interface::Process_Stereotype( const TokStereotype & i_rToken ) +{ + CallHandler( i_rToken.Text(), tt_stereotype ); +} + +void +PE_Interface::Process_Default() +{ + SetResult(done, stay); +} + + +void +PE_Interface::On_need_uik_MetaType(const char *) +{ + // Deprecated, data will be ignored + SetResult(done, stay); + eState = uik; +} + +void +PE_Interface::On_uik_Identifier(const char *) +{ + // Deprecated, data will be ignored + SetResult(done, stay); +} + +void +PE_Interface::On_uik_Punctuation(const char * i_sText) +{ + // Deprecated, data will be ignored + SetResult(done, stay); + if (strcmp(",",i_sText) == 0) + { + eState = need_ident; + } +} + +void +PE_Interface::On_need_ident_MetaType(const char *) +{ + SetResult(done, stay); + eState = ident; +} + +void +PE_Interface::On_ident_Identifier(const char *) +{ + SetResult(done, stay); +} + +void +PE_Interface::On_ident_Punctuation(const char * i_sText) +{ + SetResult(done, stay); + if (strcmp(")",i_sText) == 0) + { + eState = need_interface; + } +} + +void +PE_Interface::On_need_interface_MetaType(const char *) +{ + SetResult(done, stay); + eState = need_name; +} + +void +PE_Interface::On_need_name_Identifer(const char * i_sText) +{ + SetResult(done, stay); + sData_Name = i_sText; + eState = wait_for_base; +} + +void +PE_Interface::On_wait_for_base_Punctuation(const char * i_sText) +{ + if (i_sText[0] != ';') + { + switch (i_sText[0]) + { + case ':': + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_base; + break; + case '{': + store_Interface(); + + SetResult(done,stay); + eState = e_std; + break; + default: + SetResult(not_done, pop_failure); + eState = e_none; + } // end switch + } + else + { + bIsPreDeclaration = true; + SetResult(done, pop_success); + eState = e_none; + } +} + +void +PE_Interface::On_need_curlbr_open_Punctuation(const char * i_sText) +{ + if (i_sText[0] == '{') + { + store_Interface(); + + SetResult(done, stay); + eState = e_std; + } + else { + csv_assert(false); + } +} + + +void +PE_Interface::On_std_Metatype(const char * i_sText) +{ + if (strcmp(i_sText,"attribute") == 0) + On_std_GotoAttribute(i_sText); + else if (strcmp(i_sText,"interface") == 0) + On_std_GotoBaseInterface(i_sText); + else + On_std_GotoFunction(i_sText); +} + +void +PE_Interface::On_std_Punctuation(const char * i_sText) +{ + switch (i_sText[0]) + { + case '}': + SetResult(done, stay); + eState = need_finish; + break; + case ';': // Appears after base interface declarations. + SetResult(done, stay); + break; + default: + SetResult(not_done, pop_failure); + eState = e_none; + } // end switch +} + +void +PE_Interface::On_std_Stereotype(const char * i_sText) +{ + if (strcmp(i_sText,"oneway") == 0) + On_std_GotoFunction(i_sText); + else if ( strcmp(i_sText,"readonly") == 0 + OR strcmp(i_sText,"bound") == 0 ) + On_std_GotoAttribute(i_sText); + else if (strcmp(i_sText,"optional") == 0) + { + bOptionalMember = true; + SetResult(done, stay); + } + else + SetResult(not_done, pop_failure); +} + +void +PE_Interface::On_std_GotoFunction(const char * ) +{ + SetResult(not_done, push_sure, pPE_Function.Ptr()); + eState = in_function; +} + +void +PE_Interface::On_std_GotoAttribute(const char * ) +{ + SetResult(not_done, push_sure, pPE_Attribute.Ptr()); + eState = in_attribute; +} + +void +PE_Interface::On_std_GotoBaseInterface(const char * ) +{ + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_base_interface; +} + +void +PE_Interface::On_need_finish_Punctuation(const char * i_sText) +{ + switch (i_sText[0]) + { + case ';': + SetResult(done, pop_success); + eState = e_none; + break; + default: + SetResult(not_done, pop_failure); + eState = e_none; + } // end switch +} + +void +PE_Interface::On_Default(const char *) +{ + SetResult(not_done, pop_failure); +} + +void +PE_Interface::InitData() +{ + eState = need_interface; + + sData_Name.clear(); + bIsPreDeclaration = false; + pCurInterface = 0; + nCurInterface = 0; + nCurParsed_Base = 0; + bOptionalMember = false; +} + +void +PE_Interface::TransferData() +{ + if (NOT bIsPreDeclaration) + { + csv_assert(sData_Name.size() > 0); + csv_assert(nCurInterface.IsValid()); + } + else + { + sData_Name.clear(); + pCurInterface = 0; + nCurInterface = 0; + } + + eState = e_none; +} + +void +PE_Interface::ReceiveData() +{ + switch (eState) + { + case in_base: + eState = need_curlbr_open; + break; + case in_function: + eState = e_std; + break; + case in_attribute: + eState = e_std; + break; + case in_base_interface: + if (bOptionalMember) + { + pPE_Type->SetOptional(); + bOptionalMember = false; + } + pCurInterface->Add_Base( + nCurParsed_Base, + pPE_Type->ReleaseDocu()); + nCurParsed_Base = 0; + eState = e_std; + break; + default: + csv_assert(false); + } +} + +UnoIDL_PE & +PE_Interface::MyPE() +{ + return *this; +} + +void +PE_Interface::store_Interface() +{ + pCurInterface = & Gate().Ces().Store_Interface( + CurNamespace().CeId(), + sData_Name, + nCurParsed_Base ); + nCurInterface = pCurInterface->CeId(); + PassDocuAt(*pCurInterface); +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_property.cxx b/autodoc/source/parser_i/idl/pe_property.cxx new file mode 100644 index 000000000000..7b065879d012 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_property.cxx @@ -0,0 +1,241 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_property.cxx,v $ + * $Revision: 1.7 $ + * + * 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 <s2_luidl/pe_property.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_property.hxx> +#include <ary/idl/i_service.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_vari2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> + + + +namespace csi +{ +namespace uidl +{ + + + +PE_Property::PE_Property( const Ce_id & i_rCurOwner ) + : eState(e_none), + pCurOwner(&i_rCurOwner), + pPE_Variable(0), + nCurParsedType(0), + sCurParsedName(), + bIsOptional(false), + aStereotypes() +{ + pPE_Variable = new PE_Variable(nCurParsedType, sCurParsedName); +} + +void +PE_Property::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Variable->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Property::~PE_Property() +{ +} + +void +PE_Property::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Property::Process_Stereotype( const TokStereotype & i_rToken ) +{ + switch (i_rToken.Id()) + { + case TokStereotype::ste_optional: + bIsOptional = true; + break; + case TokStereotype::ste_readonly: + aStereotypes.Set_Flag(Stereotypes::readonly); + break; + case TokStereotype::ste_bound: + aStereotypes.Set_Flag(Stereotypes::bound); + break; + case TokStereotype::ste_constrained: + aStereotypes.Set_Flag(Stereotypes::constrained); + break; + case TokStereotype::ste_maybeambiguous: + aStereotypes.Set_Flag(Stereotypes::maybeambiguous); + break; + case TokStereotype::ste_maybedefault: + aStereotypes.Set_Flag(Stereotypes::maybedefault); + break; + case TokStereotype::ste_maybevoid: + aStereotypes.Set_Flag(Stereotypes::maybevoid); + break; + case TokStereotype::ste_removable: + aStereotypes.Set_Flag(Stereotypes::removable); + break; + case TokStereotype::ste_transient: + aStereotypes.Set_Flag(Stereotypes::transient); + break; + + default: + SetResult(not_done, pop_failure); + eState = e_none; + return; + } + + SetResult(done, stay); +} + +void +PE_Property::Process_MetaType( const TokMetaType & i_rToken ) +{ + if (eState == e_start) + { + if ( i_rToken.Id() == TokMetaType::mt_property ) + { + SetResult(done, stay); + eState = expect_variable; + return; + } + } // endif (eState == e_start) + + SetResult(not_done, pop_failure); + eState = e_none; +} + +void +PE_Property::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + switch (eState) + { + case e_start: + SetResult(done, stay); + break; + case expect_variable: + if (i_rToken.Id() == TokPunctuation::Semicolon) + { + SetResult(done, pop_success); + eState = e_none; + } + else if (i_rToken.Id() == TokPunctuation::Comma) + SetResult(done, stay); + else + SetResult(not_done, pop_failure); + break; + default: + csv_assert(false); + } +} + +void +PE_Property::Process_Default() +{ + if (eState == expect_variable) + { + SetResult(not_done, push_sure, pPE_Variable.Ptr()); + eState = in_variable; + } + else + SetResult(not_done, pop_failure); +} + +void +PE_Property::InitData() +{ + eState = e_start; + + nCurParsedType = 0; + sCurParsedName = ""; + + // bIsOptional and + // aStereotypes + // may be preset by the PE_Service-(or PE_Interface-)parent + // with PresetOptional() or + // PresetStereotype() + // - therefore it must not be set here! +} + +void +PE_Property::TransferData() +{ + if (bIsOptional) + { + SetOptional(); + bIsOptional = false; + } + + ary::idl::CodeEntity * + pCe = 0; + csv_assert(pCurOwner->IsValid()); + + pCe = &Gate().Ces().Store_Property( *pCurOwner, + sCurParsedName, + nCurParsedType, + aStereotypes ); + + csv_assert(pCe != 0); + PassDocuAt(*pCe); + + nCurParsedType = 0; + sCurParsedName.clear(); + aStereotypes = Stereotypes(); + + eState = e_none; +} + +void +PE_Property::ReceiveData() +{ + eState = expect_variable; +} + + +UnoIDL_PE & +PE_Property::MyPE() +{ + return *this; +} + + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pe_selem.cxx b/autodoc/source/parser_i/idl/pe_selem.cxx new file mode 100644 index 000000000000..3a525f8b0b2c --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_selem.cxx @@ -0,0 +1,208 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_selem.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <s2_luidl/pe_selem.hxx> + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_struct.hxx> +#include <ary/idl/i_structelem.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> + + +namespace csi +{ +namespace uidl +{ + +namespace +{ + const String C_sNone; +} + +PE_StructElement::PE_StructElement( RStructElement & o_rResult, + const RStruct & i_rCurStruct, + const String & i_rCurStructTemplateParam ) + : eState(e_none), + pResult(&o_rResult), + pCurStruct(&i_rCurStruct), + bIsExceptionElement(false), + pPE_Type(0), + nType(0), + sName(), + pCurStructTemplateParam(&i_rCurStructTemplateParam) +{ + pPE_Type = new PE_Type(nType); +} + +PE_StructElement::PE_StructElement( RStructElement & o_rResult, + const RStruct & i_rCurExc ) + : eState(e_none), + pResult(&o_rResult), + pCurStruct(&i_rCurExc), + bIsExceptionElement(true), + pPE_Type(0), + nType(0), + sName(), + pCurStructTemplateParam(&C_sNone) +{ + pPE_Type = new PE_Type(nType); +} + +void +PE_StructElement::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_StructElement::~PE_StructElement() +{ +} + +void +PE_StructElement::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_StructElement::Process_Default() +{ + if (eState == expect_type) + { + SetResult( not_done, push_sure, pPE_Type.Ptr() ); + eState = expect_name; + } + else { + csv_assert(false); + } +} + +void +PE_StructElement::Process_Identifier( const TokIdentifier & i_rToken ) +{ + csv_assert(*i_rToken.Text() != 0); + + if (eState == expect_type) + { + if ( *pCurStructTemplateParam == i_rToken.Text() ) + { + nType = lhf_FindTemplateParamType(); + SetResult( done, stay ); + eState = expect_name; + } + else // No template parameter type existing, or not matching: + { + SetResult( not_done, push_sure, pPE_Type.Ptr() ); + eState = expect_name; + } + } + else if (eState == expect_name) + { + sName = i_rToken.Text(); + SetResult( done, stay ); + eState = expect_finish; + } + else { + csv_assert(false); + } +} + +void +PE_StructElement::Process_Punctuation( const TokPunctuation &) +{ + csv_assert(eState == expect_finish); + + SetResult( done, pop_success ); +} + +void +PE_StructElement::InitData() +{ + eState = expect_type; + + nType = 0; + sName = ""; +} + +void +PE_StructElement::TransferData() +{ + csv_assert(pResult != 0 AND pCurStruct != 0); + + ary::idl::StructElement * + pCe = 0; + if (bIsExceptionElement) + { + pCe = & Gate().Ces().Store_ExceptionMember( + *pCurStruct, + sName, + nType ); + } + else + { + pCe = & Gate().Ces().Store_StructMember( + *pCurStruct, + sName, + nType ); + } + *pResult = pCe->CeId(); + PassDocuAt(*pCe); + + eState = e_none; +} + +UnoIDL_PE & +PE_StructElement::MyPE() +{ + return *this; +} + +ary::idl::Type_id +PE_StructElement::lhf_FindTemplateParamType() const +{ + const ary::idl::CodeEntity & + rCe = Gate().Ces().Find_Ce(*pCurStruct); + const ary::idl::Struct & + rStruct = static_cast< const ary::idl::Struct& >(rCe); + return rStruct.TemplateParameterType(); +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_servi.cxx b/autodoc/source/parser_i/idl/pe_servi.cxx new file mode 100644 index 000000000000..c540ff1d1820 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_servi.cxx @@ -0,0 +1,396 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_servi.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <s2_luidl/pe_servi.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_service.hxx> +#include <ary/idl/i_siservice.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_func2.hxx> +#include <s2_luidl/pe_property.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> + + + +namespace csi +{ +namespace uidl +{ + + + +PE_Service::PE_Service() + : eState(e_none), + sData_Name(), + bIsPreDeclaration(false), + pCurService(0), + pCurSiService(0), + nCurService(0), + pPE_Property(0), + nCurParsed_Property(0), + pPE_Type(0), + nCurParsed_Type(0), + pPE_Constructor(0), + bOptionalMember(false) +{ + pPE_Property = new PE_Property(nCurService); + pPE_Type = new PE_Type(nCurParsed_Type); + pPE_Constructor = new PE_Function(nCurService, PE_Function::constructor); +} + +void +PE_Service::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Property->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Constructor->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Service::~PE_Service() +{ +} + +void +PE_Service::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + + +void +PE_Service::Process_MetaType( const TokMetaType & i_rToken ) +{ + switch ( i_rToken.Id() ) + { + case TokMetaType::mt_service: + if (eState == need_name) + SetResult(done, stay ); + else if (eState == e_std) + { + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_service_type; + } + else + On_Default(); + break; + case TokMetaType::mt_interface: + if (eState == e_std) + { + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_ifc_type; + } + else + On_Default(); + break; + case TokMetaType::mt_property: + if (eState == e_std) + { + StartProperty(); + } + else + On_Default(); + break; + default: + // KORR_FUTURE: + // Should throw syntax error warning. + ; + } // end switch +} + +void +PE_Service::Process_Identifier( const TokIdentifier & i_rToken ) +{ + if (eState == need_name) + { + sData_Name = i_rToken.Text(); + SetResult(done, stay); + eState = need_curlbr_open; + } + else if (eState == e_std_sib) + { + SetResult(not_done, push_sure, pPE_Constructor.Ptr()); + } + else + On_Default(); +} + +void +PE_Service::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + switch (i_rToken.Id()) + { + case TokPunctuation::Colon: + if (eState == need_curlbr_open) + { + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = need_base_interface; + } + else + On_Default(); + break; + + case TokPunctuation::CurledBracketOpen: + if (eState == need_curlbr_open) + { + pCurService = &Gate().Ces().Store_Service( + CurNamespace().CeId(), + sData_Name ); + nCurService = pCurService->CeId(); + PassDocuAt(*pCurService); + SetResult(done, stay); + eState = e_std; + } + else if (eState == need_curlbr_open_sib) + { + SetResult(done, stay); + eState = e_std_sib; + } + else + On_Default(); + break; + case TokPunctuation::CurledBracketClose: + if (eState == e_std OR eState == e_std_sib) + { + SetResult(done, stay); + eState = need_finish; + } + else + On_Default(); + break; + case TokPunctuation::Comma: + if (eState == expect_ifc_separator) + { + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_ifc_type; + } + else if (eState == expect_service_separator) + { + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_service_type; + } + else if (eState == e_std) + { + SetResult(done, stay); + } + else + On_Default(); + break; + case TokPunctuation::Semicolon: + switch (eState) + { + case need_curlbr_open: + sData_Name.clear(); + bIsPreDeclaration = true; + SetResult(done, pop_success); + eState = e_none; + break; + case need_curlbr_open_sib: + SetResult(done, pop_success); + eState = e_none; + break; + case expect_ifc_separator: + case expect_service_separator: + SetResult(done, stay); + eState = e_std; + break; + case need_finish: + SetResult(done, pop_success); + eState = e_none; + break; + case at_ignore: + SetResult(done, stay); + eState = e_std; + break; + default: + On_Default(); + } // end switch + break; + default: + On_Default(); + } // end switch +} + +void +PE_Service::Process_Stereotype( const TokStereotype & i_rToken ) +{ + if (i_rToken.Id() == TokStereotype::ste_optional) + { + bOptionalMember = true; + SetResult(done, stay); + } + else if ( eState == e_std ) + { + StartProperty(); + } + else + On_Default(); +} + +void +PE_Service::Process_Needs() +{ + SetResult(done,stay); + eState = at_ignore; +} + +void +PE_Service::Process_Observes() +{ + SetResult(done,stay); + eState = at_ignore; +} + +void +PE_Service::Process_Default() +{ + On_Default(); +} + + +void +PE_Service::On_Default() +{ + if (eState == at_ignore) + SetResult(done, stay); + else + SetResult(not_done, pop_failure); +} + +void +PE_Service::InitData() +{ + eState = need_name; + sData_Name.clear(); + bIsPreDeclaration = false; + pCurService = 0; + pCurSiService = 0; + nCurService = 0; + nCurParsed_Property = 0; + nCurParsed_Type = 0; + bOptionalMember = false; +} + +void +PE_Service::TransferData() +{ + if (NOT bIsPreDeclaration) + { + csv_assert(sData_Name.size() > 0); + csv_assert( (pCurService != 0) != (pCurSiService != 0) ); + } + + eState = e_none; +} + +void +PE_Service::ReceiveData() +{ + switch (eState) + { + case in_property: + eState = e_std; + break; + case in_ifc_type: + if (bOptionalMember) + { + pPE_Type->SetOptional(); + } + pCurService->AddRef_SupportedInterface( + nCurParsed_Type, + pPE_Type->ReleaseDocu()); + nCurParsed_Type = 0; + eState = expect_ifc_separator; + break; + case in_service_type: + if (bOptionalMember) + { + pPE_Type->SetOptional(); + } + pCurService->AddRef_IncludedService( + nCurParsed_Type, + pPE_Type->ReleaseDocu()); + nCurParsed_Type = 0; + eState = expect_service_separator; + break; + case need_base_interface: + pCurSiService = &Gate().Ces().Store_SglIfcService( + CurNamespace().CeId(), + sData_Name, + nCurParsed_Type ); + nCurService = pCurSiService->CeId(); + PassDocuAt(*pCurSiService); + + nCurParsed_Type = 0; + eState = need_curlbr_open_sib; + break; + case e_std_sib: + break; + default: + csv_assert(false); + } + + bOptionalMember = false; +} + + +UnoIDL_PE & +PE_Service::MyPE() +{ + return *this; +} + +void +PE_Service::StartProperty() +{ + SetResult(not_done, push_sure, pPE_Property.Ptr()); + eState = in_property; + + if (bOptionalMember) + { + pPE_Property->PresetOptional(); + bOptionalMember = false; + } +} + + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pe_singl.cxx b/autodoc/source/parser_i/idl/pe_singl.cxx new file mode 100644 index 000000000000..2d6cbfa93181 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_singl.cxx @@ -0,0 +1,275 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_singl.cxx,v $ + * $Revision: 1.8 $ + * + * 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 <s2_luidl/pe_singl.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_singleton.hxx> +#include <ary/idl/i_sisingleton.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> + + + +namespace csi +{ +namespace uidl +{ + + + +#if 0 +#ifdef DF +#undef DF +#endif +#define DF &PE_Singleton::On_Default + + +PE_Singleton::F_TOK +PE_Singleton::aDispatcher[PE_Singleton::e_STATES_MAX][PE_Singleton::tt_MAX] = + { { DF, DF, DF }, // e_none + { DF, &PE_Singleton::On_need_name_Identifer, + DF }, // need_name + { DF, DF, &PE_Singleton::On_need_curlbr_open_Punctuation, + }, // need_curlbr_open + { &PE_Singleton::On_std_GotoService, + DF, &PE_Singleton::On_std_Punctuation, + }, // e_std + { DF, DF, DF }, // in_service + { DF, DF, &PE_Interface::On_need_finish_Punctuation, + } // need_finish + }; +#endif // 0 + + +PE_Singleton::PE_Singleton() + : eState(e_none), + sData_Name(), + bIsPreDeclaration(false), + pCurSingleton(0), + pCurSiSingleton(0), + pPE_Type(0), + nCurParsed_Type(0) +{ + pPE_Type = new PE_Type(nCurParsed_Type); +} + +void +PE_Singleton::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Singleton::~PE_Singleton() +{ +} + +void +PE_Singleton::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + + +void +PE_Singleton::Process_MetaType( const TokMetaType & i_rToken ) +{ + switch ( i_rToken.Id() ) + { + case TokMetaType::mt_service: + if (eState == e_std) + { + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_service; + } + else + On_Default(); + break; + case TokMetaType::mt_singleton: + if (eState == need_name) + SetResult(done, stay); + else + On_Default(); + break; + default: + // KORR_FUTURE + // Should throw syntax error warning + ; + + } // end switch +} + +void +PE_Singleton::Process_Identifier( const TokIdentifier & i_rToken ) +{ + if (eState == need_name) + { + sData_Name = i_rToken.Text(); + SetResult(done, stay); + eState = need_curlbr_open; + } + else + On_Default(); +} + +void +PE_Singleton::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + switch (i_rToken.Id()) + { + case TokPunctuation::CurledBracketOpen: + if (eState == need_curlbr_open) + { + pCurSingleton = &Gate().Ces().Store_Singleton( + CurNamespace().CeId(), + sData_Name ); + PassDocuAt(*pCurSingleton); + SetResult(done, stay); + eState = e_std; + } + else + On_Default(); + break; + case TokPunctuation::CurledBracketClose: + if (eState == e_std) + { + SetResult(done, stay); + eState = need_finish; + } + else + On_Default(); + break; + case TokPunctuation::Semicolon: + switch (eState) + { + case e_std: SetResult(done, stay); + break; + case need_finish: + SetResult(done, pop_success); + eState = e_none; + break; + default: + On_Default(); + } // end switch + break; + case TokPunctuation::Colon: + switch (eState) + { + case need_curlbr_open: + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_base_interface; + break; + default: + On_Default(); + } // end switch + break; + default: + On_Default(); + } // end switch +} + +void +PE_Singleton::Process_Default() +{ + On_Default(); +} + + +void +PE_Singleton::On_Default() +{ + SetResult(not_done, pop_failure); +} + +void +PE_Singleton::InitData() +{ + eState = need_name; + sData_Name.clear(); + bIsPreDeclaration = false; + pCurSingleton = 0; + pCurSiSingleton = 0; + nCurParsed_Type = 0; +} + +void +PE_Singleton::TransferData() +{ + if (NOT bIsPreDeclaration) + { + csv_assert(sData_Name.size() > 0); + csv_assert( (pCurSingleton != 0) != (pCurSiSingleton != 0) ); + } + + eState = e_none; +} + +void +PE_Singleton::ReceiveData() +{ + switch (eState) + { + case in_service: + pCurSingleton->Set_Service(nCurParsed_Type); + nCurParsed_Type = 0; + eState = e_std; + break; + case in_base_interface: + pCurSiSingleton = &Gate().Ces().Store_SglIfcSingleton( + CurNamespace().CeId(), + sData_Name, + nCurParsed_Type ); + PassDocuAt(*pCurSiSingleton); + nCurParsed_Type = 0; + eState = need_finish; + break; + default: + csv_assert(false); + } // end switch +} + +UnoIDL_PE & +PE_Singleton::MyPE() +{ + return *this; +} + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_struc.cxx b/autodoc/source/parser_i/idl/pe_struc.cxx new file mode 100644 index 000000000000..fac3cc5304bc --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_struc.cxx @@ -0,0 +1,330 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_struc.cxx,v $ + * $Revision: 1.9 $ + * + * 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 <s2_luidl/pe_struc.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_struct.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/pe_selem.hxx> + + + +namespace csi +{ +namespace uidl +{ + + +PE_Struct::PE_Struct() + // : aWork, + // pStati +{ + pStati = new S_Stati(*this); +} + +void +PE_Struct::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + Work().pPE_Element->EstablishContacts(this,io_rRepository,o_rResult); + Work().pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Struct::~PE_Struct() +{ +} + +void +PE_Struct::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*Stati().pCurStatus); +} + + +void +PE_Struct::InitData() +{ + Work().InitData(); + Stati().pCurStatus = &Stati().aWaitForName; +} + +void +PE_Struct::TransferData() +{ + if (NOT Work().bIsPreDeclaration) + { + csv_assert(Work().sData_Name.size() > 0); + csv_assert(Work().nCurStruct.IsValid()); + } + Stati().pCurStatus = &Stati().aNone; +} + +void +PE_Struct::ReceiveData() +{ + Stati().pCurStatus->On_SubPE_Left(); +} + +PE_Struct::S_Work::S_Work() + : sData_Name(), + sData_TemplateParam(), + bIsPreDeclaration(false), + nCurStruct(0), + pPE_Element(0), + nCurParsed_ElementRef(0), + pPE_Type(0), + nCurParsed_Base(0) + +{ + pPE_Element = new PE_StructElement(nCurParsed_ElementRef,nCurStruct,sData_TemplateParam); + pPE_Type = new PE_Type(nCurParsed_Base); +} + +void +PE_Struct::S_Work::InitData() +{ + sData_Name.clear(); + sData_TemplateParam.clear(); + bIsPreDeclaration = false; + nCurStruct = 0; + nCurParsed_ElementRef = 0; + nCurParsed_Base = 0; +} + +void +PE_Struct::S_Work::Prepare_PE_QualifiedName() +{ + nCurParsed_ElementRef = 0; +} + +void +PE_Struct::S_Work::Prepare_PE_Element() +{ + nCurParsed_Base = 0; +} + +void +PE_Struct::S_Work::Data_Set_Name( const char * i_sName ) +{ + sData_Name = i_sName; +} + +void +PE_Struct::S_Work::Data_Set_TemplateParam( const char * i_sTemplateParam ) +{ + sData_TemplateParam = i_sTemplateParam; +} + +PE_Struct::S_Stati::S_Stati(PE_Struct & io_rStruct) + : aNone(io_rStruct), + aWaitForName(io_rStruct), + aGotName(io_rStruct), + aWaitForTemplateParam(io_rStruct), + aWaitForTemplateEnd(io_rStruct), + aWaitForBase(io_rStruct), + aGotBase(io_rStruct), + aWaitForElement(io_rStruct), + aWaitForFinish(io_rStruct), + pCurStatus(0) +{ + pCurStatus = &aNone; +} + + +//*********************** Stati ***************************// + + +UnoIDL_PE & +PE_Struct::PE_StructState::MyPE() +{ + return rStruct; +} + + +void +PE_Struct::State_WaitForName::Process_Identifier( const TokIdentifier & i_rToken ) +{ + Work().Data_Set_Name(i_rToken.Text()); + MoveState( Stati().aGotName ); + SetResult(done,stay); +} + +void +PE_Struct::State_GotName::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if ( i_rToken.Id() != TokPunctuation::Semicolon ) + { + switch (i_rToken.Id()) + { + case TokPunctuation::Colon: + MoveState( Stati().aWaitForBase ); + SetResult(done,push_sure,Work().pPE_Type.Ptr()); + Work().Prepare_PE_QualifiedName(); + break; + case TokPunctuation::CurledBracketOpen: + PE().store_Struct(); + MoveState( Stati().aWaitForElement ); + SetResult(done,stay); + break; + case TokPunctuation::Lesser: + MoveState( Stati().aWaitForTemplateParam ); + SetResult(done,stay); + break; + default: + SetResult(not_done,pop_failure); + } // end switch + } + else + { + Work().sData_Name.clear(); + SetResult(done,pop_success); + } +} + +void +PE_Struct::State_WaitForTemplateParam::Process_Identifier( const TokIdentifier & i_rToken ) +{ + Work().Data_Set_TemplateParam(i_rToken.Text()); + MoveState( Stati().aWaitForTemplateEnd ); + SetResult(done,stay); +} + +void +PE_Struct::State_WaitForTemplateEnd::Process_Punctuation( const TokPunctuation & ) +{ + // Assume: TokPunctuation::Greater + MoveState( Stati().aGotName ); + SetResult(done,stay); +} + +void +PE_Struct::State_WaitForBase::On_SubPE_Left() +{ + MoveState(Stati().aGotBase); +} + +void +PE_Struct::State_GotBase::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if ( i_rToken.Id() == TokPunctuation::CurledBracketOpen ) + { + PE().store_Struct(); + MoveState( Stati().aWaitForElement ); + SetResult(done,stay); + } + else + { + SetResult(not_done,pop_failure); + } +} + +void +PE_Struct::State_WaitForElement::Process_Identifier( const TokIdentifier & ) +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr() ); + Work().Prepare_PE_Element(); +} + +void +PE_Struct::State_WaitForElement::Process_NameSeparator() +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr()); + Work().Prepare_PE_Element(); +} + +void +PE_Struct::State_WaitForElement::Process_BuiltInType( const TokBuiltInType & ) +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr()); + Work().Prepare_PE_Element(); +} + +void +PE_Struct::State_WaitForElement::Process_TypeModifier(const TokTypeModifier & ) +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr()); + Work().Prepare_PE_Element(); +} + +void +PE_Struct::State_WaitForElement::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if ( i_rToken.Id() == TokPunctuation::CurledBracketClose ) + { + MoveState( Stati().aWaitForFinish ); + SetResult( done, stay ); + } + else + { + SetResult( not_done, pop_failure ); + } +} + +void +PE_Struct::State_WaitForFinish::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if (i_rToken.Id() == TokPunctuation::Semicolon) + { + MoveState( Stati().aNone ); + SetResult( done, pop_success ); + } + else + { + SetResult( not_done, pop_failure ); + } +} + +void +PE_Struct::store_Struct() +{ + ary::idl::Struct & + rCe = Gate().Ces().Store_Struct( + CurNamespace().CeId(), + Work().sData_Name, + Work().nCurParsed_Base, + Work().sData_TemplateParam ); + PassDocuAt(rCe); + Work().nCurStruct = rCe.CeId(); +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_tydf2.cxx b/autodoc/source/parser_i/idl/pe_tydf2.cxx new file mode 100644 index 000000000000..eaac60f0c360 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_tydf2.cxx @@ -0,0 +1,187 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_tydf2.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <s2_luidl/pe_tydf2.hxx> + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_typedef.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_luidl/tk_const.hxx> + + +namespace csi +{ +namespace uidl +{ + + +#ifdef DF +#undef DF +#endif +#define DF &PE_Typedef::On_Default + +PE_Typedef::F_TOK +PE_Typedef::aDispatcher[PE_Typedef::e_STATES_MAX][PE_Typedef::tt_MAX] = + { { DF, DF, DF }, // e_none + { &PE_Typedef::On_expect_description_Any, + &PE_Typedef::On_expect_description_Any, + DF }, // expect_description + { DF, &PE_Typedef::On_expect_name_Identifier, + DF }, // expect_name + { DF, DF, &PE_Typedef::On_got_name_Punctuation } // got_name + }; + + + +inline void +PE_Typedef::CallHandler( const char * i_sTokenText, + E_TokenType i_eTokenType ) + { (this->*aDispatcher[eState][i_eTokenType])(i_sTokenText); } + + + + + +PE_Typedef::PE_Typedef() + : eState(e_none), + pPE_Type(0), + nType(0), + sName() +{ + pPE_Type = new PE_Type(nType); +} + +void +PE_Typedef::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Typedef::~PE_Typedef() +{ +} + +void +PE_Typedef::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Typedef::Process_Identifier( const TokIdentifier & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_identifier); +} + +void +PE_Typedef::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_punctuation); +} + +void +PE_Typedef::Process_Default() +{ + CallHandler("", tt_any); +} + +void +PE_Typedef::On_expect_description_Any(const char *) +{ + SetResult(not_done,push_sure, pPE_Type.Ptr()); +} + +void +PE_Typedef::On_expect_name_Identifier(const char * i_sText) +{ + sName = i_sText; + SetResult(done,stay); + eState = got_name; +} + +void +PE_Typedef::On_got_name_Punctuation(const char * i_sText) +{ + if ( i_sText[0] == ';' ) + { + SetResult(done,pop_success); + eState = e_none; + } + else + On_Default(i_sText); +} + +void +PE_Typedef::On_Default(const char * ) +{ + SetResult(not_done,pop_failure); +} + +void +PE_Typedef::InitData() +{ + eState = expect_description; + nType = 0; + sName = ""; +} + +void +PE_Typedef::ReceiveData() +{ + eState = expect_name; +} + +void +PE_Typedef::TransferData() +{ + ary::idl::Typedef & + rCe = Gate().Ces().Store_Typedef(CurNamespace().CeId(), sName, nType); + PassDocuAt(rCe); + eState = e_none; +} + +UnoIDL_PE & +PE_Typedef::MyPE() +{ + return *this; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pe_type2.cxx b/autodoc/source/parser_i/idl/pe_type2.cxx new file mode 100644 index 000000000000..1752a45d2b59 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_type2.cxx @@ -0,0 +1,317 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_type2.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <s2_luidl/pe_type2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_type.hxx> +#include <ary/idl/ip_type.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/uidl_tok.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_punct.hxx> + + + +/** Implementation Concept for Parsing a Type + +Example Type: + sequence < ::abc::TName< TplType > > AnyName; + +Status Changes: + +expect_type: + sequence -> expect_type + < -> expect_type + :: -> expect_quname_part + abc -> expect_quname_separator + :: -> expect_quname_part + TName -> expect_quname_separator + < -> in_template_type (process in nested PE_Type instance) + + expect_type: + TplType ->expect_quname_separator + > -> e_none (finish, '>' not handled) + + > -> expect_quname_separator + > -> expect_quname_separator (not finish, because sequencecounter > 0) + AnyName -> e_none (finish) +*/ + + +namespace csi +{ +namespace uidl +{ + + +PE_Type::PE_Type( ary::idl::Type_id & o_rResult ) + : pResult(&o_rResult), + nIsSequenceCounter(0), + nSequenceDownCounter(0), + bIsUnsigned(false), + sFullType(), + eState(e_none), + sLastPart(), + pPE_TemplateType(0), // @attention Recursion, only initiate, if needed! + nTemplateType(0), + aTemplateParameters() +{ +} + +PE_Type::~PE_Type() +{ +} + +void +PE_Type::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Type::Process_Identifier( const TokIdentifier & i_rToken ) +{ + if (eState == expect_type) + { + sLastPart = i_rToken.Text(); + eState = expect_quname_separator; + SetResult(done, stay); + } + else if (eState == expect_quname_part) + { + sLastPart = i_rToken.Text(); + eState = expect_quname_separator; + SetResult(done, stay); + } + else if (eState == expect_quname_separator) + { + Finish(); + } +} + +void +PE_Type::Process_NameSeparator() +{ + if (eState == expect_type) + { + sFullType.Init(true); + eState = expect_quname_part; + SetResult(done, stay); + } + else if (eState == expect_quname_separator) + { + sFullType += sLastPart; + eState = expect_quname_part; + SetResult(done, stay); + } +} + +void +PE_Type::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if (eState == expect_type) + { + csv_assert(i_rToken.Id() == TokPunctuation::Lesser); + SetResult(done, stay); + } + else if (eState == expect_quname_separator) + { + switch (i_rToken.Id()) + { + case TokPunctuation::Lesser: + eState = in_template_type; + SetResult( done, push_sure, &MyTemplateType() ); + break; + + case TokPunctuation::Greater: + if (nSequenceDownCounter > 0) + { + nSequenceDownCounter--; + SetResult(done, stay); + } + else + { + Finish(); + } + break; + + default: + Finish(); + } // end switch + } + else if (eState == in_template_type) + { + aTemplateParameters.push_back(nTemplateType); + nTemplateType = 0; + + if (i_rToken.Id() == TokPunctuation::Greater) + { + eState = expect_quname_separator; + SetResult(done, stay); + } + else if (i_rToken.Id() == TokPunctuation::Comma) + { + SetResult(done, push_sure, &MyTemplateType()); + } + else + { + csv_assert(false); + Finish(); + } + } +} + +void +PE_Type::Process_BuiltInType( const TokBuiltInType & i_rToken ) +{ + if (eState == expect_type) + { + sLastPart = i_rToken.Text(); + eState = expect_quname_separator; + SetResult(done, stay); + } + else if (eState == expect_quname_part) + { + // Can this happen? + + sLastPart = i_rToken.Text(); + eState = expect_quname_separator; + SetResult(done, stay); + } + else if (eState == expect_quname_separator) + { + // Can this happen? + + Finish(); + } +} + +void +PE_Type::Process_TypeModifier( const TokTypeModifier & i_rToken ) +{ + if (eState == expect_type) + { + switch ( i_rToken.Id() ) + { + case TokTypeModifier::tmod_unsigned: + bIsUnsigned = true; + break; + case TokTypeModifier::tmod_sequence: + nIsSequenceCounter++; + nSequenceDownCounter++; + break; + default: + csv_assert(false); + } + SetResult(done, stay); + } + else if (eState == expect_quname_separator) + { + // Can this happen? + + Finish(); + } +} + +void +PE_Type::Process_Default() +{ + Finish(); +} + +void +PE_Type::Finish() +{ + csv_assert(nSequenceDownCounter == 0); + + sFullType.SetLocalName(sLastPart); + SetResult(not_done, pop_success); +} + +PE_Type & +PE_Type::MyTemplateType() +{ + if (NOT pPE_TemplateType) + { + pPE_TemplateType = new PE_Type(nTemplateType); + pPE_TemplateType->EstablishContacts( this, + MyRepository(), + TokenResult() ); + } + return *pPE_TemplateType; +} + +void +PE_Type::InitData() +{ + eState = expect_type; + + nIsSequenceCounter = 0; + nSequenceDownCounter = 0; + bIsUnsigned = false; + sFullType.Empty(); + sLastPart.clear(); + nTemplateType = 0; + csv::erase_container(aTemplateParameters); +} + +void +PE_Type::TransferData() +{ + if (bIsUnsigned) + { + StreamLock sl(40); + String sName( sl() << "unsigned " << sFullType.LocalName() << c_str ); + sFullType.SetLocalName(sName); + } + + const ary::idl::Type & + result = Gate().Types().CheckIn_Type( sFullType, + nIsSequenceCounter, + CurNamespace().CeId(), + &aTemplateParameters ); + *pResult = result.TypeId(); + eState = e_none; +} + +UnoIDL_PE & +PE_Type::MyPE() +{ + return *this; +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_vari2.cxx b/autodoc/source/parser_i/idl/pe_vari2.cxx new file mode 100644 index 000000000000..a06d90be8417 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_vari2.cxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_vari2.cxx,v $ + * $Revision: 1.11 $ + * + * 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 <s2_luidl/pe_vari2.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_property.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> + + +namespace csi +{ +namespace uidl +{ + + +PE_Variable::PE_Variable( ary::idl::Type_id & i_rResult_Type, + String & i_rResult_Name ) + : eState(e_none), + pResult_Type(&i_rResult_Type), + pResult_Name(&i_rResult_Name), + pPE_Type(0) +{ + pPE_Type = new PE_Type(i_rResult_Type); +} + +void +PE_Variable::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Variable::~PE_Variable() +{ +} + +void +PE_Variable::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + + +void +PE_Variable::Process_Default() +{ + if (eState == expect_type) + { + SetResult( not_done, push_sure, pPE_Type.Ptr() ); + } + else{ + csv_assert(false); + } +} + +void +PE_Variable::Process_Identifier( const TokIdentifier & i_rToken ) +{ + if (eState == expect_type) + { + SetResult( not_done, push_sure, pPE_Type.Ptr() ); + } + else if (eState == expect_name) + { + *pResult_Name = i_rToken.Text(); + SetResult( done, stay ); + eState = expect_finish; + } + else { + csv_assert(false); + } +} + +void +PE_Variable::Process_Punctuation( const TokPunctuation & ) +{ + if (eState == expect_finish) + { + SetResult( not_done, pop_success ); + eState = e_none; + } + else if (eState == expect_name) + { + SetResult( not_done, pop_success ); + eState = e_none; + } + else { + csv_assert(false); + } +} + +void +PE_Variable::Process_BuiltInType( const TokBuiltInType & i_rToken ) +{ + if (eState == expect_type) + { + SetResult( not_done, push_sure, pPE_Type.Ptr() ); + } + else if (eState == expect_name AND i_rToken.Id() == TokBuiltInType::bty_ellipse) + { + SetResult( not_done, pop_success ); + eState = e_none; + } + else { + csv_assert(false); + } +} + +void +PE_Variable::InitData() +{ + eState = expect_type; + + *pResult_Type = 0; + *pResult_Name = ""; +} + +void +PE_Variable::ReceiveData() +{ + eState = expect_name; +} + +void +PE_Variable::TransferData() +{ + eState = e_none; +} + +UnoIDL_PE & +PE_Variable::MyPE() +{ + return *this; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pestate.cxx b/autodoc/source/parser_i/idl/pestate.cxx new file mode 100644 index 000000000000..3a427fa96da1 --- /dev/null +++ b/autodoc/source/parser_i/idl/pestate.cxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pestate.cxx,v $ + * $Revision: 1.7 $ + * + * 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 <s2_luidl/pestate.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/parsenv2.hxx> + + + + +namespace csi +{ +namespace uidl +{ + +void +ParseEnvState::Process_Identifier( const TokIdentifier & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_NameSeparator() +{ + Process_Default(); +} + +void +ParseEnvState::Process_Punctuation( const TokPunctuation & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_BuiltInType( const TokBuiltInType & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_TypeModifier( const TokTypeModifier & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_MetaType( const TokMetaType & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_Stereotype( const TokStereotype & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_ParameterHandling( const TokParameterHandling & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_Raises() +{ + Process_Default(); +} + +void +ParseEnvState::Process_Needs() +{ + Process_Default(); +} + +void +ParseEnvState::Process_Observes() +{ + Process_Default(); +} + +void +ParseEnvState::Process_Assignment( const TokAssignment & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_EOL() +{ + MyPE().SetResult(done,stay); +} + + +void +ParseEnvState::On_SubPE_Left() +{ +} + +void +ParseEnvState::Process_Default() +{ + if (bDefaultIsError) + MyPE().SetResult(not_done, pop_failure); + else // ignore: + MyPE().SetResult(done, stay); +} + + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/semnode.cxx b/autodoc/source/parser_i/idl/semnode.cxx new file mode 100644 index 000000000000..7539dea56814 --- /dev/null +++ b/autodoc/source/parser_i/idl/semnode.cxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: semnode.cxx,v $ + * $Revision: 1.9 $ + * + * 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 <s2_luidl/semnode.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/ary.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/parsenv2.hxx> + + +namespace csi +{ +namespace uidl +{ + + + +SemanticNode::SemanticNode() + : pParentPE(0), + pAryGate(0), + pTokenResult(0) +{ +} + +void +SemanticNode::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::idl::Gate & io_rGate, + TokenProcessing_Result & o_rResult ) +{ + pParentPE = io_pParentPE; + pAryGate = &io_rGate; + pTokenResult = &o_rResult; +} + +SemanticNode::~SemanticNode() +{ +} + +void +SemanticNode::SetTokenResult( E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + UnoIDL_PE * i_pParseEnv2Push ) +{ + csv_assert(pTokenResult != 0); + + pTokenResult->eDone = i_eDone; + pTokenResult->eStackAction = i_eWhat2DoWithEnvStack; + pTokenResult->pEnv2Push = i_pParseEnv2Push; +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/tk_const.cxx b/autodoc/source/parser_i/idl/tk_const.cxx new file mode 100644 index 000000000000..603cc640e2d4 --- /dev/null +++ b/autodoc/source/parser_i/idl/tk_const.cxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_const.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <s2_luidl/tk_const.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <s2_luidl/tokintpr.hxx> + + + +namespace csi +{ +namespace uidl +{ + + +void +TokAssignment::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Assignment(*this); +} + +const char * +TokAssignment::Text() const +{ + return sText; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/tk_ident.cxx b/autodoc/source/parser_i/idl/tk_ident.cxx new file mode 100644 index 000000000000..6cd158772aef --- /dev/null +++ b/autodoc/source/parser_i/idl/tk_ident.cxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_ident.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <s2_luidl/tk_ident.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <s2_luidl/tokintpr.hxx> + + + +namespace csi +{ +namespace uidl +{ + +void +TokIdentifier::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Identifier(*this); +} + +const char * +TokIdentifier::Text() const +{ + return sText; +} + +void +TokNameSeparator::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_NameSeparator(); +} + +const char * +TokNameSeparator::Text() const +{ + return "::"; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/tk_keyw.cxx b/autodoc/source/parser_i/idl/tk_keyw.cxx new file mode 100644 index 000000000000..0a95666b7cdd --- /dev/null +++ b/autodoc/source/parser_i/idl/tk_keyw.cxx @@ -0,0 +1,228 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_keyw.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <s2_luidl/tk_keyw.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <s2_luidl/tokintpr.hxx> + + +using csi::uidl::TokBuiltInType; +using csi::uidl::TokTypeModifier; +using csi::uidl::TokMetaType; +using csi::uidl::TokStereotype; +using csi::uidl::TokParameterHandling; + + +lux::EnumValueMap G_aTokBuiltInType_EV_TokenId_Values; +TokBuiltInType::EV_TokenId ev_bty_none(TokBuiltInType::e_none,""); +TokBuiltInType::EV_TokenId ev_bty_any(TokBuiltInType::bty_any,"any"); +TokBuiltInType::EV_TokenId ev_bty_boolean(TokBuiltInType::bty_boolean,"boolean"); +TokBuiltInType::EV_TokenId ev_bty_byte(TokBuiltInType::bty_byte,"byte"); +TokBuiltInType::EV_TokenId ev_bty_char(TokBuiltInType::bty_char,"char"); +TokBuiltInType::EV_TokenId ev_bty_double(TokBuiltInType::bty_double,"double"); +TokBuiltInType::EV_TokenId ev_bty_hyper(TokBuiltInType::bty_hyper,"hyper"); +TokBuiltInType::EV_TokenId ev_bty_long(TokBuiltInType::bty_long,"long"); +TokBuiltInType::EV_TokenId ev_bty_short(TokBuiltInType::bty_short,"short"); +TokBuiltInType::EV_TokenId ev_bty_string(TokBuiltInType::bty_string,"string"); +TokBuiltInType::EV_TokenId ev_bty_void(TokBuiltInType::bty_void,"void"); +TokBuiltInType::EV_TokenId ev_bty_ellipse(TokBuiltInType::bty_ellipse,"..."); + + +lux::EnumValueMap G_aTokTypeModifier_EV_TokenId_Values; +TokTypeModifier::EV_TokenId ev_tmod_none(TokTypeModifier::e_none,""); +TokTypeModifier::EV_TokenId ev_tmod_unsigned(TokTypeModifier::tmod_unsigned,"unsigned"); +TokTypeModifier::EV_TokenId ev_tmod_sequence(TokTypeModifier::tmod_sequence,"sequence"); + + +lux::EnumValueMap G_aTokMetaType_EV_TokenId_Values; +TokMetaType::EV_TokenId ev_mt_none(TokMetaType::e_none,""); +TokMetaType::EV_TokenId ev_mt_attribute(TokMetaType::mt_attribute,"attribute"); +TokMetaType::EV_TokenId ev_mt_constants(TokMetaType::mt_constants,"constants"); +TokMetaType::EV_TokenId ev_mt_enum(TokMetaType::mt_enum,"enum"); +TokMetaType::EV_TokenId ev_mt_exception(TokMetaType::mt_exception,"exception"); +TokMetaType::EV_TokenId ev_mt_ident(TokMetaType::mt_ident,"ident"); +TokMetaType::EV_TokenId ev_mt_interface(TokMetaType::mt_interface,"interface"); +TokMetaType::EV_TokenId ev_mt_module(TokMetaType::mt_module,"module"); +TokMetaType::EV_TokenId ev_mt_property(TokMetaType::mt_property,"property"); +TokMetaType::EV_TokenId ev_mt_service(TokMetaType::mt_service,"service"); +TokMetaType::EV_TokenId ev_mt_singleton(TokMetaType::mt_singleton,"singleton"); +TokMetaType::EV_TokenId ev_mt_struct(TokMetaType::mt_struct,"struct"); +TokMetaType::EV_TokenId ev_mt_typedef(TokMetaType::mt_typedef,"typedef"); +TokMetaType::EV_TokenId ev_mt_uik(TokMetaType::mt_uik,"uik"); + + +lux::EnumValueMap G_aTokStereotype_EV_TokenId_Values; +TokStereotype::EV_TokenId ev_ste_none(TokStereotype::e_none,""); +TokStereotype::EV_TokenId ev_ste_bound(TokStereotype::ste_bound,"bound"); +TokStereotype::EV_TokenId ev_ste_const(TokStereotype::ste_const,"const"); +TokStereotype::EV_TokenId ev_ste_constrained(TokStereotype::ste_constrained,"constrained"); +TokStereotype::EV_TokenId ev_ste_maybeambiguous(TokStereotype::ste_maybeambiguous,"maybeambiguous"); +TokStereotype::EV_TokenId ev_ste_maybedefault(TokStereotype::ste_maybedefault,"maybedefault"); +TokStereotype::EV_TokenId ev_ste_maybevoid(TokStereotype::ste_maybevoid,"maybevoid"); +TokStereotype::EV_TokenId ev_ste_oneway(TokStereotype::ste_oneway,"oneway"); +TokStereotype::EV_TokenId ev_ste_optional(TokStereotype::ste_optional,"optional"); +TokStereotype::EV_TokenId ev_ste_readonly(TokStereotype::ste_readonly,"readonly"); +TokStereotype::EV_TokenId ev_ste_removable(TokStereotype::ste_removable,"removable"); +TokStereotype::EV_TokenId ev_ste_virtual(TokStereotype::ste_virtual,"virtual"); +TokStereotype::EV_TokenId ev_ste_transient(TokStereotype::ste_transient,"transient"); +TokStereotype::EV_TokenId ev_ste_published(TokStereotype::ste_published,"published"); + + +lux::EnumValueMap G_aTokParameterHandling_EV_TokenId_Values; +TokParameterHandling::EV_TokenId ev_ph_none(TokParameterHandling::e_none,""); +TokParameterHandling::EV_TokenId ev_ph_in(TokParameterHandling::ph_in,"in"); +TokParameterHandling::EV_TokenId ev_ph_out(TokParameterHandling::ph_out,"out"); +TokParameterHandling::EV_TokenId ev_ph_inout(TokParameterHandling::ph_inout,"inout"); + + +namespace lux +{ + +template<> EnumValueMap & +TokBuiltInType::EV_TokenId::Values_() { return G_aTokBuiltInType_EV_TokenId_Values; } +template<> EnumValueMap & +TokTypeModifier::EV_TokenId::Values_() { return G_aTokTypeModifier_EV_TokenId_Values; } +template<> EnumValueMap & +TokMetaType::EV_TokenId::Values_() { return G_aTokMetaType_EV_TokenId_Values; } +template<> EnumValueMap & +TokStereotype::EV_TokenId::Values_() { return G_aTokStereotype_EV_TokenId_Values; } +template<> EnumValueMap & +TokParameterHandling::EV_TokenId::Values_() { return G_aTokParameterHandling_EV_TokenId_Values; } + +} // namespace lux + + + +namespace csi +{ +namespace uidl +{ + +void +TokBuiltInType::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_BuiltInType(*this); +} + +const char * +TokBuiltInType::Text() const +{ + return eTag.Text(); +} + +void +TokTypeModifier::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_TypeModifier(*this); +} + +const char * +TokTypeModifier::Text() const +{ + return eTag.Text(); +} + +void +TokMetaType::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_MetaType(*this); +} + +const char * +TokMetaType::Text() const +{ + return eTag.Text(); +} + +void +TokStereotype::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Stereotype(*this); +} + +const char * +TokStereotype::Text() const +{ + return eTag.Text(); +} + +void +TokParameterHandling::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_ParameterHandling(*this); +} + +const char * +TokParameterHandling::Text() const +{ + return eTag.Text(); +} + +void +TokRaises::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Raises(); +} + +const char * +TokRaises::Text() const +{ + return "raises"; +} + +void +TokNeeds::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Needs(); +} + +const char * +TokNeeds::Text() const +{ + return "needs"; +} +void +TokObserves::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Observes(); +} + +const char * +TokObserves::Text() const +{ + return "observes"; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/tk_punct.cxx b/autodoc/source/parser_i/idl/tk_punct.cxx new file mode 100644 index 000000000000..64bfe2d9e21d --- /dev/null +++ b/autodoc/source/parser_i/idl/tk_punct.cxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_punct.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <s2_luidl/tk_punct.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <parser/parserinfo.hxx> +#include <s2_luidl/tokintpr.hxx> + + +using csi::uidl::TokPunctuation; + + +lux::EnumValueMap G_aTokPunctuation_EV_TokenId_Values; +TokPunctuation::EV_TokenId ev_none(TokPunctuation::e_none,""); +TokPunctuation::EV_TokenId BracketOpen(TokPunctuation::BracketOpen,"("); +TokPunctuation::EV_TokenId BracketClose(TokPunctuation::BracketClose,")"); +TokPunctuation::EV_TokenId ArrayBracketOpen(TokPunctuation::ArrayBracketOpen,"["); +TokPunctuation::EV_TokenId ArrayBracketClose(TokPunctuation::ArrayBracketClose,"]"); +TokPunctuation::EV_TokenId CurledBracketOpen(TokPunctuation::CurledBracketOpen,"{"); +TokPunctuation::EV_TokenId CurledBracketClose(TokPunctuation::CurledBracketClose,"}"); +TokPunctuation::EV_TokenId Semicolon(TokPunctuation::Semicolon,";"); +TokPunctuation::EV_TokenId Colon(TokPunctuation::Colon,":"); +TokPunctuation::EV_TokenId DoubleColon(TokPunctuation::DoubleColon,"::"); +TokPunctuation::EV_TokenId Comma(TokPunctuation::Comma,","); +TokPunctuation::EV_TokenId Minus(TokPunctuation::Minus,"-"); +TokPunctuation::EV_TokenId Fullstop(TokPunctuation::Fullstop,"."); +TokPunctuation::EV_TokenId Lesser(TokPunctuation::Lesser,"<"); +TokPunctuation::EV_TokenId Greater(TokPunctuation::Greater,">"); + + + + +namespace lux +{ +template<> EnumValueMap & +TokPunctuation::EV_TokenId::Values_() { return G_aTokPunctuation_EV_TokenId_Values; } +} + + + + +namespace csi +{ +namespace uidl +{ + +void +TokPunctuation::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Punctuation(*this); +} + +const char * +TokPunctuation::Text() const +{ + return eTag.Text(); +} + +void +Tok_EOL::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_EOL(); +} + +const char * +Tok_EOL::Text() const +{ + return "\r\n"; +} + +void +Tok_EOF::Trigger( TokenInterpreter & ) const +{ + csv_assert(false); +// io_rInterpreter.Process_EOF(); +} + +const char * +Tok_EOF::Text() const +{ + return ""; +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/tkp_uidl.cxx b/autodoc/source/parser_i/idl/tkp_uidl.cxx new file mode 100644 index 000000000000..7ee2e36683b7 --- /dev/null +++ b/autodoc/source/parser_i/idl/tkp_uidl.cxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkp_uidl.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <s2_luidl/tkp_uidl.hxx> + +// NOT FULLY DECLARED SERVICES +#include <s2_luidl/cx_idlco.hxx> + + + +namespace csi +{ +namespace uidl +{ + + +TokenParser_Uidl::TokenParser_Uidl( Token_Receiver & o_rUidlReceiver, + DYN ::TkpDocuContext & let_drDocuContext ) + : pBaseContext(new Context_UidlCode(o_rUidlReceiver, let_drDocuContext)), + pCurContext(0) +{ + SetStartContext(); +} + +TokenParser_Uidl::~TokenParser_Uidl() +{ +} + +void +TokenParser_Uidl::SetStartContext() +{ + pCurContext = pBaseContext.Ptr(); +} + +void +TokenParser_Uidl::SetCurrentContext( TkpContext & io_rContext ) +{ + pCurContext = &io_rContext; +} + +TkpContext & +TokenParser_Uidl::CurrentContext() +{ + return *pCurContext; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/unoidl.cxx b/autodoc/source/parser_i/idl/unoidl.cxx new file mode 100644 index 000000000000..e8f86c885363 --- /dev/null +++ b/autodoc/source/parser_i/idl/unoidl.cxx @@ -0,0 +1,179 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: unoidl.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <parser/unoidl.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <stdlib.h> +#include <cosv/file.hxx> +#include <ary/ary.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <../parser/inc/x_docu.hxx> +#include <parser/parserinfo.hxx> +#include <tools/filecoll.hxx> +#include <tools/tkpchars.hxx> +#include <s2_luidl/tkp_uidl.hxx> +#include <s2_luidl/distrib.hxx> +#include <s2_luidl/pe_file2.hxx> +#include <s2_dsapi/cx_dsapi.hxx> +#include <adc_msg.hxx> +#include <x_parse2.hxx> + + + +namespace autodoc +{ + + +class FileParsePerformers +{ + public: + FileParsePerformers( + ary::Repository & + io_rRepository, + ParserInfo & io_rParserInfo ); + + void ParseFile( + const char * i_sFullPath ); + + void ConnectLinks(); + + private: + CharacterSource aFileLoader; + Dyn<csi::uidl::TokenParser_Uidl> + pTokens; + csi::uidl::TokenDistributor + aDistributor; + Dyn<csi::uidl::PE_File> + pFileParseEnvironment; + ary::Repository & + rRepository; + ParserInfo & rParserInfo; +}; + + +IdlParser::IdlParser( ary::Repository & io_rRepository ) + : pRepository(&io_rRepository) +{ +} + +void +IdlParser::Run( const autodoc::FileCollector_Ifc & i_rFiles ) +{ + Dyn<FileParsePerformers> + pFileParsePerformers( + new FileParsePerformers(*pRepository, + static_cast< ParserInfo& >(*this)) ); + + FileCollector::const_iterator iEnd = i_rFiles.End(); + for ( FileCollector::const_iterator iter = i_rFiles.Begin(); + iter != iEnd; + ++iter ) + { + Cout() << (*iter) << " ..."<< Endl(); + + try + { + pFileParsePerformers->ParseFile(*iter); + } + catch (X_AutodocParser &) + { + /// Ignore and goon + TheMessages().Out_ParseError(CurFile(), CurLine()); + pFileParsePerformers + = new FileParsePerformers(*pRepository, + static_cast< ParserInfo& >(*this)); + } + catch (X_Docu & xd) + { + // Currently thic catches only wrong since tags, while since tags are + // transformed. In this case the program shall be terminated. + Cerr() << xd << Endl(); + exit(1); + } + catch (...) + { + Cout() << "Unknown error." << Endl(); + exit(0); +// pFileParsePerformers = new FileParsePerformers( *pRepository ); + } + } + + pFileParsePerformers->ConnectLinks(); +} + +FileParsePerformers::FileParsePerformers( ary::Repository & io_rRepository, + ParserInfo & io_rParserInfo ) + : pTokens(0), + aDistributor(io_rRepository, io_rParserInfo), + rRepository( io_rRepository ), + rParserInfo(io_rParserInfo) +{ + DYN csi::dsapi::Context_Docu * + dpDocuContext + = new csi::dsapi::Context_Docu( aDistributor.DocuTokens_Receiver() ); + pTokens = new csi::uidl::TokenParser_Uidl( aDistributor.CodeTokens_Receiver(), *dpDocuContext ); + pFileParseEnvironment + = new csi::uidl::PE_File(aDistributor,rParserInfo); + + aDistributor.SetTokenProvider(*pTokens); + aDistributor.SetTopParseEnvironment(*pFileParseEnvironment); +} + +void +FileParsePerformers::ParseFile( const char * i_sFullPath ) +{ + csv::File aFile(i_sFullPath); + + aFile.open( csv::CFM_READ ); + csv_assert( aFile.is_open() ); + aFileLoader.LoadText(aFile); + aFile.close(); + + rParserInfo.Set_CurFile(i_sFullPath, true); // true = count lines + pTokens->Start(aFileLoader); + aDistributor.Reset(); + + do { + aDistributor.TradeToken(); + } while ( NOT aFileLoader.IsFinished() ); +} + +void +FileParsePerformers::ConnectLinks() +{ + // KORR_FUTURE ? +// rRepository.RwGate_Idl().ConnectAdditionalLinks(); +} + +} // namespace autodoc diff --git a/autodoc/source/parser_i/idoc/cx_docu2.cxx b/autodoc/source/parser_i/idoc/cx_docu2.cxx new file mode 100644 index 000000000000..bee8c034ea66 --- /dev/null +++ b/autodoc/source/parser_i/idoc/cx_docu2.cxx @@ -0,0 +1,270 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_docu2.cxx,v $ + * $Revision: 1.8 $ + * + * 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 <s2_dsapi/cx_docu2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <../../parser/inc/tokens/parseinc.hxx> +#include <s2_dsapi/tokrecv.hxx> +#include <s2_dsapi/tk_html.hxx> +#include <s2_dsapi/tk_xml.hxx> +#include <s2_dsapi/tk_docw2.hxx> +#include <x_parse2.hxx> + + + +namespace csi +{ +namespace dsapi +{ + + + +bool +Cx_Base::PassNewToken() +{ + if (pNewToken) + { + rReceiver.Receive(*pNewToken.Release()); + + return true; + } + return false; +} + +TkpContext & +Cx_Base::FollowUpContext() +{ + csv_assert(pFollowUpContext != 0); + return *pFollowUpContext; +} + +void +Cx_Base::Handle_DocuSyntaxError( CharacterSource & io_rText ) +{ + // KORR_FUTURE + // Put this into Error Log File + + Cerr() << "Error: Syntax error in documentation within " + << "this text:\n\"" + << io_rText.CutToken() + << "\"." + << Endl(); + SetToken( new Tok_Word(io_rText.CurToken()) ); +} + +void +Cx_EoHtml::ReadCharChain( CharacterSource & io_rText ) +{ + if ( NULCH == jumpTo(io_rText,'>') ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + io_rText.MoveOn(); + SetToken(new Tok_HtmlTag(io_rText.CutToken(),bToken_IsStartOfParagraph)); +} + +void +Cx_EoXmlConst::ReadCharChain( CharacterSource & io_rText ) +{ + char c = jumpTo(io_rText,'>','*'); + if ( NULCH == c OR '*' == c ) + { + Handle_DocuSyntaxError(io_rText); + return; + } + + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken(new Tok_XmlConst(eTokenId)); +} + +void +Cx_EoXmlLink_BeginTag::ReadCharChain( CharacterSource & io_rText ) +{ + String sScope; + String sDim; + + do { + char cReached = jumpTo(io_rText,'"','>','*'); + switch (cReached) + { + case '"': + { + io_rText.MoveOn(); + io_rText.CutToken(); + char c = jumpTo(io_rText,'"','*', '>'); + if ( NULCH == c OR '*' == c OR '>' == c) + { + if ( '>' == c ) + io_rText.MoveOn(); + Handle_DocuSyntaxError(io_rText); + return; + } + + const char * pAttribute = io_rText.CutToken(); + if ( *pAttribute != '[' ) + sScope = pAttribute; + else + sDim = pAttribute; + + io_rText.MoveOn(); + break; + } + case '>': + break; + case '*': + Handle_DocuSyntaxError(io_rText); + return; + default: + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + } // end switch + } while ( io_rText.CurChar() != '>' ); + + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken( new Tok_XmlLink_BeginTag(eTokenId, sScope.c_str(), sDim.c_str()) ); +} + +void +Cx_EoXmlLink_EndTag::ReadCharChain( CharacterSource & io_rText ) +{ + char c = jumpTo(io_rText,'>','*'); + if ( NULCH == c OR '*' == c ) + { + Handle_DocuSyntaxError(io_rText); + return; + } + + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken(new Tok_XmlLink_EndTag(eTokenId)); +} + +void +Cx_EoXmlFormat_BeginTag::ReadCharChain( CharacterSource & io_rText ) +{ + String sDim; + + char cReached = jumpTo(io_rText,'"','>','*'); + switch (cReached) + { + case '"': + { + io_rText.MoveOn(); + io_rText.CutToken(); + + char c = jumpTo(io_rText,'"','*','>'); + if ( NULCH == c OR '*' == c OR '>' == c ) + { + if ('>' == c ) + io_rText.MoveOn(); + Handle_DocuSyntaxError(io_rText); + return; + } + + sDim = io_rText.CutToken(); + + c = jumpTo(io_rText,'>','*'); + if ( NULCH == c OR '*' == c ) + { + Handle_DocuSyntaxError(io_rText); + return; + } + break; + } + case '>': + break; + case '*': + Handle_DocuSyntaxError(io_rText); + return; + default: + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + } // end switch + + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken(new Tok_XmlFormat_BeginTag(eTokenId, sDim)); +} + +void +Cx_EoXmlFormat_EndTag::ReadCharChain( CharacterSource & io_rText ) +{ + char c = jumpTo(io_rText,'>','*'); + if ( NULCH == c OR '*' == c ) + { + Handle_DocuSyntaxError(io_rText); + return; + } + + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken(new Tok_XmlFormat_EndTag(eTokenId)); +} + +void +Cx_CheckStar::ReadCharChain( CharacterSource & io_rText ) +{ + bEndTokenFound = false; + if (bIsEnd) + { + char cNext = jumpOver(io_rText,'*'); + if ( NULCH == cNext ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + if (cNext == '/') + { + io_rText.MoveOn(); + SetToken(new Tok_DocuEnd); + bEndTokenFound = true; + } + else + { + SetToken( new Tok_Word(io_rText.CutToken()) ); + } + } + else + { + jumpToWhite(io_rText); + SetToken( new Tok_Word(io_rText.CutToken()) ); + } +} + +TkpContext & +Cx_CheckStar::FollowUpContext() +{ + if (bEndTokenFound) + return *pEnd_FollowUpContext; + else + return Cx_Base::FollowUpContext(); +} + +} // namespace dsapi +} // namespace csi + diff --git a/autodoc/source/parser_i/idoc/cx_dsapi.cxx b/autodoc/source/parser_i/idoc/cx_dsapi.cxx new file mode 100644 index 000000000000..8990d6895e86 --- /dev/null +++ b/autodoc/source/parser_i/idoc/cx_dsapi.cxx @@ -0,0 +1,536 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_dsapi.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <s2_dsapi/cx_dsapi.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <x_parse2.hxx> +#include <tools/tkpchars.hxx> +#include <s2_dsapi/tk_atag2.hxx> +#include <s2_dsapi/tk_docw2.hxx> +#include <s2_dsapi/tk_xml.hxx> +#include <s2_dsapi/cx_docu2.hxx> +#include <s2_dsapi/tokrecv.hxx> + + +namespace csi +{ +namespace dsapi +{ + + +const intt C_nStatusSize = 128; +const intt C_nCppInitialNrOfStati = 400; + + +const uintt nF_fin_Error = 1; +const uintt nF_fin_Ignore = 2; +const uintt nF_fin_Eof = 3; +const uintt nF_fin_AnyWord = 4; +const uintt nF_fin_AtTag = 5; +const uintt nF_fin_EndSign = 6; +const uintt nF_goto_EoHtml = 7; +const uintt nF_goto_EoXmlConst = 8; +const uintt nF_goto_EoXmlLink_BeginTag = 9; +const uintt nF_goto_EoXmlLink_EndTag = 10; +const uintt nF_goto_EoXmlFormat_BeginTag = 11; +const uintt nF_goto_EoXmlFormat_EndTag = 12; +const uintt nF_goto_CheckStar = 13; +const uintt nF_fin_Comma = 14; +const uintt nF_fin_White = 15; + +const UINT16 nTok_at_author = 100 + Tok_AtTag::author; +const UINT16 nTok_at_see = 100 + Tok_AtTag::see; +const UINT16 nTok_at_param = 100 + Tok_AtTag::param; +const UINT16 nTok_at_return = 100 + Tok_AtTag::e_return; +const UINT16 nTok_at_throws = 100 + Tok_AtTag::e_throw; +const UINT16 nTok_at_example = 100 + Tok_AtTag::example; +const UINT16 nTok_at_deprecated = 100 + Tok_AtTag::deprecated; +const UINT16 nTok_at_suspicious = 100 + Tok_AtTag::suspicious; +const UINT16 nTok_at_missing = 100 + Tok_AtTag::missing; +const UINT16 nTok_at_incomplete = 100 + Tok_AtTag::incomplete; +const UINT16 nTok_at_version = 100 + Tok_AtTag::version; +const UINT16 nTok_at_guarantees = 100 + Tok_AtTag::guarantees; +const UINT16 nTok_at_exception = 100 + Tok_AtTag::exception; +const UINT16 nTok_at_since = 100 + Tok_AtTag::since; + +const UINT16 nTok_const_TRUE = 200 + Tok_XmlConst::e_true; +const UINT16 nTok_const_FALSE = 200 + Tok_XmlConst::e_false; +const UINT16 nTok_const_NULL = 200 + Tok_XmlConst::e_null; +const UINT16 nTok_const_void = 200 + Tok_XmlConst::e_void; + +const UINT16 nTok_link_typeB = 300 + Tok_XmlLink_BeginTag::type; +const UINT16 nTok_link_typeE = 325 + Tok_XmlLink_EndTag::type; +const UINT16 nTok_link_memberB = 300 + Tok_XmlLink_BeginTag::member; +const UINT16 nTok_link_membeE = 325 + Tok_XmlLink_EndTag::member; +const UINT16 nTok_link_constB = 300 + Tok_XmlLink_BeginTag::e_const; +const UINT16 nTok_link_constE = 325 + Tok_XmlLink_EndTag::e_const; + +const UINT16 nTok_format_listingB = 350 + Tok_XmlFormat_BeginTag::listing; +const UINT16 nTok_format_listingE = 375 + Tok_XmlFormat_EndTag::listing; +const UINT16 nTok_format_codeB = 350 + Tok_XmlFormat_BeginTag::code; +const UINT16 nTok_format_codeE = 375 + Tok_XmlFormat_EndTag::code; +const UINT16 nTok_format_atomB = 350 + Tok_XmlFormat_BeginTag::atom; +const UINT16 nTok_format_atomE = 375 + Tok_XmlFormat_EndTag::atom; + + +const UINT16 nTok_html_parastart = 400; + +const UINT16 nTok_MLDocuEnd = 501; +const UINT16 nTok_EOL = 502; + + +Context_Docu::Context_Docu( Token_Receiver & o_rReceiver ) + : aStateMachine(C_nStatusSize, C_nCppInitialNrOfStati), + pReceiver(&o_rReceiver), + pParentContext(0), + pCx_EoHtml(0), + pCx_EoXmlConst(0), + pCx_EoXmlLink_BeginTag(0), + pCx_EoXmlLink_EndTag(0), + pCx_EoXmlFormat_BeginTag(0), + pCx_EoXmlFormat_EndTag(0), + pCx_CheckStar(0), + pNewToken(0), + pFollowUpContext(0), + bIsMultiline(false) +{ + pCx_EoHtml = new Cx_EoHtml(o_rReceiver, *this); + pCx_EoXmlConst = new Cx_EoXmlConst(o_rReceiver, *this); + pCx_EoXmlLink_BeginTag = new Cx_EoXmlLink_BeginTag(o_rReceiver, *this); + pCx_EoXmlLink_EndTag = new Cx_EoXmlLink_EndTag(o_rReceiver, *this); + pCx_EoXmlFormat_BeginTag = new Cx_EoXmlFormat_BeginTag(o_rReceiver, *this); + pCx_EoXmlFormat_EndTag = new Cx_EoXmlFormat_EndTag(o_rReceiver, *this); + pCx_CheckStar = new Cx_CheckStar(*pReceiver,*this); + + SetupStateMachine(); +} + +void +Context_Docu::SetParentContext( TkpContext & io_rParentContext, + const char * ) +{ + pFollowUpContext = pParentContext = &io_rParentContext; + pCx_CheckStar->Set_End_FolloUpContext(io_rParentContext); +} + +Context_Docu::~Context_Docu() +{ +} + +void +Context_Docu::ReadCharChain( CharacterSource & io_rText ) +{ + csv_assert(pParentContext != 0); + + pNewToken = 0; + + UINT16 nTokenId = 0; + StmBoundsStatu2 & rBound = aStateMachine.GetCharChain(nTokenId, io_rText); + + // !!! + // The order of the next two lines is essential, because + // pFollowUpContext may be changed by PerformStatusFunction() also, + // which then MUST override the previous assignment. + pFollowUpContext = rBound.FollowUpContext(); + PerformStatusFunction(rBound.StatusFunctionNr(), nTokenId, io_rText); +} + +bool +Context_Docu::PassNewToken() +{ + if (pNewToken) + { + pReceiver->Receive(*pNewToken.Release()); + return true; + } + return false; +} + +TkpContext & +Context_Docu::FollowUpContext() +{ + csv_assert(pFollowUpContext != 0); + return *pFollowUpContext; +} + +void +Context_Docu::PerformStatusFunction( uintt i_nStatusSignal, + UINT16 i_nTokenId, + CharacterSource & io_rText ) +{ + switch (i_nStatusSignal) + { + case nF_fin_White: + io_rText.CutToken(); + pNewToken = new Tok_White; + break; + case nF_fin_Error: + throw X_AutodocParser(X_AutodocParser::x_InvalidChar); + // no break because of throw + case nF_fin_Ignore: + pNewToken = 0; + io_rText.CutToken(); + break; + case nF_fin_Eof: + if (bIsMultiline) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + else + io_rText.CutToken(); + pNewToken = new Tok_EOF; + break; + case nF_fin_AnyWord: + pNewToken = new Tok_Word(io_rText.CutToken()); + break; + case nF_fin_AtTag: + io_rText.CutToken(); + pNewToken = new Tok_AtTag( i_nTokenId - 100 ); + break; + case nF_fin_Comma: + io_rText.CutToken(); + pNewToken = new Tok_Comma; + break; + case nF_fin_EndSign: + io_rText.CutToken(); + switch (i_nTokenId) + { + case nTok_MLDocuEnd: + if (bIsMultiline) + { + pNewToken = new Tok_DocuEnd; + pFollowUpContext = pParentContext; + } + else + { + pNewToken = new Tok_Word(io_rText.CutToken()); + pFollowUpContext = this; + } + break; + case nTok_EOL: + if (bIsMultiline) + { + pNewToken = new Tok_EOL; + pFollowUpContext = this; + } + else + { + pNewToken = new Tok_DocuEnd; + pFollowUpContext = pParentContext; + } + pReceiver->Increment_CurLine(); + break; + default: + csv_assert(false); + } + break; + case nF_goto_EoHtml: + pCx_EoHtml->SetIfIsStartOfParagraph(i_nTokenId == nTok_html_parastart); + break; + case nF_goto_EoXmlConst: + pCx_EoXmlConst->SetTokenId(i_nTokenId - 200); + break; + case nF_goto_EoXmlLink_BeginTag: + pCx_EoXmlLink_BeginTag->SetTokenId(i_nTokenId - 300); + break; + case nF_goto_EoXmlLink_EndTag: + pCx_EoXmlLink_EndTag->SetTokenId(i_nTokenId - 325); + break; + case nF_goto_EoXmlFormat_BeginTag: + pCx_EoXmlFormat_BeginTag->SetTokenId(i_nTokenId - 350); + break; + case nF_goto_EoXmlFormat_EndTag: + pCx_EoXmlFormat_EndTag->SetTokenId(i_nTokenId - 375); + break; + case nF_goto_CheckStar: + pCx_CheckStar->SetIsEnd( bIsMultiline ); + break; + default: + csv_assert(false); + } // end switch (i_nStatusSignal) +} + +void +Context_Docu::SetupStateMachine() +{ + // Besondere Array-Stati (kein Tokenabschluss oder Kontextwechsel): +// const INT16 bas = 0; // Base-Status + const INT16 wht = 1; // Whitespace-overlook-Status + const INT16 awd = 2; // Any-Word-Read-Status + + // Kontextwechsel-Stati: + const INT16 goto_EoHtml = 3; + const INT16 goto_EoXmlConst = 4; + const INT16 goto_EoXmlLink_BeginTag = 5; + const INT16 goto_EoXmlLink_EndTag = 6; + const INT16 goto_EoXmlFormat_BeginTag = 7; + const INT16 goto_EoXmlFormat_EndTag = 8; + const INT16 goto_CheckStar = 9; + + // Tokenfinish-Stati: + const INT16 finError = 10; +// const INT16 finIgnore = 11; + const INT16 finEof = 12; + const INT16 finAnyWord = 13; + const INT16 finAtTag = 14; + const INT16 finEndSign = 15; +// const INT16 finComma = 16; + const INT16 finWhite = 17; + + // Konstanten zur Benutzung in der Tabelle: + const INT16 ght = goto_EoHtml; +/* + const INT16 gxc = goto_EoXmlConst; + const INT16 glb = goto_EoXmlLink_TagBegin; + const INT16 gle = goto_EoXmlLink_TagEnd; + const INT16 gfb = goto_EoXmlFormat_TagBegin; + const INT16 gfe = goto_EoXmlFormat_TagEnd; +*/ + const INT16 err = finError; + const INT16 faw = finAnyWord; +// const INT16 fig = finIgnore; +// const INT16 fes = finEndSign; + const INT16 fof = finEof; +// const INT16 fat = finAtTag; + const INT16 fwh = finWhite; + + /// The '0's will be replaced by calls of AddToken(). + + const INT16 A_nTopStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht, 0,wht,wht, 0,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // ... 31 + wht,awd,awd,awd,awd,awd,awd,awd,awd,awd, 0,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, 0,awd,awd,awd, // ... 63 + 0,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 95 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd // ... 127 + }; + + const INT16 A_nWhitespaceStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht,fwh,wht,wht,fwh,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // ... 31 + wht,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, // ... 63 + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, // ... 95 + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh // ... 127 + }; + + const INT16 A_nWordStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {faw,err,err,err,err,err,err,err,err,faw,faw,faw,faw,faw,err,err, + err,err,err,err,err,err,err,err,err,err,faw,err,err,err,err,err, // ... 31 + faw,awd,awd,awd,awd,awd,awd,awd,awd,awd,faw,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,faw,awd,awd,awd, // ... 63 + faw,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 95 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd // ... 127 + }; + + const INT16 A_nAtTagDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {faw,err,err,err,err,err,err,err,err,faw,faw,faw,faw,faw,err,err, + err,err,err,err,err,err,err,err,err,err,faw,err,err,err,err,err, // ... 31 + faw,awd,awd,awd,awd,awd,awd,awd,awd,awd,faw,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,faw,awd,faw,awd,awd,awd, // ... 63 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 95 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd // ... 127 + }; + + const INT16 A_nHtmlDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {ght,err,err,err,err,err,err,err,err,ght,ght,ght,ght,ght,err,err, + err,err,err,err,err,err,err,err,err,err,ght,err,err,err,err,err, // ... 31 + ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght, + ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght, // ... 63 + ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght, + ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght, // ... 95 + ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght, + ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght // ... 127 + }; + + const INT16 A_nPunctDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 16 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 48 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 80 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err // 112 ... + }; + + DYN StmArrayStatu2 * dpStatusTop + = new StmArrayStatu2( C_nStatusSize, A_nTopStatus, 0, true); + DYN StmArrayStatu2 * dpStatusWhite + = new StmArrayStatu2( C_nStatusSize, A_nWhitespaceStatus, 0, true); + DYN StmArrayStatu2 * dpStatusWord + = new StmArrayStatu2( C_nStatusSize, A_nWordStatus, 0, true); + + DYN StmBoundsStatu2 * dpBst_goto_EoHtml + = new StmBoundsStatu2( *this, *pCx_EoHtml, nF_goto_EoHtml, true ); + DYN StmBoundsStatu2 * dpBst_goto_EoXmlConst + = new StmBoundsStatu2( *this, *pCx_EoXmlConst, nF_goto_EoXmlConst, true ); + DYN StmBoundsStatu2 * dpBst_goto_EoXmlLink_BeginTag + = new StmBoundsStatu2( *this, *pCx_EoXmlLink_BeginTag, nF_goto_EoXmlLink_BeginTag, true ); + DYN StmBoundsStatu2 * dpBst_goto_EoXmlLink_EndTag + = new StmBoundsStatu2( *this, *pCx_EoXmlLink_EndTag, nF_goto_EoXmlLink_EndTag, true ); + DYN StmBoundsStatu2 * dpBst_goto_EoXmlFormat_BeginTag + = new StmBoundsStatu2( *this, *pCx_EoXmlFormat_BeginTag, nF_goto_EoXmlFormat_BeginTag, true ); + DYN StmBoundsStatu2 * dpBst_goto_EoXmlFormat_EndTag + = new StmBoundsStatu2( *this, *pCx_EoXmlFormat_EndTag, nF_goto_EoXmlFormat_EndTag, true ); + DYN StmBoundsStatu2 * dpBst_goto_CheckStar + = new StmBoundsStatu2( *this, *pCx_CheckStar, nF_goto_CheckStar, true ); + + + DYN StmBoundsStatu2 * dpBst_finError + = new StmBoundsStatu2( *this, TkpContext_Null2_(), nF_fin_Error, true ); + DYN StmBoundsStatu2 * dpBst_finIgnore + = new StmBoundsStatu2( *this, *this, nF_fin_Ignore, true); + DYN StmBoundsStatu2 * dpBst_finEof + = new StmBoundsStatu2( *this, TkpContext_Null2_(), nF_fin_Eof, false); + DYN StmBoundsStatu2 * dpBst_finAnyWord + = new StmBoundsStatu2( *this, *this, nF_fin_AnyWord, true); + DYN StmBoundsStatu2 * dpBst_finAtTag + = new StmBoundsStatu2( *this, *this, nF_fin_AtTag, false); + DYN StmBoundsStatu2 * dpBst_finEndSign + = new StmBoundsStatu2( *this, *pParentContext, nF_fin_EndSign, false); + DYN StmBoundsStatu2 * dpBst_fin_Comma + = new StmBoundsStatu2( *this, *this, nF_fin_Comma, false ); + DYN StmBoundsStatu2 * dpBst_finWhite + = new StmBoundsStatu2( *this, *this, nF_fin_White, false); + + + // dpMain aufbauen: + aStateMachine.AddStatus(dpStatusTop); + aStateMachine.AddStatus(dpStatusWhite); + aStateMachine.AddStatus(dpStatusWord); + + aStateMachine.AddStatus(dpBst_goto_EoHtml); + aStateMachine.AddStatus(dpBst_goto_EoXmlConst); + aStateMachine.AddStatus(dpBst_goto_EoXmlLink_BeginTag); + aStateMachine.AddStatus(dpBst_goto_EoXmlLink_EndTag); + aStateMachine.AddStatus(dpBst_goto_EoXmlFormat_BeginTag); + aStateMachine.AddStatus(dpBst_goto_EoXmlFormat_EndTag); + aStateMachine.AddStatus(dpBst_goto_CheckStar); + + aStateMachine.AddStatus(dpBst_finError); + aStateMachine.AddStatus(dpBst_finIgnore); + aStateMachine.AddStatus(dpBst_finEof); + aStateMachine.AddStatus(dpBst_finAnyWord); + aStateMachine.AddStatus(dpBst_finAtTag); + aStateMachine.AddStatus(dpBst_finEndSign); + aStateMachine.AddStatus(dpBst_fin_Comma); + aStateMachine.AddStatus(dpBst_finWhite); + + + aStateMachine.AddToken( "@author", nTok_at_author, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@param", nTok_at_param, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@throws", nTok_at_throws, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@see", nTok_at_see, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@since", nTok_at_since, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@example", nTok_at_example, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@return", nTok_at_return, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@returns", nTok_at_return, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@deprecated", + nTok_at_deprecated, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@suspicious", + nTok_at_suspicious, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@missing", nTok_at_missing, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@incomplete", + nTok_at_incomplete, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@version", nTok_at_version, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@guarantees", + nTok_at_guarantees, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@exception", + nTok_at_exception, A_nAtTagDefStatus, finAtTag ); + + aStateMachine.AddToken( "<", 0, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "*", 0, A_nPunctDefStatus, goto_CheckStar ); +// aStateMachine.AddToken( ",", 0, A_nPunctDefStatus, finComma ); + + aStateMachine.AddToken( "<type", nTok_link_typeB, A_nHtmlDefStatus, goto_EoXmlLink_BeginTag ); + aStateMachine.AddToken( "</type", nTok_link_typeE, A_nHtmlDefStatus, goto_EoXmlLink_EndTag ); + aStateMachine.AddToken( "<member", nTok_link_memberB, A_nHtmlDefStatus, goto_EoXmlLink_BeginTag ); + aStateMachine.AddToken( "</member", nTok_link_membeE, A_nHtmlDefStatus, goto_EoXmlLink_EndTag ); + aStateMachine.AddToken( "<const", nTok_link_constB, A_nHtmlDefStatus, goto_EoXmlLink_BeginTag ); + aStateMachine.AddToken( "</const", nTok_link_constE, A_nHtmlDefStatus, goto_EoXmlLink_EndTag ); + + aStateMachine.AddToken( "<listing", nTok_format_listingB,A_nHtmlDefStatus, goto_EoXmlFormat_BeginTag ); + aStateMachine.AddToken( "</listing",nTok_format_listingE,A_nHtmlDefStatus, goto_EoXmlFormat_EndTag ); + aStateMachine.AddToken( "<code", nTok_format_codeB, A_nHtmlDefStatus, goto_EoXmlFormat_BeginTag ); + aStateMachine.AddToken( "</code", nTok_format_codeE, A_nHtmlDefStatus, goto_EoXmlFormat_EndTag ); + aStateMachine.AddToken( "<atom", nTok_format_atomB, A_nHtmlDefStatus, goto_EoXmlFormat_BeginTag ); + aStateMachine.AddToken( "</atom", nTok_format_atomE, A_nHtmlDefStatus, goto_EoXmlFormat_EndTag ); + + aStateMachine.AddToken( "<TRUE/", nTok_const_TRUE, A_nHtmlDefStatus, goto_EoXmlConst ); + aStateMachine.AddToken( "<true/", nTok_const_TRUE, A_nHtmlDefStatus, goto_EoXmlConst ); + aStateMachine.AddToken( "<FALSE/", nTok_const_FALSE, A_nHtmlDefStatus, goto_EoXmlConst ); + aStateMachine.AddToken( "<false/", nTok_const_FALSE, A_nHtmlDefStatus, goto_EoXmlConst ); + aStateMachine.AddToken( "<NULL/", nTok_const_NULL, A_nHtmlDefStatus, goto_EoXmlConst ); + aStateMachine.AddToken( "<void/", nTok_const_void, A_nHtmlDefStatus, goto_EoXmlConst ); + + aStateMachine.AddToken( "<p", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<pre", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<dl", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<ul", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<ol", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<table", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<P", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<PRE", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<DL", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<UL", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<OL", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<TABLE", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + + aStateMachine.AddToken( "\r\n", nTok_EOL, A_nPunctDefStatus, finEndSign ); + aStateMachine.AddToken( "\n", nTok_EOL, A_nPunctDefStatus, finEndSign ); + aStateMachine.AddToken( "\r", nTok_EOL, A_nPunctDefStatus, finEndSign ); +}; + +void +Context_Docu::SetMode_IsMultiLine( bool i_bTrue ) +{ + bIsMultiline = i_bTrue; +} + + +} // namespace dsapi +} // namespace csi + diff --git a/autodoc/source/parser_i/idoc/docu_pe2.cxx b/autodoc/source/parser_i/idoc/docu_pe2.cxx new file mode 100644 index 000000000000..687b189cf894 --- /dev/null +++ b/autodoc/source/parser_i/idoc/docu_pe2.cxx @@ -0,0 +1,609 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: docu_pe2.cxx,v $ + * $Revision: 1.15 $ + * + * 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 <s2_dsapi/docu_pe2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/doc/d_oldidldocu.hxx> +#include <ary_i/d_token.hxx> +#include <parser/parserinfo.hxx> +#include <adc_cl.hxx> +#include <adc_msg.hxx> +#include <../parser/inc/x_docu.hxx> +#include <s2_dsapi/dsapitok.hxx> +#include <s2_dsapi/tk_atag2.hxx> +#include <s2_dsapi/tk_html.hxx> +#include <s2_dsapi/tk_docw2.hxx> +#include <s2_dsapi/tk_xml.hxx> + + +#ifdef UNX +#define strnicmp strncasecmp +#endif + + +namespace csi +{ +namespace dsapi +{ + + +const char * AtTagTitle( + const Tok_AtTag & i_rToken ); + + +SapiDocu_PE::SapiDocu_PE(ParserInfo & io_rPositionInfo) + : pDocu(0), + eState(e_none), + pPositionInfo(&io_rPositionInfo), + fCurTokenAddFunction(&SapiDocu_PE::AddDocuToken2Void), + pCurAtTag(0), + sCurDimAttribute(), + sCurAtSeeType_byXML(200) +{ +} + +SapiDocu_PE::~SapiDocu_PE() +{ +} + +void +SapiDocu_PE::ProcessToken( DYN csi::dsapi::Token & let_drToken ) +{ + if (IsComplete()) + { + pDocu = 0; + eState = e_none; + } + + if ( eState == e_none ) + { + pDocu = new ary::doc::OldIdlDocu; + eState = st_short; + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2Short; + } + + csv_assert(pDocu); + + let_drToken.Trigger(*this); + delete &let_drToken; +} + +void +SapiDocu_PE::Process_AtTag( const Tok_AtTag & i_rToken ) +{ + if (NOT pCurAtTag) + { + eState = st_attags; + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2CurAtTag; + } + else + { + csv_assert(eState == st_attags); + pDocu->AddAtTag(*pCurAtTag.Release()); + } + + if (i_rToken.Id() == Tok_AtTag::param) + { + pCurAtTag = new DT_ParameterAtTag; + fCurTokenAddFunction = &SapiDocu_PE::SetCurParameterAtTagName; + } + else if (i_rToken.Id() == Tok_AtTag::see) + { + pCurAtTag = new DT_SeeAlsoAtTag; + fCurTokenAddFunction = &SapiDocu_PE::SetCurSeeAlsoAtTagLinkText; + } + else if (i_rToken.Id() == Tok_AtTag::deprecated) + { + pDocu->SetDeprecated(); + pCurAtTag = new DT_StdAtTag(""); // Dummy that will not be used. + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2Deprecated; + } + else if (i_rToken.Id() == Tok_AtTag::since) + { + pCurAtTag = new DT_SinceAtTag; + fCurTokenAddFunction = &SapiDocu_PE::SetCurSinceAtTagVersion; + } + else + { + pCurAtTag = new DT_StdAtTag( AtTagTitle(i_rToken) ); + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2CurAtTag; + } +} + +void +SapiDocu_PE::Process_HtmlTag( const Tok_HtmlTag & i_rToken ) +{ + if (eState == st_short AND i_rToken.IsParagraphStarter()) + { + eState = st_description; + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2Description; + } + + // Workaround special for some errors in API docu: + if ( strnicmp("<true",i_rToken.Text(),5 ) == 0 ) + { + if ( strcmp("<TRUE/>",i_rToken.Text()) != 0 ) + TheMessages().Out_InvalidConstSymbol( i_rToken.Text(), + pPositionInfo->CurFile(), + pPositionInfo->CurLine() ); + (this->*fCurTokenAddFunction)( *new DT_TextToken("<b>true</b>") ); + return; + } + else if ( strnicmp("<false",i_rToken.Text(),6 ) == 0 ) + { + if ( strcmp("<FALSE/>",i_rToken.Text()) != 0 ) + TheMessages().Out_InvalidConstSymbol( i_rToken.Text(), + pPositionInfo->CurFile(), + pPositionInfo->CurLine() ); + (this->*fCurTokenAddFunction)( *new DT_TextToken("<b>false</b>") ); + return; + } + else if ( strnicmp("<NULL",i_rToken.Text(),5 ) == 0 ) + { + if ( strcmp("<NULL/>",i_rToken.Text()) != 0 ) + TheMessages().Out_InvalidConstSymbol( i_rToken.Text(), + pPositionInfo->CurFile(), + pPositionInfo->CurLine() ); + (this->*fCurTokenAddFunction)( *new DT_TextToken("<b>null</b>") ); + return; + } + else if ( strnicmp("<void",i_rToken.Text(),5 ) == 0 ) + { + if ( strcmp("<void/>",i_rToken.Text()) != 0 ) + TheMessages().Out_InvalidConstSymbol( i_rToken.Text(), + pPositionInfo->CurFile(), + pPositionInfo->CurLine() ); + (this->*fCurTokenAddFunction)( *new DT_TextToken("<b>void</b>") ); + return; + } + + (this->*fCurTokenAddFunction)( *new DT_Style(i_rToken.Text(),false) ); +} + +void +SapiDocu_PE::Process_XmlConst( const Tok_XmlConst & i_rToken ) +{ + (this->*fCurTokenAddFunction)(*new DT_MupConst(i_rToken.Text())); +} + +void +SapiDocu_PE::Process_XmlLink_BeginTag( const Tok_XmlLink_BeginTag & i_rToken ) +{ + switch (i_rToken.Id()) + { + case Tok_XmlLink_Tag::e_const: + (this->*fCurTokenAddFunction)(*new DT_Style("<b>",false)); + break; + case Tok_XmlLink_Tag::member: + (this->*fCurTokenAddFunction)(*new DT_MupMember(i_rToken.Scope())); + break; + case Tok_XmlLink_Tag::type: + (this->*fCurTokenAddFunction)(*new DT_MupType(i_rToken.Scope())); + break; + default: + // Do nothing. + ; + } + + if ( i_rToken.Dim().length() > 0 ) + sCurDimAttribute = i_rToken.Dim(); + else + sCurDimAttribute.clear(); +} + +void +SapiDocu_PE::Process_XmlLink_EndTag( const Tok_XmlLink_EndTag & i_rToken ) +{ + switch (i_rToken.Id()) + { + case Tok_XmlLink_Tag::e_const: + (this->*fCurTokenAddFunction)(*new DT_Style("</b>",false)); + break; + case Tok_XmlLink_Tag::member: + (this->*fCurTokenAddFunction)(*new DT_MupMember(true)); + break; + case Tok_XmlLink_Tag::type: + (this->*fCurTokenAddFunction)(*new DT_MupType(true)); + break; + default: + // Do nothing. + ; + } + if ( sCurDimAttribute.length() > 0 ) + { + (this->*fCurTokenAddFunction)( *new DT_TextToken(sCurDimAttribute.c_str()) ); + sCurDimAttribute.clear(); + } +} + +void +SapiDocu_PE::Process_XmlFormat_BeginTag( const Tok_XmlFormat_BeginTag & i_rToken ) +{ + switch (i_rToken.Id()) + { + case Tok_XmlFormat_Tag::code: + (this->*fCurTokenAddFunction)(*new DT_Style("<code>",false)); + break; + case Tok_XmlFormat_Tag::listing: + (this->*fCurTokenAddFunction)(*new DT_Style("<pre>",true)); + break; + case Tok_XmlFormat_Tag::atom: + (this->*fCurTokenAddFunction)(*new DT_Style("<code>",true)); + break; + default: + // Do nothing. + ; + } + if ( i_rToken.Dim().length() > 0 ) + sCurDimAttribute = i_rToken.Dim(); + else + sCurDimAttribute.clear(); +} + +void +SapiDocu_PE::Process_XmlFormat_EndTag( const Tok_XmlFormat_EndTag & i_rToken ) +{ + switch (i_rToken.Id()) + { + case Tok_XmlFormat_Tag::code: + (this->*fCurTokenAddFunction)(*new DT_Style("</code>",false)); + break; + case Tok_XmlFormat_Tag::listing: + (this->*fCurTokenAddFunction)(*new DT_Style("</pre>",true)); + break; + case Tok_XmlFormat_Tag::atom: + (this->*fCurTokenAddFunction)(*new DT_Style("</code>",true)); + break; + default: + // Do nothing. + ; + } + if ( sCurDimAttribute.length() > 0 ) + { + (this->*fCurTokenAddFunction)( *new DT_TextToken(sCurDimAttribute.c_str()) ); + sCurDimAttribute.clear(); + } +} + +void +SapiDocu_PE::Process_Word( const Tok_Word & i_rToken ) +{ + (this->*fCurTokenAddFunction)(*new DT_TextToken(i_rToken.Text())); +} + +void +SapiDocu_PE::Process_Comma() +{ + csv_assert(1==7); +// (this->*fCurTokenAddFunction)(*new DT_Comma(i_rToken.Text())); +} + +void +SapiDocu_PE::Process_DocuEnd() +{ + eState = st_complete; + if (pCurAtTag) + pDocu->AddAtTag(*pCurAtTag.Release()); + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2Void; +} + +void +SapiDocu_PE::Process_EOL() +{ + (this->*fCurTokenAddFunction)(*new DT_EOL); +} + +void +SapiDocu_PE::Process_White() +{ + (this->*fCurTokenAddFunction)(*new DT_White); +} + +DYN ary::doc::OldIdlDocu * +SapiDocu_PE::ReleaseJustParsedDocu() +{ + if (IsComplete()) + { + eState = e_none; + return pDocu.Release(); + } + return 0; +} + + +bool +SapiDocu_PE::IsComplete() const +{ + return eState == st_complete; +} + +void +SapiDocu_PE::AddDocuToken2Void( DYN ary::inf::DocuToken & let_drNewToken ) +{ + delete &let_drNewToken; +} + +void +SapiDocu_PE::AddDocuToken2Short( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pDocu); + pDocu->AddToken2Short(let_drNewToken); +} + +void +SapiDocu_PE::AddDocuToken2Description( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pDocu); + pDocu->AddToken2Description(let_drNewToken); +} + +void +SapiDocu_PE::AddDocuToken2Deprecated( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pDocu); + pDocu->AddToken2DeprecatedText(let_drNewToken); +} + +void +SapiDocu_PE::AddDocuToken2CurAtTag( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pCurAtTag); + pCurAtTag->AddToken(let_drNewToken); +} + +void +SapiDocu_PE::SetCurParameterAtTagName( DYN ary::inf::DocuToken & let_drNewToken ) +{ + if (let_drNewToken.IsWhiteOnly()) + { + delete &let_drNewToken; + return; + } + + csv_assert(pCurAtTag); + DT_TextToken * dpText = dynamic_cast< DT_TextToken* >(&let_drNewToken); + if (dpText != 0) + pCurAtTag->SetName(dpText->GetText()); + else + pCurAtTag->SetName("parameter ?"); + delete &let_drNewToken; + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2CurAtTag; +} + +void +SapiDocu_PE::SetCurSeeAlsoAtTagLinkText( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pCurAtTag); + + if (let_drNewToken.IsWhiteOnly()) + { + delete &let_drNewToken; + return; + } + + DT_TextToken * pText = dynamic_cast< DT_TextToken* >(&let_drNewToken); + if (pText != 0) + pCurAtTag->SetName(pText->GetText()); + else + { + DT_MupType * + pTypeBegin = dynamic_cast< DT_MupType* >(&let_drNewToken); + DT_MupMember * + pMemberBegin = dynamic_cast< DT_MupMember* >(&let_drNewToken); + if (pTypeBegin != 0 OR pMemberBegin != 0) + { + sCurAtSeeType_byXML.reset(); + + sCurAtSeeType_byXML + << ( pTypeBegin != 0 + ? pTypeBegin->Scope() + : pMemberBegin->Scope() ); + + if (sCurAtSeeType_byXML.tellp() > 0) + { + sCurAtSeeType_byXML + << "::"; + } + delete &let_drNewToken; + fCurTokenAddFunction = &SapiDocu_PE::SetCurSeeAlsoAtTagLinkText_2; + return; + } + else + { + pCurAtTag->SetName("? (no identifier found)"); + } + } + delete &let_drNewToken; + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2CurAtTag; +} + +void +SapiDocu_PE::SetCurSeeAlsoAtTagLinkText_2( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pCurAtTag); + + if (let_drNewToken.IsWhiteOnly()) + { + delete &let_drNewToken; + return; + } + + DT_TextToken * + pText = dynamic_cast< DT_TextToken* >(&let_drNewToken); + if (pText != 0) + { + sCurAtSeeType_byXML + << pText->GetText(); + pCurAtTag->SetName(sCurAtSeeType_byXML.c_str()); + } + else + { + pCurAtTag->SetName("? (no identifier found)"); + } + sCurAtSeeType_byXML.reset(); + delete &let_drNewToken; + fCurTokenAddFunction = &SapiDocu_PE::SetCurSeeAlsoAtTagLinkText_3; +} + +void +SapiDocu_PE::SetCurSeeAlsoAtTagLinkText_3( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pCurAtTag); + + if (let_drNewToken.IsWhiteOnly()) + { + delete &let_drNewToken; + return; + } + + /// Could emit warning, but don't because this parser is obsolete. +// Tok_XmlLink_BeginTag * +// pLinkEnd = dynamic_cast< Tok_XmlLink_EndTag* >(&let_drNewToken); +// if (pLinkEnd == 0) +// { +// warn_aboutMissingClosingTag(); +// } + + delete &let_drNewToken; + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2CurAtTag; +} + + + +void +SapiDocu_PE::SetCurSinceAtTagVersion( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pCurAtTag); + + DT_TextToken * pToken = dynamic_cast< DT_TextToken* >(&let_drNewToken); + if (pToken == 0) + { + delete &let_drNewToken; + return; + } + + const String + sVersion(pToken->GetText()); + const char + cFirst = *sVersion.begin(); + const char + cCiphersend = '9' + 1; + const autodoc::CommandLine & + rCommandLine = autodoc::CommandLine::Get_(); + + + if ( rCommandLine.DoesTransform_SinceTag()) + { + // The @since version number shall be interpreted, + + if ( NOT csv::in_range('0', cFirst, cCiphersend) ) + { + // But this is a non-number-part, so we wait for + // the next one. + delete &let_drNewToken; + return; + } + else if (rCommandLine.DisplayOf_SinceTagValue(sVersion).empty()) + { + // This is the numbered part, but we don't know it. + delete &let_drNewToken; + + StreamLock + sl(200); + sl() + << "Since-value '" + << sVersion + << "' not found in translation table."; + throw X_Docu("since", sl().c_str()); + } + } + + // Either since tags are not specially interpreted, or + // we got a known one. + pCurAtTag->AddToken(let_drNewToken); + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2SinceAtTag; +} + +void +SapiDocu_PE::AddDocuToken2SinceAtTag( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pCurAtTag); + String & + sValue = pCurAtTag->Access_Text().Access_TextOfFirstToken(); + StreamLock + sHelp(1000); + + DT_TextToken * + pToken = dynamic_cast< DT_TextToken* >(&let_drNewToken); + if (pToken != 0) + { + sValue = sHelp() << sValue << pToken->GetText() << c_str; + } + else if (dynamic_cast< DT_White* >(&let_drNewToken) != 0) + { + sValue = sHelp() << sValue << " " << c_str; + } + delete &let_drNewToken; +} + +const char * +AtTagTitle( const Tok_AtTag & i_rToken ) +{ + switch (i_rToken.Id()) + { + case Tok_AtTag::author: return ""; + case Tok_AtTag::see: return "See also"; + case Tok_AtTag::param: return "Parameters"; + case Tok_AtTag::e_return: return "Returns"; + case Tok_AtTag::e_throw: return "Throws"; + case Tok_AtTag::example: return "Example"; + case Tok_AtTag::deprecated: return "Deprecated"; + case Tok_AtTag::suspicious: return ""; + case Tok_AtTag::missing: return ""; + case Tok_AtTag::incomplete: return ""; + case Tok_AtTag::version: return ""; + case Tok_AtTag::guarantees: return "Guarantees"; + case Tok_AtTag::exception: return "Exception"; + case Tok_AtTag::since: return "Since version"; + default: + // See below. + ; + } + return i_rToken.Text(); +} + + + +} // namespace dsapi +} // namespace csi + diff --git a/autodoc/source/parser_i/idoc/makefile.mk b/autodoc/source/parser_i/idoc/makefile.mk new file mode 100644 index 000000000000..90b483f3cbb5 --- /dev/null +++ b/autodoc/source/parser_i/idoc/makefile.mk @@ -0,0 +1,66 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# 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=parser2_s2_dsapi + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/cx_docu2.obj \ + $(OBJ)$/cx_dsapi.obj \ + $(OBJ)$/docu_pe2.obj \ + $(OBJ)$/tk_atag2.obj \ + $(OBJ)$/tk_docw2.obj \ + $(OBJ)$/tk_html.obj \ + $(OBJ)$/tk_xml.obj + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser_i/idoc/tk_atag2.cxx b/autodoc/source/parser_i/idoc/tk_atag2.cxx new file mode 100644 index 000000000000..d3061a35ef56 --- /dev/null +++ b/autodoc/source/parser_i/idoc/tk_atag2.cxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_atag2.cxx,v $ + * $Revision: 1.8 $ + * + * 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 <s2_dsapi/tk_atag2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <s2_dsapi/tokintpr.hxx> + + + +using csi::dsapi::Tok_AtTag; + +lux::EnumValueMap G_aTokAtTag_EV_TokenId_Values; +Tok_AtTag::EV_TokenId ev_none2(Tok_AtTag::e_none,""); +Tok_AtTag::EV_TokenId ev_author(Tok_AtTag::author,"@author"); +Tok_AtTag::EV_TokenId ev_see(Tok_AtTag::see,"@see"); +Tok_AtTag::EV_TokenId ev_param(Tok_AtTag::param,"@param"); +Tok_AtTag::EV_TokenId ev_e_return(Tok_AtTag::e_return,"@return"); +Tok_AtTag::EV_TokenId ev_e_throw(Tok_AtTag::e_throw,"@throws"); +Tok_AtTag::EV_TokenId ev_example(Tok_AtTag::example,"@example"); +Tok_AtTag::EV_TokenId ev_deprecated(Tok_AtTag::deprecated,"@deprecated"); +Tok_AtTag::EV_TokenId ev_suspicious(Tok_AtTag::suspicious,"@suspicious"); +Tok_AtTag::EV_TokenId ev_missing(Tok_AtTag::missing,"@missing"); +Tok_AtTag::EV_TokenId ev_incomplete(Tok_AtTag::incomplete,"@incomplete"); +Tok_AtTag::EV_TokenId ev_version(Tok_AtTag::version,"@version"); +Tok_AtTag::EV_TokenId ev_guarantees(Tok_AtTag::guarantees,"@guarantees"); +Tok_AtTag::EV_TokenId ev_exception(Tok_AtTag::exception,"@exception"); +Tok_AtTag::EV_TokenId ev_since(Tok_AtTag::since,"@since"); + + +namespace lux +{ +template<> EnumValueMap & +Tok_AtTag::EV_TokenId::Values_() { return G_aTokAtTag_EV_TokenId_Values; } +} + + +namespace csi +{ +namespace dsapi +{ + +void +Tok_AtTag::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_AtTag(*this); +} + +const char * +Tok_AtTag::Text() const +{ + return eTag.Text(); +} + +} // namespace dsapi +} // namespace csi + diff --git a/autodoc/source/parser_i/idoc/tk_docw2.cxx b/autodoc/source/parser_i/idoc/tk_docw2.cxx new file mode 100644 index 000000000000..3999148262b0 --- /dev/null +++ b/autodoc/source/parser_i/idoc/tk_docw2.cxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_docw2.cxx,v $ + * $Revision: 1.6 $ + * + * 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 <s2_dsapi/tk_docw2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <s2_dsapi/tokintpr.hxx> + + + +namespace csi +{ +namespace dsapi +{ + +void +Tok_Word::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Word(*this); +} + +const char * +Tok_Word::Text() const +{ + return sText; +} + +void +Tok_Comma::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Comma(); +} + +const char * +Tok_Comma::Text() const +{ + return ","; +} + +void +Tok_DocuEnd::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_DocuEnd(); +} + +const char * +Tok_DocuEnd::Text() const +{ + return "*/"; +} + +void +Tok_EOL::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_EOL(); +} + +const char * +Tok_EOL::Text() const +{ + return "\r\n"; +} + +void +Tok_EOF::Trigger( TokenInterpreter & ) const +{ + csv_assert(false); +} + +const char * +Tok_EOF::Text() const +{ + return ""; +} + +void +Tok_White::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_White(); +} + +const char * +Tok_White::Text() const +{ + return " "; +} + + + + +} // namespace dsapi +} // namespace csi + diff --git a/autodoc/source/parser_i/idoc/tk_html.cxx b/autodoc/source/parser_i/idoc/tk_html.cxx new file mode 100644 index 000000000000..ceb7a430451e --- /dev/null +++ b/autodoc/source/parser_i/idoc/tk_html.cxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_html.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <s2_dsapi/tk_html.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <s2_dsapi/tokintpr.hxx> + + + +namespace csi +{ +namespace dsapi +{ + +void +Tok_HtmlTag::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_HtmlTag(*this); +} + +const char * +Tok_HtmlTag::Text() const +{ + return sTag; +} + + +} // namespace dsapi +} // namespace csi + + diff --git a/autodoc/source/parser_i/idoc/tk_xml.cxx b/autodoc/source/parser_i/idoc/tk_xml.cxx new file mode 100644 index 000000000000..b5d2f71d8956 --- /dev/null +++ b/autodoc/source/parser_i/idoc/tk_xml.cxx @@ -0,0 +1,177 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_xml.cxx,v $ + * $Revision: 1.7 $ + * + * 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 <s2_dsapi/tk_xml.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <s2_dsapi/tokintpr.hxx> + +using csi::dsapi::Tok_XmlConst; +using csi::dsapi::Tok_XmlLink_Tag; +using csi::dsapi::Tok_XmlFormat_Tag; + + +lux::EnumValueMap G_aTok_XmlConst_EV_TokenId_Values; +Tok_XmlConst::EV_TokenId ev_consts_none(Tok_XmlConst::e_none,""); +Tok_XmlConst::EV_TokenId ev_e_true(Tok_XmlConst::e_true,"true"); +Tok_XmlConst::EV_TokenId ev_e_false(Tok_XmlConst::e_false,"false"); +Tok_XmlConst::EV_TokenId ev_e_null(Tok_XmlConst::e_null,"NULL"); +Tok_XmlConst::EV_TokenId ev_e_void(Tok_XmlConst::e_void,"void"); + +lux::EnumValueMap G_aTok_XmlLink_Tag_EV_TokenId_Values; +Tok_XmlLink_Tag::EV_TokenId ev_linktags_none(Tok_XmlLink_Tag::e_none,""); +Tok_XmlLink_Tag::EV_TokenId ev_e_const(Tok_XmlLink_Tag::e_const,"const"); +Tok_XmlLink_Tag::EV_TokenId ev_member(Tok_XmlLink_Tag::member,"member"); +Tok_XmlLink_Tag::EV_TokenId ev_type(Tok_XmlLink_Tag::type,"type"); + +lux::EnumValueMap G_aTok_XmlFormat_Tag_EV_TokenId_Values; +Tok_XmlFormat_Tag::EV_TokenId ev_formattags_none(Tok_XmlFormat_Tag::e_none,""); +Tok_XmlFormat_Tag::EV_TokenId ev_code(Tok_XmlFormat_Tag::code,"code"); +Tok_XmlFormat_Tag::EV_TokenId ev_listing(Tok_XmlFormat_Tag::listing,"listing"); +Tok_XmlFormat_Tag::EV_TokenId ev_atom(Tok_XmlFormat_Tag::atom,"code"); + + +namespace lux +{ + +template<> EnumValueMap & +Tok_XmlConst::EV_TokenId::Values_() { return G_aTok_XmlConst_EV_TokenId_Values; } +template<> EnumValueMap & +Tok_XmlLink_Tag::EV_TokenId::Values_() { return G_aTok_XmlLink_Tag_EV_TokenId_Values; } +template<> EnumValueMap & +Tok_XmlFormat_Tag::EV_TokenId::Values_() { return G_aTok_XmlFormat_Tag_EV_TokenId_Values; } + +} // namespace lux + + + +namespace csi +{ +namespace dsapi +{ + +void +Tok_XmlConst::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_XmlConst(*this); +} + +const char * +Tok_XmlConst::Text() const +{ + return eTag.Text(); +} + +void +Tok_XmlLink_BeginTag::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_XmlLink_BeginTag(*this); +} + +const char * +Tok_XmlLink_BeginTag::Text() const +{ + static StreamStr ret(120); + ret.seekp(0); + if (sScope.length() > 0) + { + ret << "<" + << eTag.Text() + << " scope=\"" + << sScope + << "\">"; + } + else + { + ret << "<" + << eTag.Text() + << ">"; + } + return ret.c_str(); +} + +void +Tok_XmlLink_EndTag::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_XmlLink_EndTag(*this); +} + +const char * +Tok_XmlLink_EndTag::Text() const +{ + static StreamStr ret(120); + ret.seekp(0); + ret << "</" + << eTag.Text() + << ">"; + return ret.c_str(); +} + +void +Tok_XmlFormat_BeginTag::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_XmlFormat_BeginTag(*this); +} + +const char * +Tok_XmlFormat_BeginTag::Text() const +{ + static StreamStr ret(120); + ret.seekp(0); + ret << "<" + << eTag.Text() + << ">"; + return ret.c_str(); +} + +void +Tok_XmlFormat_EndTag::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_XmlFormat_EndTag(*this); +} + +const char * +Tok_XmlFormat_EndTag::Text() const +{ + static StreamStr ret(120); + ret.seekp(0); + ret << "</" + << eTag.Text() + << ">"; + return ret.c_str(); +} + + +} // namespace dsapi +} // namespace csi + + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/cx_docu2.hxx b/autodoc/source/parser_i/inc/s2_dsapi/cx_docu2.hxx new file mode 100644 index 000000000000..39c8c61c020b --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/cx_docu2.hxx @@ -0,0 +1,236 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_docu2.hxx,v $ + * $Revision: 1.4 $ + * + * 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 DSAPI_CX_DOCU2_HXX +#define DSAPI_CX_DOCU2_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcont2.hxx> + // COMPONENTS + // PARAMETERS +#include <s2_dsapi/tk_xml.hxx> + +namespace csi +{ +namespace dsapi +{ + +class Token_Receiver; + + +/** +@descr +*/ + +class Cx_Base : public ::TkpContext +{ + public: + virtual bool PassNewToken(); + virtual TkpContext & + FollowUpContext(); + protected: + // LIFECYCLE + Cx_Base( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : rReceiver(o_rReceiver), + pFollowUpContext(&i_rFollowUpContext) + // pNewToken + { } + protected: + void SetToken( + DYN Token * let_dpToken ) + { pNewToken = let_dpToken; } + void Handle_DocuSyntaxError( + CharacterSource & io_rText ); + + private: + // DATA + Token_Receiver & rReceiver; + TkpContext * pFollowUpContext; + Dyn<Token> pNewToken; +}; + + +class Cx_EoHtml : public Cx_Base +{ + public: + // LIFECYCLE + Cx_EoHtml( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetIfIsStartOfParagraph( + bool i_bNextTokenProperty ) + { bToken_IsStartOfParagraph = i_bNextTokenProperty; } + + private: + bool bToken_IsStartOfParagraph; +}; + +class Cx_EoXmlConst : public Cx_Base +{ + public: + // LIFECYCLE + Cx_EoXmlConst( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetTokenId( + lux::Enum< Tok_XmlConst::E_TokenId > + i_eTokenId ) + { eTokenId = i_eTokenId; } + private: + Tok_XmlConst::EV_TokenId + eTokenId; +}; + +class Cx_EoXmlLink_BeginTag : public Cx_Base +{ + public: + // LIFECYCLE + Cx_EoXmlLink_BeginTag( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetTokenId( + Tok_XmlLink_BeginTag::EV_TokenId + i_eTokenId ) + { eTokenId = i_eTokenId; } + private: + Tok_XmlLink_BeginTag::EV_TokenId + eTokenId; +}; + +class Cx_EoXmlLink_EndTag : public Cx_Base +{ + public: + // LIFECYCLE + Cx_EoXmlLink_EndTag( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetTokenId( + Tok_XmlLink_EndTag::EV_TokenId + i_eTokenId ) + { eTokenId = i_eTokenId; } + private: + Tok_XmlLink_EndTag::E_TokenId + eTokenId; +}; + +class Cx_EoXmlFormat_BeginTag : public Cx_Base +{ + public: + // LIFECYCLE + Cx_EoXmlFormat_BeginTag( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetTokenId( + lux::Enum< Tok_XmlFormat_BeginTag::E_TokenId > + i_eTokenId ) + { eTokenId = i_eTokenId; } + private: + lux::Enum< Tok_XmlFormat_BeginTag::E_TokenId > + eTokenId; +}; + +class Cx_EoXmlFormat_EndTag : public Cx_Base +{ + public: + // LIFECYCLE + Cx_EoXmlFormat_EndTag( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetTokenId( + lux::Enum< Tok_XmlFormat_EndTag::E_TokenId > + i_eTokenId ) + { eTokenId = i_eTokenId; } + private: + lux::Enum< Tok_XmlFormat_EndTag::E_TokenId > + eTokenId; +}; + +class Cx_CheckStar : public Cx_Base +{ + public: + // LIFECYCLE + Cx_CheckStar( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext), + bIsEnd(false), bEndTokenFound(false) + { } + void Set_End_FolloUpContext( + TkpContext & i_rEnd_FollowUpContext ) + { pEnd_FollowUpContext = &i_rEnd_FollowUpContext; } + + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetIsEnd( + bool i_bIsEnd ) + { bIsEnd = i_bIsEnd; } + virtual TkpContext & + FollowUpContext(); + private: + TkpContext * pEnd_FollowUpContext; + bool bIsEnd; + bool bEndTokenFound; +}; + + +} // namespace dsapi +} // namespace csi + + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/cx_dsapi.hxx b/autodoc/source/parser_i/inc/s2_dsapi/cx_dsapi.hxx new file mode 100644 index 000000000000..242dbd790b80 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/cx_dsapi.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_dsapi.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_CX_DSAPI_HXX +#define ADC_CX_DSAPI_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcont2.hxx> + // COMPONENTS +#include <cosv/tpl/dyn.hxx> +#include <tokens/tkpstam2.hxx> + // PARAMETERS + + +namespace csi +{ +namespace dsapi +{ + +class Token_Receiver; +class Token; + +class Cx_EoHtml; +class Cx_EoXmlConst; +class Cx_EoXmlLink_BeginTag; +class Cx_EoXmlLink_EndTag; +class Cx_EoXmlFormat_BeginTag; +class Cx_EoXmlFormat_EndTag; +class Cx_CheckStar; + +/** +@descr +*/ +class Context_Docu : public TkpDocuContext, + private StateMachineContext +{ + public: + // LIFECYCLE + Context_Docu( + Token_Receiver & o_rReceiver ); + virtual void SetParentContext( + TkpContext & io_rParentContext, + const char * i_sMultiLineEndToken ); + + ~Context_Docu(); + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + + virtual bool PassNewToken(); + virtual void SetMode_IsMultiLine( + bool i_bTrue ); + + // INQUIRY + virtual TkpContext & + FollowUpContext(); + private: + // SERVICE FUNCTIONS + virtual void PerformStatusFunction( + uintt i_nStatusSignal, + UINT16 i_nTokenId, + CharacterSource & io_rText ); + + void SetupStateMachine(); + + // DATA + StateMachin2 aStateMachine; + Token_Receiver * pReceiver; + + // Contexts + TkpContext * pParentContext; + String sMultiLineEndToken; + + Dyn<Cx_EoHtml> pCx_EoHtml; + Dyn<Cx_EoXmlConst> pCx_EoXmlConst; + Dyn<Cx_EoXmlLink_BeginTag> + pCx_EoXmlLink_BeginTag; + Dyn<Cx_EoXmlLink_EndTag> + pCx_EoXmlLink_EndTag; + Dyn<Cx_EoXmlFormat_BeginTag> + pCx_EoXmlFormat_BeginTag; + Dyn<Cx_EoXmlFormat_EndTag> + pCx_EoXmlFormat_EndTag; + Dyn<Cx_CheckStar> pCx_CheckStar; + + // Temporary data, used during ReadCharChain() + Dyn<Token> pNewToken; + ::TkpContext * pFollowUpContext; + bool bIsMultiline; +}; + + +} // namespace dsapi +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/docu_pe2.hxx b/autodoc/source/parser_i/inc/s2_dsapi/docu_pe2.hxx new file mode 100644 index 000000000000..16af1e82491f --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/docu_pe2.hxx @@ -0,0 +1,177 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: docu_pe2.hxx,v $ + * $Revision: 1.9 $ + * + * 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 ADC_DSAPI_DOCU_PE2_HXX +#define ADC_DSAPI_DOCU_PE2_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_dsapi/tokintpr.hxx> + // COMPONENTS + // PARAMETERS + +class ParserInfo; + +namespace ary +{ +namespace doc +{ + class OldIdlDocu; +} + +namespace inf +{ + class DocuToken; +} // namespace info +} // namespace ary + + + +namespace csi +{ +namespace dsapi +{ + + +class Token; +class DT_AtTag; + +class SapiDocu_PE : public TokenInterpreter +{ + public: + SapiDocu_PE( + ParserInfo & io_rPositionInfo ); + ~SapiDocu_PE(); + + void ProcessToken( + DYN csi::dsapi::Token & + let_drToken ); + + virtual void Process_AtTag( + const Tok_AtTag & i_rToken ); + virtual void Process_HtmlTag( + const Tok_HtmlTag & i_rToken ); + virtual void Process_XmlConst( + const Tok_XmlConst & + i_rToken ); + virtual void Process_XmlLink_BeginTag( + const Tok_XmlLink_BeginTag & + i_rToken ); + virtual void Process_XmlLink_EndTag( + const Tok_XmlLink_EndTag & + i_rToken ); + virtual void Process_XmlFormat_BeginTag( + const Tok_XmlFormat_BeginTag & + i_rToken ); + virtual void Process_XmlFormat_EndTag( + const Tok_XmlFormat_EndTag & + i_rToken ); + virtual void Process_Word( + const Tok_Word & i_rToken ); + virtual void Process_Comma(); + virtual void Process_DocuEnd(); + virtual void Process_EOL(); + virtual void Process_White(); + + + DYN ary::doc::OldIdlDocu * + ReleaseJustParsedDocu(); + + bool IsComplete() const; + + private: + enum E_State + { + e_none = 0, + st_short, + st_description, + st_attags, + st_complete + }; + + typedef void ( SapiDocu_PE::*F_TokenAdder )( DYN ary::inf::DocuToken & let_drNewToken ); + + void AddDocuToken2Void( + DYN ary::inf::DocuToken & + let_drNewToken ); + void AddDocuToken2Short( + DYN ary::inf::DocuToken & + let_drNewToken ); + void AddDocuToken2Description( + DYN ary::inf::DocuToken & + let_drNewToken ); + void AddDocuToken2Deprecated( + DYN ary::inf::DocuToken & + let_drNewToken ); + void AddDocuToken2CurAtTag( + DYN ary::inf::DocuToken & + let_drNewToken ); + void SetCurParameterAtTagName( + DYN ary::inf::DocuToken & + let_drNewToken ); + void SetCurSeeAlsoAtTagLinkText( + DYN ary::inf::DocuToken & + let_drNewToken ); + void SetCurSeeAlsoAtTagLinkText_2( + DYN ary::inf::DocuToken & + let_drNewToken ); + void SetCurSeeAlsoAtTagLinkText_3( + DYN ary::inf::DocuToken & + let_drNewToken ); + void SetCurSinceAtTagVersion( + DYN ary::inf::DocuToken & + let_drNewToken ); + void AddDocuToken2SinceAtTag( + DYN ary::inf::DocuToken & + let_drNewToken ); + + // DATA + Dyn<ary::doc::OldIdlDocu> + pDocu; + E_State eState; + ParserInfo * pPositionInfo; + F_TokenAdder fCurTokenAddFunction; + + Dyn<DT_AtTag> pCurAtTag; + String sCurDimAttribute; + StreamStr sCurAtSeeType_byXML; +}; + +} // namespace dsapi +} // namespace csi + + +// IMPLEMENTATION + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/dsapitok.hxx b/autodoc/source/parser_i/inc/s2_dsapi/dsapitok.hxx new file mode 100644 index 000000000000..64bd73bd0d2e --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/dsapitok.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dsapitok.hxx,v $ + * $Revision: 1.3 $ + * + * 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 DSAPI_DSAPITOK_HXX +#define DSAPI_DSAPITOK_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/token2.hxx> + // COMPONENTS + // PARAMETERS + + +namespace csi +{ +namespace dsapi +{ + + +class TokenInterpreter; + + +class Token : public TextToken +{ + public: + // LIFECYCLE + virtual ~Token() {} + + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const = 0; +}; + + +} // namespace dsapi +} // namespace csi + + +#endif + + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/tk_atag2.hxx b/autodoc/source/parser_i/inc/s2_dsapi/tk_atag2.hxx new file mode 100644 index 000000000000..5e4804ff4ca4 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/tk_atag2.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_atag2.hxx,v $ + * $Revision: 1.5 $ + * + * 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 DSAPI_TK_ATAG2_HXX +#define DSAPI_TK_ATAG2_HXX + +// USED SERVICES + // BASE CLASSES +#include <s2_dsapi/dsapitok.hxx> + // COMPONENTS + // PARAMETERS +#include <luxenum.hxx> + +namespace csi +{ +namespace dsapi +{ + + +class Tok_AtTag : public Token +{ + public: + // TYPE + enum E_TokenId + { + e_none = 0, + author = 1, + see = 2, + param = 3, + e_return = 4, + e_throw = 5, + example = 6, + deprecated = 7, + suspicious = 8, + missing = 9, + incomplete = 10, + version = 11, + guarantees = 12, + exception = 13, + since = 14 + }; + typedef lux::Enum<E_TokenId> EV_TokenId; + + // Spring and Fall + Tok_AtTag( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + E_TokenId Id() const { return eTag; } + + private: + EV_TokenId eTag; +}; + +} // namespace dsapi +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/tk_docw2.hxx b/autodoc/source/parser_i/inc/s2_dsapi/tk_docw2.hxx new file mode 100644 index 000000000000..f3d1d514844f --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/tk_docw2.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_docw2.hxx,v $ + * $Revision: 1.5 $ + * + * 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 DSAPI_TK_DOCW2_HXX +#define DSAPI_TK_DOCW2_HXX + +// USED SERVICES + // BASE CLASSES +#include <s2_dsapi/dsapitok.hxx> + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace dsapi +{ + + +class Tok_Word : public Token +{ + public: + // Spring and Fall + Tok_Word( + const char * i_sText ) + : sText(i_sText) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + + private: + // DATA + String sText; +}; + +class Tok_Comma : public Token +{ + public: + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; +}; + +class Tok_DocuEnd : public Token +{ + public: + // Spring and Fall + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; +}; + +class Tok_EOL : public Token +{ + public: + // Spring and Fall + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; +}; + +class Tok_EOF : public Token +{ + public: + // Spring and Fall + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; +}; + +class Tok_White : public Token +{ + public: + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; +}; + + + +} // namespace dsapi +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/tk_html.hxx b/autodoc/source/parser_i/inc/s2_dsapi/tk_html.hxx new file mode 100644 index 000000000000..42e9b369c3c5 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/tk_html.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_html.hxx,v $ + * $Revision: 1.4 $ + * + * 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 DSAPI_TK_HTML_HXX +#define DSAPI_TK_HTML_HXX + + +// USED SERVICES + // BASE CLASSES +#include <s2_dsapi/dsapitok.hxx> + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace dsapi +{ + + +class Tok_HtmlTag : public Token +{ + public: + // Spring and Fall + Tok_HtmlTag( + const char * i_sTag, + bool i_bIsParagraphStarter ) + : sTag(i_sTag), + bIsParagraphStarter(i_bIsParagraphStarter) + {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + bool IsParagraphStarter() const + { return bIsParagraphStarter; } + + private: + String sTag; + bool bIsParagraphStarter; +}; + + +} // namespace dsapi +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/tk_xml.hxx b/autodoc/source/parser_i/inc/s2_dsapi/tk_xml.hxx new file mode 100644 index 000000000000..fd12a6e2924a --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/tk_xml.hxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_xml.hxx,v $ + * $Revision: 1.5 $ + * + * 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 DSAPI_TK_XML_HXX +#define DSAPI_TK_XML_HXX + +// USED SERVICES + // BASE CLASSES +#include <s2_dsapi/dsapitok.hxx> + // COMPONENTS + // PARAMETERS +#include <luxenum.hxx> + + +namespace csi +{ +namespace dsapi +{ + + +class Tok_XmlTag : public Token +{ + public: +}; + +class Tok_XmlConst : public Tok_XmlTag +{ + public: + // TYPE + enum E_TokenId + { + e_none = 0, + e_true = 1, + e_false = 2, + e_null = 3, + e_void = 4 + }; + typedef lux::Enum<E_TokenId> EV_TokenId; + + // Spring and Fall + Tok_XmlConst( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + E_TokenId Id() const { return eTag; } + + private: + // DATA + EV_TokenId eTag; +}; + +class Tok_XmlLink_Tag : public Tok_XmlTag +{ + public: + // TYPE + enum E_TokenId + { + e_none = 0, + e_const = 1, + member = 2, + type = 3 + }; + typedef lux::Enum<E_TokenId> EV_TokenId; +}; + +class Tok_XmlLink_BeginTag : public Tok_XmlLink_Tag +{ + public: + // Spring and Fall + Tok_XmlLink_BeginTag( + EV_TokenId i_eTag, + const String & i_sScope, + const String & i_sDim ) + : eTag(i_eTag), + sScope(i_sScope), + sDim(i_sDim) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + E_TokenId Id() const { return eTag; } + const String & Scope() const { return sScope; } + const String & Dim() const { return sDim; } + + private: + // DATA + EV_TokenId eTag; + String sScope; + String sDim; +}; + +class Tok_XmlLink_EndTag : public Tok_XmlLink_Tag +{ + public: + // Spring and Fall + Tok_XmlLink_EndTag( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + E_TokenId Id() const { return eTag; } + + private: + // DATA + EV_TokenId eTag; +}; + +class Tok_XmlFormat_Tag : public Tok_XmlTag +{ + public: + // TYPE + enum E_TokenId + { + e_none = 0, + code = 1, + listing = 2, + atom = 3 + }; + typedef lux::Enum<E_TokenId> EV_TokenId; +}; + +class Tok_XmlFormat_BeginTag : public Tok_XmlFormat_Tag +{ + public: + // Spring and Fall + Tok_XmlFormat_BeginTag( + EV_TokenId i_eTag, + const String & i_sDim ) + : eTag(i_eTag), + sDim(i_sDim) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + E_TokenId Id() const { return eTag; } + const String & Dim() const { return sDim; } + + private: + // DATA + EV_TokenId eTag; + String sDim; +}; + +class Tok_XmlFormat_EndTag : public Tok_XmlFormat_Tag +{ + public: + // Spring and Fall + Tok_XmlFormat_EndTag( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + E_TokenId Id() const { return eTag; } + + private: + // DATA + EV_TokenId eTag; +}; + + +} // namespace dsapi +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/tokintpr.hxx b/autodoc/source/parser_i/inc/s2_dsapi/tokintpr.hxx new file mode 100644 index 000000000000..c192813c67c1 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/tokintpr.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tokintpr.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_DSAPI_TOKINTPR_HXX +#define ADC_DSAPI_TOKINTPR_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace dsapi +{ + + +class Tok_AtTag; +class Tok_XmlConst; +class Tok_XmlLink_BeginTag; +class Tok_XmlLink_EndTag; +class Tok_XmlFormat_BeginTag; +class Tok_XmlFormat_EndTag; +class Tok_Word; +class Tok_HtmlTag; + +class TokenInterpreter +{ + public: + virtual ~TokenInterpreter() {} + + virtual void Process_AtTag( + const Tok_AtTag & i_rToken ) = 0; + virtual void Process_HtmlTag( + const Tok_HtmlTag & i_rToken ) = 0; + virtual void Process_XmlConst( + const Tok_XmlConst & + i_rToken ) = 0; + virtual void Process_XmlLink_BeginTag( + const Tok_XmlLink_BeginTag & + i_rToken ) = 0; + virtual void Process_XmlLink_EndTag( + const Tok_XmlLink_EndTag & + i_rToken ) = 0; + virtual void Process_XmlFormat_BeginTag( + const Tok_XmlFormat_BeginTag & + i_rToken ) = 0; + virtual void Process_XmlFormat_EndTag( + const Tok_XmlFormat_EndTag & + i_rToken ) = 0; + virtual void Process_Word( + const Tok_Word & i_rToken ) = 0; + virtual void Process_Comma() = 0; + virtual void Process_DocuEnd() = 0; + virtual void Process_EOL() = 0; + virtual void Process_White() = 0; +}; + + + +// IMPLEMENTATION + + +} // namespace dsapi +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/tokrecv.hxx b/autodoc/source/parser_i/inc/s2_dsapi/tokrecv.hxx new file mode 100644 index 000000000000..25456759f316 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/tokrecv.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tokrecv.hxx,v $ + * $Revision: 1.4 $ + * + * 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 DSAPI_TOKRECV_HXX +#define DSAPI_TOKRECV_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace dsapi +{ + + +class Token; +/** +@descr +*/ +class Token_Receiver +{ + public: + virtual ~Token_Receiver() {} + virtual void Receive( + DYN Token & let_drToken ) = 0; + virtual void Increment_CurLine() = 0; +}; + + +} // namespace dsapi +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/cx_idlco.hxx b/autodoc/source/parser_i/inc/s2_luidl/cx_idlco.hxx new file mode 100644 index 000000000000..4ccb9b68bb9a --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/cx_idlco.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_idlco.hxx,v $ + * $Revision: 1.4 $ + * + * 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 LUIDL_CX_IDLCO_HXX +#define LUIDL_CX_IDLCO_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcont2.hxx> + // COMPONENTS +#include <tokens/tkpstam2.hxx> + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + +class Token_Receiver; +class Token; + +/** +*/ +class Context_UidlCode : public TkpContext, + private StateMachineContext +{ + public: + // LIFECYCLE + Context_UidlCode( + Token_Receiver & o_rReceiver, + DYN TkpDocuContext & + let_drContext_Docu ); + ~Context_UidlCode(); + // OPERATORS + + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual bool PassNewToken(); + + // INQUIRY + virtual TkpContext & + FollowUpContext(); + private: + // SERVICE FUNCTIONS + void PerformStatusFunction( + uintt i_nStatusSignal, + UINT16 i_nTokenId, + CharacterSource & io_rText ); + void SetupStateMachine(); + + // DATA + StateMachin2 aStateMachine; + Token_Receiver * pReceiver; + + // Contexts + Dyn<TkpDocuContext> pDocuContext; + + Dyn<TkpContext> dpContext_MLComment; + Dyn<TkpContext> dpContext_SLComment; + Dyn<TkpContext> dpContext_Preprocessor; + Dyn<TkpContext> dpContext_Assignment; + + // Temporary data, used during ReadCharChain() + Dyn<Token> pNewToken; + ::TkpContext * pFollowUpContext; +}; + + +} // namespace uidl +} // namespace csi + +#endif diff --git a/autodoc/source/parser_i/inc/s2_luidl/cx_sub.hxx b/autodoc/source/parser_i/inc/s2_luidl/cx_sub.hxx new file mode 100644 index 000000000000..60416af9ce58 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/cx_sub.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_sub.hxx,v $ + * $Revision: 1.7 $ + * + * 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 ADC_LUIDL_CX_SUB_HXX +#define ADC_LUIDL_CX_SUB_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcont2.hxx> + // COMPONENTS + // PARAMETERS + +#include "uidl_tok.hxx" + +namespace csi +{ +namespace uidl +{ + +class Token_Receiver; +class Token; + + +class Cx_Base : public ::TkpContext +{ + public: + virtual bool PassNewToken(); + virtual TkpContext & + FollowUpContext(); + protected: + // LIFECYCLE + Cx_Base( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : rReceiver(o_rReceiver), + pFollowUpContext(&i_rFollowUpContext), + pNewToken() + {} + protected: + void SetToken( + DYN Token * let_dpToken ) + { pNewToken = let_dpToken; } + Token_Receiver & Receiver() { return rReceiver; } + + private: + // DATA + Token_Receiver & rReceiver; + TkpContext * pFollowUpContext; + Dyn<Token> pNewToken; +}; + + + +/** +@descr +*/ + +class Context_MLComment : public Cx_Base +{ + public: + Context_MLComment( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + +class Context_SLComment : public Cx_Base +{ + public: + Context_SLComment( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + +class Context_Praeprocessor : public Cx_Base +{ + public: + Context_Praeprocessor( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + +class Context_Assignment : public Cx_Base +{ + public: + Context_Assignment( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/distrib.hxx b/autodoc/source/parser_i/inc/s2_luidl/distrib.hxx new file mode 100644 index 000000000000..19f052eac791 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/distrib.hxx @@ -0,0 +1,275 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: distrib.hxx,v $ + * $Revision: 1.8 $ + * + * 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 LUIDL_DISTRIB_HXX +#define LUIDL_DISTRIB_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/tokrecv.hxx> +#include <s2_dsapi/tokrecv.hxx> +#include <s2_luidl/tokproct.hxx> + // COMPONENTS + // PARAMETERS + + +class ParserInfo; + +namespace ary +{ + class Repository; + +namespace doc +{ + class OldIdlDocu; +} // namespace inf +} // namespace ary) + + + +namespace csi +{ +namespace dsapi +{ + class Token_Receiver; + class SapiDocu_PE; +} + + + +namespace uidl +{ + + +typedef std::vector< DYN Token * > TokenQueue; +typedef TokenQueue::iterator TokenIterator; + +class TokenParser_Uidl; +class UnoIDL_PE; +class Token; + + +class TokenDistributor : private TokenProcessing_Types + +{ + public: + TokenDistributor( + ary::Repository & io_rRepository, + ParserInfo & io_rParserInfo ); + void SetTokenProvider( + TokenParser_Uidl & io_rTokenSource ); + void SetTopParseEnvironment( + UnoIDL_PE & io_pTopParseEnvironment ); + ~TokenDistributor(); + + + void Reset() { aDocumentation.Reset(); } + /** calls pTokenSource->GetNextToken() and checks the incoming tokens, until a + usable token is found. This token will be forwarded to + pTopParseEnv; + */ + void TradeToken(); + + csi::uidl::Token_Receiver & + CodeTokens_Receiver(); + csi::dsapi::Token_Receiver & + DocuTokens_Receiver(); + + /** Used from PE_File, if there is a docu to get without + an environment to push (this is the case for modules). + */ + DYN ary::doc::OldIdlDocu * + ReleaseLastParsedDocu() + { return aDocumentation.ReleaseLastParsedDocu(); } + + /** Used from PE_File, if the term "published" was parsed. + The next opened parse environment will be set to be published + (call ->UnoIDL_PE::SetPublished()). + */ + void Set_PublishedOn() + { aProcessingData.Set_PublishedOn(); } + + + private: + class Documentation; + class ProcessingData; + friend class ProcessingData; + + class ProcessingData : public csi::uidl::Token_Receiver, + private TokenProcessing_Types + { + public: + ProcessingData( + ary::Repository & io_rRepository, + Documentation & i_rDocuProcessor, + ParserInfo & io_rParserInfo ); + ~ProcessingData(); + void SetTopParseEnvironment( + UnoIDL_PE & io_pTopParseEnvironment ); + + + /** is called from pTokenSource before finishing a ::TokenParse2::GetNextToken() + call and passes the just parsed token to this class. + */ + virtual void Receive( + DYN csi::uidl::Token & + let_drToken ); + virtual void Increment_CurLine(); + + void ProcessCurToken(); + + UnoIDL_PE & CurEnvironment() const; + bool NextTokenExists() const; + void Set_PublishedOn() + { bPublishedRecentlyOn = true; } + + private: + typedef uintt TokenQ_Position; + typedef std::pair< UnoIDL_PE *, TokenQ_Position > EnvironmentInfo; + typedef std::vector< EnvironmentInfo > EnvironmentStack; + + void AcknowledgeResult(); + const csi::uidl::Token & + CurToken() const; + UnoIDL_PE & CurEnv() const; + UnoIDL_PE & PushEnv() const; + uintt CurTokenPosition() const; + uintt CurEnv_TriedTokenPosition() const; + void DecrementTryCount(); + + EnvironmentStack aEnvironments; + TokenQueue aTokenQueue; + TokenIterator itCurToken; + TokenProcessing_Result + aCurResult; + uintt nTryCount; + bool bFinished; + ary::Repository & + rRepository; + ParserInfo & rParserInfo; + Documentation * pDocuProcessor; + bool bPublishedRecentlyOn; + }; + + class Documentation : public csi::dsapi::Token_Receiver + { + public: + Documentation( + ParserInfo & io_rParserInfo); + ~Documentation(); + + void Reset() { bIsPassedFirstDocu = false; } + + virtual void Receive( + DYN csi::dsapi::Token & + let_drToken ); + virtual void Increment_CurLine(); + DYN ary::doc::OldIdlDocu * + ReleaseLastParsedDocu() + { return pMostRecentDocu.Release(); } + private: + Dyn<csi::dsapi::SapiDocu_PE> + pDocuParseEnv; + ParserInfo & rParserInfo; + Dyn<ary::doc::OldIdlDocu> + pMostRecentDocu; + bool bIsPassedFirstDocu; + }; + + // DATA + TokenParser_Uidl * pTokenSource; + Documentation aDocumentation; + ProcessingData aProcessingData; +}; + + + +// IMPLEMENTATION + +inline void +TokenDistributor::SetTokenProvider( TokenParser_Uidl & io_rTokenSource ) + { pTokenSource = &io_rTokenSource; } + +inline void +TokenDistributor::SetTopParseEnvironment( UnoIDL_PE & io_pTopParseEnvironment ) + { aProcessingData.SetTopParseEnvironment(io_pTopParseEnvironment); } + +inline csi::uidl::Token_Receiver & +TokenDistributor::CodeTokens_Receiver() + { return aProcessingData; } + +inline csi::dsapi::Token_Receiver & +TokenDistributor::DocuTokens_Receiver() + { return aDocumentation; } + +inline const csi::uidl::Token & +TokenDistributor::ProcessingData::CurToken() const +{ + csv_assert( itCurToken != aTokenQueue.end() ); + csv_assert( *itCurToken != 0 ); + return *(*itCurToken); +} + +inline UnoIDL_PE & +TokenDistributor::ProcessingData::CurEnv() const +{ + csv_assert( aEnvironments.size() > 0 ); + csv_assert( aEnvironments.back().first != 0 ); + return *aEnvironments.back().first; +} + +inline UnoIDL_PE & +TokenDistributor::ProcessingData::PushEnv() const +{ + csv_assert( aCurResult.pEnv2Push != 0 ); + return *aCurResult.pEnv2Push; +} + +inline uintt +TokenDistributor::ProcessingData::CurTokenPosition() const +{ + return itCurToken - aTokenQueue.begin(); +} + +inline uintt +TokenDistributor::ProcessingData::CurEnv_TriedTokenPosition() const +{ + csv_assert( aEnvironments.size() > 0 ); + return aEnvironments.back().second; +} + + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/parsenv2.hxx b/autodoc/source/parser_i/inc/s2_luidl/parsenv2.hxx new file mode 100644 index 000000000000..ab6bf849055c --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/parsenv2.hxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: parsenv2.hxx,v $ + * $Revision: 1.11 $ + * + * 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 LUIDL_PARSENV2_HXX +#define LUIDL_PARSENV2_HXX + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/tokproct.hxx> + // COMPONENTS +#include <s2_luidl/semnode.hxx> + // PARAMETERS +#include <ary/idl/i_types4idl.hxx> +#include <ary/idl/i_module.hxx> + + + +class ParserInfo; + +namespace ary +{ + class QualifiedName; + class Repository; + +namespace doc +{ + class OldIdlDocu; +} + +namespace idl +{ + class CodeEntity; +} +} + + + +namespace csi +{ +namespace uidl +{ + + +class Token; +class SemanticNode; + + +class UnoIDL_PE : virtual protected TokenProcessing_Types +{ + public: + virtual ~UnoIDL_PE(); + + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & + io_rRepository, + TokenProcessing_Result & + o_rResult ); +// virtual void EstablishContacts( +// UnoIDL_PE * io_pParentPE, +// ary::idl::Gate & +// io_rGate, +// TokenProcessing_Result & +// o_rResult ); + virtual void Enter( + E_EnvStackAction i_eWayOfEntering ); + virtual void Leave( + E_EnvStackAction i_eWayOfLeaving ); + virtual void ProcessToken( + const Token & i_rToken ) = 0; + + void SetDocu( + DYN ary::doc::OldIdlDocu * + let_dpDocu ); + void SetPublished(); + void SetOptional(); + void PassDocuAt( + ary::idl::CodeEntity & + io_rCe ); + + UnoIDL_PE * Parent() const { return aMyNode.Parent(); } + + void SetResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + UnoIDL_PE * i_pParseEnv2Push = 0 ) + { aMyNode.SetTokenResult( i_eDone, i_eWhat2DoWithEnvStack, i_pParseEnv2Push ); } + virtual const ary::idl::Module & + CurNamespace() const; + virtual const ParserInfo & + ParseInfo() const; + ary::idl::Gate & Gate() const { return aMyNode.AryGate(); } + TokenProcessing_Result & + TokenResult() const { return aMyNode.TokenResult(); } + DYN ary::doc::OldIdlDocu * + ReleaseDocu() { return pDocu.Release(); } + protected: + UnoIDL_PE(); + ary::Repository & MyRepository() { csv_assert(pRepository != 0); + return *pRepository; } + private: + virtual void InitData(); + virtual void TransferData() = 0; + virtual void ReceiveData(); + + SemanticNode aMyNode; + Dyn<ary::doc::OldIdlDocu> + pDocu; + ary::Repository * pRepository; +}; + + + + +} // namespace uidl +} // namespace csi +#endif diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_attri.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_attri.hxx new file mode 100644 index 000000000000..ede8f656afd4 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_attri.hxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_attri.hxx,v $ + * $Revision: 1.7 $ + * + * 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 ADC_UIDL_PE_ATTRI_HXX +#define ADC_UIDL_PE_ATTRI_HXX + + + +// USED SERVICES + // BASE CLASSES + +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS +#include <ary/idl/i_property.hxx> + // PARAMETERS +#include <ary/idl/i_gate.hxx> + + +namespace ary +{ + namespace idl + { + class Attribute; + } +} + +namespace csi +{ +namespace uidl +{ + + +class PE_Variable; +class PE_Type; + +class PE_Attribute : public UnoIDL_PE, + public ParseEnvState +{ + public: + typedef ary::idl::Ce_id Ce_id; + typedef ary::idl::Type_id Type_id; + + PE_Attribute( + const Ce_id & i_rCurOwner ); + + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & + io_rRepository, + TokenProcessing_Result & + o_rResult ); + virtual ~PE_Attribute(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + virtual void Process_MetaType( + const TokMetaType & i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_Raises(); + virtual void Process_Default(); + + private: + enum E_State + { + e_none, + e_start, + in_variable, + expect_end, + in_raise_std, /// before 'get', 'set', ';' or '}' + in_get, + in_set + }; + + virtual void InitData(); + virtual void ReceiveData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + E_State eState; + const Ce_id * pCurOwner; + + Dyn<PE_Variable> pPE_Variable; + Dyn<PE_Type> pPE_Exception; + + // object-data + ary::idl::Attribute * + pCurAttribute; + Type_id nCurParsedType; + String sCurParsedName; + bool bReadOnly; + bool bBound; +}; + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_const.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_const.hxx new file mode 100644 index 000000000000..9219191bd27c --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_const.hxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_const.hxx,v $ + * $Revision: 1.6 $ + * + * 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 LUIDL_PE_CONST_HXX +#define LUIDL_PE_CONST_HXX + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + + +namespace udm { +class Agent_Struct; +} // namespace udm + + +namespace csi +{ +namespace uidl +{ + +class ConstantsGroup; + +class PE_Type; +class PE_Value; + +class PE_Constant : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Constant(); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & + io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_Constant(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + + private: + enum E_State + { + e_none, + expect_name, + expect_curl_bracket_open, + expect_const, + expect_value, + expect_finish, + e_STATES_MAX + }; + enum E_TokenType + { + tt_stereotype, + tt_identifier, + tt_punctuation, + tt_MAX + }; + typedef void (PE_Constant::*F_TOK)(const char *); + + + void CallHandler( + const char * i_sTokenText, + E_TokenType i_eTokenType ); + + void On_expect_name_Identifier(const char * i_sText); + void On_expect_curl_bracket_open_Punctuation(const char * i_sText); + void On_expect_const_Stereotype(const char * i_sText); + void On_expect_const_Punctuation(const char * i_sText); + void On_expect_value_Identifier(const char * i_sText); + void On_expect_finish_Punctuation(const char * i_sText); + void On_Default(const char * ); + + void EmptySingleConstData(); + void CreateSingleConstant(); + + virtual void InitData(); + virtual void ReceiveData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + static F_TOK aDispatcher[e_STATES_MAX][tt_MAX]; + + E_State eState; + + String sData_Name; + ary::idl::Ce_id nDataId; + + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nType; + + Dyn<PE_Value> pPE_Value; + String sName; + String sAssignment; +}; + + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_enum2.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_enum2.hxx new file mode 100644 index 000000000000..e27b157fd1d6 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_enum2.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_enum2.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_UIDL_PE_ENUM2_HXX +#define ADC_UIDL_PE_ENUM2_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + + + +namespace csi +{ +namespace uidl +{ + +// class Enum; + +class PE_Value; + +class PE_Enum : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Enum(); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_Enum(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + + private: + enum E_State + { + e_none, + expect_name, + expect_curl_bracket_open, + expect_value, + expect_finish, + e_STATES_MAX + }; + enum E_TokenType + { + tt_identifier, + tt_punctuation, + tt_MAX + }; + typedef void (PE_Enum::*F_TOK)(const char *); + + + void CallHandler( + const char * i_sTokenText, + E_TokenType i_eTokenType ); + + void On_expect_name_Identifier(const char * i_sText); + void On_expect_curl_bracket_open_Punctuation(const char * i_sText); + void On_expect_value_Punctuation(const char * i_sText); + void On_expect_value_Identifier(const char * i_sText); + void On_expect_finish_Punctuation(const char * i_sText); + void On_Default(const char * ); + + void EmptySingleValueData(); + void CreateSingleValue(); + + virtual void InitData(); + virtual void ReceiveData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + static F_TOK aDispatcher[e_STATES_MAX][tt_MAX]; + + E_State eState; + + String sData_Name; + ary::idl::Ce_id nDataId; + + Dyn<PE_Value> pPE_Value; + String sName; + String sAssignment; +}; + + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_evalu.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_evalu.hxx new file mode 100644 index 000000000000..93a3d3f37991 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_evalu.hxx @@ -0,0 +1,130 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_evalu.hxx,v $ + * $Revision: 1.5 $ + * + * 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 LUIDL_PE_EVALU_HXX +#define LUIDL_PE_EVALU_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + + +namespace udm { +class Agent_Struct; +} // namespace udm + + +namespace csi +{ +namespace uidl +{ + +class PE_Value : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Value( + String & o_rName, + String & o_rAssignment, + bool i_bIsConst ); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & + io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_Value(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_Assignment( + const TokAssignment & + i_rToken ); + private: + enum E_State + { + e_none = 0, + expect_name, + got_name, + e_STATES_MAX + }; + enum E_TokenType /// @ATTENTION Do not change existing values (except of tt_MAX) !!! Else array-indices will break. + { + tt_identifier = 0, + tt_punctuation = 1, + tt_assignment = 2, + tt_MAX + }; + typedef void (PE_Value::*F_TOK)(const char *); + + + void CallHandler( + const char * i_sTokenText, + E_TokenType i_eTokenType ); + + void On_expect_name_Identifier(const char * i_sText); + void On_got_name_Punctuation(const char * i_sText); + void On_got_name_Assignment(const char * i_sText); + void On_Default(const char * ); + + virtual void InitData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + bool IsConst() const { return bIsConst; } + + static F_TOK aDispatcher[e_STATES_MAX][tt_MAX]; + + E_State eState; + String * pName; + String * pAssignment; + bool bIsConst; +}; + + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_excp.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_excp.hxx new file mode 100644 index 000000000000..b9f89e3c831a --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_excp.hxx @@ -0,0 +1,262 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_excp.hxx,v $ + * $Revision: 1.6 $ + * + * 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 LUIDL_PE_EXCP_HXX +#define LUIDL_PE_EXCP_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS +#include <s2_luidl/semnode.hxx> +#include <ary/qualiname.hxx> + // PARAMETERS + + + +namespace csi +{ +namespace prl +{ + class TNamespace; +} +} + + + +namespace csi +{ +namespace uidl +{ + + +class Exception; +class StructElement; +class PE_StructElement; +class PE_Type; + + +class PE_Exception : public UnoIDL_PE +{ + public: + PE_Exception(); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_Exception(); + virtual void ProcessToken( + const Token & i_rToken ); + + private: + struct S_Work + { + S_Work(); + + void InitData(); + void Prepare_PE_QualifiedName(); + void Prepare_PE_Element(); + void Data_Set_Name( + const char * i_sName ); + // DATA + String sData_Name; + bool bIsPreDeclaration; + ary::idl::Ce_id nCurStruct; + + Dyn<PE_StructElement> + pPE_Element; + ary::idl::Ce_id nCurParsed_ElementRef; + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nCurParsed_Base; + }; + + struct S_Stati; + class PE_StructState; + friend struct S_Stati; + friend class PE_StructState; + + + class PE_StructState : public ParseEnvState + { + public: + + protected: + PE_StructState( + PE_Exception & i_rStruct ) + : rStruct(i_rStruct) {} + void MoveState( + ParseEnvState & i_rState ) const; + void SetResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + UnoIDL_PE * i_pParseEnv2Push = 0 ) const + { rStruct.SetResult(i_eDone, i_eWhat2DoWithEnvStack, i_pParseEnv2Push); } + + S_Stati & Stati() const { return *rStruct.pStati; } + S_Work & Work() const { return rStruct.aWork; } + PE_Exception & PE() const { return rStruct; } + + private: + virtual UnoIDL_PE & MyPE(); + // DATA + PE_Exception & rStruct; + }; + + class State_None : public PE_StructState + { + public: + State_None( + PE_Exception & i_rStruct ) + : PE_StructState(i_rStruct) {} + }; + class State_WaitForName : public PE_StructState + { // -> Name + public: + State_WaitForName( + PE_Exception & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + }; + class State_GotName : public PE_StructState + { // -> : { ; + public: + State_GotName( + PE_Exception & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + class State_WaitForBase : public PE_StructState + { // -> Base + public: + State_WaitForBase( + PE_Exception & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void On_SubPE_Left(); + }; + class State_GotBase : public PE_StructState + { // -> { + public: + State_GotBase( + PE_Exception & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + class State_WaitForElement : public PE_StructState + { // -> Typ } + public: + State_WaitForElement( + PE_Exception & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_NameSeparator(); + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ); + virtual void Process_TypeModifier( + const TokTypeModifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); +// virtual void On_SubPE_Left(); + }; + class State_WaitForFinish : public PE_StructState + { // -> ; + public: + State_WaitForFinish( + PE_Exception & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + + struct S_Stati + { + S_Stati( + PE_Exception & io_rStruct ); + void SetState( + ParseEnvState & i_rNextState ) + { pCurStatus = &i_rNextState; } + + State_None aNone; + State_WaitForName aWaitForName; + State_GotName aGotName; + State_WaitForBase aWaitForBase; + State_GotBase aGotBase; + State_WaitForElement + aWaitForElement; + State_WaitForFinish aWaitForFinish; + + ParseEnvState * pCurStatus; + }; + + virtual void InitData(); + virtual void TransferData(); + virtual void ReceiveData(); + + public: + + void store_Exception(); + + private: + + S_Stati & Stati() { return *pStati; } + S_Work & Work() { return aWork; } + + // DATA + S_Work aWork; + Dyn<S_Stati> pStati; +}; + + +inline void +PE_Exception::PE_StructState::MoveState( + ParseEnvState & i_rState ) const + { rStruct.Stati().SetState(i_rState); } + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_file2.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_file2.hxx new file mode 100644 index 000000000000..be493eb4ea31 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_file2.hxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_file2.hxx,v $ + * $Revision: 1.7 $ + * + * 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 LUIDL_PE_FILE2_HXX +#define LUIDL_PE_FILE2_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + + +namespace ary +{ +namespace idl +{ +class Module; +} // namespace idl +} // namespace ary + + +namespace csi +{ +namespace uidl +{ + +class TokenDistributor; +class PE_Service; +class PE_Singleton; +class PE_Interface; +class PE_Struct; +class PE_Exception; +class PE_Constant; +class PE_Enum; +class PE_Typedef; + + +class PE_File : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_File( + TokenDistributor & i_rTokenAdmin, + const ParserInfo & i_parseInfo ); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_File(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_MetaType( + const TokMetaType & i_rToken ); + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + virtual void Process_Default(); + + private: + enum E_State + { + e_none, + e_std, + wait_for_module, + wait_for_module_bracket, + wait_for_module_semicolon, + in_sub_pe, + on_default + }; + + virtual void InitData(); + virtual void TransferData(); + virtual void ReceiveData(); + virtual UnoIDL_PE & MyPE(); + virtual const ary::idl::Module & + CurNamespace() const; + virtual const ParserInfo & + ParseInfo() const; + // DATA + TokenDistributor * pTokenAdmin; + Dyn<PE_Service> pPE_Service; + Dyn<PE_Singleton> pPE_Singleton; + Dyn<PE_Interface> pPE_Interface; + Dyn<PE_Struct> pPE_Struct; + Dyn<PE_Exception> pPE_Exception; + Dyn<PE_Constant> pPE_Constant; + Dyn<PE_Enum> pPE_Enum; + Dyn<PE_Typedef> pPE_Typedef; + + const ary::idl::Module * + pCurNamespace; + const ParserInfo * pParseInfo; + + E_State eState; + uintt nBracketCount_inDefMode; +}; + + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_func2.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_func2.hxx new file mode 100644 index 000000000000..7adbe8efc7a0 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_func2.hxx @@ -0,0 +1,170 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_func2.hxx,v $ + * $Revision: 1.6 $ + * + * 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 ADC_UIDL_PE_FUNC2_HXX +#define ADC_UIDL_PE_FUNC2_HXX + + + +// USED SERVICES + // BASE CLASSES +// #include <ary/idl/i_gate.hxx> +// #include <ary/idl/ip_ce.hxx> +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS +#include <ary/idl/i_param.hxx> + // PARAMETERS + +namespace ary +{ + namespace idl + { + class Function; + } +} + + +namespace csi +{ +namespace uidl +{ + +class PE_Type; +class PE_Variable; + +class PE_Function : public UnoIDL_PE, + public ParseEnvState +{ + public: + typedef ary::idl::Ce_id RParent; + typedef ary::idl::Ce_id RFunction; + + enum E_Constructor { constructor }; + + /// Constructor for interfaces. + PE_Function( + const RParent & i_rCurInterface ); + + /// Constructor for single interface based services. + PE_Function( + const RParent & i_rCurService, + E_Constructor i_eCtorMarker ); + + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + virtual ~PE_Function(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ); + virtual void Process_ParameterHandling( + const TokParameterHandling & + i_rToken ); + virtual void Process_Raises(); + virtual void Process_Default(); + + private: + enum E_State + { + e_none, + e_start, + in_return_type, + expect_name, + expect_params_list, + expect_parameter, + expect_parameter_variable, + in_parameter_variable, + expect_parameter_separator, + params_finished, + expect_exceptions_list, + expect_exception, + in_exception, + expect_exception_separator, + exceptions_finished + }; + + void GoIntoReturnType(); + void GoIntoParameterVariable(); + void GoIntoException(); + void OnDefault(); + + virtual void InitData(); + virtual void ReceiveData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + E_State eState; + + String sData_Name; + ary::idl::Type_id nData_ReturnType; + bool bData_Oneway; + ary::idl::Function * + pCurFunction; + + const RParent * pCurParent; + + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nCurParsedType; // ReturnType or Exception + + String sName; + + Dyn<PE_Variable> pPE_Variable; + ary::idl::E_ParameterDirection + eCurParsedParam_Direction; + ary::idl::Type_id nCurParsedParam_Type; + String sCurParsedParam_Name; + bool bIsForConstructors; +}; + + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_iface.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_iface.hxx new file mode 100644 index 000000000000..296ea875b27b --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_iface.hxx @@ -0,0 +1,187 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_iface.hxx,v $ + * $Revision: 1.7 $ + * + * 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 ADC_UIDL_PE_IFACE_HXX +#define ADC_UIDL_PE_IFACE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + +namespace ary +{ +namespace idl +{ + class Interface; +} +} + +namespace csi +{ +namespace uidl +{ + + + +class PE_Function; +class PE_Attribute; +class PE_Type; + +class PE_Interface : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Interface(); + virtual ~PE_Interface(); + + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_MetaType( + const TokMetaType & i_rToken ); + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_NameSeparator(); + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ); + virtual void Process_TypeModifier( + const TokTypeModifier & + i_rToken ); + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + virtual void Process_Default(); + + private: + enum E_State /// @ATTENTION Do not change existing values (except of e_STATES_MAX) !!! Else array-indices will break. + { + e_none = 0, + need_uik, + uik, + need_ident, + ident, + need_interface, + need_name, + wait_for_base, + in_base, // in header, after ":" + need_curlbr_open, + e_std, + in_function, + in_attribute, + need_finish, + in_base_interface, // in body, after "interface" + e_STATES_MAX + }; + enum E_TokenType /// @ATTENTION Do not change existing values (except of tt_MAX) !!! Else array-indices will break. + { + tt_metatype = 0, + tt_identifier = 1, + tt_punctuation = 2, + tt_startoftype = 3, + tt_stereotype = 4, + tt_MAX + }; + typedef void (PE_Interface::*F_TOK)(const char *); + + + void On_need_uik_MetaType(const char * i_sText); + void On_uik_Identifier(const char * i_sText); + void On_uik_Punctuation(const char * i_sText); + void On_need_ident_MetaType(const char * i_sText); + void On_ident_Identifier(const char * i_sText); + void On_ident_Punctuation(const char * i_sText); + void On_need_interface_MetaType(const char * i_sText); + void On_need_name_Identifer(const char * i_sText); + void On_wait_for_base_Punctuation(const char * i_sText); + void On_need_curlbr_open_Punctuation(const char * i_sText); + void On_std_Metatype(const char * i_sText); + void On_std_Punctuation(const char * i_sText); + void On_std_Stereotype(const char * i_sText); + void On_std_GotoFunction(const char * i_sText); + void On_std_GotoAttribute(const char * i_sText); + void On_std_GotoBaseInterface(const char * i_sText); + void On_need_finish_Punctuation(const char * i_sText); + void On_Default(const char * i_sText); + + void CallHandler( + const char * i_sTokenText, + E_TokenType i_eTokenType ); + + virtual void InitData(); + virtual void TransferData(); + virtual void ReceiveData(); + virtual UnoIDL_PE & MyPE(); + + void store_Interface(); + + // DATA + static F_TOK aDispatcher[e_STATES_MAX][tt_MAX]; + + E_State eState; + String sData_Name; + bool bIsPreDeclaration; + ary::idl::Interface * + pCurInterface; + ary::idl::Ce_id nCurInterface; + + Dyn<PE_Function> pPE_Function; + Dyn<PE_Attribute> pPE_Attribute; + + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nCurParsed_Base; + bool bOptionalMember; +}; + + + +// IMPLEMENTATION + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_modul.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_modul.hxx new file mode 100644 index 000000000000..4da9b6e3958b --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_modul.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_modul.hxx,v $ + * $Revision: 1.3 $ + * + * 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 LUIDL_PE_MODUL_HXX +#define LUIDL_PE_MODUL_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <semantic/semnode.hxx> + // COMPONENTS + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + + + +class PE_Module : public ::ParseEnvironment +{ + public: + + virtual void Enter( + E_EnvStackAction i_eWayOfEntering ); + virtual void Leave( + E_EnvStackAction i_eWayOfLeaving ); + + private: +}; + + +} // namespace uidl +} // namespace csi + + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_property.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_property.hxx new file mode 100644 index 000000000000..5d5c1ab37e02 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_property.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_property.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_UIDL_PE_PROPERTY_HXX +#define ADC_UIDL_PE_PROPERTY_HXX + + + +// USED SERVICES + // BASE CLASSES + +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS +#include <ary/idl/i_property.hxx> + // PARAMETERS +#include <ary/idl/i_gate.hxx> + + +namespace csi +{ +namespace uidl +{ + + +class PE_Variable; + +class PE_Property : public UnoIDL_PE, + public ParseEnvState +{ + public: + typedef ary::idl::Ce_id Ce_id; + typedef ary::idl::Type_id Type_id; + typedef ary::idl::Property::Stereotypes Stereotypes; + + + PE_Property( + const Ce_id & i_rCurOwner ); + + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & + io_rRepository, + TokenProcessing_Result & + o_rResult ); + virtual ~PE_Property(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + virtual void Process_MetaType( + const TokMetaType & i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_Default(); + + void PresetOptional() { bIsOptional = true; } + void PresetStereotypes( + Stereotypes::E_Flags + i_eFlag ) + { aStereotypes.Set_Flag(i_eFlag); } + private: + enum E_State + { + e_none, + e_start, + expect_variable, + in_variable + }; + + virtual void InitData(); + virtual void ReceiveData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + E_State eState; + const Ce_id * pCurOwner; + + Dyn<PE_Variable> pPE_Variable; + + // object-data + Type_id nCurParsedType; + String sCurParsedName; + bool bIsOptional; + Stereotypes aStereotypes; +}; + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_selem.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_selem.hxx new file mode 100644 index 000000000000..19194a44da59 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_selem.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_selem.hxx,v $ + * $Revision: 1.6 $ + * + * 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 LUIDL_PE_SELEM_HXX +#define LUIDL_PE_SELEM_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_gate.hxx> + + +namespace udm { +class Agent_Struct; +} // namespace udm + + +namespace csi +{ +namespace uidl +{ + +class PE_Type; +class StructElement; +class Struct; + +class PE_StructElement : public UnoIDL_PE, + public ParseEnvState +{ + public: + typedef ary::idl::Ce_id RStructElement; + typedef ary::idl::Ce_id RStruct; + + PE_StructElement( /// Use for Struct-elements + RStructElement & o_rResult, + const RStruct & i_rCurStruct, + const String & i_rCurStructTemplateParam ); + PE_StructElement( /// Use for Exception-elements + RStructElement & o_rResult, + const RStruct & i_rCurExc ); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_StructElement(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Default(); + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + + private: + enum E_State + { + e_none, + expect_type, + expect_name, + expect_finish + }; + + virtual void InitData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + ary::idl::Type_id lhf_FindTemplateParamType() const; + + // DATA + E_State eState; + RStructElement * pResult; + const RStruct * pCurStruct; + bool bIsExceptionElement; + + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nType; + String sName; + const String * pCurStructTemplateParam; +}; + + + +} // namespace uidl +} // namespace csi + + +#endif diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_servi.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_servi.hxx new file mode 100644 index 000000000000..92e40b4e1bc6 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_servi.hxx @@ -0,0 +1,152 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_servi.hxx,v $ + * $Revision: 1.6 $ + * + * 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 ADC_UIDL_PE_SERVI_HXX +#define ADC_UIDL_PE_SERVI_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + +namespace ary +{ + namespace idl + { + class Service; + class SglIfcService; + } +} + +namespace csi +{ +namespace uidl +{ + +class PE_Property; +class PE_Type; +class PE_Function; + + +class PE_Service : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Service(); + virtual ~PE_Service(); + + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_MetaType( + const TokMetaType & i_rToken ); + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + virtual void Process_Needs(); + virtual void Process_Observes(); + virtual void Process_Default(); + + private: + void On_Default(); + + enum E_State + { + e_none = 0, + need_name, + need_curlbr_open, + e_std, + in_property, + in_ifc_type, + in_service_type, + expect_ifc_separator, + expect_service_separator, + at_ignore, + need_finish, + need_base_interface, /// After ":". + need_curlbr_open_sib, /// After base interface in single interface based service. + e_std_sib, /// Standard in single interface based service. + e_STATES_MAX + }; + + virtual void InitData(); + virtual void TransferData(); + virtual void ReceiveData(); + virtual UnoIDL_PE & MyPE(); + + void StartProperty(); + + + // DATA + E_State eState; + String sData_Name; + bool bIsPreDeclaration; + ary::idl::Service * pCurService; + ary::idl::SglIfcService * + pCurSiService; + ary::idl::Ce_id nCurService; // Needed for PE_Attribute. + + Dyn<PE_Property> pPE_Property; + ary::idl::Ce_id nCurParsed_Property; + + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nCurParsed_Type; + + Dyn<PE_Function> pPE_Constructor; + + bool bOptionalMember; +}; + + + +// IMPLEMENTATION + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_singl.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_singl.hxx new file mode 100644 index 000000000000..ec3214e77fd0 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_singl.hxx @@ -0,0 +1,153 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_singl.hxx,v $ + * $Revision: 1.5 $ + * + * 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 LUIDL_PE_SINGL_HXX +#define LUIDL_PE_SINGL_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + +namespace ary +{ + namespace idl + { + class Singleton; + class SglIfcSingleton; + } +} + + +namespace csi +{ +namespace uidl +{ + +class PE_Type; + + +class PE_Singleton : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Singleton(); + virtual ~PE_Singleton(); + + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_MetaType( + const TokMetaType & i_rToken ); + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_Default(); + + private: + enum E_State + { + e_none = 0, + need_name, + need_curlbr_open, + e_std, + in_service, + need_finish, + in_base_interface, + e_STATES_MAX + }; + + +#if 0 + enum E_TokenType /// @ATTENTION Do not change existing values (except of tt_MAX) !!! Else array-indices will break. + { + tt_metatype = 0, + tt_identifier = 1, + tt_punctuation = 2, + tt_startoftype = 3, + tt_MAX + }; + typedef void (PE_Singleton::*F_TOK)(const char *); + + + void On_need_singleton_MetaType(const char * i_sText); + void On_need_name_Identifer(const char * i_sText); + void On_need_curlbr_open_Punctuation(const char * i_sText); + void On_std_GotoService(const char * i_sText); + void On_std_Punctuation(const char * i_sText); + void On_need_finish_Punctuation(const char * i_sText); + + void CallHandler( + const char * i_sTokenText, + E_TokenType i_eTokenType ); +#endif // 0 + + void On_Default(); + + virtual void InitData(); + virtual void TransferData(); + virtual void ReceiveData(); + virtual UnoIDL_PE & MyPE(); + + // DATA +// static F_TOK aDispatcher[e_STATES_MAX][tt_MAX]; + + E_State eState; + String sData_Name; + bool bIsPreDeclaration; + ary::idl::Singleton * + pCurSingleton; + ary::idl::SglIfcSingleton * + pCurSiSingleton; + + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nCurParsed_Type; +}; + + +} // namespace uidl +} // namespace csi + + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_struc.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_struc.hxx new file mode 100644 index 000000000000..e362f45562ea --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_struc.hxx @@ -0,0 +1,288 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_struc.hxx,v $ + * $Revision: 1.7 $ + * + * 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 LUIDL_PE_STRUC_HXX +#define LUIDL_PE_STRUC_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS +#include <s2_luidl/semnode.hxx> +#include <ary/qualiname.hxx> + // PARAMETERS + + + +namespace csi +{ +namespace prl +{ + class TNamespace; +} +} + + + +namespace csi +{ +namespace uidl +{ + + +class Struct; +class StructElement; +class PE_StructElement; +class PE_Type; + + +class PE_Struct : public UnoIDL_PE +{ + public: + PE_Struct(); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_Struct(); + virtual void ProcessToken( + const Token & i_rToken ); + + private: + struct S_Work + { + S_Work(); + + void InitData(); + void Prepare_PE_QualifiedName(); + void Prepare_PE_Element(); + void Data_Set_Name( + const char * i_sName ); + void Data_Set_TemplateParam( + const char * i_sTemplateParam ); + + String sData_Name; + String sData_TemplateParam; + bool bIsPreDeclaration; + ary::idl::Ce_id nCurStruct; + + Dyn<PE_StructElement> + pPE_Element; + ary::idl::Ce_id nCurParsed_ElementRef; + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nCurParsed_Base; + }; + + struct S_Stati; + class PE_StructState; + friend struct S_Stati; + friend class PE_StructState; + + + class PE_StructState : public ParseEnvState + { + public: + + protected: + PE_StructState( + PE_Struct & i_rStruct ) + : rStruct(i_rStruct) {} + void MoveState( + ParseEnvState & i_rState ) const; + void SetResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + UnoIDL_PE * i_pParseEnv2Push = 0 ) const + { rStruct.SetResult(i_eDone, i_eWhat2DoWithEnvStack, i_pParseEnv2Push); } + + S_Stati & Stati() const { return *rStruct.pStati; } + S_Work & Work() const { return rStruct.aWork; } + PE_Struct & PE() const { return rStruct; } + + private: + virtual UnoIDL_PE & MyPE(); + // DATA + PE_Struct & rStruct; + }; + + class State_None : public PE_StructState + { + public: + State_None( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + }; + class State_WaitForName : public PE_StructState + { // -> Name + public: + State_WaitForName( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + }; + class State_GotName : public PE_StructState + { // -> : { ; < + public: + State_GotName( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + class State_WaitForTemplateParam : public PE_StructState + { // -> Template parameter identifier + public: + State_WaitForTemplateParam( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + }; + class State_WaitForTemplateEnd : public PE_StructState + { // -> > + public: + State_WaitForTemplateEnd( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + class State_WaitForBase : public PE_StructState + { // -> Base + public: + State_WaitForBase( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void On_SubPE_Left(); + }; + class State_GotBase : public PE_StructState + { // -> { + public: + State_GotBase( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + class State_WaitForElement : public PE_StructState + { // -> Typ } + public: + State_WaitForElement( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_NameSeparator(); + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ); + virtual void Process_TypeModifier( + const TokTypeModifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + class State_WaitForFinish : public PE_StructState + { // -> ; + public: + State_WaitForFinish( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + + struct S_Stati + { + S_Stati( + PE_Struct & io_rStruct ); + void SetState( + ParseEnvState & i_rNextState ) + { pCurStatus = &i_rNextState; } + + State_None aNone; + State_WaitForName aWaitForName; + State_GotName aGotName; + State_WaitForTemplateParam + aWaitForTemplateParam; + State_WaitForTemplateEnd + aWaitForTemplateEnd; + State_WaitForBase aWaitForBase; + State_GotBase aGotBase; + State_WaitForElement + aWaitForElement; + State_WaitForFinish aWaitForFinish; + + ParseEnvState * pCurStatus; + }; + + virtual void InitData(); + virtual void TransferData(); + virtual void ReceiveData(); + + public: + + void store_Struct(); + + private: + + S_Stati & Stati() { return *pStati; } + S_Work & Work() { return aWork; } + + // DATA + S_Work aWork; + Dyn<S_Stati> pStati; +}; + + +inline void +PE_Struct::PE_StructState::MoveState( + ParseEnvState & i_rState ) const + { rStruct.Stati().SetState(i_rState); } + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_tydf2.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_tydf2.hxx new file mode 100644 index 000000000000..ee5fb69c26cf --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_tydf2.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_tydf2.hxx,v $ + * $Revision: 1.5 $ + * + * 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 LUIDL_PE_TYDF2_HXX +#define LUIDL_PE_TYDF2_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + + + + +namespace csi +{ +namespace uidl +{ + +class PE_Type; + + +class PE_Typedef : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Typedef(); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_Typedef(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_Default(); + + private: + enum E_State + { + e_none = 0, + expect_description, + expect_name, + got_name, + e_STATES_MAX + }; + enum E_TokenType /// @ATTENTION Do not change existing values (except of tt_MAX) !!! Else array-indices will break. + { + tt_any = 0, + tt_identifier, + tt_punctuation, + tt_MAX + }; + typedef void (PE_Typedef::*F_TOK)(const char *); + + + void CallHandler( + const char * i_sTokenText, + E_TokenType i_eTokenType ); + + void On_expect_description_Any(const char * i_sText); + void On_expect_name_Identifier(const char * i_sText); + void On_got_name_Punctuation(const char * i_sText); + void On_Default(const char * ); + + virtual void InitData(); + virtual void ReceiveData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + static F_TOK aDispatcher[e_STATES_MAX][tt_MAX]; + + E_State eState; + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nType; + String sName; +}; + + + +} // namespace uidl +} // namespace csi + + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_type2.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_type2.hxx new file mode 100644 index 000000000000..4880395ea979 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_type2.hxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_type2.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_PE_TYPE2_HXX +#define ADC_PE_TYPE2_HXX + + + +// USED SERVICES + // BASE CLASSES +#include<s2_luidl/parsenv2.hxx> +#include<s2_luidl/pestate.hxx> + // COMPONENTS +#include<ary/qualiname.hxx> + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + + +class PE_Type : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Type( + ary::idl::Type_id & o_rResult ); + virtual ~PE_Type(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_NameSeparator(); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ); + virtual void Process_TypeModifier( + const TokTypeModifier & + i_rToken ); + virtual void Process_Default(); + + private: + enum E_State + { + e_none = 0, + expect_type, + expect_quname_part, + expect_quname_separator, + in_template_type + }; + + void Finish(); + PE_Type & MyTemplateType(); + + virtual void InitData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + ary::idl::Type_id * pResult; + + uintt nIsSequenceCounter; + uintt nSequenceDownCounter; + bool bIsUnsigned; + ary::QualifiedName sFullType; + + E_State eState; + String sLastPart; + + Dyn<PE_Type> pPE_TemplateType; /// @attention Recursion, only initiate, if needed! + ary::idl::Type_id nTemplateType; + std::vector<ary::idl::Type_id> + aTemplateParameters; +}; + + + +// IMPLEMENTATION + + +} // namespace uidl +} // namespace csi + +#endif diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_vari2.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_vari2.hxx new file mode 100644 index 000000000000..936b027920dc --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_vari2.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_vari2.hxx,v $ + * $Revision: 1.6 $ + * + * 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 ADC_UIDL_PE_VARI2_HXX +#define ADC_UIDL_PE_VARI2_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + + +class PE_Type; + + +class PE_Variable : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Variable( + ary::idl::Type_id & i_rResult_Type, + String & i_rResult_Name ); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & + io_rRepository, + TokenProcessing_Result & + o_rResult ); + virtual ~PE_Variable(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Default(); + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ); + private: + enum E_State + { + e_none, + expect_type, + expect_name, + expect_finish + }; + + virtual void InitData(); + virtual void ReceiveData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + E_State eState; + ary::idl::Type_id * pResult_Type; + String * pResult_Name; + + Dyn<PE_Type> pPE_Type; +}; + + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pestate.hxx b/autodoc/source/parser_i/inc/s2_luidl/pestate.hxx new file mode 100644 index 000000000000..ab7f4af16ed8 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pestate.hxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pestate.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_PESTATE_HXX +#define ADC_PESTATE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include<s2_luidl/tokintpr.hxx> +#include<s2_luidl/tokproct.hxx> + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace uidl +{ + + +class TokIdentifier; +class TokBuiltInType; +class TokPunctuation; +class Tok_Documentation; + +class ParseEnvState : public TokenInterpreter, + virtual protected TokenProcessing_Types +{ + public: + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_NameSeparator(); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ); + virtual void Process_TypeModifier( + const TokTypeModifier & + i_rToken ); + virtual void Process_MetaType( + const TokMetaType & i_rToken ); + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + virtual void Process_ParameterHandling( + const TokParameterHandling & + i_rToken ); + virtual void Process_Raises(); + virtual void Process_Needs(); + virtual void Process_Observes(); + virtual void Process_Assignment( + const TokAssignment & + i_rToken ); + virtual void Process_EOL(); + + virtual void On_SubPE_Left(); + + virtual void Process_Default(); + + protected: + ParseEnvState() : bDefaultIsError(true) {} + void SetDefault2Ignore() { bDefaultIsError = false; } + + private: + virtual UnoIDL_PE & MyPE() = 0; + bool bDefaultIsError; +}; + + + +// IMPLEMENTATION + + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/semnode.hxx b/autodoc/source/parser_i/inc/s2_luidl/semnode.hxx new file mode 100644 index 000000000000..b9dee36f1da5 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/semnode.hxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: semnode.hxx,v $ + * $Revision: 1.6 $ + * + * 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 ADC_SEMNODE_HXX +#define ADC_SEMNODE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/tokproct.hxx> + // COMPONENTS + // PARAMETERS +#include <ary/qualiname.hxx> +// #include <udm/ref.hxx> + + +namespace ary +{ + class QualifiedName; + class Repository; + +namespace idl +{ + class Gate; + class Module; +} // namespace idl +} // namespace ary + + +namespace csi +{ +namespace uidl +{ + + +class Struct; +class Token; + + +/** is an implementation class for UnoIDL_PE s +*/ +class SemanticNode : private TokenProcessing_Types +{ + public: + SemanticNode(); + void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::idl::Gate & io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~SemanticNode(); + + void SetTokenResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + UnoIDL_PE * i_pParseEnv2Push = 0 ); + UnoIDL_PE * Parent() const { return pParentPE; } + ary::idl::Gate & AryGate() const { return *pAryGate; } + TokenProcessing_Result & + TokenResult() const { return *pTokenResult; } + + private: + // DATA + UnoIDL_PE * pParentPE; + ary::idl::Gate * pAryGate; + TokenProcessing_Result * + pTokenResult; +}; + + +/* +class Trying_PE +{ + public: + virtual ~Trying_PE() {} + + protected: + Trying_PE(); + + virtual void ProcessToken( + const Token & i_rToken ); + + void StartTry( + UnoIDL_PE & i_rFirstTry ); + void Add2Try( + UnoIDL_PE & i_rTry ); + bool AmITrying() const; + UnoIDL_PE * NextTry() const; + void FinishTry(); + + private: + std::vector<UnoIDL_PE*> + aTryableSubEnvironments; + uintt nTryCounter; +}; + +*/ + + +// IMPLEMENTATION + + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/smp_uidl.hxx b/autodoc/source/parser_i/inc/s2_luidl/smp_uidl.hxx new file mode 100644 index 000000000000..4e242b5b4806 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/smp_uidl.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: smp_uidl.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_SMP_HXX +#define ADC_SMP_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/tok_recv.hxx> +#include <s2_dsapi/tok_recv.hxx> + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace uidl +{ + + + +/** is an implementation class for ParseEnvironment +*/ +class SemanticParser : public csi::uidl::Token_Receiver, + public csi::dsapi::Token_Receiver +{ + public: + typedef std::deque< DYN TextToken * > TokenQueue; + + ~SemanticParser(); + + + void Receive( + DYN csi::uidl::Token & + let_drToken ); + void Receive( + DYN csi::dsapi::Token & + let_drToken ); + + private: + // DATA + TokenQueue aTokenQueue; + + +}; + + + +// IMPLEMENTATION + + +} // namespace uidl +} // namespace csi + +#endif + + diff --git a/autodoc/source/parser_i/inc/s2_luidl/tk_const.hxx b/autodoc/source/parser_i/inc/s2_luidl/tk_const.hxx new file mode 100644 index 000000000000..364aa1de8ea2 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tk_const.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_const.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_UIDL_TK_CONST_HXX +#define ADC_UIDL_TK_CONST_HXX + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/uidl_tok.hxx> + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace uidl +{ + + +class TokAssignment : public Token +{ + public: + TokAssignment( + const char * i_sText ) + : sText(i_sText) {} + + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; + private: + // DATA + String sText; +}; + + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/tk_ident.hxx b/autodoc/source/parser_i/inc/s2_luidl/tk_ident.hxx new file mode 100644 index 000000000000..5a38faf1b106 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tk_ident.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_ident.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_UIDL_TK_IDENT_HXX +#define ADC_UIDL_TK_IDENT_HXX + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/uidl_tok.hxx> + // COMPONENTS + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + + +class TokIdentifier : public Token +{ + public: + TokIdentifier( + const char * i_sText ) + : sText(i_sText) {} + + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; + private: + // DATA + String sText; +}; + +class TokNameSeparator : public Token +{ + public: + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; +}; + + +} // namespace uidl +} // namespace csi + +#endif + + diff --git a/autodoc/source/parser_i/inc/s2_luidl/tk_keyw.hxx b/autodoc/source/parser_i/inc/s2_luidl/tk_keyw.hxx new file mode 100644 index 000000000000..0cedd0ab5027 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tk_keyw.hxx @@ -0,0 +1,254 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_keyw.hxx,v $ + * $Revision: 1.7 $ + * + * 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 ADC_UIDL_TK_KEYW_HXX +#define ADC_UIDL_TK_KEYW_HXX + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/uidl_tok.hxx> + // COMPONENTS +#include <luxenum.hxx> + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + + +class TokKeyword : public Token +{ +}; + + +class TokBuiltInType : public TokKeyword +{ + public: + enum E_TokenId + { + e_none = 0, + bty_any = 1, + bty_boolean = 2, + bty_byte = 3, + bty_char = 4, + bty_double = 5, + bty_hyper = 6, + bty_long = 7, + bty_short = 8, + bty_string = 9, + bty_void = 10, + bty_ellipse = 11 + }; + typedef lux::Enum<E_TokenId> EV_TokenId; + + TokBuiltInType( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; + E_TokenId Id() const { return eTag; } + + private: + // DATA + EV_TokenId eTag; +}; + + +class TokTypeModifier : public TokKeyword +{ + public: + enum E_TokenId + { + e_none = 0, + tmod_unsigned = 1, + tmod_sequence + }; + typedef lux::Enum<E_TokenId> EV_TokenId; + + TokTypeModifier( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; + E_TokenId Id() const { return eTag; } + + private: + // DATA + EV_TokenId eTag; +}; + +class TokMetaType : public TokKeyword +{ + public: + enum E_TokenId + { + e_none = 0, + mt_attribute = 1, + mt_constants, + mt_enum, + mt_exception, + mt_ident, + mt_interface, + mt_module, + mt_property, + mt_service, + mt_singleton, + mt_struct, + mt_typedef, + mt_uik + }; + typedef lux::Enum<E_TokenId> EV_TokenId; + + TokMetaType( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; + E_TokenId Id() const { return eTag; } + + + private: + // DATA + EV_TokenId eTag; +}; + +class TokStereotype : public TokKeyword +{ + public: + // TYPES + enum E_TokenId + { + e_none = 0, + ste_bound = 1, + ste_const, + ste_constrained, + ste_maybeambiguous, + ste_maybedefault, + ste_maybevoid, + ste_oneway, + ste_optional, + ste_readonly, + ste_removable, + ste_virtual, + ste_transient, + ste_published + }; + + typedef lux::Enum<E_TokenId> EV_TokenId; + + TokStereotype( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char * + Text() const; + E_TokenId Id() const { return eTag; } + + private: + // DATA + EV_TokenId eTag; +}; + +class TokParameterHandling : public TokKeyword +{ + public: + // TYPES + enum E_TokenId + { + e_none = 0, + ph_in, + ph_out, + ph_inout + }; + typedef lux::Enum<E_TokenId> EV_TokenId; + + TokParameterHandling( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char * + Text() const; + E_TokenId Id() const { return eTag; } + + private: + // DATA + EV_TokenId eTag; +}; + +class TokRaises : public TokKeyword +{ + public: + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; +}; + +class TokNeeds : public TokKeyword +{ + public: + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; +}; + +class TokObserves : public TokKeyword +{ + public: + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; +}; + + +} // namespace uidl +} // namespace csi + +#endif + + diff --git a/autodoc/source/parser_i/inc/s2_luidl/tk_punct.hxx b/autodoc/source/parser_i/inc/s2_luidl/tk_punct.hxx new file mode 100644 index 000000000000..8e72a10fbc4a --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tk_punct.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_punct.hxx,v $ + * $Revision: 1.5 $ + * + * 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 ADC_UIDL_TK_PUNCT_HXX +#define ADC_UIDL_TK_PUNCT_HXX + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/uidl_tok.hxx> + // COMPONENTS +#include <luxenum.hxx> + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + + +class TokPunctuation : public Token +{ + public: + // TYPES + enum E_TokenId + { + e_none = 0, + BracketOpen = 1, // ( + BracketClose = 2, // ) + ArrayBracketOpen = 3, // [ + ArrayBracketClose = 4, // ] + CurledBracketOpen = 5, // { + CurledBracketClose = 6, // } + Semicolon = 7, // ; + Colon = 8, // : + DoubleColon = 9, // :: + Comma = 10, // , + Minus = 11, // - + Fullstop = 12, // . + Lesser = 13, // < + Greater = 14 // > + }; + typedef lux::Enum<E_TokenId> EV_TokenId; + + + TokPunctuation( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char * + Text() const; + EV_TokenId Id() const { return eTag; } + + + private: + // DATA + EV_TokenId eTag; +}; + +class Tok_EOL : public Token +{ + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char * + Text() const; +}; + +class Tok_EOF : public Token +{ + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char * + Text() const; +}; + + +} // namespace uidl +} // namespace csi + +#endif + + diff --git a/autodoc/source/parser_i/inc/s2_luidl/tkp_uidl.hxx b/autodoc/source/parser_i/inc/s2_luidl/tkp_uidl.hxx new file mode 100644 index 000000000000..2dadc4ee3ad7 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tkp_uidl.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkp_uidl.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_TKP_UIDL_HXX +#define ADC_TKP_UIDL_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkp2.hxx> + // COMPONENTS + // PARAMETRS + +class TkpDocuContext; + + +namespace csi +{ +namespace uidl +{ + + + +class Token_Receiver; +class Context_UidlCode; + + +/** This is a TokenParser which is able to parse tokens from + C++ source code. +*/ +class TokenParser_Uidl : public TokenParse2 +{ + public: + // LIFECYCLE + TokenParser_Uidl( + Token_Receiver & o_rUidlReceiver, + DYN TkpDocuContext & + let_drDocuContext ); + virtual ~TokenParser_Uidl(); + + // OPERATIONS + private: + virtual ::TkpContext & + CurrentContext(); + + virtual void SetStartContext(); + virtual void SetCurrentContext( + TkpContext & io_rContext ); + // DATA + Dyn<Context_UidlCode> + pBaseContext; + ::TkpContext * pCurContext; +}; + + +} // namespace uidl +} // namespace csi + +#endif + + diff --git a/autodoc/source/parser_i/inc/s2_luidl/tokintpr.hxx b/autodoc/source/parser_i/inc/s2_luidl/tokintpr.hxx new file mode 100644 index 000000000000..2aa310c3dc64 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tokintpr.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tokintpr.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_LUIDL_TOKINTPR_HXX +#define ADC_LUIDL_TOKINTPR_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace uidl +{ + + +class TokIdentifier; +class TokPunctuation; +class TokBuiltInType; +class TokTypeModifier; +class TokMetaType; +class TokStereotype; +class TokParameterHandling; +class TokAssignment; +class Tok_Documentation; + + +class TokenInterpreter +{ + public: + virtual ~TokenInterpreter() {} + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ) = 0; + virtual void Process_NameSeparator() = 0; // :: + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ) = 0; + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ) = 0; + virtual void Process_TypeModifier( + const TokTypeModifier & + i_rToken ) = 0; + virtual void Process_MetaType( + const TokMetaType & i_rToken ) = 0; + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ) = 0; + virtual void Process_ParameterHandling( + const TokParameterHandling & + i_rToken ) = 0; + virtual void Process_Raises() = 0; + virtual void Process_Needs() = 0; + virtual void Process_Observes() = 0; + virtual void Process_Assignment( + const TokAssignment & + i_rToken ) = 0; + virtual void Process_EOL() = 0; +}; + + + +// IMPLEMENTATION + + +} // namespace uidl +} // namespace csi + +#endif diff --git a/autodoc/source/parser_i/inc/s2_luidl/tokproct.hxx b/autodoc/source/parser_i/inc/s2_luidl/tokproct.hxx new file mode 100644 index 000000000000..57210760fc87 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tokproct.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tokproct.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_TOKPROCT_HXX +#define ADC_TOKPROCT_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + + +class UnoIDL_PE; + + +/** is a parent class for classes, which take part in parsing tokens semantically. + It provides some types for them. +*/ +class TokenProcessing_Types +{ + public: + enum E_TokenDone + { + not_done = 0, + done = 1 + }; + + enum E_EnvStackAction + { + stay, // same parse environment + push_sure, // push sub environment, which must be the correct one + push_try, // push sub environment, which is tried, if it may be the right one + pop_success, // return to parent environment, parsing was successful + pop_failure // return to parent environment, but an error occured. + }; + + struct TokenProcessing_Result + { + E_TokenDone eDone; + E_EnvStackAction eStackAction; + UnoIDL_PE * pEnv2Push; + + TokenProcessing_Result() + : eDone(not_done), eStackAction(stay), pEnv2Push(0) {} + void reset() { eDone = not_done; eStackAction = stay; pEnv2Push = 0; } + }; + + enum E_ParseResult + { + res_error, + res_complete, + res_predeclaration + }; +}; + + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/tokrecv.hxx b/autodoc/source/parser_i/inc/s2_luidl/tokrecv.hxx new file mode 100644 index 000000000000..e0e2d01be46a --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tokrecv.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tokrecv.hxx,v $ + * $Revision: 1.4 $ + * + * 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 LUIDL_TOKRECV_HXX +#define LUIDL_TOKRECV_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace uidl +{ + + +class Token; + +/** +@descr +*/ +class Token_Receiver +{ + public: + virtual ~Token_Receiver() {} + virtual void Receive( + DYN Token & let_drToken ) = 0; + virtual void Increment_CurLine() = 0; +}; + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/uidl_tok.hxx b/autodoc/source/parser_i/inc/s2_luidl/uidl_tok.hxx new file mode 100644 index 000000000000..9fc7950c7749 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/uidl_tok.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: uidl_tok.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_UIDL_TOK_HXX +#define ADC_UIDL_TOK_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/token2.hxx> + // COMPONENTS + // PARAMETERS + + +class ParserInfo; + +namespace csi +{ +namespace uidl +{ + + +class TokenInterpreter; + +class Token : public TextToken +{ + public: + // LIFECYCLE + virtual ~Token() {} + + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const = 0; +}; + +} // namespace uidl +} // namespace csi + +#endif + + diff --git a/autodoc/source/parser_i/inc/semantic/parsenv2.hxx b/autodoc/source/parser_i/inc/semantic/parsenv2.hxx new file mode 100644 index 000000000000..21ba2b565463 --- /dev/null +++ b/autodoc/source/parser_i/inc/semantic/parsenv2.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: parsenv2.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_PARSEENV2_HXX +#define ADC_PARSEENV2_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +#include <queue> + + + +class ParseEnvironment +{ + public: + virtual ~ParseEnvironment(); + + virtual void Enter() = 0; +}; + + +#endif + diff --git a/autodoc/source/parser_i/inc/tokens/stmstar2.hxx b/autodoc/source/parser_i/inc/tokens/stmstar2.hxx new file mode 100644 index 000000000000..a28d2cb37f28 --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/stmstar2.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstar2.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_STMSTAR2_HXX +#define ADC_STMSTAR2_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/stmstat2.hxx> + // COMPONENTS + // PARAMETERS + // SERVICES + + +class StmArrayStatu2 : public StmStatu2 +{ + public: + // LIFECYCLE + StmArrayStatu2( + intt i_nStatusSize, + const INT16 * in_aArrayModel, + uintt i_nTokenId, + bool in_bIsDefault ); + ~StmArrayStatu2(); + + // INQUIRY + StmStatu2::Branch NextBy( + intt in_nFollowersIndex) const; + UINT16 TokenId() const { return nTokenId; } + virtual bool IsADefault() const; + + // ACCESS + virtual StmArrayStatu2 * + AsArray(); + bool SetBranch( + intt in_nBranchIx, + StmStatu2::Branch + in_nBranch ); + void SetTokenId( + UINT16 in_nTokenId ); + private: + StmStatu2::Branch * dpBranches; + intt nNrOfBranches; + UINT16 nTokenId; + bool bIsADefault; +}; + + +// IMPLEMENTATION + +inline void +StmArrayStatu2::SetTokenId( UINT16 in_nTokenId ) + { nTokenId = in_nTokenId; } + + + +#endif + + diff --git a/autodoc/source/parser_i/inc/tokens/stmstat2.hxx b/autodoc/source/parser_i/inc/tokens/stmstat2.hxx new file mode 100644 index 000000000000..cfa0c7e1a623 --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/stmstat2.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstat2.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_STMSTAT2_HXX +#define ADC_STMSTAT2_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +class StmArrayStatu2; +class StmBoundsStatu2; + +/** A StmStatu2 is a state within a StateMachin2. + There are two kinds of it. Either its an array of pointers to + other states within the state machine - an ArrayStatus. + + Or it is a BoundsStatus, which shows, the token cannot be + followed further within the StateMachin2. +**/ +class StmStatu2 // := "State machine status" +{ + public: + typedef intt Branch; /// Values >= 0 give a next #Status' ID. + /// Values <= 0 tell, that a token is finished. + /// a value < 0 returns the status back to an upper level state machine. + // LIFECYCLE + virtual ~StmStatu2() {} + + // OPERATIONS + virtual StmArrayStatu2 * + AsArray(); + virtual StmBoundsStatu2 * + AsBounds(); + + // INQUIRY + virtual bool IsADefault() const = 0; +}; + + + +#endif + + diff --git a/autodoc/source/parser_i/inc/tokens/stmstfi2.hxx b/autodoc/source/parser_i/inc/tokens/stmstfi2.hxx new file mode 100644 index 000000000000..2f15f7098d82 --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/stmstfi2.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstfi2.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_STMSTFI2_HXX +#define ADC_STMSTFI2_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/stmstat2.hxx> + // COMPONENTS + // PARAMETERS + + +class TkpContext; +class StateMachineContext; + +/** +**/ +class StmBoundsStatu2 : public StmStatu2 +{ + public: + // LIFECYCLE + StmBoundsStatu2( + StateMachineContext & + o_rOwner, + TkpContext & i_rFollowUpContext, + uintt i_nStatusFunctionNr, + bool i_bIsDefault ); + // INQUIRY + TkpContext * FollowUpContext(); + uintt StatusFunctionNr() const; + virtual bool IsADefault() const; + + // ACCESS + virtual StmBoundsStatu2 * + AsBounds(); + + private: + StateMachineContext * + pOwner; + TkpContext * pFollowUpContext; + uintt nStatusFunctionNr; + bool bIsDefault; +}; + +inline TkpContext * +StmBoundsStatu2::FollowUpContext() + { return pFollowUpContext; } +inline uintt +StmBoundsStatu2::StatusFunctionNr() const + { return nStatusFunctionNr; } + + +#endif + + diff --git a/autodoc/source/parser_i/inc/tokens/tkp2.hxx b/autodoc/source/parser_i/inc/tokens/tkp2.hxx new file mode 100644 index 000000000000..7315b569e2aa --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/tkp2.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkp2.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_TKP2_HXX +#define ADC_TKP2_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +class CharacterSource; +class TkpContext; + // PARAMETRS + + + +/** This is the interface for parser classes, which get a sequence of Token s from + a text. + + Start() starts to parse the text from the given i_rSource. + GetNextToken() returns a Token on the heap as long as there are + still characters in the text left. The last time GetNextToken() + returns NULL. + + The algorithms for parsing tokens from the text are an issue of + the derived classes. +*/ +class TokenParse2 +{ + public: + // LIFECYCLE + TokenParse2(); + virtual ~TokenParse2() {} + + // OPERATIONS + virtual void Start( + CharacterSource & + i_rSource ); + + /** @short Gets the next identifiable token out of the + source code. + @return true, if there was passed a valid token. + false, if the parsed stream is finished or + an error occured. + */ + bool GetNextToken(); + + private: + virtual void SetStartContext() = 0; + virtual void SetCurrentContext( + TkpContext & io_rContext ) = 0; + virtual TkpContext & + CurrentContext() = 0; + // DATA + CharacterSource * pChars; +}; + + +#endif + + diff --git a/autodoc/source/parser_i/inc/tokens/tkpcont2.hxx b/autodoc/source/parser_i/inc/tokens/tkpcont2.hxx new file mode 100644 index 000000000000..e494b8c1a956 --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/tkpcont2.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkpcont2.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_TKPCONT2_HXX +#define ADC_TKPCONT2_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +class CharacterSource; +class TkpNullContext; +class TkpNullContex2; + +/** @task + Specifies a context within which tokens are interpreted in a special + way. For example in parsing C++ there could be a context for code, + one for comments and a third one for preprocessor statements, because + each of these would give the same token different meanings. +**/ +class TkpContext +{ + public: + // LIFECYCLE + virtual ~TkpContext() {} + + // OPERATIONS + /** @descr + The functions starts to parse with the CurToken() of io_rText. + It leaves io_rText at the first char of the following Token or + the following Context. + + This function returns, when a context has parsed some characterss + and completed a token OR left the context. + If the token is to be ignored, PassNewToken() returns false + and cuts the token from io_rText. + If the token is to be parsed further in a different context, + PassNewToken() returns false, but the token is + NOT cut from io_rText. + + If the function has found a valid and complete token, PassNewToken() + passes the parsed token to the internally known receiver and + returns true. The token is cut from io_rText. + **/ + virtual void ReadCharChain( + CharacterSource & io_rText ) = 0; + /** Has to pass the parsed token to a known receiver. + @return true, if a token was passed. + false, if no token was parsed complete by this context. + */ + virtual bool PassNewToken() = 0; + virtual TkpContext & + FollowUpContext() = 0; + + static TkpNullContext & + Null_(); +}; + +TkpNullContex2 & TkpContext_Null2_(); + +class StateMachineContext +{ + public: + virtual ~StateMachineContext() {} + + /// Is used by StmBoundsStatu2 only. + virtual void PerformStatusFunction( + uintt i_nStatusSignal, + UINT16 i_nTokenId, + CharacterSource & io_rText ) = 0; +}; + +class TkpNullContex2 : public TkpContext +{ + public: + ~TkpNullContex2(); + + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual bool PassNewToken(); + virtual TkpContext & + FollowUpContext(); +}; + +class TkpDocuContext : public TkpContext +{ + public: + virtual void SetParentContext( + TkpContext & io_rParentContext, + const char * i_sMultiLineEndToken ) = 0; + virtual void SetMode_IsMultiLine( + bool i_bTrue ) = 0; +}; + + + +#endif + + diff --git a/autodoc/source/parser_i/inc/tokens/tkpstam2.hxx b/autodoc/source/parser_i/inc/tokens/tkpstam2.hxx new file mode 100644 index 000000000000..293097edab7f --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/tkpstam2.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkpstam2.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_TKPSTAM2_HXX +#define ADC_TKPSTAM2_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcont2.hxx> + // COMPONENTS +#include <tokens/stmstar2.hxx> +#include <tokens/stmstfi2.hxx> + +/** @descr + This state-machine models state transitions from one state to another + per indices of branches. If the indices represent ascii-char-values, + the state-machine can be used for recognising tokens of text. + + The state-machine can be a status itself. + + StateMachin2 needs the array-size of all stati as a guess, how many stati + the state machine will contain, when at work. + + +**/ +class StateMachin2 +{ + public: + // Types + typedef StmStatu2::Branch Branch; + typedef StmStatu2 * * StatusList; + + //# Interface self + // LIFECYCLE + StateMachin2( + intt in_nStatusSize, + intt in_nInitial_StatusListSize ); /// The user of the constructor should guess + /// the approximate number of stati here to + /// avoid multiple reallocations. + /// @#AddStatus + intt AddStatus( /// @return the new #Status' ID + DYN StmStatu2 * let_dpStatus); + /// @#AddToken + void AddToken( + const char * in_sToken, + UINT16 in_nTokenId, + const INT16 * in_aBranches, + INT16 in_nBoundsStatus ); + ~StateMachin2(); + + // OPERATIONS + StmBoundsStatu2 & + GetCharChain( + UINT16 & o_nTokenId, + CharacterSource & io_rText ); + private: + // SERVICE FUNCTIONS + StmStatu2 & Status( + intt in_nStatusNr) const; + StmArrayStatu2 & + CurrentStatus() const; + StmBoundsStatu2 * + BoundsStatus() const; + + /// Sets the PeekedStatus. + void Peek( + intt in_nBranch); + + void ResizeStati(); // Adds space for 32 stati. + + // DATA + StatusList pStati; /// List of Status, implemented as simple C-array of length #nStatiSpace + /// with nStatiLength valid members (beginning from zero). + intt nCurrentStatus; + intt nPeekedStatus; + + intt nStatusSize; /// Size of the branch array of a single status. + + intt nNrofStati; /// Nr of Stati so far. + intt nStatiSpace; /// Size of allocated array for #pStati (size in items). +}; + + + +/** @#AddToken + @descr + Adds a token, which will be recogniszeds by the + statemachine. + + +**/ + + + +#endif + + diff --git a/autodoc/source/parser_i/inc/tokens/token2.hxx b/autodoc/source/parser_i/inc/tokens/token2.hxx new file mode 100644 index 000000000000..1592ac476896 --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/token2.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: token2.hxx,v $ + * $Revision: 1.3 $ + * + * 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 ADC_TOKEN2_HXX +#define ADC_TOKEN2_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETRS + + + +/** This is the interface for parser classes, which get a sequence of Token s from + a text. + + Start() starts to parse the text from the given i_rSource. + GetNextToken() returns a Token on the heap as long as there are + still characters in the text left. The last time GetNextToken() + returns NULL. + + The algorithms for parsing tokens from the text are an issue of + the derived classes. +*/ +class TextToken +{ + public: + // LIFECYCLE + virtual ~TextToken() {} + + + // INQUIRY + virtual const char* Text() const = 0; +}; + + +#endif + + diff --git a/autodoc/source/parser_i/inc/x_parse2.hxx b/autodoc/source/parser_i/inc/x_parse2.hxx new file mode 100644 index 000000000000..4c3d594a2690 --- /dev/null +++ b/autodoc/source/parser_i/inc/x_parse2.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: x_parse2.hxx,v $ + * $Revision: 1.4 $ + * + * 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 ADC_X_PARSE2_HXX +#define ADC_X_PARSE2_HXX + +// USED SERVICES + // BASE CLASSES +#include <cosv/x.hxx> + // COMPONENTS + // PARAMETERS + + +class X_AutodocParser : public csv::Exception +{ + public: + // TYPES + enum E_Type + { + x_Any = 0, + x_InvalidChar, + x_UnexpectedToken, + x_UnexpectedEOF + }; + // LIFECYCLE + X_AutodocParser( + E_Type i_eType, + const char * i_sName = "" ) + : eType(i_eType), sName(i_sName) {} + // INQUIRY + virtual void GetInfo( + std::ostream & o_rOutputMedium ) const; + + private: + E_Type eType; + String sName; + +}; + + + + +#endif diff --git a/autodoc/source/parser_i/tokens/makefile.mk b/autodoc/source/parser_i/tokens/makefile.mk new file mode 100644 index 000000000000..64413dd085ae --- /dev/null +++ b/autodoc/source/parser_i/tokens/makefile.mk @@ -0,0 +1,67 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# 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=garden +TARGET=parser2_tokens +TARGETTYPE=CUI + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/stmstar2.obj \ + $(OBJ)$/stmstat2.obj \ + $(OBJ)$/stmstfi2.obj \ + $(OBJ)$/tkpstam2.obj \ + $(OBJ)$/tkp2.obj \ + $(OBJ)$/tkpcont2.obj \ + $(OBJ)$/x_parse2.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser_i/tokens/stmstar2.cxx b/autodoc/source/parser_i/tokens/stmstar2.cxx new file mode 100644 index 000000000000..8d0fb2cb0460 --- /dev/null +++ b/autodoc/source/parser_i/tokens/stmstar2.cxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstar2.cxx,v $ + * $Revision: 1.6 $ + * + * 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 <tokens/stmstar2.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <x_parse2.hxx> + + + +StmArrayStatu2::StmArrayStatu2( intt i_nStatusSize, + const INT16 * in_aArrayModel, + uintt i_nTokenId, + bool in_bIsDefault ) + : dpBranches(new StmStatu2::Branch[i_nStatusSize]), + nNrOfBranches(i_nStatusSize), + nTokenId(UINT16(i_nTokenId)), + bIsADefault(in_bIsDefault) +{ + // KORR_FUTURE: Interface of StmArrayStatu2() has to be changed. + csv_assert(i_nTokenId < 64536); + + if (in_aArrayModel != 0) + { + intt count = 0; + for (const INT16 * get = in_aArrayModel; count < nNrOfBranches; count++, get++) + dpBranches[count] = *get; + } + else // + { + memset(dpBranches, 0, nNrOfBranches); + } // endif +} + +StmArrayStatu2::~StmArrayStatu2() +{ + delete [] dpBranches; +} + +bool +StmArrayStatu2::SetBranch( intt in_nBranchIx, + StmStatu2::Branch in_nBranch ) +{ + if ( csv::in_range(intt(0), in_nBranchIx, intt(nNrOfBranches) ) ) + { + dpBranches[in_nBranchIx] = in_nBranch; + return true; + } + return false; +} + + +StmStatu2::Branch +StmArrayStatu2::NextBy(intt in_nIndex) const +{ + if (in_nIndex < 0) + throw X_AutodocParser(X_AutodocParser::x_InvalidChar); + + return in_nIndex < nNrOfBranches + ? dpBranches[in_nIndex] + : dpBranches[nNrOfBranches - 1]; +} + + +bool +StmArrayStatu2::IsADefault() const +{ + return bIsADefault; +} + +StmArrayStatu2 * +StmArrayStatu2::AsArray() +{ + return this; +} + diff --git a/autodoc/source/parser_i/tokens/stmstat2.cxx b/autodoc/source/parser_i/tokens/stmstat2.cxx new file mode 100644 index 000000000000..7a1acd599219 --- /dev/null +++ b/autodoc/source/parser_i/tokens/stmstat2.cxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstat2.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <tokens/stmstat2.hxx> + + +// NOT FULLY DECLARED SERVICES + +StmArrayStatu2 * +StmStatu2::AsArray() +{ + return 0; +} + +StmBoundsStatu2 * +StmStatu2::AsBounds() +{ + return 0; +} + + diff --git a/autodoc/source/parser_i/tokens/stmstfi2.cxx b/autodoc/source/parser_i/tokens/stmstfi2.cxx new file mode 100644 index 000000000000..46cdf6666d64 --- /dev/null +++ b/autodoc/source/parser_i/tokens/stmstfi2.cxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstfi2.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <tokens/stmstfi2.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <tokens/tkpcont2.hxx> + + +StmBoundsStatu2::StmBoundsStatu2( StateMachineContext & + o_rOwner, + TkpContext & i_rFollowUpContext, + uintt i_nStatusFunctionNr, + bool i_bIsDefault ) + : pOwner(&o_rOwner), + pFollowUpContext(&i_rFollowUpContext), + nStatusFunctionNr(i_nStatusFunctionNr), + bIsDefault(i_bIsDefault) +{ +} + +bool +StmBoundsStatu2::IsADefault() const +{ + return bIsDefault; +} + +StmBoundsStatu2 * +StmBoundsStatu2::AsBounds() +{ + return this; +} + + + diff --git a/autodoc/source/parser_i/tokens/tkp2.cxx b/autodoc/source/parser_i/tokens/tkp2.cxx new file mode 100644 index 000000000000..2754e5da0909 --- /dev/null +++ b/autodoc/source/parser_i/tokens/tkp2.cxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkp2.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <tokens/tkp2.hxx> + +// NOT FULLY DECLARED SERVICES +#include <tools/tkpchars.hxx> +#include <tokens/tkpcont2.hxx> + +TokenParse2::TokenParse2() + : pChars(0) +{ +} + +void +TokenParse2::Start( CharacterSource & i_rSource ) +{ + pChars = &i_rSource; + SetStartContext(); +} + +bool +TokenParse2::GetNextToken() +{ + csv_assert(pChars != 0); + + bool bDone = false; + while ( NOT bDone AND NOT pChars->IsFinished() ) + { + CurrentContext().ReadCharChain(*pChars); + bDone = CurrentContext().PassNewToken(); + SetCurrentContext(CurrentContext().FollowUpContext()); + } + return bDone; +} + + diff --git a/autodoc/source/parser_i/tokens/tkpcont2.cxx b/autodoc/source/parser_i/tokens/tkpcont2.cxx new file mode 100644 index 000000000000..9fcb928bc7a4 --- /dev/null +++ b/autodoc/source/parser_i/tokens/tkpcont2.cxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkpcont2.cxx,v $ + * $Revision: 1.5 $ + * + * 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 <tokens/tkpcont2.hxx> + +// NOT FULLY DECLARED SERVICES + + + +TkpNullContex2 G_aNullContex2; + +TkpNullContex2 & +TkpContext_Null2_() +{ + return G_aNullContex2; +} + +TkpNullContex2::~TkpNullContex2() +{ +} + +void +TkpNullContex2::ReadCharChain( CharacterSource & ) +{ +} + +bool +TkpNullContex2::PassNewToken() +{ + return false; +} + +TkpContext & +TkpNullContex2::FollowUpContext() +{ + return *this; +} + + + diff --git a/autodoc/source/parser_i/tokens/tkpstam2.cxx b/autodoc/source/parser_i/tokens/tkpstam2.cxx new file mode 100644 index 000000000000..6a6d4a03b9c6 --- /dev/null +++ b/autodoc/source/parser_i/tokens/tkpstam2.cxx @@ -0,0 +1,177 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkpstam2.cxx,v $ + * $Revision: 1.7 $ + * + * 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 <tokens/tkpstam2.hxx> + +// NOT FULLY DECLARED SERVICES +#include <tokens/stmstar2.hxx> +#include <tools/tkpchars.hxx> + + +const intt C_nStatuslistResizeValue = 32; +const intt C_nTopStatus = 0; + +StateMachin2::StateMachin2( intt in_nStatusSize, + intt in_nInitial_StatusListSize ) + : pStati(new StmStatu2*[in_nInitial_StatusListSize]), + nCurrentStatus(C_nTopStatus), + nPeekedStatus(C_nTopStatus), + nStatusSize(in_nStatusSize), + nNrofStati(0), + nStatiSpace(in_nInitial_StatusListSize) +{ + csv_assert(in_nStatusSize > 0); + csv_assert(in_nInitial_StatusListSize > 0); + + memset(pStati, 0, sizeof(StmStatu2*) * nStatiSpace); +} + +intt +StateMachin2::AddStatus(StmStatu2 * let_dpStatus) +{ + if (nNrofStati == nStatiSpace) + { + ResizeStati(); + } + pStati[nNrofStati] = let_dpStatus; + return nNrofStati++; +} + +void +StateMachin2::AddToken( const char * in_sToken, + UINT16 in_nTokenId, + const INT16 * in_aBranches, + INT16 in_nBoundsStatus ) +{ + if (csv::no_str(in_sToken)) + return; + + // Durch existierende Stati durchhangeln: + nCurrentStatus = 0; + nPeekedStatus = 0; + + for ( const char * pChar = in_sToken; + *pChar != NULCH; + ++pChar ) + { + Peek(*pChar); + StmStatu2 & rPst = Status(nPeekedStatus); + if ( rPst.IsADefault() OR rPst.AsBounds() != 0 ) + { + nPeekedStatus = AddStatus( new StmArrayStatu2(nStatusSize, in_aBranches, 0, false ) ); + CurrentStatus().SetBranch( *pChar, nPeekedStatus ); + } + nCurrentStatus = nPeekedStatus; + } // end for + StmArrayStatu2 & rLastStatus = CurrentStatus(); + rLastStatus.SetTokenId(in_nTokenId); + for (intt i = 0; i < nStatusSize; i++) + { + if (Status(rLastStatus.NextBy(i)).AsBounds() != 0) + rLastStatus.SetBranch(i,in_nBoundsStatus); + } // end for +} + +StateMachin2::~StateMachin2() +{ + for (intt i = 0; i < nNrofStati; i++) + { + delete pStati[i]; + } + delete [] pStati; +} + +StmBoundsStatu2 & +StateMachin2::GetCharChain( UINT16 & o_nTokenId, + CharacterSource & io_rText ) +{ + nCurrentStatus = C_nTopStatus; + Peek(io_rText.CurChar()); + while (BoundsStatus() == 0) + { + nCurrentStatus = nPeekedStatus; + Peek(io_rText.MoveOn()); + } + o_nTokenId = CurrentStatus().TokenId(); + + return *BoundsStatus(); +} + +void +StateMachin2::ResizeStati() +{ + intt nNewSize = nStatiSpace + C_nStatuslistResizeValue; + intt i = 0; + StatusList pNewStati = new StmStatu2*[nNewSize]; + + for ( ; i < nNrofStati; i++) + { + pNewStati[i] = pStati[i]; + } + memset( pNewStati+i, + 0, + (nNewSize-i) * sizeof(StmStatu2*) ); + + delete [] pStati; + pStati = pNewStati; + nStatiSpace = nNewSize; +} + +StmStatu2 & +StateMachin2::Status(intt in_nStatusNr) const +{ + csv_assert( csv::in_range(intt(0), in_nStatusNr, intt(nNrofStati)) ); + return *pStati[in_nStatusNr]; +} + +StmArrayStatu2 & +StateMachin2::CurrentStatus() const +{ + StmArrayStatu2 * pCurSt = Status(nCurrentStatus).AsArray(); + if (pCurSt == 0) + { + csv_assert(false); + } + return *pCurSt; +} + +StmBoundsStatu2 * +StateMachin2::BoundsStatus() const +{ + return Status(nPeekedStatus).AsBounds(); +} + +void +StateMachin2::Peek(intt in_nBranch) +{ + StmArrayStatu2 & rSt = CurrentStatus(); + nPeekedStatus = rSt.NextBy(in_nBranch); +} diff --git a/autodoc/source/parser_i/tokens/x_parse2.cxx b/autodoc/source/parser_i/tokens/x_parse2.cxx new file mode 100644 index 000000000000..eadc8042f3a4 --- /dev/null +++ b/autodoc/source/parser_i/tokens/x_parse2.cxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: x_parse2.cxx,v $ + * $Revision: 1.7 $ + * + * 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 <x_parse2.hxx> + +// NOT FULLY DECLARED SERVICES + + enum E_Type + { + x_Any = 0, + x_InvalidChar, + x_UnexpectedEOF + }; +void +X_AutodocParser::GetInfo( std::ostream & o_rOutputMedium ) const +{ + switch (eType) + { + case x_Any: + o_rOutputMedium << "Unspecified parsing exception ." << Endl(); + break; + case x_InvalidChar: + o_rOutputMedium << "Unknown character during parsing." << Endl(); + break; + case x_UnexpectedToken: + o_rOutputMedium << "Unexpected token " << sName << " found." << Endl(); + break; + case x_UnexpectedEOF: + o_rOutputMedium << "Unexpected end of file found." << Endl(); + break; + default: + o_rOutputMedium << "Unknown exception during parsing." << Endl(); + } +} + + diff --git a/autodoc/source/tools/filecoll.cxx b/autodoc/source/tools/filecoll.cxx new file mode 100644 index 000000000000..cb7693fd0add --- /dev/null +++ b/autodoc/source/tools/filecoll.cxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: filecoll.cxx,v $ + * $Revision: 1.12 $ + * + * 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 <tools/filecoll.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <cosv/ploc_dir.hxx> + +#include <stdio.h> + + +FileCollector::FileCollector( uintt i_nRoughNrOfFiles ) + // : aFoundFiles +{ + if (i_nRoughNrOfFiles > 0) + aFoundFiles.reserve(i_nRoughNrOfFiles); +} + +uintt +FileCollector::AddFilesFrom( const char * i_sRootDir, + const char * i_sFilter, + E_SearchMode i_eSearchMode ) +{ + uintt nSizeAtStart = aFoundFiles.size(); + + if (csv::no_str(i_sFilter) OR csv::no_str(i_sRootDir)) + { + Cout() << "Warning: The filter contains no files." << Endl(); + return 0; + } + + csv::ploc::Directory aDir(i_sRootDir); + if (NOT aDir.Exists()) + { + Cerr() << "Warning: The path for the files to be parsed could not be found:\n" + << i_sRootDir + << Endl(); + return 0; + } + + Cout() << "." << Flush(); + aDir.GetContainedFiles(aFoundFiles, i_sFilter); + + if (i_eSearchMode == recursive) + { + StreamStr aPath(1020); + aPath << i_sRootDir << csv::ploc::Delimiter(); + uintt nSubDirStart = aPath.tellp(); + + StringVector aSubDirs; + aDir.GetContainedDirectories(aSubDirs); + + for ( const_iterator iter = aSubDirs.begin(); + iter != aSubDirs.end(); + ++iter ) + { + aPath.seekp(nSubDirStart); + aPath << (*iter); + AddFilesFrom( aPath.c_str(), i_sFilter, i_eSearchMode ); + } + } + + return aFoundFiles.size() - nSizeAtStart; +} + +uintt +FileCollector::AddFile( const char * i_sFilePath ) +{ + FILE * pFile = fopen( i_sFilePath, "r" ); + if ( pFile == 0 ) + { + Cerr() << "Warning: The path for the file to be parsed could not be found:\n" + << i_sFilePath + << Endl(); + return 0; + } + + fclose(pFile); + aFoundFiles.push_back(i_sFilePath); + return 1; +} + +void +FileCollector::EraseAll() +{ + csv::erase_container(aFoundFiles); +} + +FileCollector::const_iterator +FileCollector::Begin() const +{ + return aFoundFiles.begin(); +} + +FileCollector::const_iterator +FileCollector::End() const +{ + return aFoundFiles.end(); +} + +uintt +FileCollector::Size() const +{ + return aFoundFiles.size(); +} + diff --git a/autodoc/source/tools/makefile.mk b/autodoc/source/tools/makefile.mk new file mode 100644 index 000000000000..6d611dc23c57 --- /dev/null +++ b/autodoc/source/tools/makefile.mk @@ -0,0 +1,62 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# 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=autodoc_tools +TARGETTYPE=CUI + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/filecoll.obj \ + $(OBJ)$/tkpchars.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/tools/tkpchars.cxx b/autodoc/source/tools/tkpchars.cxx new file mode 100644 index 000000000000..eb820e2d75b6 --- /dev/null +++ b/autodoc/source/tools/tkpchars.cxx @@ -0,0 +1,162 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkpchars.cxx,v $ + * $Revision: 1.10 $ + * + * 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 <tools/tkpchars.hxx> + +// NOT FULLY DECLARED SERVICES +#include <cosv/bstream.hxx> +#include <cosv/x.hxx> + + + +CharacterSource::CharacterSource() + : dpSource(new char[2]), + nSourceSize(0), + nCurPos(0), + nLastCut(0), + nLastTokenStart(0), + cCharAtLastCut(0) +{ + dpSource[nSourceSize] = NULCH; + dpSource[nSourceSize+1] = NULCH; +} + +CharacterSource::~CharacterSource() +{ + delete [] dpSource; +} + +void +CharacterSource::LoadText(csv::bstream & io_rSource) +{ + if (dpSource != 0) + delete [] dpSource; + + io_rSource.seek(0, csv::end); + nSourceSize = intt(io_rSource.position()); + io_rSource.seek(0); + + dpSource = new char[nSourceSize+1]; + + intt nCount = (intt) io_rSource.read(dpSource,nSourceSize); + if (nCount != nSourceSize) + throw csv::X_Default("IO-Error: Could not load file completely."); + + dpSource[nSourceSize] = NULCH; + + BeginSource(); +} + +/// KORR_FUTURE: So far, this works only when tokens do not cross inserted text boundaries. +void +CharacterSource::InsertTextAtCurPos( const char * i_sText2Insert ) +{ + if ( i_sText2Insert == 0 ? true : strlen(i_sText2Insert) == 0 ) + return; + + aSourcesStack.push( S_SourceState( + dpSource, + nSourceSize, + nCurPos, + nLastCut, + nLastTokenStart, + cCharAtLastCut ) ); + + nSourceSize = strlen(i_sText2Insert); + dpSource = new char[nSourceSize+1]; + strcpy( dpSource, i_sText2Insert); // SAFE STRCPY (#100211# - checked) + + BeginSource(); +} + +const char * +CharacterSource::CutToken() +{ + dpSource[nLastCut] = cCharAtLastCut; + nLastTokenStart = nLastCut; + nLastCut = CurPos(); + cCharAtLastCut = dpSource[nLastCut]; + dpSource[nLastCut] = NULCH; + + return &dpSource[nLastTokenStart]; +} + +void +CharacterSource::BeginSource() +{ + nCurPos = 0; + nLastCut = 0; + nLastTokenStart = 0; + cCharAtLastCut = dpSource[nLastCut]; + dpSource[nLastCut] = NULCH; +} + +// KORR_FUTURE: So far, this works only when tokens do not cross inserted text boundaries. +char +CharacterSource::MoveOn_OverStack() +{ + while ( aSourcesStack.size() > 0 AND nCurPos >= nSourceSize-1 ) + { + S_SourceState & aState = aSourcesStack.top(); + delete [] dpSource; + + dpSource = aState.dpSource; + nSourceSize = aState.nSourceSize; + nCurPos = aState.nCurPos; + nLastCut = aState.nLastCut; + nLastTokenStart = aState.nLastTokenStart; + cCharAtLastCut = aState.cCharAtLastCut; + + aSourcesStack.pop(); + } + + if ( nLastCut < nCurPos ) + CutToken(); + + return CurChar(); +} + +CharacterSource:: +S_SourceState::S_SourceState( DYN char * dpSource_, + intt nSourceSize_, + intt nCurPos_, + intt nLastCut_, + intt nLastTokenStart_, + char cCharAtLastCut_ ) + : dpSource(dpSource_), + nSourceSize(nSourceSize_), + nCurPos(nCurPos_), + nLastCut(nLastCut_), + nLastTokenStart(nLastTokenStart_), + cCharAtLastCut(cCharAtLastCut_) +{ +} + |