Freeciv21
Develop your civilization from humble roots to a global empire
fix_enabler_item Class Reference
+ Inheritance diagram for fix_enabler_item:
+ Collaboration diagram for fix_enabler_item:

Public Member Functions

 fix_enabler_item (struct action_enabler *enabler)
 Construct fix_enabler_item to help req_vec_fix with the action enabler unique stuff. More...
 
virtual ~fix_enabler_item ()
 Destructor for fix_enabler_item. More...
 
void close () override
 Tell the helper that it has outlived its usefulnes. More...
 
const void * item () override
 Returns a pointer to the ruleset item. More...
 
void * item_working_copy () override
 Returns a pointer to the working copy of the ruleset item. More...
 
const char * name () override
 Returns a name to describe the item, hopefully good enough to distinguish it from other items. More...
 
struct req_vec_problemfind_next_problem () override
 Returns the next detected requirement vector problem for the ruleset item or nullptr if no fix is found to be needed. More...
 
void apply_accepted_changes () override
 Do all the changes the user has accepted to the ruleset item. More...
 
void undo_accepted_changes () override
 Undo all the changes the user has accepted to the ruleset item. More...
 
int num_vectors () override
 Returns the number of requirement vectors in this item. More...
 
requirement_vector_namer vector_namer () override
 Returns a function pointer to a function that names this item kind's requirement vector number number. More...
 
requirement_vector_by_number vector_getter () override
 Returns a function pointer to a function that returns a writable pointer to the specified requirement vector in the specified parent item. More...
 
bool vector_in_item (const struct requirement_vector *vec) override
 Check if the specified vector belongs to this item. More...
 

Private Attributes

struct action_enablercurrent_enabler
 
struct action_enablerlocal_copy
 
QString my_name
 

Detailed Description

Definition at line 36 of file tab_enablers.cpp.

Constructor & Destructor Documentation

◆ fix_enabler_item()

fix_enabler_item::fix_enabler_item ( struct action_enabler enabler)
explicit

Construct fix_enabler_item to help req_vec_fix with the action enabler unique stuff.

Definition at line 416 of file tab_enablers.cpp.

◆ ~fix_enabler_item()

fix_enabler_item::~fix_enabler_item ( )
virtual

Destructor for fix_enabler_item.

Definition at line 440 of file tab_enablers.cpp.

Member Function Documentation

◆ apply_accepted_changes()

void fix_enabler_item::apply_accepted_changes ( )
overridevirtual

Do all the changes the user has accepted to the ruleset item.

N.B.: This could be called before all problems are fixed if the user wishes to try to fix problems by hand or to come back and fix the remaining problems later.

Implements req_vec_fix_item.

Definition at line 488 of file tab_enablers.cpp.

◆ close()

void fix_enabler_item::close ( )
overridevirtual

Tell the helper that it has outlived its usefulnes.

Implements req_vec_fix_item.

Definition at line 445 of file tab_enablers.cpp.

◆ find_next_problem()

struct req_vec_problem * fix_enabler_item::find_next_problem ( )
overridevirtual

Returns the next detected requirement vector problem for the ruleset item or nullptr if no fix is found to be needed.

Returns
the next requirement vector problem for the item.

Implements req_vec_fix_item.

Definition at line 472 of file tab_enablers.cpp.

◆ item()

const void * fix_enabler_item::item ( )
overridevirtual

Returns a pointer to the ruleset item.

Returns
a pointer to the ruleset item.

Implements req_vec_fix_item.

Definition at line 451 of file tab_enablers.cpp.

◆ item_working_copy()

void * fix_enabler_item::item_working_copy ( )
overridevirtual

Returns a pointer to the working copy of the ruleset item.

Returns
a pointer to the working copy of the ruleset item.

Implements req_vec_fix_item.

Definition at line 457 of file tab_enablers.cpp.

◆ name()

const char * fix_enabler_item::name ( )
overridevirtual

Returns a name to describe the item, hopefully good enough to distinguish it from other items.

Must be short enough for a quick mention.

Returns
a (not always unique) name for the ruleset item.

Implements req_vec_fix_item.

Definition at line 465 of file tab_enablers.cpp.

◆ num_vectors()

int fix_enabler_item::num_vectors ( )
overridevirtual

Returns the number of requirement vectors in this item.

Returns
the number of requirement vectors the item has.

Implements req_vec_fix_item.

Definition at line 517 of file tab_enablers.cpp.

◆ undo_accepted_changes()

void fix_enabler_item::undo_accepted_changes ( )
overridevirtual

Undo all the changes the user has accepted to the ruleset item.

N.B.: This could be called after all problems are fixed if the user wishes to see all problems and try to fix them by hand.

Implements req_vec_fix_item.

Definition at line 503 of file tab_enablers.cpp.

◆ vector_getter()

requirement_vector_by_number fix_enabler_item::vector_getter ( )
overridevirtual

Returns a function pointer to a function that returns a writable pointer to the specified requirement vector in the specified parent item.

Returns
a writable pointer to the requirement vector getter function.

Implements req_vec_fix_item.

Definition at line 536 of file tab_enablers.cpp.

◆ vector_in_item()

bool fix_enabler_item::vector_in_item ( const struct requirement_vector *  vec)
overridevirtual

Check if the specified vector belongs to this item.

Parameters
vecthe requirement vector that may belong to this item.
Returns
true iff the vector belongs to this item.

Implements req_vec_fix_item.

Definition at line 546 of file tab_enablers.cpp.

◆ vector_namer()

requirement_vector_namer fix_enabler_item::vector_namer ( )
overridevirtual

Returns a function pointer to a function that names this item kind's requirement vector number number.

Useful when there is more than one requirement vector.

Returns
the requirement vector namer for ruleset items of this kind.

Implements req_vec_fix_item.

Definition at line 525 of file tab_enablers.cpp.

Member Data Documentation

◆ current_enabler

struct action_enabler* fix_enabler_item::current_enabler
private

◆ local_copy

struct action_enabler* fix_enabler_item::local_copy
private

◆ my_name

QString fix_enabler_item::my_name
private

Definition at line 56 of file tab_enablers.cpp.

Referenced by fix_enabler_item(), and name().