Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::EnumParameter Class Reference
Inheritance diagram for dart::EnumParameter:
dart::MethodParameter

Public Member Functions

 EnumParameter (const char *name, bool required, const char *const *enums)
 
virtual bool Validate (const char *value) const
 
- Public Member Functions inherited from dart::MethodParameter
 MethodParameter (const char *name, bool required)
 
virtual ~MethodParameter ()
 
virtual bool Validate (const char *value) const
 
virtual bool ValidateObject (const Object &value) const
 
const char * name () const
 
bool required () const
 
virtual void PrintError (const char *name, const char *value, JSONStream *js) const
 
virtual void PrintErrorObject (const char *name, const Object &value, JSONStream *js) const
 

Detailed Description

Definition at line 841 of file service.cc.

Constructor & Destructor Documentation

◆ EnumParameter()

dart::EnumParameter::EnumParameter ( const char *  name,
bool  required,
const char *const *  enums 
)
inline

Definition at line 843 of file service.cc.

844 : MethodParameter(name, required), enums_(enums) {}
const char * name() const
Definition: service.cc:147
MethodParameter(const char *name, bool required)
Definition: service.cc:138
bool required() const
Definition: service.cc:149

Member Function Documentation

◆ Validate()

virtual bool dart::EnumParameter::Validate ( const char *  value) const
inlinevirtual

Reimplemented from dart::MethodParameter.

Definition at line 846 of file service.cc.

846 {
847 if (value == nullptr) {
848 return true;
849 }
850 for (intptr_t i = 0; enums_[i] != nullptr; i++) {
851 if (strcmp(value, enums_[i]) == 0) {
852 return true;
853 }
854 }
855 return false;
856 }
uint8_t value

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