![]() |
Paradox Game Engine
v1.0.0 beta06
|
Represents a container that can hold properties, lightweight to embed (lazy initialized). More...
Classes | |
class | Serializer |
Serializer for the PropertyContainer | |
class | ValueHolder |
class | ValueHolder< T > |
Public Member Functions | |
delegate void | PropertyUpdatedDelegate (ref PropertyContainer propertyContainer, PropertyKey propertyKey, object newValue, object oldValue) |
Property changed delegate. More... | |
PropertyContainer (object owner) | |
IEnumerator< KeyValuePair < PropertyKey, object > > | GetEnumerator () |
Gets the key-properties value pairs in this instance. More... | |
void | Clear () |
void | Add< T > (PropertyKey< T > key, T value) |
Adds the specified key-value pair. More... | |
bool | ContainsKey (PropertyKey key) |
Determines whether the specified instance contains this key. More... | |
void | Add (PropertyKey key, object value) |
bool | Remove (PropertyKey propertyKey) |
void | CopyTo (ref PropertyContainer destination) |
Copies properties from this instance to a container. More... | |
object | Get (PropertyKey propertyKey) |
Gets the specified tag value. More... | |
T | Get< T > (PropertyKey< T > propertyKey) |
Gets the specified tag value. More... | |
bool | TryGetValue (PropertyKey propertyKey, out object value) |
Tries to get a tag value. More... | |
bool | TryGetValue< T > (PropertyKey< T > propertyKey, out T value) |
Tries to get a tag value. More... | |
void | Set< T > (PropertyKey< T > propertyKey, T tagValue) |
Sets the specified tag value. More... | |
void | SetObject (PropertyKey propertyKey, object tagValue) |
Sets the specified tag value. More... | |
IEnumerator IEnumerable. | GetEnumerator () |
Static Public Member Functions | |
static void | AddAccessorProperty (Type type, PropertyKey propertyKey) |
Properties | |
object | Owner [get, set] |
int | Count [get] |
Gets the number of properties stored in this container. More... | |
bool | IsReadOnly [get] |
object | this[PropertyKey key] [get, set] |
ICollection< PropertyKey > | Keys [get] |
ICollection< object > | Values [get] |
Events | |
PropertyUpdatedDelegate | PropertyUpdated |
Occurs when a property is modified. More... | |
Represents a container that can hold properties, lightweight to embed (lazy initialized).
Tag properties system purpose is to allow binding of properties that aren't logically supposed to be in a general class (probably because the property exists only in a higher level part of the engine). A typical example includes source mesh, collision data and various bouding volumes for a Geometry object: including them directly in the low-level Geometry class would be a terrible design decision ! And the other well known solution, which consist of maintaining a Dictionary of object to properties isn't really nice either (especially with non-deterministic object destruction, it's hard to clean it up, would require lot of events). As a result, a specific system has been implemented. A class that could hold such tag properties should have an instance of PropertyContainer as a mutable field member. An cool feature of this system is that if a property doesn't exist, it could be generated during first access from a delegate or come from a default value.
Definition at line 29 of file PropertyContainer.cs.
SiliconStudio.Core.PropertyContainer.PropertyContainer | ( | object | owner | ) |
Definition at line 51 of file PropertyContainer.cs.
void SiliconStudio.Core.PropertyContainer.Add | ( | PropertyKey | key, |
object | value | ||
) |
Definition at line 150 of file PropertyContainer.cs.
void SiliconStudio.Core.PropertyContainer.Add< T > | ( | PropertyKey< T > | key, |
T | value | ||
) |
Adds the specified key-value pair.
T |
key | The key. |
value | The value. |
Definition at line 133 of file PropertyContainer.cs.
|
static |
Definition at line 512 of file PropertyContainer.cs.
References SiliconStudio.Core.PropertyKey.AccessorMetadata.
void SiliconStudio.Core.PropertyContainer.Clear | ( | ) |
Definition at line 102 of file PropertyContainer.cs.
bool SiliconStudio.Core.PropertyContainer.ContainsKey | ( | PropertyKey | key | ) |
Determines whether the specified instance contains this key.
key | The key. |
true
if the specified instance contains this key; otherwise, false
. Definition at line 145 of file PropertyContainer.cs.
void SiliconStudio.Core.PropertyContainer.CopyTo | ( | ref PropertyContainer | destination | ) |
Copies properties from this instance to a container.
destination | The destination. |
Definition at line 218 of file PropertyContainer.cs.
object SiliconStudio.Core.PropertyContainer.Get | ( | PropertyKey | propertyKey | ) |
Gets the specified tag value.
propertyKey | The tag property. |
Definition at line 229 of file PropertyContainer.cs.
Referenced by SiliconStudio.Paradox.UI.Panels.Panel.PanelChildrenComparer.Compare(), SiliconStudio.Paradox.UI.Panels.GridBase.GetElementGridPositions(), and SiliconStudio.Paradox.UI.Panels.GridBase.GetElementSpanValues().
T SiliconStudio.Core.PropertyContainer.Get< T > | ( | PropertyKey< T > | propertyKey | ) |
Gets the specified tag value.
T | Type of the tag value |
propertyKey | The tag property. |
Definition at line 275 of file PropertyContainer.cs.
References SiliconStudio.Core.PropertyKey.AccessorMetadata, SiliconStudio.Core.PropertyKey.DefaultValueMetadata, SiliconStudio.Core.PropertyKey.IsValueType, and SiliconStudio.Core.DefaultValueMetadata.KeepValue.
IEnumerator<KeyValuePair<PropertyKey, object> > SiliconStudio.Core.PropertyContainer.GetEnumerator | ( | ) |
Gets the key-properties value pairs in this instance.
Definition at line 73 of file PropertyContainer.cs.
IEnumerator IEnumerable. SiliconStudio.Core.PropertyContainer.GetEnumerator | ( | ) |
Definition at line 566 of file PropertyContainer.cs.
delegate void SiliconStudio.Core.PropertyContainer.PropertyUpdatedDelegate | ( | ref PropertyContainer | propertyContainer, |
PropertyKey | propertyKey, | ||
object | newValue, | ||
object | oldValue | ||
) |
Property changed delegate.
container | The property container. |
key | The property key. |
newValue | The property new value. |
oldValue | The property old value. |
bool SiliconStudio.Core.PropertyContainer.Remove | ( | PropertyKey | propertyKey | ) |
Definition at line 155 of file PropertyContainer.cs.
void SiliconStudio.Core.PropertyContainer.Set< T > | ( | PropertyKey< T > | propertyKey, |
T | tagValue | ||
) |
Sets the specified tag value.
T | Type of the tag value |
propertyKey | The tag property. |
tagValue | The tag value. |
Definition at line 360 of file PropertyContainer.cs.
References SiliconStudio.Core.PropertyKey.AccessorMetadata, SiliconStudio.Core.PropertyKey.DefaultValueMetadata, SiliconStudio.Core.AccessorMetadata.GetValue(), SiliconStudio.Core.PropertyKey.IsValueType, SiliconStudio.Core.PropertyKey.ObjectInvalidationMetadata, and SiliconStudio.Core.PropertyKey.ValidateValueMetadata.
void SiliconStudio.Core.PropertyContainer.SetObject | ( | PropertyKey | propertyKey, |
object | tagValue | ||
) |
Sets the specified tag value.
propertyKey | The tag property. |
tagValue | The tag value. |
Definition at line 454 of file PropertyContainer.cs.
bool SiliconStudio.Core.PropertyContainer.TryGetValue | ( | PropertyKey | propertyKey, |
out object | value | ||
) |
Tries to get a tag value.
T | Type of the tag value |
propertyKey | The tag property. |
value | The value or default vaue if not found |
true
if the was found; false
otherwiseDefinition at line 322 of file PropertyContainer.cs.
Referenced by SiliconStudio.Paradox.Effects.Modules.Renderers.LightingGroupInfo.GetOrCreate().
bool SiliconStudio.Core.PropertyContainer.TryGetValue< T > | ( | PropertyKey< T > | propertyKey, |
out T | value | ||
) |
Tries to get a tag value.
T | Type of the tag value |
propertyKey | The tag property. |
value | The value or default vaue if not found |
true
if the was found; false
otherwiseDefinition at line 343 of file PropertyContainer.cs.
|
get |
Gets the number of properties stored in this container.
The count of properties.
Definition at line 112 of file PropertyContainer.cs.
|
get |
Definition at line 120 of file PropertyContainer.cs.
|
get |
Definition at line 197 of file PropertyContainer.cs.
|
getset |
Definition at line 59 of file PropertyContainer.cs.
|
getset |
Definition at line 185 of file PropertyContainer.cs.
|
get |
Definition at line 206 of file PropertyContainer.cs.
PropertyUpdatedDelegate SiliconStudio.Core.PropertyContainer.PropertyUpdated |
Occurs when a property is modified.
Definition at line 49 of file PropertyContainer.cs.