OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 26 matching lines...) Expand all Loading... | |
37 #include "core/cross/service_locator.h" | 37 #include "core/cross/service_locator.h" |
38 #include "core/cross/object_manager.h" | 38 #include "core/cross/object_manager.h" |
39 #include "core/cross/id_manager.h" | 39 #include "core/cross/id_manager.h" |
40 | 40 |
41 namespace o3d { | 41 namespace o3d { |
42 | 42 |
43 ObjectBase::Class ObjectBase::class_ = { | 43 ObjectBase::Class ObjectBase::class_ = { |
44 O3D_STRING_CONSTANT("ObjectBase"), NULL | 44 O3D_STRING_CONSTANT("ObjectBase"), NULL |
45 }; | 45 }; |
46 | 46 |
47 const char* ObjectBase::Class::unqualified_name() const { | |
apatrick
2009/07/07 00:58:25
How about a unit test?
| |
48 if (strncmp(name_, | |
49 O3D_NAMESPACE O3D_NAMESPACE_SEPARATOR, | |
50 sizeof(O3D_NAMESPACE) + sizeof(O3D_NAMESPACE_SEPARATOR)) == 0) { | |
51 return name_ + sizeof(O3D_NAMESPACE) + sizeof(O3D_NAMESPACE_SEPARATOR) - 2; | |
52 } | |
53 return name_; | |
54 } | |
55 | |
47 ObjectBase::ObjectBase(ServiceLocator *service_locator) | 56 ObjectBase::ObjectBase(ServiceLocator *service_locator) |
48 : id_(IdManager::CreateId()), | 57 : id_(IdManager::CreateId()), |
49 service_locator_(service_locator) { | 58 service_locator_(service_locator) { |
50 // Upon object construction, register this object with the object manager | 59 // Upon object construction, register this object with the object manager |
51 // to allow for central lookup. | 60 // to allow for central lookup. |
52 ObjectManager* object_manager = service_locator_->GetService<ObjectManager>(); | 61 ObjectManager* object_manager = service_locator_->GetService<ObjectManager>(); |
53 if (object_manager) { | 62 if (object_manager) { |
54 object_manager->RegisterObject(this); | 63 object_manager->RegisterObject(this); |
55 } | 64 } |
56 } | 65 } |
(...skipping 18 matching lines...) Expand all Loading... | |
75 // find base in the hierarchy of derived | 84 // find base in the hierarchy of derived |
76 for (; derived; derived = derived->parent()) { | 85 for (; derived; derived = derived->parent()) { |
77 if (name.compare(derived->name()) == 0) { | 86 if (name.compare(derived->name()) == 0) { |
78 return true; | 87 return true; |
79 } | 88 } |
80 } | 89 } |
81 return false; | 90 return false; |
82 } | 91 } |
83 | 92 |
84 } // namespace o3d | 93 } // namespace o3d |
OLD | NEW |