aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/GetObjectAttributesParts.cpp
blob: 14b9a8ac2826c5dddfab9364c520c325e7d2cb41 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/**
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#include <aws/s3/model/GetObjectAttributesParts.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>

#include <utility>

using namespace Aws::Utils::Xml;
using namespace Aws::Utils;

namespace Aws
{
namespace S3
{
namespace Model
{

GetObjectAttributesParts::GetObjectAttributesParts() : 
    m_totalPartsCount(0),
    m_totalPartsCountHasBeenSet(false),
    m_partNumberMarker(0),
    m_partNumberMarkerHasBeenSet(false),
    m_nextPartNumberMarker(0),
    m_nextPartNumberMarkerHasBeenSet(false),
    m_maxParts(0),
    m_maxPartsHasBeenSet(false),
    m_isTruncated(false),
    m_isTruncatedHasBeenSet(false),
    m_partsHasBeenSet(false)
{
}

GetObjectAttributesParts::GetObjectAttributesParts(const XmlNode& xmlNode) : 
    m_totalPartsCount(0),
    m_totalPartsCountHasBeenSet(false),
    m_partNumberMarker(0),
    m_partNumberMarkerHasBeenSet(false),
    m_nextPartNumberMarker(0),
    m_nextPartNumberMarkerHasBeenSet(false),
    m_maxParts(0),
    m_maxPartsHasBeenSet(false),
    m_isTruncated(false),
    m_isTruncatedHasBeenSet(false),
    m_partsHasBeenSet(false)
{
  *this = xmlNode;
}

GetObjectAttributesParts& GetObjectAttributesParts::operator =(const XmlNode& xmlNode)
{
  XmlNode resultNode = xmlNode;

  if(!resultNode.IsNull())
  {
    XmlNode totalPartsCountNode = resultNode.FirstChild("PartsCount");
    if(!totalPartsCountNode.IsNull())
    {
      m_totalPartsCount = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(totalPartsCountNode.GetText()).c_str()).c_str());
      m_totalPartsCountHasBeenSet = true;
    }
    XmlNode partNumberMarkerNode = resultNode.FirstChild("PartNumberMarker");
    if(!partNumberMarkerNode.IsNull())
    {
      m_partNumberMarker = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(partNumberMarkerNode.GetText()).c_str()).c_str());
      m_partNumberMarkerHasBeenSet = true;
    }
    XmlNode nextPartNumberMarkerNode = resultNode.FirstChild("NextPartNumberMarker");
    if(!nextPartNumberMarkerNode.IsNull())
    {
      m_nextPartNumberMarker = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(nextPartNumberMarkerNode.GetText()).c_str()).c_str());
      m_nextPartNumberMarkerHasBeenSet = true;
    }
    XmlNode maxPartsNode = resultNode.FirstChild("MaxParts");
    if(!maxPartsNode.IsNull())
    {
      m_maxParts = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(maxPartsNode.GetText()).c_str()).c_str());
      m_maxPartsHasBeenSet = true;
    }
    XmlNode isTruncatedNode = resultNode.FirstChild("IsTruncated");
    if(!isTruncatedNode.IsNull())
    {
      m_isTruncated = StringUtils::ConvertToBool(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(isTruncatedNode.GetText()).c_str()).c_str());
      m_isTruncatedHasBeenSet = true;
    }
    XmlNode partsNode = resultNode.FirstChild("Part");
    if(!partsNode.IsNull())
    {
      XmlNode partMember = partsNode;
      while(!partMember.IsNull())
      {
        m_parts.push_back(partMember);
        partMember = partMember.NextNode("Part");
      }

      m_partsHasBeenSet = true;
    }
  }

  return *this;
}

void GetObjectAttributesParts::AddToNode(XmlNode& parentNode) const
{
  Aws::StringStream ss;
  if(m_totalPartsCountHasBeenSet)
  {
   XmlNode totalPartsCountNode = parentNode.CreateChildElement("PartsCount");
   ss << m_totalPartsCount;
   totalPartsCountNode.SetText(ss.str());
   ss.str("");
  }

  if(m_partNumberMarkerHasBeenSet)
  {
   XmlNode partNumberMarkerNode = parentNode.CreateChildElement("PartNumberMarker");
   ss << m_partNumberMarker;
   partNumberMarkerNode.SetText(ss.str());
   ss.str("");
  }

  if(m_nextPartNumberMarkerHasBeenSet)
  {
   XmlNode nextPartNumberMarkerNode = parentNode.CreateChildElement("NextPartNumberMarker");
   ss << m_nextPartNumberMarker;
   nextPartNumberMarkerNode.SetText(ss.str());
   ss.str("");
  }

  if(m_maxPartsHasBeenSet)
  {
   XmlNode maxPartsNode = parentNode.CreateChildElement("MaxParts");
   ss << m_maxParts;
   maxPartsNode.SetText(ss.str());
   ss.str("");
  }

  if(m_isTruncatedHasBeenSet)
  {
   XmlNode isTruncatedNode = parentNode.CreateChildElement("IsTruncated");
   ss << std::boolalpha << m_isTruncated;
   isTruncatedNode.SetText(ss.str());
   ss.str("");
  }

  if(m_partsHasBeenSet)
  {
   for(const auto& item : m_parts)
   {
     XmlNode partsNode = parentNode.CreateChildElement("Part");
     item.AddToNode(partsNode);
   }
  }

}

} // namespace Model
} // namespace S3
} // namespace Aws