1 /*
2  * Copyright 2009-2017 Alibaba Cloud All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #include <alibabacloud/oss/model/AppendObjectResult.h>
19 #include "utils/Utils.h"
20 using namespace AlibabaCloud::OSS;
21 
AppendObjectResult()22 AppendObjectResult::AppendObjectResult():
23     OssObjectResult(),
24     length_(0),
25     crc64_(0)
26 {
27 }
28 
AppendObjectResult(const HeaderCollection & headers)29 AppendObjectResult::AppendObjectResult(const HeaderCollection& headers):
30     OssObjectResult(headers),
31     length_(0),
32     crc64_(0)
33 {
34    if (headers.find("x-oss-next-append-position") == headers.end()) {
35        parseDone_ = false;
36    } else {
37        length_ = std::strtoull(headers.at("x-oss-next-append-position").c_str(), nullptr, 10);
38    }
39 
40    if (headers.find("x-oss-hash-crc64ecma") == headers.end()) {
41        parseDone_ = false;
42    } else {
43        crc64_  = std::strtoull(headers.at("x-oss-hash-crc64ecma").c_str(), nullptr, 10);
44    }
45    parseDone_ = true;
46 }
47 
48