NanoByte.Common
Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
NanoByte.Common.PropertyPointer< T > Class Template Reference

Wraps delegate-based access to a value as a property. More...

Inheritance diagram for NanoByte.Common.PropertyPointer< T >:

Public Member Functions

 PropertyPointer ([NotNull] Func< T > getValue, [NotNull] Action< T > setValue, T defaultValue=default, bool needsEncoding=false)
 Creates a property pointer. More...
 

Static Public Member Functions

static PropertyPointer< T > For< T > ([NotNull] Func< T > getValue, [NotNull] Action< T > setValue, T defaultValue=default, bool needsEncoding=false)
 Creates a property pointer. More...
 
static PropertyPointer< T > For< T > ([NotNull] Expression< Func< T >> getValue, T defaultValue=default, bool needsEncoding=false)
 Creates a property pointer. More...
 
static PropertyPointer< string > ToStringPointer ([NotNull] this PropertyPointer< bool > pointer)
 Wraps a bool pointer in a string pointer. More...
 
static PropertyPointer< string > ToStringPointer ([NotNull] this PropertyPointer< int > pointer)
 Wraps an int pointer in a string pointer. More...
 
static PropertyPointer< string > ToStringPointer ([NotNull] this PropertyPointer< long > pointer)
 Wraps an long pointer in a string pointer. More...
 
static PropertyPointer< string > ToStringPointer ([NotNull] this PropertyPointer< TimeSpan > pointer)
 Wraps a TimeSpan pointer in a string pointer. More...
 
static PropertyPointer< string > ToStringPointer ([NotNull] this PropertyPointer< Uri > pointer)
 Wraps an Uri pointer in a string pointer. More...
 

Public Attributes

bool IsDefaultValue => Equals(Value, DefaultValue)
 true if Value is equal to DefaultValue. More...
 

Properties

Value [get, set]
 Transparent access to the wrapper value. More...
 
DefaultValue [get]
 The default value of the property. More...
 
bool NeedsEncoding [get]
 Indicates that this property needs to be encoded (e.g. as base64) before it can be stored in a file. More...
 

Detailed Description

Wraps delegate-based access to a value as a property.

Provides factory methods for PropertyPointer<T>.

Template Parameters
TThe type of value the property contains.

Constructor & Destructor Documentation

◆ PropertyPointer()

NanoByte.Common.PropertyPointer< T >.PropertyPointer ( [NotNull] Func< T >  getValue,
[NotNull] Action< T >  setValue,
defaultValue = default,
bool  needsEncoding = false 
)
inline

Creates a property pointer.

Parameters
getValueA delegate that returns the current value.
setValueA delegate that sets the value.
defaultValueThe default value of the property
needsEncodingIndicates that this property needs to be encoded (e.g. as base64) before it can be stored in a file.

Member Function Documentation

◆ For< T >() [1/2]

static PropertyPointer<T> NanoByte.Common.PropertyPointer< T >.For< T > ( [NotNull] Func< T >  getValue,
[NotNull] Action< T >  setValue,
defaultValue = default,
bool  needsEncoding = false 
)
static

Creates a property pointer.

Template Parameters
TThe type of value the property contains.
Parameters
getValueA delegate that returns the current value.
setValueA delegate that sets the value.
defaultValueThe default value of the property
needsEncodingIndicates that this property needs to be encoded (e.g. as base64) before it can be stored in a file.

◆ For< T >() [2/2]

static PropertyPointer<T> NanoByte.Common.PropertyPointer< T >.For< T > ( [NotNull] Expression< Func< T >>  getValue,
defaultValue = default,
bool  needsEncoding = false 
)
inlinestatic

Creates a property pointer.

Template Parameters
TThe type of value the property contains.
Parameters
getValueAn expression pointing to the property.
defaultValueThe default value of the property
needsEncodingIndicates that this property needs to be encoded (e.g. as base64) before it can be stored in a file.

◆ ToStringPointer() [1/5]

static PropertyPointer<string> NanoByte.Common.PropertyPointer< T >.ToStringPointer ( [NotNull] this PropertyPointer< bool >  pointer)
inlinestatic

Wraps a bool pointer in a string pointer.

◆ ToStringPointer() [2/5]

static PropertyPointer<string> NanoByte.Common.PropertyPointer< T >.ToStringPointer ( [NotNull] this PropertyPointer< int >  pointer)
inlinestatic

Wraps an int pointer in a string pointer.

◆ ToStringPointer() [3/5]

static PropertyPointer<string> NanoByte.Common.PropertyPointer< T >.ToStringPointer ( [NotNull] this PropertyPointer< long >  pointer)
inlinestatic

Wraps an long pointer in a string pointer.

◆ ToStringPointer() [4/5]

static PropertyPointer<string> NanoByte.Common.PropertyPointer< T >.ToStringPointer ( [NotNull] this PropertyPointer< TimeSpan >  pointer)
inlinestatic

Wraps a TimeSpan pointer in a string pointer.

◆ ToStringPointer() [5/5]

static PropertyPointer<string> NanoByte.Common.PropertyPointer< T >.ToStringPointer ( [NotNull] this PropertyPointer< Uri >  pointer)
inlinestatic

Wraps an Uri pointer in a string pointer.

Member Data Documentation

◆ IsDefaultValue

bool NanoByte.Common.PropertyPointer< T >.IsDefaultValue => Equals(Value, DefaultValue)

true if Value is equal to DefaultValue.

Property Documentation

◆ DefaultValue

T NanoByte.Common.PropertyPointer< T >.DefaultValue
get

The default value of the property.

◆ NeedsEncoding

bool NanoByte.Common.PropertyPointer< T >.NeedsEncoding
get

Indicates that this property needs to be encoded (e.g. as base64) before it can be stored in a file.

◆ Value

T NanoByte.Common.PropertyPointer< T >.Value
getset

Transparent access to the wrapper value.


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