The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Private Attributes | List of all members
hotkey::wml_hotkey_record Class Reference

RAII helper class to control the lifetime of a WML hotkey_command. More...

#include <hotkey_command.hpp>

Public Member Functions

 wml_hotkey_record (const wml_hotkey_record &)=delete
 Don't allow copying so objects don't get erased early. More...
 
const wml_hotkey_recordoperator= (const wml_hotkey_record &)=delete
 
 wml_hotkey_record (wml_hotkey_record &&)=default
 But we do want move semantics. More...
 
wml_hotkey_recordoperator= (wml_hotkey_record &&)=default
 
 wml_hotkey_record (const std::string &id, const t_string &description, const config &default_hotkey)
 Registers a hotkey_command for a WML hotkey with the given ID if one does not already exist. More...
 
 ~wml_hotkey_record ()
 

Private Attributes

std::function< void()> cleanup_ {}
 Handles removing the associated hotkey_command on this object's destruction. More...
 

Detailed Description

RAII helper class to control the lifetime of a WML hotkey_command.

Definition at line 326 of file hotkey_command.hpp.

Constructor & Destructor Documentation

◆ wml_hotkey_record() [1/3]

hotkey::wml_hotkey_record::wml_hotkey_record ( const wml_hotkey_record )
delete

Don't allow copying so objects don't get erased early.

◆ wml_hotkey_record() [2/3]

hotkey::wml_hotkey_record::wml_hotkey_record ( wml_hotkey_record &&  )
default

But we do want move semantics.

◆ wml_hotkey_record() [3/3]

hotkey::wml_hotkey_record::wml_hotkey_record ( const std::string &  id,
const t_string description,
const config default_hotkey 
)

Registers a hotkey_command for a WML hotkey with the given ID if one does not already exist.

Definition at line 386 of file hotkey_command.cpp.

References hotkey::add_hotkey(), cleanup_, DBG_G, config::empty(), ERR_CF, hotkey::has_hotkey_item(), hotkey::HKCAT_CUSTOM, hotkey::HOTKEY_WML, id, hotkey::load_from_config(), LOG_G, and hotkey::scope_game.

◆ ~wml_hotkey_record()

hotkey::wml_hotkey_record::~wml_hotkey_record ( )

Definition at line 420 of file hotkey_command.cpp.

References cleanup_.

Member Function Documentation

◆ operator=() [1/2]

const wml_hotkey_record& hotkey::wml_hotkey_record::operator= ( const wml_hotkey_record )
delete

◆ operator=() [2/2]

wml_hotkey_record& hotkey::wml_hotkey_record::operator= ( wml_hotkey_record &&  )
default

Member Data Documentation

◆ cleanup_

std::function<void()> hotkey::wml_hotkey_record::cleanup_ {}
private

Handles removing the associated hotkey_command on this object's destruction.

Definition at line 344 of file hotkey_command.hpp.

Referenced by wml_hotkey_record(), and ~wml_hotkey_record().


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