当前位置: 首页>>代码示例>>C++>>正文


C++ SharedValue::SetInt方法代码示例

本文整理汇总了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));
		}
	}
开发者ID:jonnymind,项目名称:kroll,代码行数:25,代码来源:blob.cpp

示例2: FieldCount

	void ResultSetBinding::FieldCount(const ValueList& args, SharedValue result)
	{
		if (rs.isNull())
		{
			result->SetInt(0);
		}
		else
		{
			result->SetInt(rs->columnCount());
		}
	}
开发者ID:CJ580K,项目名称:titanium,代码行数:11,代码来源:resultset_binding.cpp

示例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());
		}
	}
开发者ID:pjunior,项目名称:titanium,代码行数:27,代码来源:pipe.cpp

示例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);
	}
开发者ID:CJ580K,项目名称:titanium,代码行数:11,代码来源:network_binding.cpp

示例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);
}
开发者ID:pctj101,项目名称:titanium,代码行数:12,代码来源:user_window.cpp

示例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);
		}
	}
开发者ID:CJ580K,项目名称:titanium,代码行数:49,代码来源:resultset_binding.cpp

示例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());
		}

	}
开发者ID:peggielich,项目名称:titanium,代码行数:20,代码来源:tcp_socket_binding.cpp

示例8: _GetLength

	void Menu::_GetLength(const ValueList& args, SharedValue result)
	{
		result->SetInt(this->children.size());
	}
开发者ID:jonnymind,项目名称:titanium_desktop,代码行数:4,代码来源:menu.cpp

示例9: GetContentLength

	void HttpServerRequest::GetContentLength(const ValueList& args, SharedValue result)
	{
		result->SetInt(request.getContentLength());
	}
开发者ID:alicciabraaten,项目名称:titanium,代码行数:4,代码来源:http_server_request.cpp

示例10: Length

	void Blob::Length(const ValueList& args, SharedValue result)
	{
		result->SetInt(length);
	}
开发者ID:jonnymind,项目名称:kroll,代码行数:4,代码来源:blob.cpp

示例11: _GetType

	void ComponentBinding::_GetType(const ValueList& args, SharedValue result)
	{
		result->SetInt((int) this->component->type);
	}
开发者ID:jonnymind,项目名称:kroll,代码行数:4,代码来源:component_binding.cpp


注:本文中的SharedValue::SetInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。