DescribeCustomizeReportChartDataResult.cc 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. #include <alibabacloud/aegis/model/DescribeCustomizeReportChartDataResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Aegis;
  19. using namespace AlibabaCloud::Aegis::Model;
  20. DescribeCustomizeReportChartDataResult::DescribeCustomizeReportChartDataResult() :
  21. ServiceResult()
  22. {}
  23. DescribeCustomizeReportChartDataResult::DescribeCustomizeReportChartDataResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeCustomizeReportChartDataResult::~DescribeCustomizeReportChartDataResult()
  29. {}
  30. void DescribeCustomizeReportChartDataResult::parse(const std::string &payload)
  31. {
  32. Json::Reader reader;
  33. Json::Value value;
  34. reader.parse(payload, value);
  35. setRequestId(value["RequestId"].asString());
  36. auto allChartListNode = value["ChartList"]["chart"];
  37. for (auto valueChartListchart : allChartListNode)
  38. {
  39. Chart chartListObject;
  40. if(!valueChartListchart["ChartId"].isNull())
  41. chartListObject.chartId = valueChartListchart["ChartId"].asString();
  42. if(!valueChartListchart["ChartName"].isNull())
  43. chartListObject.chartName = valueChartListchart["ChartName"].asString();
  44. if(!valueChartListchart["Type"].isNull())
  45. chartListObject.type = valueChartListchart["Type"].asString();
  46. auto allDataListNode = allChartListNode["DataList"]["data"];
  47. for (auto allChartListNodeDataListdata : allDataListNode)
  48. {
  49. Chart::Data dataListObject;
  50. if(!allChartListNodeDataListdata["Name"].isNull())
  51. dataListObject.name = allChartListNodeDataListdata["Name"].asString();
  52. if(!allChartListNodeDataListdata["Count"].isNull())
  53. dataListObject.count = std::stoi(allChartListNodeDataListdata["Count"].asString());
  54. if(!allChartListNodeDataListdata["Old"].isNull())
  55. dataListObject.old = std::stoi(allChartListNodeDataListdata["Old"].asString());
  56. auto allChartDataListNode = allDataListNode["ChartDataList"]["chartData"];
  57. for (auto allDataListNodeChartDataListchartData : allChartDataListNode)
  58. {
  59. Chart::Data::ChartData chartDataListObject;
  60. if(!allDataListNodeChartDataListchartData["Name"].isNull())
  61. chartDataListObject.name = allDataListNodeChartDataListchartData["Name"].asString();
  62. if(!allDataListNodeChartDataListchartData["Value"].isNull())
  63. chartDataListObject.value = std::stoi(allDataListNodeChartDataListchartData["Value"].asString());
  64. dataListObject.chartDataList.push_back(chartDataListObject);
  65. }
  66. chartListObject.dataList.push_back(dataListObject);
  67. }
  68. chartList_.push_back(chartListObject);
  69. }
  70. }
  71. std::vector<DescribeCustomizeReportChartDataResult::Chart> DescribeCustomizeReportChartDataResult::getChartList()const
  72. {
  73. return chartList_;
  74. }