Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
ExtendedOptions Class Reference

Public Member Functions

 ExtendedOptions (const SkString &optionsString, bool *outParseSucceeded)
 
bool get_option_gpu_color (const char *optionKey, SkColorType *outColorType, SkAlphaType *alphaType, bool optional=true) const
 
bool get_option_gpu_api (const char *optionKey, SkCommandLineConfigGpu::ContextType *outContextType, bool *outFakeGLESVersion2, bool optional=true) const
 
bool get_option_gpu_surf_type (const char *optionKey, SkCommandLineConfigGpu::SurfType *outSurfType, bool optional=true) const
 
bool get_option_int (const char *optionKey, int *outInt, bool optional=true) const
 
bool get_option_bool (const char *optionKey, bool *outBool, bool optional=true) const
 

Detailed Description

Definition at line 436 of file CommonFlagsConfig.cpp.

Constructor & Destructor Documentation

◆ ExtendedOptions()

ExtendedOptions::ExtendedOptions ( const SkString optionsString,
bool *  outParseSucceeded 
)
inline

Definition at line 438 of file CommonFlagsConfig.cpp.

438 {
439 TArray<SkString> optionParts;
440 SkStrSplit(optionsString.c_str(), ",", kStrict_SkStrSplitMode, &optionParts);
441 for (int i = 0; i < optionParts.size(); ++i) {
442 TArray<SkString> keyValueParts;
443 SkStrSplit(optionParts[i].c_str(), "=", kStrict_SkStrSplitMode, &keyValueParts);
444 if (keyValueParts.size() != 2) {
445 *outParseSucceeded = false;
446 return;
447 }
448 const SkString& key = keyValueParts[0];
449 const SkString& value = keyValueParts[1];
450 if (fOptionsMap.find(key) == nullptr) {
451 fOptionsMap.set(key, value);
452 } else {
453 // Duplicate values are not allowed.
454 *outParseSucceeded = false;
455 return;
456 }
457 }
458 *outParseSucceeded = true;
459 }
void SkStrSplit(const char *str, const char *delimiters, SkStrSplitMode splitMode, TArray< SkString > *out)
@ kStrict_SkStrSplitMode
Definition: SkStringUtils.h:47
const char * c_str() const
Definition: SkString.h:133
int size() const
Definition: SkTArray.h:421
V * find(const K &key) const
Definition: SkTHash.h:494
V * set(K key, V val)
Definition: SkTHash.h:487
uint8_t value

Member Function Documentation

◆ get_option_bool()

bool ExtendedOptions::get_option_bool ( const char *  optionKey,
bool *  outBool,
bool  optional = true 
) const
inline

Definition at line 557 of file CommonFlagsConfig.cpp.

557 {
558 SkString* optionValue = fOptionsMap.find(SkString(optionKey));
559 if (optionValue == nullptr) {
560 return optional;
561 }
562 return parse_option_bool(*optionValue, outBool);
563 }
static bool parse_option_bool(const SkString &value, bool *outBool)

◆ get_option_gpu_api()

bool ExtendedOptions::get_option_gpu_api ( const char *  optionKey,
SkCommandLineConfigGpu::ContextType outContextType,
bool *  outFakeGLESVersion2,
bool  optional = true 
) const
inline

Definition at line 472 of file CommonFlagsConfig.cpp.

475 {
476 SkString* optionValue = fOptionsMap.find(SkString(optionKey));
477 if (optionValue == nullptr) {
478 return optional;
479 }
480 return parse_option_gpu_api(*optionValue, outContextType, outFakeGLESVersion2);
481 }
static bool parse_option_gpu_api(const SkString &value, SkCommandLineConfigGpu::ContextType *outContextType, bool *outFakeGLESVersion2)

◆ get_option_gpu_color()

bool ExtendedOptions::get_option_gpu_color ( const char *  optionKey,
SkColorType outColorType,
SkAlphaType alphaType,
bool  optional = true 
) const
inline

Definition at line 461 of file CommonFlagsConfig.cpp.

464 {
465 SkString* optionValue = fOptionsMap.find(SkString(optionKey));
466 if (optionValue == nullptr) {
467 return optional;
468 }
469 return parse_option_gpu_color(*optionValue, outColorType, alphaType);
470 }
static bool parse_option_gpu_color(const SkString &value, SkColorType *outColorType, SkAlphaType *alphaType)

◆ get_option_gpu_surf_type()

bool ExtendedOptions::get_option_gpu_surf_type ( const char *  optionKey,
SkCommandLineConfigGpu::SurfType outSurfType,
bool  optional = true 
) const
inline

Definition at line 539 of file CommonFlagsConfig.cpp.

541 {
542 SkString* optionValue = fOptionsMap.find(SkString(optionKey));
543 if (optionValue == nullptr) {
544 return optional;
545 }
546 return parse_option_gpu_surf_type(*optionValue, outSurfType);
547 }
static bool parse_option_gpu_surf_type(const SkString &value, SkCommandLineConfigGpu::SurfType *surfType)

◆ get_option_int()

bool ExtendedOptions::get_option_int ( const char *  optionKey,
int outInt,
bool  optional = true 
) const
inline

Definition at line 549 of file CommonFlagsConfig.cpp.

549 {
550 SkString* optionValue = fOptionsMap.find(SkString(optionKey));
551 if (optionValue == nullptr) {
552 return optional;
553 }
554 return parse_option_int(*optionValue, outInt);
555 }
static bool parse_option_int(const SkString &value, int *outInt)

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