Add support for boolean arguments

This commit is contained in:
momo5502 2019-01-06 12:21:45 +01:00 committed by momo5502
parent 31ad6655f1
commit faf12ae6e7
4 changed files with 18 additions and 3 deletions

View File

@ -22,6 +22,12 @@ bool html_argument::is_number() const
return this->value_->vt == VT_I4; return this->value_->vt == VT_I4;
} }
bool html_argument::is_bool() const
{
if (this->is_empty()) return false;
return this->value_->vt == VT_BOOL;
}
std::string html_argument::get_string() const std::string html_argument::get_string() const
{ {
if (!this->is_string()) return {}; if (!this->is_string()) return {};
@ -34,3 +40,9 @@ int html_argument::get_number() const
if (!this->is_number()) return 0; if (!this->is_number()) return 0;
return this->value_->intVal; return this->value_->intVal;
} }
bool html_argument::get_bool() const
{
if(!this->is_bool()) return false;
return this->value_->boolVal != FALSE;
}

View File

@ -9,9 +9,11 @@ public:
bool is_string() const; bool is_string() const;
bool is_number() const; bool is_number() const;
bool is_bool() const;
std::string get_string() const; std::string get_string() const;
int get_number() const; int get_number() const;
bool get_bool() const;
private: private:
VARIANT* value_; VARIANT* value_;

File diff suppressed because one or more lines are too long