本文整理汇总了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());
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}