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


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

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

示例2: IsValidRow

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

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

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

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

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

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

示例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);
			}
		}
	}
开发者ID:jonnymind,项目名称:kroll,代码行数:20,代码来源:component_binding.cpp

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

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

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

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

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

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

示例14: _IsSeparator

	void MenuItem::_IsSeparator(const ValueList& args, SharedValue result)
	{
		result->SetBool(this->type == SEPARATOR);
	}
开发者ID:leongersing,项目名称:titanium_desktop,代码行数:4,代码来源:menu_item.cpp

示例15: IsOpen

	void FileStream::IsOpen(const ValueList& args, SharedValue result)
	{
		Poco::FileInputStream* fis = dynamic_cast<Poco::FileInputStream*>(this->stream);
		result->SetBool(fis!=NULL);
	}
开发者ID:cfs051059,项目名称:titanium,代码行数:5,代码来源:file_stream.cpp


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