00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef incCOMMON_COMPOSITE_OBJECT
00010 #define incCOMMON_COMPOSITE_OBJECT
00011
00012
00013 #include "object.hpp"
00014 #include "outerable_object.hpp"
00015 #include "comparable_object.hpp"
00016 #include "nameable_object.hpp"
00017
00018 namespace ph {
00019 namespace common {
00020
00021 class composite_object_helper
00022
00023
00024
00025 {
00026 public:
00027
00028 bool helper_equal(const object_base *obj,
00029 object_base *outer, const std::string &name) const
00030 {
00031 if (obj->outerable())
00032 {
00033
00034
00035 object_base *o = obj->outerable()->outer();
00036 if (o)
00037 {
00038 if (o->comparable())
00039 {
00040 if (!o->comparable()->equal(outer))
00041 return false;
00042 }
00043 else
00044 {
00045 if (o != outer)
00046 return false;
00047 }
00048 }
00049 else if (outer)
00050 return false;
00051
00052
00053 if (obj->nameable())
00054 return obj->nameable()->name() == name;
00055 else
00056 return false;
00057 }
00058
00059 return false;
00060 }
00061 };
00062
00063 };
00064 };
00065
00066 #endif // incCOMMON_COMPOSITE_OBJECT