1 // Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com> 2 // 3 // Permission is hereby granted, free of charge, to any person obtaining a copy 4 // of this software and associated documentation files (the "Software"), to deal 5 // in the Software without restriction, including without limitation the rights 6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 // copies of the Software, and to permit persons to whom the Software is 8 // furnished to do so, subject to the following conditions: 9 // 10 // The above copyright notice and this permission notice shall be included in 11 // all copies or substantial portions of the Software. 12 // 13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 // THE SOFTWARE. 20 21 #pragma once 22 23 #include "CPlusPlusForwardDeclarations.h" 24 25 namespace CPlusPlus { 26 27 class CPLUSPLUS_EXPORT TypeVisitor 28 { 29 TypeVisitor(const TypeVisitor &other); 30 void operator =(const TypeVisitor &other); 31 32 public: 33 TypeVisitor(); 34 virtual ~TypeVisitor(); 35 36 void accept(Type *type); 37 preVisit(Type *)38 virtual bool preVisit(Type *) { return true; } postVisit(Type *)39 virtual void postVisit(Type *) {} 40 visit(UndefinedType *)41 virtual void visit(UndefinedType *) {} visit(VoidType *)42 virtual void visit(VoidType *) {} visit(IntegerType *)43 virtual void visit(IntegerType *) {} visit(FloatType *)44 virtual void visit(FloatType *) {} visit(PointerToMemberType *)45 virtual void visit(PointerToMemberType *) {} visit(PointerType *)46 virtual void visit(PointerType *) {} visit(ReferenceType *)47 virtual void visit(ReferenceType *) {} visit(ArrayType *)48 virtual void visit(ArrayType *) {} visit(NamedType *)49 virtual void visit(NamedType *) {} visit(Function *)50 virtual void visit(Function *) {} visit(Namespace *)51 virtual void visit(Namespace *) {} visit(Template *)52 virtual void visit(Template *) {} visit(Class *)53 virtual void visit(Class *) {} visit(Enum *)54 virtual void visit(Enum *) {} visit(ForwardClassDeclaration *)55 virtual void visit(ForwardClassDeclaration *) {} visit(ObjCClass *)56 virtual void visit(ObjCClass *) {} visit(ObjCProtocol *)57 virtual void visit(ObjCProtocol *) {} visit(ObjCMethod *)58 virtual void visit(ObjCMethod *) {} visit(ObjCForwardClassDeclaration *)59 virtual void visit(ObjCForwardClassDeclaration *) {} visit(ObjCForwardProtocolDeclaration *)60 virtual void visit(ObjCForwardProtocolDeclaration*) {} 61 }; 62 63 } // namespace CPlusPlus 64