• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ValueList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ValueList的典型用法代码示例。如果您正苦于以下问题:C++ ValueList类的具体用法?C++ ValueList怎么用?C++ ValueList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ValueList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: AppURLToPath

	void AppBinding::AppURLToPath(const ValueList& args, SharedValue result)
	{
		//FIXME - use FileUtils for this... so we can a common implementation
		
		result->SetString("");

		if (args.size() < 0 || !args.at(0)->IsString())
			return;

//FIXME: take into consider the appid which is in the host position of the URL
		std::string url = std::string(args.at(0)->ToString());
		if (url.find("app://") == 0)
		{
			url = url.substr(6, url.length() - 6);
		}
		std::string path = Poco::Environment::get("KR_HOME", "");

		result->SetString(std::string(path + KR_PATH_SEP + kAppURLPrefix + KR_PATH_SEP + url).c_str());
	}
开发者ID:alicciabraaten,项目名称:titanium,代码行数:19,代码来源:app_binding.cpp


示例2: capture

void SDLIntegration::capture(ValueList& axisValues, ValueList& buttonValues) const
{
    if (_joystick)
    {
        SDL_JoystickUpdate();
        
        axisValues.resize(_numAxes);
        for(int ai=0; ai<_numAxes; ++ai)
        {
            axisValues[ai] = SDL_JoystickGetAxis(_joystick, ai);
        }

        buttonValues.resize(_numButtons);
        for(int bi=0; bi<_numButtons; ++bi)
        {
            buttonValues[bi] = SDL_JoystickGetButton(_joystick, bi);
        }
    }
}
开发者ID:yueying,项目名称:osg,代码行数:19,代码来源:SDLIntegration.cpp


示例3: StdIn

	void AppBinding::StdIn(const ValueList& args, KValueRef result)
	{
		args.VerifyException("stdin", "?ss");
		std::string input;
		char delimiter = '\n';

		if (args.size() >= 1)
		{
			std::cout << args.GetString(0);
		}

		if (args.size() >= 2)
		{
			delimiter = args.GetString(1).at(0);
		}

		getline(std::cin, input, delimiter);
		result->SetString(input);
	}
开发者ID:Adimpression,项目名称:TideSDK,代码行数:19,代码来源:app_binding.cpp


示例4: if

	void TCPSocketBinding::OnRead(const Poco::AutoPtr<ReadableNotification>& n)
	{
		std::string eprefix = "TCPSocketBinding::OnRead: ";
		try
		{
			// Always read bytes, so that the tubes get cleared.
			char data[BUFFER_SIZE + 1];
			int size = socket.receiveBytes(&data, BUFFER_SIZE);

			bool read_complete = (size <= 0);
			if (read_complete && !this->onReadComplete.isNull())
			{
				ValueList args;
				ti_host->InvokeMethodOnMainThread(this->onReadComplete, args, false);
			}
			else if (!read_complete && !this->onRead.isNull())
			{
				data[size] = '\0';

				ValueList args;
				args.push_back(Value::NewString(data));
				ti_host->InvokeMethodOnMainThread(this->onRead, args, false);
			}
		}
		catch(ValueException& e)
		{
			std::cerr << eprefix << *(e.GetValue()->DisplayString()) << std::endl;
			ValueList args(Value::NewString(e.ToString()));
			ti_host->InvokeMethodOnMainThread(this->onError, args, false);
		}
		catch(Poco::Exception &e)
		{
			std::cerr << eprefix << e.displayText() << std::endl;
			ValueList args(Value::NewString(e.displayText()));
			ti_host->InvokeMethodOnMainThread(this->onError, args, false);
		}
		catch(...)
		{
			std::cerr << eprefix << "Unknown exception" << std::endl;
			ValueList args(Value::NewString("Unknown exception"));
			ti_host->InvokeMethodOnMainThread(this->onError, args, false);
		}
	}
开发者ID:jonnymind,项目名称:titanium_desktop,代码行数:43,代码来源:tcp_socket_binding.cpp


示例5: FieldByName

 void ResultSetBinding::FieldByName(const ValueList& args, KValueRef result)
 {
     result->SetNull();
     if (!rs.isNull())
     {
         args.VerifyException("fieldByName", "s");
         std::string name = args.at(0)->ToString();
         size_t count = rs->columnCount();
         for (size_t i = 0; i<count; i++)
         {
             const std::string &str = rs->columnName(i);
             if (str == name)
             {
                 TransformValue(i,result);
                 break;
             }
         }
     }
 }
开发者ID:Adimpression,项目名称:TideSDK,代码行数:19,代码来源:resultset_binding.cpp


示例6: Substr

	void Blob::Substr(const ValueList& args, SharedValue result)
	{
		// This method now follows the spec located at:
		// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String/substr
		args.VerifyException("Blob.substr", "i,?i");
		std::string target = "";
		if (this->length > 0)
		{
			target = this->buffer;
		}

		int start = args.GetInt(0);
		if (start > 0 && start >= this->length)
		{
			result->SetString("");
			return;
		}

		if (start < 0 && (-1*start) > this->length)
		{
			start = 0;
		}
		else if (start < 0)
		{
			start = this->length + start;
		}

		int length = this->length - start;
		if (args.size() > 1)
		{
			length = args.GetInt(1);
		}

		if (length <= 0)
		{
			result->SetString("");
			return;
		}

		std::string r = target.substr(start, length);
		result->SetString(r);
	}
开发者ID:jonnymind,项目名称:kroll,代码行数:42,代码来源:blob.cpp


示例7: operator

void  Compiler::operator()( ValueListMore &  values,
                            boost::optional< Value > &  value_first,
                            ValueList &  values_middle,
                            boost::optional< Value > &  value_last ) const
{
  if ( value_first )
  {
    Value &  value = *value_first;
    values.data_.emplace_back( std::move( value ) );
    values.has_front_any_ = false;
  }
  std::move( values_middle.begin(), values_middle.end(),
             std::back_inserter( values.data_ ) );
  if ( value_last )
  {
    Value &  value = *value_last;
    values.data_.emplace_back( std::move( value ) );
    values.has_back_any_ = false;
  }
}
开发者ID:lyokha,项目名称:ldapsf,代码行数:20,代码来源:ldap_sf_grammar.cpp


示例8: PostMessage

	void Worker::PostMessage(const ValueList& args, SharedValue result)
	{
		// store the message in our queue (waiting for the lock) and
		// then signal the thread to wake up to process the message
		SharedValue message = args.at(0);
		{
			Poco::ScopedLock<Poco::Mutex> lock(mutex);
			this->messages.push_back(message);
		}
		this->condition.signal();
	}
开发者ID:leongersing,项目名称:titanium_desktop,代码行数:11,代码来源:worker.cpp


示例9: AddConnectivityListener

void NetworkBinding::AddConnectivityListener(const ValueList& args, SharedValue result)
{
    ArgUtils::VerifyArgsException("addConnectivityListener", args, "m");
    SharedBoundMethod 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:rlwesq,项目名称:titanium,代码行数:11,代码来源:network_binding.cpp


示例10: _LastIndexOf

	void Bytes::_LastIndexOf(const ValueList& args, KValueRef result)
	{
		// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String/lastIndexOf
		args.VerifyException("Bytes.lastIndexOf", "s,?i");

		std::string target(this->AsString());
		int start = args.GetInt(1, target.length() + 1);
		if (start < 0) start = 0;
		size_t pos = target.rfind(args.GetString(0), start);

		if (pos == std::string::npos)
		{
			// No matches found
			result->SetInt(-1);
		}
		else
		{
			result->SetInt(pos);
		}
	}
开发者ID:OnlyChristopher,项目名称:TideSDK,代码行数:20,代码来源:bytes.cpp


示例11: 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


示例12: list_flag_value_complete

// Convert a DATAList flag into a long integer value
long list_flag_value_complete( DATAExpression *flag, struct flag_type *flag_table ) {
  ValueList *list = flag->eval().asList();
  char flagString[MAX_STRING_LENGTH];
  flagString[0] = '\0';

  if ( list->size == 0 || ( list->size == 1 && !str_cmp( "none", list->elems[0].asStr() ) ) )
    return 0;
  
  // Convert the list into a string
  for ( int i = 0; i < list->size; i++ ) {
    strcat( flagString, list->elems[i].asStr() );
    if ( i < list->size-1 )
      strcat( flagString, " " );
  }

  list->explicit_free();

  // Send the string to flag_value
  return flag_value_complete( flag_table, flagString );
}
开发者ID:SinaC,项目名称:OldMud,代码行数:21,代码来源:dbdata.C


示例13: ImportScripts

	void WorkerContext::ImportScripts(const ValueList &args, SharedValue result)
	{
		Logger *logger = Logger::Get("WorkerContext");
		
		SharedKMethod appURLToPath = host->GetGlobalObject()->GetNS("App.appURLToPath")->ToMethod();
		AutoPtr<Worker> _worker = worker.cast<Worker>();
		JSGlobalContextRef context = KJSUtil::GetGlobalContext(_worker->GetGlobalObject());
		
		for (size_t c = 0; c < args.size(); c++)
		{
			// first convert the path to a full URL file path
			ValueList a;
			a.push_back(args.at(c));
			SharedValue result = appURLToPath->Call(a);
			const char *path = result->ToString();

			logger->Debug("attempting to import worker script = %s",path);
			KJSUtil::EvaluateFile(context, (char*)path);
		}
	}
开发者ID:leongersing,项目名称:titanium_desktop,代码行数:20,代码来源:worker_context.cpp


示例14: _SetSubmenu

void MenuItem::_SetSubmenu(const ValueList& args, KValueRef result)
{
    args.VerifyException("setSubmenu", "o|0");
    AutoPtr<Menu> newSubmenu = NULL;

    if (args.at(0)->IsObject())
    {
        KObjectRef o = args.at(0)->ToObject();
        o = KObject::Unwrap(o);
        newSubmenu = o.cast<Menu>();
    }

    if (!newSubmenu.isNull() && newSubmenu->ContainsItem(this))
    {
        throw ValueException::FromString("Tried to construct a recursive menu");
    }

    this->submenu = newSubmenu;
    this->SetSubmenuImpl(newSubmenu);
}
开发者ID:Defachko,项目名称:titanium_desktop,代码行数:20,代码来源:MenuItem.cpp


示例15: 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


示例16: addr

	void NetworkBinding::GetHostByAddress(const ValueList& args, SharedValue result)
	{
		if (args.at(0)->IsObject())
		{
			SharedKObject obj = args.at(0)->ToObject();
			SharedPtr<IPAddressBinding> b = obj.cast<IPAddressBinding>();
			if (!b.isNull())
			{
				// in this case, they've passed us an IPAddressBinding
				// object, which we can just retrieve the ipaddress
				// instance and resolving using it
				IPAddress addr(b->GetAddress()->toString());
				SharedPtr<HostBinding> binding = new HostBinding(addr);
				if (binding->IsInvalid())
				{
					throw ValueException::FromString("Could not resolve address");
				}
				result->SetObject(binding);
				return;
			}
			else
			{
				SharedValue bo = obj->Get("toString");
				if (bo->IsMethod())
				{
					SharedKMethod m = bo->ToMethod();
					ValueList args;
					SharedValue tostr = m->Call(args);
					this->_GetByHost(tostr->ToString(),result);
					return;
				}
				throw ValueException::FromString("Unknown object passed");
			}
		}
		else if (args.at(0)->IsString())
		{
			// in this case, they just passed in a string so resolve as
			// normal
			this->_GetByHost(args.at(0)->ToString(),result);
		}
	}
开发者ID:CJ580K,项目名称:titanium,代码行数:41,代码来源:network_binding.cpp


示例17: Read

	void Pipe::Read(const ValueList& args, SharedValue result)
	{
		if (closed)
		{
			throw ValueException::FromString("Pipe is already closed");
		}
		Poco::PipeInputStream *is = dynamic_cast<Poco::PipeInputStream*>(pipe);
		if (is==NULL)
		{
			throw ValueException::FromString("Stream is not readable");
		}
		char *buf = NULL;
		try
		{
			int size = 1024;
			// allow the size of the returned buffer to be 
			// set by the caller - defaults to 1024 if not specified
			if (args.size()>0 && args.at(0)->IsInt())
			{
				size = args.at(0)->ToInt();
			}
			buf = new char[size];
			is->read(buf,size);
			int count = is->gcount();
			if (count <=0)
			{
				result->SetNull();
			}
			else
			{
				buf[count] = '\0';
				result->SetString(buf);
			}
			delete [] buf;
		}
		catch (Poco::ReadFileException &e)
		{
			if (buf) delete[] buf;
			throw ValueException::FromString(e.what());
		}
	}
开发者ID:pjunior,项目名称:titanium,代码行数:41,代码来源:pipe.cpp


示例18: dealias

Value * CodeGenerator::genIndirectCall(const tart::IndirectCallExpr* in) {
  const Expr * fn = in->function();
  const Type * fnType = dealias(fn->type().unqualified());
  bool saveIntermediateStackRoots = true;

  Value * fnValue;
  ValueList args;
  size_t savedRootCount = rootStackSize();

  if (const FunctionType * ft = dyn_cast<FunctionType>(fnType)) {
    fnValue = genArgExpr(fn, saveIntermediateStackRoots);

    if (fnValue != NULL) {
      if (ft->isStatic()) {
        //fnValue = builder_.CreateLoad(fnValue);
      } else {
        //DFAIL("Implement");
      }
    }
  } else {
    diag.info(in) << in->function() << " - " << in->function()->exprType();
    TFAIL << "Invalid function type: " << in->function() << " - " << in->function()->exprType();
  }

  const ExprList & inArgs = in->args();
  for (ExprList::const_iterator it = inArgs.begin(); it != inArgs.end(); ++it) {
    Expr * arg = *it;
    Value * argVal = genArgExpr(arg, saveIntermediateStackRoots);
    if (argVal == NULL) {
      return NULL;
    }

    args.push_back(argVal);
  }

  llvm::Value * result = genCallInstr(fnValue, args, "indirect");

  // Clear out all the temporary roots
  popRootStack(savedRootCount);
  return result;
}
开发者ID:afrog33k,项目名称:tart,代码行数:41,代码来源:CodeGenCall.cpp


示例19: PostMessage

	void WorkerContext::PostMessage(const ValueList &args, KValueRef result)
	{
		Logger *logger = Logger::Get("WorkerContext");
		KValueRef message(args.at(0));

		logger->Debug("PostMessage called with %s", message->DisplayString()->c_str());
		{
			Poco::ScopedLock<Poco::Mutex> lock(mutex);
			messages.push_back(message);
		}
		SendQueuedMessages();
	}
开发者ID:JamesHayton,项目名称:titanium_desktop,代码行数:12,代码来源:worker_context.cpp


示例20: getUseChain

StructuredModuleEditor::ValueList StructuredModuleEditor::getUseChain(
		Value *V) {
	ValueList Vals;

	for (Value::use_iterator UI = V->use_begin(), UE = V->use_end(); UI != UE;
			++UI) {
		Value *ValueToPush;

		Instruction *Inst = dyn_cast<Instruction>(*UI);
		if (Inst && Inst->getOpcode() == Instruction::Store) {
			StoreInst *StInst = dyn_cast<StoreInst>(Inst);
			Value *Storee = StInst->getPointerOperand();
			ValueToPush = Storee;
		} else
			ValueToPush = *UI;

		Vals.push_back(ValueToPush);
	}

	return Vals;
}
开发者ID:32bitmicro,项目名称:fracture,代码行数:21,代码来源:StructuredModuleEditor.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ValueLocation类代码示例发布时间:2022-05-31
下一篇:
C++ ValueInt类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap