Definitto 1.1.0
The essential defines manager for the Unity game engine. API reference.
Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
Turbanov.Toolworks.Definitto.Define Class Reference

A single define in the list. More...

Inheritance diagram for Turbanov.Toolworks.Definitto.Define:
Inheritance graph
[legend]
Collaboration diagram for Turbanov.Toolworks.Definitto.Define:
Collaboration graph
[legend]

Public Member Functions

void ClearCache ()
 Clears the cache for the define. More...
 
 Define (Defines owner, string name)
 Create a new define with the specified name . More...
 
 Define (string name)
 Initializes a new instance of the Turbanov.Toolworks.Definitto.Define class without owner. More...
 
bool IsEnabled (IEnumerable< BuildTypeId > buildTypeIds, IEnumerable< PlatformId > platformTypes, AggregationPolicy policy=AggregationPolicy.All, bool raw=false)
 Check if the define is enabled for specified build types on specified platforms. More...
 
bool IsEnabled (BuildTypeId buildTypeId, PlatformId platformId, AggregationPolicy policy=AggregationPolicy.All, bool raw=false)
 Is the define active for the specified build type on the specified platform? More...
 
bool IsEnabled (BuildCategoryId buildCategoryId, PlatformId platformId, AggregationPolicy policy=AggregationPolicy.All, bool raw=false)
 Determines whether this instance is enabled for the specified build category and platform. More...
 
bool IsEnabled (BuildTypeId buildTypeId, PlatformCategoryId platformCategoryId, AggregationPolicy policy=AggregationPolicy.All, bool raw=false)
 Determines whether this instance is enabled for the specified build type and platform category. More...
 
bool IsEnabled (BuildCategoryId buildCategoryId, PlatformCategoryId platformCategoryId, AggregationPolicy policy=AggregationPolicy.All, bool raw=false)
 Determines whether this instance is enabled for the specified build category and platform category. More...
 
bool CanBeDisabled (BuildTypeId buildTypeId, PlatformId platformId, bool raw=false)
 Determines whether this instance can be disabled for the specified buildTypeId and platformId . More...
 
void SetEnabled (IEnumerable< BuildTypeId > buildTypeIds, IEnumerable< PlatformId > platformTypes, bool enabled=true, bool raw=false)
 Set define active/inactive for the build type and platform. More...
 
void SetEnabled (BuildTypeId buildTypeId, PlatformId platformType, bool enabled=true, bool raw=false)
 Set define active/inactive for the build type and platform. More...
 
void SetEnabled (BuildCategoryId buildCategoryId, PlatformId platformId, bool enabled=true, bool raw=false)
 Set the define active/inactive for the build category and platform. More...
 
void SetEnabled (BuildTypeId buildTypeId, PlatformCategoryId platformCategoryId, bool enabled=true, bool raw=false)
 Set define active/inactive for the build type and platform category. This method is for Editor only. More...
 
void SetEnabled (BuildCategoryId buildCategoryId, PlatformCategoryId platformCategoryId, bool enabled=true, bool raw=false)
 Set define active/inactive for the build category and the platform category. More...
 

Static Public Member Functions

static bool IsNameValid (string name)
 Test if a name is a valid define name. More...
 

Public Attributes

const string NameProp = "_Name"
 The name of the name property. More...
 

Properties

string Name [get, set]
 The name of the constant. The setter is available only in the Editor mode. More...
 
ReadOnlyCollection< DefineStateStates [get]
 The states for which the define is active. More...
 
bool IsMuted [get, set]
 Is the define currently muted? More...
 
DefineStateEvent StateChanged [get]
 The define was changed in some way for a state. More...
 
DefineNameEvent NameChanged [get]
 An event is generated when the name of the define was changed. The second argument is the former name of the define. More...
 
DefineEvent IsMutedChanged [get]
 An event is generated when the muted status of the define was changed. More...
 
Defines Owner [get, set]
 The owning defines list. The setter is only for internal usage. More...
 
bool IsValid [get]
 Is the define valid? More...
 
bool IsBuiltIn [get]
 Is the define built-in into Unity? More...
 
bool IsActive [get]
 Determines whether this define is enabled under the currently active build type and platform. If you want to check the define state for specific platform use the Define.IsEnabled(BuildTypeId, PlatformId, AggregationPolicy) method and its overloads. More...
 

Detailed Description

A single define in the list.

Constructor & Destructor Documentation

◆ Define() [1/2]

Turbanov.Toolworks.Definitto.Define.Define ( Defines  owner,
string  name 
)

Create a new define with the specified name .

Parameters
ownerThe owning list of the define.
nameThe name of the define. May be invalid, but it won't be considered enabled, until it becomes valid.

◆ Define() [2/2]

Turbanov.Toolworks.Definitto.Define.Define ( string  name)

Initializes a new instance of the Turbanov.Toolworks.Definitto.Define class without owner.

Parameters
nameName.

Member Function Documentation

◆ CanBeDisabled()

bool Turbanov.Toolworks.Definitto.Define.CanBeDisabled ( BuildTypeId  buildTypeId,
PlatformId  platformId,
bool  raw = false 
)

Determines whether this instance can be disabled for the specified buildTypeId and platformId .

The define can't be disabled, if it is built-in and is active for platform and build type.

This method is for Editor mode only.

Returns
true if this instance can be disabled; otherwise, false.
Parameters
buildTypeIdThe build type identifier.
platformIdThe platform identifier.
rawShould the IsMuted and IsValid statuses be ignored?

◆ ClearCache()

void Turbanov.Toolworks.Definitto.Define.ClearCache ( )

Clears the cache for the define.

◆ IsEnabled() [1/5]

bool Turbanov.Toolworks.Definitto.Define.IsEnabled ( IEnumerable< BuildTypeId buildTypeIds,
IEnumerable< PlatformId platformTypes,
AggregationPolicy  policy = AggregationPolicy.All,
bool  raw = false 
)

Check if the define is enabled for specified build types on specified platforms.

Even if the define is enabled for supplied state, this function will return false, unless the raw is set to true.

Returns
true if this instance is enabled; otherwise, false.
Parameters
buildTypeIdsThe build type identifiers to match against.
platformTypesThe platform types to match against.
policyThe policy to use when aggregating the define states.
rawShould the IsMuted and IsValid statuses be ignored?

◆ IsEnabled() [2/5]

bool Turbanov.Toolworks.Definitto.Define.IsEnabled ( BuildTypeId  buildTypeId,
PlatformId  platformId,
AggregationPolicy  policy = AggregationPolicy.All,
bool  raw = false 
)

Is the define active for the specified build type on the specified platform?

This function uses a fast cache internally, whenever possible.

Even if the define is enabled for supplied state, this function will return false, unless the raw is set to true.

Returns
true if this instance is enabled; otherwise, false.
Parameters
buildTypeIdThe build type to match against.
platformIdThe platform to match against.
policyIn case buildTypeId is BuildTypeId.All or platformId is PlatformId.All, the policy to use when aggregating the define states.
rawShould the IsMuted and IsValid statuses be ignored?

◆ IsEnabled() [3/5]

bool Turbanov.Toolworks.Definitto.Define.IsEnabled ( BuildCategoryId  buildCategoryId,
PlatformId  platformId,
AggregationPolicy  policy = AggregationPolicy.All,
bool  raw = false 
)

Determines whether this instance is enabled for the specified build category and platform.

Even if the define is enabled for supplied state, this function will return false, unless the raw is set to true.

Returns
true if this instance is enabled; otherwise, false.
Parameters
buildCategoryIdThe build category to examine for.
platformIdThe platform to examine one.
policyThe aggregation policy to use.
rawShould the IsMuted and IsValid statuses be ignored?

◆ IsEnabled() [4/5]

bool Turbanov.Toolworks.Definitto.Define.IsEnabled ( BuildTypeId  buildTypeId,
PlatformCategoryId  platformCategoryId,
AggregationPolicy  policy = AggregationPolicy.All,
bool  raw = false 
)

Determines whether this instance is enabled for the specified build type and platform category.

Even if the define is enabled for supplied state, this function will return false, unless the raw is set to true.

Returns
true if this instance is enabled; otherwise, false.
Parameters
buildTypeIdThe build type to examine for.
platformCategoryIdThe platform category to examine on.
policyThe aggregation policy to use.
rawShould the IsMuted and IsValid statuses be ignored?

◆ IsEnabled() [5/5]

bool Turbanov.Toolworks.Definitto.Define.IsEnabled ( BuildCategoryId  buildCategoryId,
PlatformCategoryId  platformCategoryId,
AggregationPolicy  policy = AggregationPolicy.All,
bool  raw = false 
)

Determines whether this instance is enabled for the specified build category and platform category.

Even if the define is enabled for supplied state, this function will return false, unless the raw is set to true.

Returns
true if this instance is enabled; otherwise, false.
Parameters
buildCategoryIdThe build category to examine for.
platformCategoryIdThe platform category to examine on.
policyThe aggregation policy to use.
rawShould the IsMuted and IsValid statuses be ignored?

◆ IsNameValid()

static bool Turbanov.Toolworks.Definitto.Define.IsNameValid ( string  name)
static

Test if a name is a valid define name.

Parameters
nameThe name to analyze.
Returns
The result of the validation analysis.

◆ SetEnabled() [1/5]

void Turbanov.Toolworks.Definitto.Define.SetEnabled ( IEnumerable< BuildTypeId buildTypeIds,
IEnumerable< PlatformId platformTypes,
bool  enabled = true,
bool  raw = false 
)

Set define active/inactive for the build type and platform.

Changing the define's state during the Play mode is not allowed.

Parameters
buildTypeIdsThe build type identifiers to set for.
platformTypesThe platform types to set enabled state for.
enabledShould the define be enabled or disabled?
rawShould the IsMuted and IsValid statuses be ignored?

◆ SetEnabled() [2/5]

void Turbanov.Toolworks.Definitto.Define.SetEnabled ( BuildTypeId  buildTypeId,
PlatformId  platformType,
bool  enabled = true,
bool  raw = false 
)

Set define active/inactive for the build type and platform.

Changing the define's state during the Play mode is not allowed.

Changing the states of a muted define are also not allowed, unless raw is set to true.

Parameters
buildTypeIdThe build type to set for.
platformTypeThe platform type to set on.
enabledShould activate or disable?
rawShould the IsMuted and IsValid statuses be ignored?

◆ SetEnabled() [3/5]

void Turbanov.Toolworks.Definitto.Define.SetEnabled ( BuildCategoryId  buildCategoryId,
PlatformId  platformId,
bool  enabled = true,
bool  raw = false 
)

Set the define active/inactive for the build category and platform.

This method is for Editor only.

Parameters
buildCategoryIdThe build category to set for.
platformIdThe platform to set on.
enabledShould enable or disable?
rawShould the IsMuted and IsValid statuses be ignored?

◆ SetEnabled() [4/5]

void Turbanov.Toolworks.Definitto.Define.SetEnabled ( BuildTypeId  buildTypeId,
PlatformCategoryId  platformCategoryId,
bool  enabled = true,
bool  raw = false 
)

Set define active/inactive for the build type and platform category. This method is for Editor only.

Parameters
buildTypeIdThe build type to set for.
platformCategoryIdThe platform category to set on.
enabledShould enable or disable?
rawShould the IsMuted and IsValid statuses be ignored?

◆ SetEnabled() [5/5]

void Turbanov.Toolworks.Definitto.Define.SetEnabled ( BuildCategoryId  buildCategoryId,
PlatformCategoryId  platformCategoryId,
bool  enabled = true,
bool  raw = false 
)

Set define active/inactive for the build category and the platform category.

This method is for Editor only.

Parameters
buildCategoryIdThe build category to set for.
platformCategoryIdThe platform category to set on.
enabledShould enable or disable?
rawShould the IsMuted and IsValid statuses be ignored?

Member Data Documentation

◆ NameProp

const string Turbanov.Toolworks.Definitto.Define.NameProp = "_Name"

The name of the name property.

Property Documentation

◆ IsActive

bool Turbanov.Toolworks.Definitto.Define.IsActive
get

Determines whether this define is enabled under the currently active build type and platform. If you want to check the define state for specific platform use the Define.IsEnabled(BuildTypeId, PlatformId, AggregationPolicy) method and its overloads.

Returns
true if the define is currently enabled; otherwise, false.

◆ IsBuiltIn

bool Turbanov.Toolworks.Definitto.Define.IsBuiltIn
get

Is the define built-in into Unity?

true if this instance is built in; otherwise, false.

◆ IsMuted

bool Turbanov.Toolworks.Definitto.Define.IsMuted
getset

Is the define currently muted?

The semantic behind muting a define is as if it's no longer in the list, but still occupies its place (has an index). So methods like Defines.Find(string, bool) won't find it by default. Use the raw parameter to query and change the muted defines. As the muted define still has its index it can be referred by indexing operators of Defines.

The define can be muted to disable it globally for all the build types and platforms. The internal list of enabled states is actually preserved, so you can un-mute the define later, to get the former states.

◆ IsMutedChanged

DefineEvent Turbanov.Toolworks.Definitto.Define.IsMutedChanged
get

An event is generated when the muted status of the define was changed.

◆ IsValid

bool Turbanov.Toolworks.Definitto.Define.IsValid
get

Is the define valid?

Invalid defines can't have their states changed, unless you use the raw parameter in methods like Define.SetEnabled(BuildTypeId, PlatformId, bool, bool)

◆ Name

string Turbanov.Toolworks.Definitto.Define.Name
getset

The name of the constant. The setter is available only in the Editor mode.

◆ NameChanged

DefineNameEvent Turbanov.Toolworks.Definitto.Define.NameChanged
get

An event is generated when the name of the define was changed. The second argument is the former name of the define.

◆ Owner

Defines Turbanov.Toolworks.Definitto.Define.Owner
getset

The owning defines list. The setter is only for internal usage.

◆ StateChanged

DefineStateEvent Turbanov.Toolworks.Definitto.Define.StateChanged
get

The define was changed in some way for a state.

◆ States

ReadOnlyCollection<DefineState> Turbanov.Toolworks.Definitto.Define.States
get

The states for which the define is active.


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