本文整理汇总了C++中SharedValue::SetInt方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedValue::SetInt方法的具体用法?C++ SharedValue::SetInt怎么用?C++ SharedValue::SetInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedValue
的用法示例。
在下文中一共展示了SharedValue::SetInt方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LastIndexOf
void Blob::LastIndexOf(const ValueList& args, SharedValue result)
{
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String/lastIndexOf
args.VerifyException("Blob.lastIndexOf", "s,?i");
if (this->length <= 0)
{
result->SetInt(-1);
}
else
{
std::string target = this->buffer;
std::string needle = args.at(0)->ToString();
int start = target.size() + 1;
if (args.size() > 1)
{
start = args.GetNumber(1);
if (start < 0)
{
start = 0;
}
}
result->SetInt(target.rfind(needle, start));
}
}
示例2: FieldCount
void ResultSetBinding::FieldCount(const ValueList& args, SharedValue result)
{
if (rs.isNull())
{
result->SetInt(0);
}
else
{
result->SetInt(rs->columnCount());
}
}
示例3: Write
void Pipe::Write(const ValueList& args, SharedValue result)
{
if (closed)
{
throw ValueException::FromString("Pipe is already closed");
}
if (!args.at(0)->IsString())
{
throw ValueException::FromString("Can only write string data");
}
Poco::PipeOutputStream *os = dynamic_cast<Poco::PipeOutputStream*>(pipe);
if (os==NULL)
{
throw ValueException::FromString("Stream is not writeable");
}
const char *data = args.at(0)->ToString();
int len = (int)strlen(data);
try
{
os->write(data,len);
result->SetInt(len);
}
catch (Poco::WriteFileException &e)
{
throw ValueException::FromString(e.what());
}
}
示例4: AddConnectivityListener
void NetworkBinding::AddConnectivityListener(const ValueList& args, SharedValue result)
{
args.VerifyException("addConnectivityListener", "m");
SharedKMethod target = args.at(0)->ToMethod();
Listener listener = Listener();
listener.id = this->next_listener_id++;
listener.callback = target;
this->listeners.push_back(listener);
result->SetInt(listener.id);
}
示例5: _AddEventListener
void UserWindow::_AddEventListener(const ValueList& args, SharedValue result)
{
args.VerifyException("addEventListener", "m");
SharedKMethod target = args.at(0)->ToMethod();
Listener listener = Listener();
listener.id = this->next_listener_id++;
listener.callback = target;
this->listeners.push_back(listener);
result->SetInt(listener.id);
}
示例6: 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);
}
}
示例7: 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
{
std::string buf = args.at(0)->ToString();
int count = this->socket.sendBytes(buf.c_str(),buf.length());
result->SetInt(count);
}
catch(Poco::Exception &e)
{
throw ValueException::FromString(eprefix + e.displayText());
}
}
示例8: _GetLength
void Menu::_GetLength(const ValueList& args, SharedValue result)
{
result->SetInt(this->children.size());
}
示例9: GetContentLength
void HttpServerRequest::GetContentLength(const ValueList& args, SharedValue result)
{
result->SetInt(request.getContentLength());
}
示例10: Length
void Blob::Length(const ValueList& args, SharedValue result)
{
result->SetInt(length);
}
示例11: _GetType
void ComponentBinding::_GetType(const ValueList& args, SharedValue result)
{
result->SetInt((int) this->component->type);
}