コード例 #1
0
optional<float> parseProperty(const char* name, const JSValue& value) {
    if (!value.IsNumber()) {
        Log::Warning(Event::ParseStyle, "value of '%s' must be a number, or a number function", name);
        return {};
    }

    return value.GetDouble();
}
コード例 #2
0
	bool Buffer::js_setProperty(const JSString& name, const JSValue& value)
	{
		const auto property_name = static_cast<std::string>(name);
		if (value.IsNumber() && isDataIndexProperty(property_name)) {
			data__.at(std::stoi(property_name)) = static_cast<std::uint8_t>(static_cast<std::uint32_t>(value));
			return true;
		}
		return false;
	}