RecognizeDrivingLicenseResult.cc 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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/ocr/model/RecognizeDrivingLicenseResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Ocr;
  19. using namespace AlibabaCloud::Ocr::Model;
  20. RecognizeDrivingLicenseResult::RecognizeDrivingLicenseResult() :
  21. ServiceResult()
  22. {}
  23. RecognizeDrivingLicenseResult::RecognizeDrivingLicenseResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. RecognizeDrivingLicenseResult::~RecognizeDrivingLicenseResult()
  29. {}
  30. void RecognizeDrivingLicenseResult::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 dataNode = value["Data"];
  37. auto faceResultNode = dataNode["FaceResult"];
  38. if(!faceResultNode["PlateNumber"].isNull())
  39. data_.faceResult.plateNumber = faceResultNode["PlateNumber"].asString();
  40. if(!faceResultNode["VehicleType"].isNull())
  41. data_.faceResult.vehicleType = faceResultNode["VehicleType"].asString();
  42. if(!faceResultNode["Owner"].isNull())
  43. data_.faceResult.owner = faceResultNode["Owner"].asString();
  44. if(!faceResultNode["UseCharacter"].isNull())
  45. data_.faceResult.useCharacter = faceResultNode["UseCharacter"].asString();
  46. if(!faceResultNode["Address"].isNull())
  47. data_.faceResult.address = faceResultNode["Address"].asString();
  48. if(!faceResultNode["Model"].isNull())
  49. data_.faceResult.model = faceResultNode["Model"].asString();
  50. if(!faceResultNode["Vin"].isNull())
  51. data_.faceResult.vin = faceResultNode["Vin"].asString();
  52. if(!faceResultNode["EngineNumber"].isNull())
  53. data_.faceResult.engineNumber = faceResultNode["EngineNumber"].asString();
  54. if(!faceResultNode["RegisterDate"].isNull())
  55. data_.faceResult.registerDate = faceResultNode["RegisterDate"].asString();
  56. if(!faceResultNode["IssueDate"].isNull())
  57. data_.faceResult.issueDate = faceResultNode["IssueDate"].asString();
  58. auto backResultNode = dataNode["BackResult"];
  59. if(!backResultNode["ApprovedPassengerCapacity"].isNull())
  60. data_.backResult.approvedPassengerCapacity = backResultNode["ApprovedPassengerCapacity"].asString();
  61. if(!backResultNode["ApprovedLoad"].isNull())
  62. data_.backResult.approvedLoad = backResultNode["ApprovedLoad"].asString();
  63. if(!backResultNode["FileNumber"].isNull())
  64. data_.backResult.fileNumber = backResultNode["FileNumber"].asString();
  65. if(!backResultNode["GrossMass"].isNull())
  66. data_.backResult.grossMass = backResultNode["GrossMass"].asString();
  67. if(!backResultNode["EnergyType"].isNull())
  68. data_.backResult.energyType = backResultNode["EnergyType"].asString();
  69. if(!backResultNode["InspectionRecord"].isNull())
  70. data_.backResult.inspectionRecord = backResultNode["InspectionRecord"].asString();
  71. if(!backResultNode["OverallDimension"].isNull())
  72. data_.backResult.overallDimension = backResultNode["OverallDimension"].asString();
  73. if(!backResultNode["TractionMass"].isNull())
  74. data_.backResult.tractionMass = backResultNode["TractionMass"].asString();
  75. if(!backResultNode["UnladenMass"].isNull())
  76. data_.backResult.unladenMass = backResultNode["UnladenMass"].asString();
  77. if(!backResultNode["PlateNumber"].isNull())
  78. data_.backResult.plateNumber = backResultNode["PlateNumber"].asString();
  79. }
  80. RecognizeDrivingLicenseResult::Data RecognizeDrivingLicenseResult::getData()const
  81. {
  82. return data_;
  83. }