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


C++ CopyFrom函数代码示例

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


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

示例1: parser

nsresult
SVGTransformList::SetValueFromString(const nsAString& aValue)
{
    SVGTransformListParser parser(aValue);
    if (!parser.Parse()) {
        // there was a parse error.
        return NS_ERROR_DOM_SYNTAX_ERR;
    }

    return CopyFrom(parser.GetTransformList());
}
开发者ID:h4writer,项目名称:gecko-dev,代码行数:11,代码来源:SVGTransformList.cpp

示例2: tokenizer

nsresult SVGPointList::SetValueFromString(const nsAString& aValue) {
  // The spec says that the list is parsed and accepted up to the first error
  // encountered, so we must call CopyFrom even if an error occurs. We still
  // want to throw any error code from setAttribute if there's a problem
  // though, so we must take care to return any error code.

  nsresult rv = NS_OK;

  SVGPointList temp;

  nsCharSeparatedTokenizerTemplate<nsContentUtils::IsHTMLWhitespace> tokenizer(
      aValue, ',', nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL);

  while (tokenizer.hasMoreTokens()) {
    const nsAString& token = tokenizer.nextToken();

    RangedPtr<const char16_t> iter = SVGContentUtils::GetStartRangedPtr(token);
    const RangedPtr<const char16_t> end =
        SVGContentUtils::GetEndRangedPtr(token);

    float x;
    if (!SVGContentUtils::ParseNumber(iter, end, x)) {
      rv = NS_ERROR_DOM_SYNTAX_ERR;
      break;
    }

    float y;
    if (iter == end) {
      if (!tokenizer.hasMoreTokens() ||
          !SVGContentUtils::ParseNumber(tokenizer.nextToken(), y)) {
        rv = NS_ERROR_DOM_SYNTAX_ERR;
        break;
      }
    } else {
      // It's possible for the token to be 10-30 which has
      // no separator but needs to be parsed as 10, -30
      const nsAString& leftOver = Substring(iter.get(), end.get());
      if (leftOver[0] != '-' || !SVGContentUtils::ParseNumber(leftOver, y)) {
        rv = NS_ERROR_DOM_SYNTAX_ERR;
        break;
      }
    }
    temp.AppendItem(SVGPoint(x, y));
  }
  if (tokenizer.separatorAfterCurrentToken()) {
    rv = NS_ERROR_DOM_SYNTAX_ERR;  // trailing comma
  }
  nsresult rv2 = CopyFrom(temp);
  if (NS_FAILED(rv2)) {
    return rv2;  // prioritize OOM error code over syntax errors
  }
  return rv;
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:53,代码来源:SVGPointList.cpp

示例3: ActorTransform

	WidgetLayout::WidgetLayout(const WidgetLayout& other):
		ActorTransform(mnew Data()), anchorMin(this), anchorMax(this), offsetMin(this), offsetMax(this),
		anchorLeft(this), anchorRight(this), anchorBottom(this), anchorTop(this), offsetLeft(this),
		offsetBottom(this), offsetTop(this), minSize(this), minWidth(this), minHeight(this),
		maxSize(this), maxWidth(this), maxHeight(this), weight(this), widthWeight(this),
		heigthWeight(this), offsetRight(this)
	{
		mData = (Data*)ActorTransform::mData;

		CopyFrom(other);
		mCheckMinMaxFunc = other.mCheckMinMaxFunc;
	}
开发者ID:zenkovich,项目名称:o2,代码行数:12,代码来源:WidgetLayout.cpp

示例4: _distpach_remote_service_cmsg

static inline void _distpach_remote_service_cmsg(RpcServerImpl * impl, int fd, const char * buff, int ibuff){
    dcrpc_msg_t rpc_msg;
    if (!rpc_msg.Unpack(buff, ibuff)){
        GLOG_ERR("unpack rpc msg error ! buff length:%d", ibuff);
        return;
    }
    GLOG_TRA("recv [%d] [%s] [%s]", fd, rpc_msg.path().c_str() , rpc_msg.ShortDebugString().c_str());
    auto it = impl->dispatcher.find(rpc_msg.path());
    if (it == impl->dispatcher.end()){//not found
        rpc_msg.clear_request();
        rpc_msg.set_status(RpcMsg_StatusCode_RPC_STATUS_NOT_EXIST);
    }
    else {
        rpc_msg.set_status(RpcMsg_StatusCode_RPC_STATUS_SUCCESS);        
        RpcValues args((const RpcValuesImpl &)(rpc_msg.request().args()));
		RpcService * service = it->second;
		uint64_t transac_cookie = rpc_msg.cookie().transaction();
		if (service->isasync()){
			if (transac_cookie == 0){
				GLOG_ERR("transaction is 0 but in a async call ... %s", rpc_msg.Debug());
				return;
			}
			else {
				async_rpc_yield_call(impl, transac_cookie, fd, rpc_msg);
				int ret = service->yield(transac_cookie,
					args, *rpc_msg.mutable_response()->mutable_error(), fd);
				rpc_msg.mutable_response()->set_status(ret);
				if (ret == 0){
					return;
				}
				else {
					rpc_msg.clear_request();
				}
			}
		}
		else {
			RpcValues result;
			rpc_msg.mutable_response()->set_status(
				service->call(result, args,
                *rpc_msg.mutable_response()->mutable_error(), fd));
			auto msg_result = rpc_msg.mutable_response()->mutable_result();
			msg_result->CopyFrom(*(decltype(msg_result))result.data());
			rpc_msg.clear_request();
		}
    }
    if (rpc_msg.cookie().transaction() > 0){
        _rpc_send_msg(impl, fd, rpc_msg);
    }
}
开发者ID:jj4jj,项目名称:dcpots,代码行数:49,代码来源:dcsrpc.cpp

示例5: open_handler

//handling open request
void open_handler(Msg *msg, int sender_pid)
{
    //msg->ptr1 is pathname, msg->num1 is length of pathname, msg->num2 is proc_inode
    char pathname[MAXPATHNAMELEN];
    CopyFrom(sender_pid,pathname,msg->ptr1,msg->num1+1);
    int open_inum = path_to_inum(pathname,msg->num1,msg->num2,0);
    if (open_inum<=0) {
        msg->type = ERROR;
    }
    else {
        msg->num1 = open_inum;
        inode_cache *n = read_inode(open_inum);
        msg->num2 = n->data.reuse;
    }
}
开发者ID:liujun77,项目名称:Yalnix-File-System,代码行数:16,代码来源:yfs.c

示例6: chdir_handler

//handling chdir request
void chdir_handler(Msg *msg, int sender_pid)
{
    char pathname[MAXPATHNAMELEN];
    CopyFrom(sender_pid,pathname,msg->ptr1,msg->num1+1);
    int target_inum = path_to_inum(pathname,msg->num1,msg->num2,0);
    if (target_inum<=0) {
        perror("illegal destination directory!");
        msg->type = ERROR;
        return;
    }
    inode_cache *n = read_inode(target_inum);
    if (n->data.type!=INODE_DIRECTORY) {
        perror("trying to change current directory to a non-directory place");
        msg->type = ERROR;
        return;
    }
    msg->num1 = target_inum;
}
开发者ID:liujun77,项目名称:Yalnix-File-System,代码行数:19,代码来源:yfs.c

示例7: CopyFrom

CObjectImageArray &CObjectImageArray::operator= (const CObjectImageArray &Source)

//	Operator =

	{
	if (m_pRotationOffset)
		delete [] m_pRotationOffset;

	if (m_pGlowImages)
		delete [] m_pGlowImages;

	if (m_pScaledImages)
		delete [] m_pScaledImages;

	CopyFrom(Source);

	return *this;
	}
开发者ID:alanhorizon,项目名称:Transport,代码行数:18,代码来源:CObjectImageArray.cpp

示例8: serializeAmount

 protocol::AccountAssetResponse
 PbQueryResponseFactory::serializeAccountAssetResponse(
     const model::AccountAssetResponse &accountAssetResponse) const {
   protocol::AccountAssetResponse pb_response;
   auto pb_account_asset = pb_response.mutable_account_assets();
   for (auto &asset: accountAssetResponse.acct_assets) {
     auto pb_asset = new iroha::protocol::AccountAsset();
     pb_asset->set_asset_id(
         asset.asset_id);
     pb_asset->set_account_id(
         asset.account_id);
     auto pb_amount = pb_asset->mutable_balance();
     pb_amount->CopyFrom(
         serializeAmount(asset.balance));
     pb_account_asset->AddAllocated(pb_asset);
   }
   return pb_response;
 }
开发者ID:kevinmcmahon,项目名称:iroha,代码行数:18,代码来源:pb_query_response_factory.cpp

示例9: async_rpc_get_context

int	   RpcServer::reply(RpcService *, uint64_t cookie, const RpcValues & result, int ret, const char * error){
	RpcServiceCallContext * ctx = async_rpc_get_context(impl, cookie);
	if (ctx){
		dcrpc_msg_t & rpc_msg = ctx->msg;
		rpc_msg.mutable_response()->set_status(ret);
		if (error){
			rpc_msg.mutable_response()->set_error(error);
		}
		auto msg_result = rpc_msg.mutable_response()->mutable_result();
		msg_result->CopyFrom(*(decltype(msg_result))result.data());
		rpc_msg.clear_request();
		ret = _rpc_send_msg(impl, ctx->fd, rpc_msg);
		async_rpc_resume_call(impl, cookie);
		return ret;
	}
	else {
		return -1;
	}
}
开发者ID:jj4jj,项目名称:dcpots,代码行数:19,代码来源:dcsrpc.cpp

示例10: tokenizer

nsresult SVGLengthList::SetValueFromString(const nsAString& aValue) {
  SVGLengthList temp;

  nsCharSeparatedTokenizerTemplate<nsContentUtils::IsHTMLWhitespace> tokenizer(
      aValue, ',', nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL);

  while (tokenizer.hasMoreTokens()) {
    SVGLength length;
    if (!length.SetValueFromString(tokenizer.nextToken())) {
      return NS_ERROR_DOM_SYNTAX_ERR;
    }
    if (!temp.AppendItem(length)) {
      return NS_ERROR_OUT_OF_MEMORY;
    }
  }
  if (tokenizer.separatorAfterCurrentToken()) {
    return NS_ERROR_DOM_SYNTAX_ERR;  // trailing comma
  }
  return CopyFrom(temp);
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:20,代码来源:SVGLengthList.cpp

示例11: WriteNamespace

WString WriteNamespace(List<WString>& currentNamespaces, List<WString>& namespaces, StreamWriter& writer)
{
	vint common = 0;
	for (vint i = 0; i < currentNamespaces.Count() && i < namespaces.Count(); i++)
	{
		if (currentNamespaces[i] == namespaces[i])
		{
			common++;
		}
		else
		{
			break;
		}
	}

	for (vint i = 0; i < currentNamespaces.Count() - common; i++)
	{
		WString prefix;
		for (vint j = 0; j < currentNamespaces.Count() - i - 1; j++)
		{
			prefix += L"\t";
		}
		writer.WriteLine(prefix + L"}");
	}

	WString prefix;
	FOREACH_INDEXER(WString, ns, i, namespaces)
	{
		if (i >= common)
		{
			writer.WriteLine(prefix + L"namespace " + ns);
			writer.WriteLine(prefix + L"{");
		}
		prefix += L"\t";
	}

	CopyFrom(currentNamespaces, namespaces);
	return prefix;
}
开发者ID:2ephyr,项目名称:GacUI,代码行数:39,代码来源:CodegenUtility.cpp

示例12: tokenizer

nsresult
SVGNumberList::SetValueFromString(const nsAString& aValue)
{
  SVGNumberList temp;

  nsCharSeparatedTokenizerTemplate<IsSVGWhitespace>
    tokenizer(aValue, ',', nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL);

  while (tokenizer.hasMoreTokens()) {
    float num;
    if (!SVGContentUtils::ParseNumber(tokenizer.nextToken(), num)) {
      return NS_ERROR_DOM_SYNTAX_ERR;
    }
    if (!temp.AppendItem(num)) {
      return NS_ERROR_OUT_OF_MEMORY;
    }
  }
  if (tokenizer.separatorAfterCurrentToken()) {
    return NS_ERROR_DOM_SYNTAX_ERR; // trailing comma
  }
  return CopyFrom(temp);
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:22,代码来源:SVGNumberList.cpp

示例13: FromJson

void UAssetImportData::Serialize(FArchive& Ar)
{
	if (Ar.UE4Ver() >= VER_UE4_ASSET_IMPORT_DATA_AS_JSON)
	{
		FString Json;
		if (Ar.IsLoading())
		{
			Ar << Json;
			TOptional<FAssetImportInfo> Copy = FromJson(MoveTemp(Json));
			if (Copy.IsSet())
			{
				CopyFrom(Copy.GetValue());
			}
		}
		else if (Ar.IsSaving())
		{
			Json = ToJson();
			Ar << Json;
		}
	}

	Super::Serialize(Ar);
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:23,代码来源:AssetImportData.cpp

示例14: CopyFrom

/** \brief Loads the main UI theme, and a menu theme.
 *
 *  See also foundtheme(void), it will return true when called after
 *  this method if this method was successful.
 *
 *  \param menufile name of menu item xml file
 */
void MythThemedMenu::Init(const QString &menufile)
{
    if (!m_state->m_loaded)
    {
        if (m_state->Create())
            m_foundtheme = true;
    }
    else
        m_foundtheme = true;

    if (!m_foundtheme)
        return;

    CopyFrom(m_state);

    connect(m_buttonList, SIGNAL(itemSelected(MythUIButtonListItem*)),
            SLOT(setButtonActive(MythUIButtonListItem*)));
    connect(m_buttonList, SIGNAL(itemClicked(MythUIButtonListItem*)),
            SLOT(buttonAction(MythUIButtonListItem*)));

    if (!parseMenu(menufile))
        m_foundtheme = false;
}
开发者ID:killerkiwi,项目名称:mythtv,代码行数:30,代码来源:myththemedmenu.cpp

示例15: tokenizer

nsresult
SVGLengthList::SetValueFromString(const nsAString& aValue)
{
  SVGLengthList temp;

  nsCharSeparatedTokenizerTemplate<IsSVGWhitespace>
    tokenizer(aValue, ',', nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL);

  nsCAutoString str;  // outside loop to minimize memory churn

  while (tokenizer.hasMoreTokens()) {
    SVGLength length;
    if (!length.SetValueFromString(tokenizer.nextToken())) {
      return NS_ERROR_DOM_SYNTAX_ERR;
    }
    if (!temp.AppendItem(length)) {
      return NS_ERROR_OUT_OF_MEMORY;
    }
  }
  if (tokenizer.lastTokenEndedWithSeparator()) {
    return NS_ERROR_DOM_SYNTAX_ERR; // trailing comma
  }
  return CopyFrom(temp);
}
开发者ID:Ajunboys,项目名称:mozilla-os2,代码行数:24,代码来源:SVGLengthList.cpp


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