本文整理汇总了C++中KValueRef::SetBool方法的典型用法代码示例。如果您正苦于以下问题:C++ KValueRef::SetBool方法的具体用法?C++ KValueRef::SetBool怎么用?C++ KValueRef::SetBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KValueRef
的用法示例。
在下文中一共展示了KValueRef::SetBool方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Getter
void PropertiesBinding::Getter(const ValueList& args, KValueRef result, Type type)
{
if (args.size() > 0 && args.at(0)->IsString())
{
std::string eprefix = "PropertiesBinding::Get: ";
try
{
std::string property = args.at(0)->ToString();
if (args.size() == 1)
{
switch (type)
{
case Bool:
result->SetBool(config->getBool(property));
break;
case Double:
result->SetDouble(config->getDouble(property));
break;
case Int:
result->SetInt(config->getInt(property));
break;
case String:
result->SetString(config->getString(property).c_str());
break;
default:
break;
}
return;
}
else if (args.size() >= 2)
{
switch (type)
{
case Bool:
result->SetBool(config->getBool(property, args.at(1)->ToBool()));
break;
case Double:
result->SetDouble(config->getDouble(property, args.at(1)->ToDouble()));
break;
case Int:
result->SetInt(config->getInt(property, args.at(1)->ToInt()));
break;
case String:
result->SetString(config->getString(property, args.at(1)->ToString()).c_str());
break;
default: break;
}
return;
}
}
catch(Poco::Exception &e)
{
throw ValueException::FromString(eprefix + e.displayText());
}
}
}
示例2: HasProperty
void PropertiesBinding::HasProperty(const ValueList& args, KValueRef result)
{
result->SetBool(false);
if (args.size() >= 1 && args.at(0)->IsString())
{
std::string property = args.at(0)->ToString();
result->SetBool(config->hasProperty(property));
}
}
示例3: CanEvaluate
void PHPEvaluator::CanEvaluate(const ValueList& args, KValueRef result)
{
args.VerifyException("canEvaluate", "s");
result->SetBool(false);
string mimeType(args.GetString(0));
if (mimeType == "text/php")
{
result->SetBool(true);
}
}
示例4: IsValidRow
void ResultSetBinding::IsValidRow(const ValueList& args, KValueRef result)
{
if (rs.isNull())
{
result->SetBool(false);
}
else
{
result->SetBool(!eof);
}
}
示例5: CanPreprocess
void PHPEvaluator::CanPreprocess(const ValueList& args, KValueRef result)
{
args.VerifyException("canPreprocess", "s");
string url(args.GetString(0));
Poco::URI uri(url);
result->SetBool(false);
if (Script::HasExtension(uri.getPath().c_str(), "php"))
{
result->SetBool(true);
}
}
示例6: Close
void TCPServerConnectionBinding::Close(const ValueList& args, KValueRef result)
{
if (!closed)
{
this->closed = true;
socket.close();
result->SetBool(true);
}
else
{
result->SetBool(false);
}
}
示例7: Close
void TCPSocketBinding::Close(const ValueList& args, KValueRef result)
{
if (this->opened)
{
this->opened = false;
this->reactor.stop();
this->socket.close();
result->SetBool(true);
}
else
{
result->SetBool(false);
}
}
示例8: RemoveProperty
void Properties::RemoveProperty(const ValueList& args, KValueRef result)
{
args.VerifyException("removeProperty", "s");
result->SetBool(config->removeProperty(args.GetString(0)));
if (result) {
this->SaveConfig();
}
}
示例9: _RemoveConnectivityListener
void Network::_RemoveConnectivityListener(
const ValueList& args, KValueRef result)
{
args.VerifyException("removeConnectivityListener", "n");
int id = args.at(0)->ToInt();
std::vector<Listener>::iterator it = this->listeners.begin();
while (it != this->listeners.end())
{
if ((*it).id == id)
{
this->listeners.erase(it);
result->SetBool(true);
return;
}
it++;
}
result->SetBool(false);
}
示例10: Send
void HTTPClientBinding::Send(const ValueList& args, KValueRef result)
{
// Get send data if provided
args.VerifyException("send", "?s|o|0");
KValueRef sendData(args.GetValue(0));
// Setup output stream for data
this->outstream = new std::ostringstream(std::ios::binary | std::ios::out);
result->SetBool(this->BeginRequest(sendData));
}
示例11: Open
void HTTPClientBinding::Open(const ValueList& args, KValueRef result)
{
args.VerifyException("open", "ss?bss");
this->method = args.GetString(0);
this->url = args.GetString(1);
this->SetString("url", this->url);
// Validate the scheme
const std::string scheme = Poco::URI(url).getScheme();
if (scheme != "http" && scheme != "https")
{
logger->Error("%s scheme is not supported", scheme.c_str());
result->SetBool(false);
return;
}
if (this->method.empty())
{
this->method = Poco::Net::HTTPRequest::HTTP_GET;
}
if (args.size() >= 3)
{
this->async = args.GetBool(2);
}
if (args.size() >= 4)
{
this->basicCredentials.setUsername(args.GetString(3));
this->basicCredentials.setPassword(args.GetString(4));
}
// Get on*** handler functions
this->ondatastream = this->GetMethod("ondatastream");
this->onreadystate = this->GetMethod("onreadystatechange");
this->onsendstream = this->GetMethod("onsendstream");
this->onload = this->GetMethod("onload");
this->ChangeState(1); // opened
result->SetBool(true);
}
示例12: _IsLoaded
void ComponentBinding::_IsLoaded(const ValueList& args, KValueRef result)
{
SharedApplication app = Host::GetInstance()->GetApplication();
result->SetBool(false);
if (this->component.get() == app->runtime.get())
{
result->SetBool(true);
}
std::vector<SharedComponent>::iterator i = app->modules.begin();
while (i != app->modules.end())
{
SharedComponent c = *i++;
if (c.get() == this->component.get())
{
result->SetBool(true);
}
}
}
示例13: _HasData
void Clipboard::_HasData(const ValueList& args, KValueRef result)
{
args.VerifyException("hasData", "?s");
DataType type = UNKNOWN;
if (args.size() > 0)
{
std::string mimeType(args.GetString(0));
type = MimeTypeToDataType(mimeType);
}
result->SetBool(this->HasData(type));
}
示例14: TransformValue
void ResultSetBinding::TransformValue(size_t index, KValueRef result)
{
MetaColumn::ColumnDataType type = rs->columnType(index);
Poco::DynamicAny value = rs->value(index);
if (value.isEmpty())
{
result->SetNull();
}
else if (type == MetaColumn::FDT_STRING)
{
std::string str;
value.convert(str);
result->SetString(str);
}
else if (type == MetaColumn::FDT_BOOL)
{
bool v = false;
value.convert(v);
result->SetBool(v);
}
else if (type == MetaColumn::FDT_FLOAT || type == MetaColumn::FDT_DOUBLE)
{
float f = 0;
value.convert(f);
result->SetDouble(f);
}
else if (type == MetaColumn::FDT_BLOB || type == MetaColumn::FDT_UNKNOWN)
{
std::string str;
value.convert(str);
result->SetString(str);
}
else
{
// the rest of these are ints:
// FDT_INT8,
// FDT_UINT8,
// FDT_INT16,
// FDT_UINT16,
// FDT_INT32,
// FDT_UINT32,
// FDT_INT64,
// FDT_UINT64,
int i;
value.convert(i);
result->SetInt(i);
}
}
示例15: Receive
void HTTPClientBinding::Receive(const ValueList& args, KValueRef result)
{
args.VerifyException("receive", "m|o ?s|o|0");
// Set output handler
this->outstream = 0;
result->SetBool(false);
if (args.at(0)->IsMethod())
{
this->outputHandler = args.at(0)->ToMethod();
}
else if (args.at(0)->IsObject())
{
KObjectRef handlerObject(args.at(0)->ToObject());
KMethodRef writeMethod(handlerObject->GetMethod("write", 0));
if (writeMethod.isNull())
{
logger->Error("Unsupported object type as output handler:"
" does not have write method");
}
else
{
this->outputHandler = writeMethod;
}
}
else
{
logger->Error("Invalid type as output handler!");
return;
}
// Get the send data if provided
KValueRef sendData(args.GetValue(1));
result->SetBool(this->BeginRequest(sendData));
}