Empeld
Empeld plugin documentation.
pluginbase.Objects.Syncable.ValidatedSyncableBase< T, TBase > Class Template Reference

Base class helper for a syncable than can be validated More...

Inheritance diagram for pluginbase.Objects.Syncable.ValidatedSyncableBase< T, TBase >:
pluginbase.Objects.Syncable.SyncableBase< TBase > pluginbase.Objects.Syncable.IValidatedNetSyncable

Protected Member Functions

bool Validate (T current, T proposed, DecodeContext context)
 Validate the specified current, proposed and context. More...
 
- Protected Member Functions inherited from pluginbase.Objects.Syncable.SyncableBase< TBase >
void Touch ()
 Touch the instance, notifying something has changed More...
 
virtual void TouchRecurse ()
 Touch the instance More...
 
virtual void ResetWatch ()
 Reset the touched state More...
 
virtual void OnChanged ()
 Raises the changed event. More...
 
abstract void EncodeTo (BinaryWriter writer, EncodeContext context)
 Encode changes to binary data More...
 
abstract void DecodeFrom (BinaryReader reader, DecodeContext context)
 Decode changes from binary data More...
 
abstract void Persist (IPersistObject obj)
 Persist the instance to a persist object More...
 
abstract void Load (IReadPersistObject obj)
 Load the instance from a persist object More...
 

Additional Inherited Members

- Events inherited from pluginbase.Objects.Syncable.SyncableBase< TBase >
Action< T > Changed
 Event triggered when any change occurs on this object, either locally or over the network More...
 
Action< T > NetUpdate
 Event triggered when a change occurs resulting from a change over the network More...
 
Action< T > Touched
 Event occurs only when an object is first touched. Usually the first instance of a local-change More...
 

Detailed Description

Base class helper for a syncable than can be validated

Type Constraints
TBase :ValidatedSyncableBase 
TBase :T 
TBase :TBase 

Member Function Documentation

◆ Validate()

bool pluginbase.Objects.Syncable.ValidatedSyncableBase< T, TBase >.Validate ( current,
proposed,
DecodeContext  context 
)
protected

Validate the specified current, proposed and context.

Parameters
currentIf set to true current.
proposedIf set to true proposed.
contextIf set to true context.

Attribute: i

;

48  {
49  for (int i=0; i<_validators.Count; ++i)
50  {
51  var validator = _validators[i];
52  if (validator.ValidateBy.HasFlag(context.Endpoint)
53  && !validator.Validate(current, proposed, context))
54  {
55  return false;
56  }
57  }
58  return true;
59  }

The documentation for this class was generated from the following file: