Skip to content

ui::CommandRef

Header: winui/ui/Command.hpp.

What a control's .command field holds: a non-owning reference to a ui::Command, written as the command itself (.command = save), or empty. Either end may go first: a CommandRef whose command was destroyed is empty, and the controls holding it act as if they had none.

It follows the Command object it was given. A copy of the command, or one it was moved into, starts with no refs.

CommandRef

CommandRef() noexcept = default

No command.

CommandRef

CommandRef(std::nullptr_t) noexcept

No command.

CommandRef

CommandRef(const Command& command) noexcept

A reference to command; implicit, so a field takes .command = save.

CommandRef

CommandRef(const CommandRef& other) noexcept

Another reference to the same command.

operator=

CommandRef& operator=(const CommandRef& other) noexcept

Points at other's command instead.

~CommandRef

~CommandRef()

get

const Command* get() const noexcept

The command, or nullptr when there is none or it was destroyed.

operator const Command *

operator const Command *() const noexcept

The command, or nullptr: a CommandRef reads like the pointer it replaces.

operator->

const Command* operator->() const noexcept

The command. Only use it while there is one.