bool DirectMapProperty<ObjectType, MemberType>::RefData( const void *in, void *out, const Variant &key, Variant &value) const { typedef typename MemberType::key_type KeyType; if(out) { MemberType &map = translucent_cast<ObjectType *>(out)->*mMember; typename MemberType::const_iterator it; if(key.CanConstRefAs<KeyType>()) return value.RefValue(map[key.AsConstRef<KeyType>()]); else if(key.CanReadAs<KeyType>()) return value.RefValue(map[key.AsValue<KeyType>()]); else return false; } else if(in) { const MemberType &map = translucent_cast<const ObjectType *>(in)->*mMember; typename MemberType::const_iterator it; if(key.CanConstRefAs<KeyType>()) it = map.find(key.AsConstRef<KeyType>()); else if(key.CanReadAs<KeyType>()) it = map.find(key.AsValue<KeyType>()); if(it == map.end()) return false; return value.ConstRefValue(it->second); } else return false; }
bool DirectArrayProperty<ObjectType, MemberType>::RefData( const void *in, void *out, unsigned index, Variant &value) const { if(index >= Size(in)) return false; if(out) { return value.RefValue((translucent_cast<ObjectType *>(out)->*mMember)[index]); } else if(in) { return value.ConstRefValue((translucent_cast<const ObjectType *>(in)->*mMember)[index]); } else return false; }