Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
BaseOption Struct Referenceabstract
Inheritance diagram for BaseOption:
Option< double > Option< std::string > Option< T > DoubleOption StringOption

Public Member Functions

virtual void set (const std::string &_value)=0
 
virtual std::string valueToString ()=0
 
 BaseOption (std::string _selector, std::string _description)
 
virtual ~BaseOption ()
 

Static Public Member Functions

static void Init (const std::vector< BaseOption * > &, int argc, char **argv)
 

Public Attributes

std::string selector
 
std::string description
 

Detailed Description

Definition at line 45 of file using_skia_and_harfbuzz.cpp.

Constructor & Destructor Documentation

◆ BaseOption()

BaseOption::BaseOption ( std::string  _selector,
std::string  _description 
)
inline

Definition at line 51 of file using_skia_and_harfbuzz.cpp.

52 : selector(std::move(_selector))
53 , description(std::move(_description)) {}

◆ ~BaseOption()

virtual BaseOption::~BaseOption ( )
inlinevirtual

Definition at line 55 of file using_skia_and_harfbuzz.cpp.

55{}

Member Function Documentation

◆ Init()

void BaseOption::Init ( const std::vector< BaseOption * > &  option_list,
int  argc,
char **  argv 
)
static

Definition at line 68 of file using_skia_and_harfbuzz.cpp.

69 {
70 std::map<std::string, BaseOption *> options;
71 for (BaseOption *opt : option_list) {
72 options[opt->selector] = opt;
73 }
74 for (int i = 1; i < argc; i++) {
75 std::string option_selector(argv[i]);
76 auto it = options.find(option_selector);
77 if (it != options.end()) {
78 if (i >= argc) {
79 break;
80 }
81 const char *option_value = argv[i + 1];
82 it->second->set(option_value);
83 i++;
84 } else {
85 printf("Ignoring unrecognized option: %s.\n", argv[i]);
86 printf("Usage: %s {option value}\n", argv[0]);
87 printf("\tTakes text from stdin and produces pdf file.\n");
88 printf("Supported options:\n");
89 for (BaseOption *opt : option_list) {
90 printf("\t%s\t%s (%s)\n", opt->selector.c_str(),
91 opt->description.c_str(), opt->valueToString().c_str());
92 }
93 exit(-1);
94 }
95 }
96}
const char * options
char ** argv
Definition: library.h:9
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: SkSLString.cpp:83
exit(kErrorExitCode)

◆ set()

virtual void BaseOption::set ( const std::string &  _value)
pure virtual

Implemented in DoubleOption, and StringOption.

◆ valueToString()

virtual std::string BaseOption::valueToString ( )
pure virtual

Implemented in DoubleOption, and StringOption.

Member Data Documentation

◆ description

std::string BaseOption::description

Definition at line 47 of file using_skia_and_harfbuzz.cpp.

◆ selector

std::string BaseOption::selector

Definition at line 46 of file using_skia_and_harfbuzz.cpp.


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