Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Typedefs
options.h File Reference
#include "bin/dartutils.h"
#include "platform/globals.h"
#include "platform/hashmap.h"
#include "platform/syslog.h"

Go to the source code of this file.

Classes

class  dart::bin::OptionProcessor
 
class  dart::bin::CallbackOptionProcessor
 

Namespaces

namespace  dart
 
namespace  dart::bin
 

Macros

#define DEFINE_CB_OPTION(callback)    static CallbackOptionProcessor option_##callback(&callback);
 
#define DEFINE_STRING_OPTION_CB(name, callback)
 
#define DEFINE_STRING_OPTION(name, variable)    DEFINE_STRING_OPTION_CB(name, { variable = value; })
 
#define DEFINE_ENUM_OPTION(name, enum_name, variable)
 
#define DEFINE_BOOL_OPTION_CB(name, callback)
 
#define DEFINE_BOOL_OPTION(name, variable)
 
#define DEFINE_BOOL_OPTION_SHORT(short_name, long_name, variable)
 

Typedefs

typedef bool(* dart::bin::OptionProcessorCallback) (const char *arg, CommandLineOptions *vm_options)
 

Macro Definition Documentation

◆ DEFINE_BOOL_OPTION

#define DEFINE_BOOL_OPTION (   name,
  variable 
)
Value:
class OptionProcessor_##name : public OptionProcessor { \
public: \
virtual bool Process(const char* option, CommandLineOptions* vm_options) { \
const char* value = OptionProcessor::ProcessOption(option, "--" #name); \
if (value == nullptr) { \
return false; \
} \
if (*value == '=') { \
Syslog::PrintErr("Non-empty value for option " #name "\n"); \
return false; \
} \
if (*value != '\0') { \
return false; \
} \
variable = true; \
return true; \
} \
}; \
static OptionProcessor_##name option_##name;
uint8_t value
const char * name
Definition fuchsia.cc:50

Definition at line 123 of file options.h.

124 : public OptionProcessor { \
125 public: \
126 virtual bool Process(const char* option, CommandLineOptions* vm_options) { \
127 const char* value = OptionProcessor::ProcessOption(option, "--" #name); \
128 if (value == nullptr) { \
129 return false; \
130 } \
131 if (*value == '=') { \
132 Syslog::PrintErr("Non-empty value for option " #name "\n"); \
133 return false; \
134 } \
135 if (*value != '\0') { \
136 return false; \
137 } \
138 variable = true; \
139 return true; \
140 } \
141 }; \
142 static OptionProcessor_##name option_##name;

◆ DEFINE_BOOL_OPTION_CB

#define DEFINE_BOOL_OPTION_CB (   name,
  callback 
)
Value:
class OptionProcessor_##name : public OptionProcessor { \
public: \
virtual bool Process(const char* option, CommandLineOptions* vm_options) { \
const char* value = OptionProcessor::ProcessOption(option, "--" #name); \
if (value == nullptr) { \
return false; \
} \
if (*value == '=') { \
Syslog::PrintErr("Non-empty value for option " #name "\n"); \
return false; \
} \
if (*value != '\0') { \
return false; \
} \
callback(vm_options); \
return true; \
} \
}; \
static OptionProcessor_##name option_##name;

Definition at line 102 of file options.h.

103 : public OptionProcessor { \
104 public: \
105 virtual bool Process(const char* option, CommandLineOptions* vm_options) { \
106 const char* value = OptionProcessor::ProcessOption(option, "--" #name); \
107 if (value == nullptr) { \
108 return false; \
109 } \
110 if (*value == '=') { \
111 Syslog::PrintErr("Non-empty value for option " #name "\n"); \
112 return false; \
113 } \
114 if (*value != '\0') { \
115 return false; \
116 } \
117 callback(vm_options); \
118 return true; \
119 } \
120 }; \
121 static OptionProcessor_##name option_##name;

◆ DEFINE_BOOL_OPTION_SHORT

#define DEFINE_BOOL_OPTION_SHORT (   short_name,
  long_name,
  variable 
)
Value:
class OptionProcessor_##long_name : public OptionProcessor { \
public: \
virtual bool Process(const char* option, CommandLineOptions* vm_options) { \
const char* value = \
OptionProcessor::ProcessOption(option, "-" #short_name); \
if (value == nullptr) { \
value = OptionProcessor::ProcessOption(option, "--" #long_name); \
} \
if (value == nullptr) { \
return false; \
} \
if (*value == '=') { \
Syslog::PrintErr("Non-empty value for option " #long_name "\n"); \
return false; \
} \
if (*value != '\0') { \
return false; \
} \
variable = true; \
return true; \
} \
}; \
static OptionProcessor_##long_name option_##long_name;

Definition at line 144 of file options.h.

145 : public OptionProcessor { \
146 public: \
147 virtual bool Process(const char* option, CommandLineOptions* vm_options) { \
148 const char* value = \
149 OptionProcessor::ProcessOption(option, "-" #short_name); \
150 if (value == nullptr) { \
151 value = OptionProcessor::ProcessOption(option, "--" #long_name); \
152 } \
153 if (value == nullptr) { \
154 return false; \
155 } \
156 if (*value == '=') { \
157 Syslog::PrintErr("Non-empty value for option " #long_name "\n"); \
158 return false; \
159 } \
160 if (*value != '\0') { \
161 return false; \
162 } \
163 variable = true; \
164 return true; \
165 } \
166 }; \
167 static OptionProcessor_##long_name option_##long_name;

◆ DEFINE_CB_OPTION

#define DEFINE_CB_OPTION (   callback)     static CallbackOptionProcessor option_##callback(&callback);

Definition at line 60 of file options.h.

◆ DEFINE_ENUM_OPTION

#define DEFINE_ENUM_OPTION (   name,
  enum_name,
  variable 
)
Value:
const char* const* kNames = k##enum_name##Names; \
for (intptr_t i = 0; kNames[i] != nullptr; i++) { \
if (strcmp(value, kNames[i]) == 0) { \
variable = static_cast<enum_name>(i); \
return true; \
} \
} \
Syslog::PrintErr( \
"Unrecognized value for " #name ": '%s'\nValid values are: ", value); \
for (intptr_t i = 0; kNames[i] != nullptr; i++) { \
Syslog::PrintErr("%s%s", i > 0 ? ", " : "", kNames[i]); \
} \
Syslog::PrintErr("\n"); \
})
#define DEFINE_STRING_OPTION_CB(name, callback)
Definition options.h:63

Definition at line 85 of file options.h.

86 { \
87 const char* const* kNames = k##enum_name##Names; \
88 for (intptr_t i = 0; kNames[i] != nullptr; i++) { \
89 if (strcmp(value, kNames[i]) == 0) { \
90 variable = static_cast<enum_name>(i); \
91 return true; \
92 } \
93 } \
94 Syslog::PrintErr( \
95 "Unrecognized value for " #name ": '%s'\nValid values are: ", value); \
96 for (intptr_t i = 0; kNames[i] != nullptr; i++) { \
97 Syslog::PrintErr("%s%s", i > 0 ? ", " : "", kNames[i]); \
98 } \
99 Syslog::PrintErr("\n"); \
100 })
const char *const enum_name

◆ DEFINE_STRING_OPTION

#define DEFINE_STRING_OPTION (   name,
  variable 
)     DEFINE_STRING_OPTION_CB(name, { variable = value; })

Definition at line 82 of file options.h.

83 { variable = value; })

◆ DEFINE_STRING_OPTION_CB

#define DEFINE_STRING_OPTION_CB (   name,
  callback 
)
Value:
class OptionProcessor_##name : public OptionProcessor { \
public: \
virtual bool Process(const char* option, CommandLineOptions* vm_options) { \
const char* value = \
OptionProcessor::ProcessOption(option, "--" #name "="); \
if (value == nullptr) { \
return false; \
} \
if (*value == '\0') { \
Syslog::PrintErr("Empty value for option " #name "\n"); \
return false; \
} \
return true; \
} \
}; \
static OptionProcessor_##name option_##name;
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

Definition at line 63 of file options.h.

64 : public OptionProcessor { \
65 public: \
66 virtual bool Process(const char* option, CommandLineOptions* vm_options) { \
67 const char* value = \
68 OptionProcessor::ProcessOption(option, "--" #name "="); \
69 if (value == nullptr) { \
70 return false; \
71 } \
72 if (*value == '\0') { \
73 Syslog::PrintErr("Empty value for option " #name "\n"); \
74 return false; \
75 } \
76 callback; \
77 return true; \
78 } \
79 }; \
80 static OptionProcessor_##name option_##name;