This source file includes following definitions.
- value_
- GetType
- GetBool
- GetInt32
- SetBool
- SetInt32
#include "ppapi/shared_impl/socket_option_data.h"
namespace ppapi {
SocketOptionData::SocketOptionData() : type_(TYPE_INVALID), value_(0) {}
SocketOptionData::~SocketOptionData() {}
SocketOptionData::Type SocketOptionData::GetType() const { return type_; }
bool SocketOptionData::GetBool(bool* out_value) const {
if (!out_value || type_ != TYPE_BOOL)
return false;
*out_value = value_ != 0;
return true;
}
bool SocketOptionData::GetInt32(int32_t* out_value) const {
if (!out_value || type_ != TYPE_INT32)
return false;
*out_value = value_;
return true;
}
void SocketOptionData::SetBool(bool value) {
type_ = TYPE_BOOL;
value_ = value ? 1 : 0;
}
void SocketOptionData::SetInt32(int32_t value) {
type_ = TYPE_INT32;
value_ = value;
}
}