Flutter Engine
The Flutter Engine
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
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

Definition at line 123 of file options.h.

◆ 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.

◆ 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.

◆ 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"); \
})
const char *const enum_name
#define DEFINE_STRING_OPTION_CB(name, callback)
Definition: options.h:63

Definition at line 85 of file options.h.

◆ DEFINE_STRING_OPTION

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

Definition at line 82 of file options.h.

◆ 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; \
} \
callback; \
return true; \
} \
}; \
static OptionProcessor_##name option_##name;

Definition at line 63 of file options.h.