本文整理汇总了C++中SharedValue::SetBool方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedValue::SetBool方法的具体用法?C++ SharedValue::SetBool怎么用?C++ SharedValue::SetBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedValue
的用法示例。
在下文中一共展示了SharedValue::SetBool方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetProxy
void NetworkBinding::SetProxy(const ValueList& args, SharedValue result)
{
std::string hostname = args.at(0)->ToString();
std::string port = args.at(1)->ToString();
std::string username = args.at(2)->ToString();
std::string password = args.at(3)->ToString();
if(proxy)
{
delete proxy;
proxy = NULL;
}
#if defined(OS_WIN32)
std::string http_proxy = "http://";
http_proxy += username + ":" + password + "@";
http_proxy += hostname + ":" + port;
int i = ::_putenv_s("HTTP_PROXY", http_proxy.c_str());
if(i != 0)
{
result->SetBool(false);
}
#endif
proxy = new ti::Proxy(hostname, port, username,password);
result->SetBool(true);
}
示例2: IsValidRow
void ResultSetBinding::IsValidRow(const ValueList& args, SharedValue result)
{
if (rs.isNull())
{
result->SetBool(false);
}
else
{
result->SetBool(!eof);
}
}
示例3: Ready
void FileStream::Ready(const ValueList& args, SharedValue result)
{
Poco::FileInputStream* fis = dynamic_cast<Poco::FileInputStream*>(this->stream);
if(!fis)
{
result->SetBool(false);
}
else
{
result->SetBool(fis->eof()==false);
}
}
示例4: Write
void FileStream::Write(const ValueList& args, SharedValue result)
{
char *text = NULL;
int size = 0;
if (args.at(0)->IsObject())
{
SharedKObject b = args.at(0)->ToObject();
SharedPtr<Blob> blob = b.cast<Blob>();
if (!blob.isNull())
{
text = (char*)blob->Get();
size = (int)blob->Length();
}
}
else if (args.at(0)->IsString())
{
text = (char*)args.at(0)->ToString();
}
else if (args.at(0)->IsInt())
{
std::stringstream ostr;
ostr << args.at(0)->ToInt();
text = (char*)ostr.str().c_str();
size = ostr.str().length();
}
else if (args.at(0)->IsDouble())
{
std::stringstream ostr;
ostr << args.at(0)->ToDouble();
text = (char*)ostr.str().c_str();
size = ostr.str().length();
}
if (size==0)
{
size = strlen(text);
}
if (text == NULL)
{
result->SetBool(false);
return;
}
if (size <= 0)
{
result->SetBool(false);
return;
}
Write(text,size);
result->SetBool(true);
}
示例5: Close
void TCPSocketBinding::Close(const ValueList& args, SharedValue result)
{
if (this->opened)
{
this->opened = false;
this->reactor.stop();
this->socket.close();
result->SetBool(true);
}
else
{
result->SetBool(false);
}
}
示例6: Connect
void TCPSocketBinding::Connect(const ValueList& args, SharedValue result)
{
std::string eprefix = "Connect exception: ";
if (this->opened)
{
throw ValueException::FromString(eprefix + "Socket is already open");
}
try
{
SocketAddress a(this->host.c_str(),this->port);
this->socket.connectNB(a);
this->thread.start(this->reactor);
this->opened = true;
result->SetBool(true);
}
catch(Poco::IOException &e)
{
throw ValueException::FromString(eprefix + e.displayText());
}
catch(std::exception &e)
{
throw ValueException::FromString(eprefix + e.what());
}
catch(...)
{
throw ValueException::FromString(eprefix + "Unknown exception");
}
}
示例7: OpenURL
void DesktopBinding::OpenURL(const ValueList& args, SharedValue result)
{
if (args.size()!=1)
{
throw ValueException::FromString("openURL takes 1 parameter");
}
std::string url = args.at(0)->ToString();
result->SetBool(TI_DESKTOP::OpenURL(url));
}
示例8: _IsLoaded
void ComponentBinding::_IsLoaded(const ValueList& args, SharedValue 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);
}
}
}
示例9: RemoveConnectivityListener
void NetworkBinding::RemoveConnectivityListener(
const ValueList& args,
SharedValue 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: Open
void FileStream::Open(const ValueList& args, SharedValue result)
{
FileStreamMode mode = MODE_READ;
bool binary = false;
bool append = false;
if (args.size()>=1) mode = (FileStreamMode)args.at(0)->ToInt();
if (args.size()>=2) binary = args.at(1)->ToBool();
if (args.size()>=3) append = args.at(2)->ToBool();
bool opened = this->Open(mode,binary,append);
result->SetBool(opened);
}
示例11: _RemoveEventListener
void UserWindow::_RemoveEventListener(const ValueList& args, SharedValue result)
{
if (args.size() != 1 || !args.at(0)->IsNumber())
{
throw ValueException::FromString("invalid argument");
}
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);
}
示例12: TransformValue
void ResultSetBinding::TransformValue(size_t index, SharedValue 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);
}
}
示例13: Write
void TCPSocketBinding::Write(const ValueList& args, SharedValue result)
{
std::string eprefix = "TCPSocketBinding::Write: ";
if (!this->opened)
{
throw ValueException::FromString(eprefix + "Socket is not open");
}
try
{
Poco::Mutex::ScopedLock lock(bufferMutex);
buffer += args.at(0)->ToString();
result->SetBool(true);
}
catch(Poco::Exception &e)
{
throw ValueException::FromString(eprefix + e.displayText());
}
}
示例14: _IsSeparator
void MenuItem::_IsSeparator(const ValueList& args, SharedValue result)
{
result->SetBool(this->type == SEPARATOR);
}
示例15: IsOpen
void FileStream::IsOpen(const ValueList& args, SharedValue result)
{
Poco::FileInputStream* fis = dynamic_cast<Poco::FileInputStream*>(this->stream);
result->SetBool(fis!=NULL);
}