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