Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Public Attributes | List of all members
dart::Flag Class Reference

Public Types

enum  FlagType {
  kBoolean , kInteger , kUint64 , kString ,
  kFlagHandler , kOptionHandler , kNumFlagTypes
}
 

Public Member Functions

 Flag (const char *name, const char *comment, void *addr, FlagType type)
 
 Flag (const char *name, const char *comment, FlagHandler handler)
 
 Flag (const char *name, const char *comment, OptionHandler handler)
 
void Print ()
 
bool IsUnrecognized () const
 

Public Attributes

const char * name_
 
const char * comment_
 
CStringUniquePtr string_value_
 
union {
   void *   addr_
 
   bool *   bool_ptr_
 
   int *   int_ptr_
 
   uint64_t *   uint64_ptr_
 
   charp *   charp_ptr_
 
   FlagHandler   flag_handler_
 
   OptionHandler   option_handler_
 
}; 
 
const FlagType type_
 
bool changed_ = false
 

Detailed Description

Definition at line 103 of file flags.cc.

Member Enumeration Documentation

◆ FlagType

Enumerator
kBoolean 
kInteger 
kUint64 
kString 
kFlagHandler 
kOptionHandler 
kNumFlagTypes 

Definition at line 105 of file flags.cc.

105 {
106 kBoolean,
107 kInteger,
108 kUint64,
109 kString,
113 };
@ kUint64
Definition: flags.cc:108
@ kNumFlagTypes
Definition: flags.cc:112
@ kBoolean
Definition: flags.cc:106
@ kFlagHandler
Definition: flags.cc:110
@ kOptionHandler
Definition: flags.cc:111
@ kString
Definition: flags.cc:109
@ kInteger
Definition: flags.cc:107

Constructor & Destructor Documentation

◆ Flag() [1/3]

dart::Flag::Flag ( const char *  name,
const char *  comment,
void *  addr,
FlagType  type 
)
inline

Definition at line 115 of file flags.cc.

116 : name_(name), comment_(comment), addr_(addr), type_(type) {}
GLenum type
const char * name_
Definition: flags.cc:170
void * addr_
Definition: flags.cc:177
const FlagType type_
Definition: flags.cc:185
const char * comment_
Definition: flags.cc:171
const char *const name

◆ Flag() [2/3]

dart::Flag::Flag ( const char *  name,
const char *  comment,
FlagHandler  handler 
)
inline

Definition at line 117 of file flags.cc.

118 : name_(name),
119 comment_(comment),
120 flag_handler_(handler),
FlagHandler flag_handler_
Definition: flags.cc:182

◆ Flag() [3/3]

dart::Flag::Flag ( const char *  name,
const char *  comment,
OptionHandler  handler 
)
inline

Definition at line 122 of file flags.cc.

123 : name_(name),
124 comment_(comment),
125 option_handler_(handler),
OptionHandler option_handler_
Definition: flags.cc:183

Member Function Documentation

◆ IsUnrecognized()

bool dart::Flag::IsUnrecognized ( ) const
inline

Definition at line 166 of file flags.cc.

166 {
167 return (type_ == kBoolean) && (bool_ptr_ == nullptr);
168 }
bool * bool_ptr_
Definition: flags.cc:178

◆ Print()

void dart::Flag::Print ( )
inline

Definition at line 128 of file flags.cc.

128 {
129 if (IsUnrecognized()) {
130 OS::PrintErr("%s: unrecognized\n", name_);
131 return;
132 }
133 switch (type_) {
134 case kBoolean: {
135 OS::Print("%s: %s (%s)\n", name_, *this->bool_ptr_ ? "true" : "false",
136 comment_);
137 break;
138 }
139 case kInteger: {
140 OS::Print("%s: %d (%s)\n", name_, *this->int_ptr_, comment_);
141 break;
142 }
143 case kUint64: {
144 OS::Print("%s: %" Pu64 " (%s)\n", name_, *this->uint64_ptr_, comment_);
145 break;
146 }
147 case kString: {
148 if (*this->charp_ptr_ != nullptr) {
149 OS::Print("%s: '%s' (%s)\n", name_, *this->charp_ptr_, comment_);
150 } else {
151 OS::Print("%s: (null) (%s)\n", name_, comment_);
152 }
153 break;
154 }
155 case kOptionHandler:
156 case kFlagHandler: {
157 OS::Print("%s: (%s)\n", name_, comment_);
158 break;
159 }
160 default:
161 UNREACHABLE();
162 break;
163 }
164 }
#define UNREACHABLE()
Definition: assert.h:248
int * int_ptr_
Definition: flags.cc:179
uint64_t * uint64_ptr_
Definition: flags.cc:180
charp * charp_ptr_
Definition: flags.cc:181
bool IsUnrecognized() const
Definition: flags.cc:166
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static void Print(const char *format,...) PRINTF_ATTRIBUTE(1
#define Pu64
Definition: globals.h:417

Member Data Documentation

◆ 

union { ... } dart::Flag::@147

◆ addr_

void* dart::Flag::addr_

Definition at line 177 of file flags.cc.

◆ bool_ptr_

bool* dart::Flag::bool_ptr_

Definition at line 178 of file flags.cc.

◆ changed_

bool dart::Flag::changed_ = false

Definition at line 186 of file flags.cc.

◆ charp_ptr_

charp* dart::Flag::charp_ptr_

Definition at line 181 of file flags.cc.

◆ comment_

const char* dart::Flag::comment_

Definition at line 171 of file flags.cc.

◆ flag_handler_

FlagHandler dart::Flag::flag_handler_

Definition at line 182 of file flags.cc.

◆ int_ptr_

int* dart::Flag::int_ptr_

Definition at line 179 of file flags.cc.

◆ name_

const char* dart::Flag::name_

Definition at line 170 of file flags.cc.

◆ option_handler_

OptionHandler dart::Flag::option_handler_

Definition at line 183 of file flags.cc.

◆ string_value_

CStringUniquePtr dart::Flag::string_value_

Definition at line 175 of file flags.cc.

◆ type_

const FlagType dart::Flag::type_

Definition at line 185 of file flags.cc.

◆ uint64_ptr_

uint64_t* dart::Flag::uint64_ptr_

Definition at line 180 of file flags.cc.


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