RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Dumper::ChoiceDisplay Class Reference

Represents an enumerated value, with named options. More...

#include <dumper.h>

Inheritance diagram for Dumper::ChoiceDisplay:
Dumper::Display< offset_t >

Public Member Functions

 ChoiceDisplay (std::map< offset_t, std::string > names, std::string default_name, bool missing_on_value, offset_t missing_value, std::shared_ptr< Display< offset_t > > secondary_display)
 
bool IsMissing (std::tuple< offset_t > &values) override
 
void DisplayValue (Dumper &dump, std::tuple< offset_t > values) override
 
- Public Member Functions inherited from Dumper::Display< offset_t >
virtual bool IsMissing (std::tuple< Ts... > &values)
 Returns true if the specified value is such that it should not be displayed.
 
virtual void DisplayValue (Dumper &dump, std::tuple< Ts... > values)=0
 Prints the value through the Dumper, different types of fields can be displayed in different ways.
 

Static Public Member Functions

static std::shared_ptr< ChoiceDisplayMake (std::map< offset_t, std::string > names, std::string default_name="unknown", std::shared_ptr< Display< offset_t > > secondary_display=nullptr)
 Create a choice display.
 
static std::shared_ptr< ChoiceDisplayMake (std::map< offset_t, std::string > names, offset_t missing_value, std::string default_name="unknown", std::shared_ptr< Display< offset_t > > secondary_display=nullptr)
 Create a choice display.
 
static std::shared_ptr< ChoiceDisplayMake (std::map< offset_t, std::string > names, std::shared_ptr< Display< offset_t > > secondary_display)
 Create a choice display.
 
static std::shared_ptr< ChoiceDisplayMake (std::map< offset_t, std::string > names, offset_t missing_value, std::shared_ptr< Display< offset_t > > secondary_display)
 Create a choice display.
 
static std::shared_ptr< ChoiceDisplayMake (std::string on_true, std::string on_false)
 Creates a boolean choice.
 
static std::shared_ptr< ChoiceDisplayMake (std::string on_true)
 Creates a boolean choice that is either present with name or not present at all.
 

Public Attributes

std::map< offset_t, std::string > names
 Maps values to names.
 
std::string default_name
 Name for values not contained in names.
 
bool missing_on_value
 If false, any value not listed in names is missing, otherwise only missing_value is missing.
 
offset_t missing_value
 The single missing value, only used for missing_on_value true.
 
std::shared_ptr< Display< offset_t > > secondary_display
 Alternative representation, appearing in parentheses after the value.
 

Detailed Description

Represents an enumerated value, with named options.

Member Function Documentation

◆ Make() [1/6]

static std::shared_ptr< ChoiceDisplay > Dumper::ChoiceDisplay::Make ( std::map< offset_t, std::string > names,
offset_t missing_value,
std::shared_ptr< Display< offset_t > > secondary_display )
inlinestatic

Create a choice display.

Parameters
[in]namesA lookup table that maps certain values to their string representation
[in]missing_valueThe value that is considered missing
[in]secondary_displayDisplays the value within parentheses after the name. If a secondary display is not provided, only the name is displayed
Returns
A choice display

◆ Make() [2/6]

static std::shared_ptr< ChoiceDisplay > Dumper::ChoiceDisplay::Make ( std::map< offset_t, std::string > names,
offset_t missing_value,
std::string default_name = "unknown",
std::shared_ptr< Display< offset_t > > secondary_display = nullptr )
inlinestatic

Create a choice display.

Parameters
[in]namesA lookup table that maps certain values to their string representation
[in]missing_valueThe value that is considered missing
[in]default_nameThe string to print when the value cannot be found in the lookup table
[in]secondary_displayDisplays the value within parentheses after the name. If a secondary display is not provided, only the name is displayed
Returns
A choice display

◆ Make() [3/6]

static std::shared_ptr< ChoiceDisplay > Dumper::ChoiceDisplay::Make ( std::map< offset_t, std::string > names,
std::shared_ptr< Display< offset_t > > secondary_display )
inlinestatic

Create a choice display.

Parameters
[in]namesA lookup table that maps certain values to their string representation
[in]secondary_displayDisplays the value within parentheses after the name. If a secondary display is not provided, only the name is displayed
Returns
A choice display

◆ Make() [4/6]

static std::shared_ptr< ChoiceDisplay > Dumper::ChoiceDisplay::Make ( std::map< offset_t, std::string > names,
std::string default_name = "unknown",
std::shared_ptr< Display< offset_t > > secondary_display = nullptr )
inlinestatic

Create a choice display.

Parameters
[in]namesA lookup table that maps certain values to their string representation
[in]default_nameThe string to print when the value cannot be found in the lookup table
[in]secondary_displayDisplays the value within parentheses after the name. If a secondary display is not provided, only the name is displayed
Returns
A choice display

◆ Make() [5/6]

static std::shared_ptr< ChoiceDisplay > Dumper::ChoiceDisplay::Make ( std::string on_true)
inlinestatic

Creates a boolean choice that is either present with name or not present at all.

Parameters
[in]on_trueName to display on 1
Returns
A choice display

◆ Make() [6/6]

static std::shared_ptr< ChoiceDisplay > Dumper::ChoiceDisplay::Make ( std::string on_true,
std::string on_false )
inlinestatic

Creates a boolean choice.

Parameters
[in]on_trueName to display on 1
[in]on_falseName to display on 0
Returns
A choice display

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