From: <bl...@us...> - 2003-05-28 07:33:57
|
Update of /cvsroot/cpptool/rfta/include/rfta/refactoring In directory sc8-pr-cvs1:/tmp/cvs-serv17902/include/rfta/refactoring Modified Files: CodeModelForward.h Added Files: CodeModelDeclarations.h Log Message: * added very rough support for function declaration --- NEW FILE: CodeModelDeclarations.h --- // ////////////////////////////////////////////////////////////////////////// // (c)Copyright 2002, Baptiste Lepilleur. // Created: 2003/05/27 // ////////////////////////////////////////////////////////////////////////// #ifndef RFTA_CODEMODELDECLARATIONS_H #define RFTA_CODEMODELDECLARATIONS_H #include <rfta/refactoring/ChangeTrackers.h> #include <rfta/refactoring/CodeModelForward.h> #include <rfta/refactoring/CodeModelElement.h> #include <boost/shared_ptr.hpp> #include <string> #include <vector> namespace Refactoring { namespace CodeModel { class DeclarationVisitor; class RFTA_API Declaration : public Element { public: virtual ~Declaration(); void accept( ElementVisitor &visitor ); virtual void accept( DeclarationVisitor &visitor ) =0; }; class RFTA_API Type : public TextElement { public: Type( const std::string &type ) : TextElement( type ) { } std::string getTypeText() const { return TextElement::getElementText(); } // overridden from Element void accept( ElementVisitor &visitor ); }; class RFTA_API ArrayTypeSuffix : public TextElement { public: ArrayTypeSuffix( const std::string &type ) : TextElement( type ) { } std::string getSuffixText() const { return TextElement::getElementText(); } // overridden from Element void accept( ElementVisitor &visitor ); }; class RFTA_API VariableName : public TextElement { public: VariableName( const std::string &name ) : TextElement( name ) { } std::string getName() const { return TextElement::getElementText(); } // overridden from Element void accept( ElementVisitor &visitor ); }; class RFTA_API Parameter : public Element { public: Parameter( const TypePtr &type, const VariableNamePtr &name, const ArrayTypeSuffixPtr &typeSuffix ); Parameter( const TypePtr &type, const VariableNamePtr &name, const ArrayTypeSuffixPtr &typeSuffix, const AssignInitializerExpressionPtr &initializer ); private: TypePtr type_; VariableNamePtr name_; ArrayTypeSuffixPtr typeSuffix_; AssignInitializerExpressionPtr initializer_; }; class RFTA_API Parameters : public Element { public: void appendParameter( const ParameterPtr ¶meter ); private: }; class RFTA_API FunctionName : public TextElement { public: FunctionName( const std::string &name ) : TextElement( name ) { } std::string getName() const { return TextElement::getElementText(); } // overridden from Element void accept( ElementVisitor &visitor ); }; /* class RFTA_API Modifier : public TextElement { public: Modifier( const std::string &name ) : TextElement( name ) { } std::string getName() const { return TextElement::getElementText(); } // overridden from Element void accept( ElementVisitor &visitor ); }; class RFTA_API Modifiers : public Element { public: }; */ class RFTA_API FunctionDeclaration : public Element { public: FunctionDeclaration( const TypePtr &returnType, const FunctionNamePtr &functionName, const ParametersPtr ¶meters ); FunctionDeclaration( const TypePtr &returnType, const FunctionNamePtr &functionName, const ParametersPtr ¶meters, const CompoundStatementPtr &body ); FunctionNamePtr getFunctionName() const; bool hasBody() const; CompoundStatementPtr getBody() const; private: TypePtr returnType_; FunctionNamePtr functionName_; ParametersPtr parameters_; CompoundStatementPtr body_; }; } // namespace CodeModel } // namespace Refactoring #endif // RFTA_CODEMODELDECLARATIONS_H Index: CodeModelForward.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelForward.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** CodeModelForward.h 26 May 2003 21:12:33 -0000 1.15 --- CodeModelForward.h 28 May 2003 07:33:54 -0000 1.16 *************** *** 18,21 **** --- 18,30 ---- class Identifier; + class Declaration; + class Type; + class ArrayTypeSuffix; + class VariableName; + class Parameter; + class Parameters; + class FunctionName; + class FunctionDeclaration; + class BreakStatement; class CaseStatement; *************** *** 68,71 **** --- 77,88 ---- typedef boost::shared_ptr<WhileStatement> WhileStatementPtr; + typedef boost::shared_ptr<Declaration> DeclarationPtr; + typedef boost::shared_ptr<Type> TypePtr; + typedef boost::shared_ptr<ArrayTypeSuffix> ArrayTypeSuffixPtr; + typedef boost::shared_ptr<VariableName> VariableNamePtr; + typedef boost::shared_ptr<Parameter> ParameterPtr; + typedef boost::shared_ptr<Parameters> ParametersPtr; + typedef boost::shared_ptr<FunctionName> FunctionNamePtr; + typedef boost::shared_ptr<FunctionDeclaration> FunctionDeclarationPtr; typedef boost::shared_ptr<Element> ElementPtr; |