Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals
reflect

ref_object.cpp

Go to the documentation of this file.
00001 // See ../license.txt for license information.
00002 //
00003 // ref_object.cpp
00004 //
00005 // 4-Jul-2003 phamilton Created
00006 //
00007 
00008 #define REFLECT_IN_LIBRARY_SOURCE
00009 
00010 #include "ref_object.hpp"
00011 
00012 using namespace ph::reflect;
00013 
00014 bool ref_object_helper::helper_accept(const ph::common::object_base *obj, 
00015 const ph::common::object_base *member, bool owned,
00016 ph::common::object_name_visitor *visitor) const
00017 {
00018 if (!obj->nameable())
00019 return false;
00020 if (!visitor->visit_composite(obj, obj->nameable()))
00021 return false;
00022 if (member)
00023 {
00024 // only visit the sub-object if it handles visitable.
00025 if (!member->visitable())
00026 return false;
00027 // only recurse if the visitor wants it and the member is owned.
00028 // this prevents loops in recursive visitors.
00029 if (visitor->recurse() && owned)
00030 {
00031 if (!member->visitable()->accept(visitor))
00032 return false;
00033 }
00034 else
00035 {
00036 if (!member->nameable())
00037 return false;
00038 if (!visitor->visit(member, member->nameable()))
00039 return false;
00040 }
00041 }
00042 return true;
00043 }
00044 
00045 bool ref_object_helper::helper_accept(ph::common::object_base *obj, 
00046 ph::common::object_base *member, bool owned,
00047 ph::common::object_visitor *visitor)
00048 {
00049 if (!visitor->visit_composite(obj))
00050 return false;
00051 if (member)
00052 {
00053 // only visit the sub-object if it handles visitable.
00054 if (!member->visitable())
00055 return false;
00056 // only recurse if the visitor wants it and the member is owned.
00057 // this prevents loops in recursive visitors.
00058 if (visitor->recurse() && owned)
00059 {
00060 if (!member->visitable()->accept(visitor))
00061 return false;
00062 }
00063 else
00064 {
00065 if (!visitor->visit(member))
00066 return false;
00067 }
00068 }
00069 return true;
00070 }
00071 
00072 bool ref_object_helper::helper_accept(const ph::common::object_base *obj, 
00073 const ph::common::object_base *member, bool owned,
00074 ph::common::const_object_visitor *visitor) const
00075 {
00076 if (!visitor->visit_composite(obj))
00077 return false;
00078 if (member)
00079 {
00080 // only visit the sub-object if it handles visitable.
00081 if (!member->visitable())
00082 return false;
00083 // only recurse if the visitor wants it and the member is owned.
00084 // this prevents loops in recursive visitors.
00085 if (visitor->recurse() && owned)
00086 {
00087 if (!member->visitable()->accept(visitor))
00088 return false;
00089 }
00090 else
00091 {
00092 if (!visitor->visit(member))
00093 return false;
00094 }
00095 }
00096 return true;
00097 }

Generated on Wed Apr 5 22:03:26 2006 for cppxmlobj by doxygen 1.4.3

AltStyle によって変換されたページ (->オリジナル) /