NDEVR
API Documentation
SetProperty< t_property, t_type >

A command that sets a single compile-time-known property on a single DesignObject, with full undo/redo support. More...

Inheritance diagram for SetProperty< t_property, t_type >:
[legend]
Collaboration diagram for SetProperty< t_property, t_type >:
[legend]

Public Member Functions

 SetProperty ()
 Default constructor.
 SetProperty (const DesignObject &object, const t_type &value)
 Constructs a SetProperty command targeting a specific object with the given value.
 SetProperty (const SetProperty< t_property, t_type > &value)
 Copy constructor.
 SetProperty (const t_type &value)
 Constructs a SetProperty command with a value but no target.
virtual bool addTarget (UUID target_id) override
 Sets the target object for this command by UUID, replacing any previous target.
void execute (DesignObjectLookup *lookup) override
 Executes or undoes the property change on the target object.
virtual StringView icon () const override
 Returns the icon identifier for this command.
virtual TranslatedString name () const override
 Returns the human-readable name of this command for display in the UI.
Public Member Functions inherited from DesignCommand
 DesignCommand ()
 Default constructor.
 DesignCommand (const DesignCommand &command)=default
 Default copy constructor.
virtual ~DesignCommand ()
 Virtual destructor.
virtual bool canCombineWith (const DynamicPointer< DesignCommand > &)
 Checks whether this command can be combined with another command into a single operation.
virtual bool canGroupWith (const DynamicPointer< DesignCommand > &)
 Checks whether this command can be grouped with another command for batch execution.
virtual void combineWith (const DynamicPointer< DesignCommand > &command)
 Combines this command with another compatible command, merging their operations.
virtual bool isAsyncExecution () const
 Whether this command should be executed asynchronously.
void setUndoRedoID (UUID undo_redo_group)
 Sets the undo-redo group identifier for this command.
UUID undoRedoID () const
 Gets the undo-redo group identifier for this command.

Public Attributes

t_type value
 The new property value to apply.
Public Attributes inherited from DesignCommand
bool can_undo = true
 Whether this command supports being undone.
bool has_executed = false
 Whether this command has already been executed.
UUID id
 Unique identifier for this command instance.
bool is_undo = false
 Whether this command represents an undo operation.
LogPtr log
 Log pipe for reporting command progress and errors.
Time time = Constant<Time>::Invalid
 Timestamp of when the command was created or executed.
bool update_project_modified = true
 Whether executing this command should mark the project as modified.

Protected Attributes

t_type m_previous_value
 The stored previous value, used for undo.
UUID m_target
 The UUID of the target design object.
Protected Attributes inherited from DesignCommand
UUID m_undo_redo_group
 The undo-redo group this command belongs to, for batch undo/redo.

Detailed Description

template<auto t_property, class t_type = typename PropertySpec<t_property>::type>
class SetProperty< t_property, t_type >

A command that sets a single compile-time-known property on a single DesignObject, with full undo/redo support.


The property and its value type are specified as template parameters.

Template Parameters
t_propertyThe compile-time property identifier (e.g., an NDPO, NDPG, or NDPM enum value).
t_typeThe value type of the property, defaulting to the type declared by PropertySpec.

Definition at line 22 of file SetPropertiesCommand.h.

Constructor & Destructor Documentation

◆ SetProperty() [1/3]

template<auto t_property, class t_type = typename PropertySpec<t_property>::type>
SetProperty< t_property, t_type >::SetProperty ( const DesignObject & object,
const t_type & value )
inline

Constructs a SetProperty command targeting a specific object with the given value.

Parameters
[in]objectThe design object whose property will be set.
[in]valueThe new value to assign to the property.

Definition at line 33 of file SetPropertiesCommand.h.

References m_previous_value, m_target, and value.

◆ SetProperty() [2/3]

template<auto t_property, class t_type = typename PropertySpec<t_property>::type>
SetProperty< t_property, t_type >::SetProperty ( const t_type & value)
inline

Constructs a SetProperty command with a value but no target.

A target must be added later via addTarget() before execution.

Parameters
[in]valueThe new value to assign to the property.

Definition at line 43 of file SetPropertiesCommand.h.

References m_previous_value, m_target, and value.

◆ SetProperty() [3/3]

template<auto t_property, class t_type = typename PropertySpec<t_property>::type>
SetProperty< t_property, t_type >::SetProperty ( const SetProperty< t_property, t_type > & value)
inline

Copy constructor.

Parameters
[in]valueThe SetProperty instance to copy from.

Definition at line 52 of file SetPropertiesCommand.h.

References DesignCommand::DesignCommand(), SetProperty(), m_previous_value, m_target, and value.

Member Function Documentation

◆ addTarget()

template<auto t_property, class t_type = typename PropertySpec<t_property>::type>
virtual bool SetProperty< t_property, t_type >::addTarget ( UUID target_id)
inlineoverridevirtual

Sets the target object for this command by UUID, replacing any previous target.

Parameters
[in]target_idThe UUID of the design object to target.
Returns
True, indicating the target was accepted.

Reimplemented from DesignCommand.

Definition at line 100 of file SetPropertiesCommand.h.

References m_target.

◆ execute()

template<auto t_property, class t_type = typename PropertySpec<t_property>::type>
void SetProperty< t_property, t_type >::execute ( DesignObjectLookup * lookup)
inlineoverridevirtual

Executes or undoes the property change on the target object.

When executing forward, the previous value is stored and the new value is applied. When undoing, the previous value is restored.

Parameters
[in]lookupThe design object registry containing the target object.

Reimplemented from DesignCommand.

Definition at line 81 of file SetPropertiesCommand.h.

References DesignCommand::is_undo, m_previous_value, m_target, DesignObjectLookup::object(), value, and DesignObjectLookup::writeLock().

◆ icon()

template<auto t_property, class t_type = typename PropertySpec<t_property>::type>
virtual StringView SetProperty< t_property, t_type >::icon ( ) const
inlineoverridevirtual

Returns the icon identifier for this command.

Returns
A string view containing the icon name.

Implements DesignCommand.

Definition at line 63 of file SetPropertiesCommand.h.

◆ name()

template<auto t_property, class t_type = typename PropertySpec<t_property>::type>
virtual TranslatedString SetProperty< t_property, t_type >::name ( ) const
inlineoverridevirtual

Returns the human-readable name of this command for display in the UI.

Returns
The translated command name.

Implements DesignCommand.

Definition at line 71 of file SetPropertiesCommand.h.


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