From fe5bdbf24a1e33e308590d862ce2680e6c25b3ea Mon Sep 17 00:00:00 2001 From: sdk-team Date: Fri, 2 Jul 2021 03:25:20 +0000 Subject: [PATCH] Release RecognizeQuotaInvoice RecognizeTicketInvoice RecognizePdf. --- CHANGELOG | 3 + VERSION | 2 +- ocr/CMakeLists.txt | 12 ++ ocr/include/alibabacloud/ocr/OcrClient.h | 24 ++++ .../ocr/model/RecognizePDFRequest.h | 48 +++++++ .../ocr/model/RecognizePDFResult.h | 80 +++++++++++ .../ocr/model/RecognizeQuotaInvoiceRequest.h | 48 +++++++ .../ocr/model/RecognizeQuotaInvoiceResult.h | 85 +++++++++++ .../ocr/model/RecognizeTicketInvoiceRequest.h | 48 +++++++ .../ocr/model/RecognizeTicketInvoiceResult.h | 101 +++++++++++++ ocr/src/OcrClient.cc | 108 ++++++++++++++ ocr/src/model/RecognizePDFRequest.cc | 40 ++++++ ocr/src/model/RecognizePDFResult.cc | 104 ++++++++++++++ ocr/src/model/RecognizeQuotaInvoiceRequest.cc | 40 ++++++ ocr/src/model/RecognizeQuotaInvoiceResult.cc | 107 ++++++++++++++ .../model/RecognizeTicketInvoiceRequest.cc | 40 ++++++ ocr/src/model/RecognizeTicketInvoiceResult.cc | 135 ++++++++++++++++++ 17 files changed, 1024 insertions(+), 1 deletion(-) create mode 100644 ocr/include/alibabacloud/ocr/model/RecognizePDFRequest.h create mode 100644 ocr/include/alibabacloud/ocr/model/RecognizePDFResult.h create mode 100644 ocr/include/alibabacloud/ocr/model/RecognizeQuotaInvoiceRequest.h create mode 100644 ocr/include/alibabacloud/ocr/model/RecognizeQuotaInvoiceResult.h create mode 100644 ocr/include/alibabacloud/ocr/model/RecognizeTicketInvoiceRequest.h create mode 100644 ocr/include/alibabacloud/ocr/model/RecognizeTicketInvoiceResult.h create mode 100644 ocr/src/model/RecognizePDFRequest.cc create mode 100644 ocr/src/model/RecognizePDFResult.cc create mode 100644 ocr/src/model/RecognizeQuotaInvoiceRequest.cc create mode 100644 ocr/src/model/RecognizeQuotaInvoiceResult.cc create mode 100644 ocr/src/model/RecognizeTicketInvoiceRequest.cc create mode 100644 ocr/src/model/RecognizeTicketInvoiceResult.cc diff --git a/CHANGELOG b/CHANGELOG index bf5484a9b..9048fcad5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2021-07-02 Version: 1.36.805 +- Release RecognizeQuotaInvoice RecognizeTicketInvoice RecognizePdf. + 2021-07-02 Version: 1.36.804 - Release AnalyzeChestVessel. diff --git a/VERSION b/VERSION index e02e6e9a1..7e2d9c78b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.804 \ No newline at end of file +1.36.805 \ No newline at end of file diff --git a/ocr/CMakeLists.txt b/ocr/CMakeLists.txt index 42141e1b3..9398801ae 100644 --- a/ocr/CMakeLists.txt +++ b/ocr/CMakeLists.txt @@ -45,12 +45,16 @@ set(ocr_public_header_model include/alibabacloud/ocr/model/RecognizeIdentityCardResult.h include/alibabacloud/ocr/model/RecognizeLicensePlateRequest.h include/alibabacloud/ocr/model/RecognizeLicensePlateResult.h + include/alibabacloud/ocr/model/RecognizePDFRequest.h + include/alibabacloud/ocr/model/RecognizePDFResult.h include/alibabacloud/ocr/model/RecognizePassportMRZRequest.h include/alibabacloud/ocr/model/RecognizePassportMRZResult.h include/alibabacloud/ocr/model/RecognizePoiNameRequest.h include/alibabacloud/ocr/model/RecognizePoiNameResult.h include/alibabacloud/ocr/model/RecognizeQrCodeRequest.h include/alibabacloud/ocr/model/RecognizeQrCodeResult.h + include/alibabacloud/ocr/model/RecognizeQuotaInvoiceRequest.h + include/alibabacloud/ocr/model/RecognizeQuotaInvoiceResult.h include/alibabacloud/ocr/model/RecognizeStampRequest.h include/alibabacloud/ocr/model/RecognizeStampResult.h include/alibabacloud/ocr/model/RecognizeTableRequest.h @@ -59,6 +63,8 @@ set(ocr_public_header_model include/alibabacloud/ocr/model/RecognizeTakeoutOrderResult.h include/alibabacloud/ocr/model/RecognizeTaxiInvoiceRequest.h include/alibabacloud/ocr/model/RecognizeTaxiInvoiceResult.h + include/alibabacloud/ocr/model/RecognizeTicketInvoiceRequest.h + include/alibabacloud/ocr/model/RecognizeTicketInvoiceResult.h include/alibabacloud/ocr/model/RecognizeTrainTicketRequest.h include/alibabacloud/ocr/model/RecognizeTrainTicketResult.h include/alibabacloud/ocr/model/RecognizeVATInvoiceRequest.h @@ -96,12 +102,16 @@ set(ocr_src src/model/RecognizeIdentityCardResult.cc src/model/RecognizeLicensePlateRequest.cc src/model/RecognizeLicensePlateResult.cc + src/model/RecognizePDFRequest.cc + src/model/RecognizePDFResult.cc src/model/RecognizePassportMRZRequest.cc src/model/RecognizePassportMRZResult.cc src/model/RecognizePoiNameRequest.cc src/model/RecognizePoiNameResult.cc src/model/RecognizeQrCodeRequest.cc src/model/RecognizeQrCodeResult.cc + src/model/RecognizeQuotaInvoiceRequest.cc + src/model/RecognizeQuotaInvoiceResult.cc src/model/RecognizeStampRequest.cc src/model/RecognizeStampResult.cc src/model/RecognizeTableRequest.cc @@ -110,6 +120,8 @@ set(ocr_src src/model/RecognizeTakeoutOrderResult.cc src/model/RecognizeTaxiInvoiceRequest.cc src/model/RecognizeTaxiInvoiceResult.cc + src/model/RecognizeTicketInvoiceRequest.cc + src/model/RecognizeTicketInvoiceResult.cc src/model/RecognizeTrainTicketRequest.cc src/model/RecognizeTrainTicketResult.cc src/model/RecognizeVATInvoiceRequest.cc diff --git a/ocr/include/alibabacloud/ocr/OcrClient.h b/ocr/include/alibabacloud/ocr/OcrClient.h index 16e309953..4afafb2ed 100644 --- a/ocr/include/alibabacloud/ocr/OcrClient.h +++ b/ocr/include/alibabacloud/ocr/OcrClient.h @@ -46,12 +46,16 @@ #include "model/RecognizeIdentityCardResult.h" #include "model/RecognizeLicensePlateRequest.h" #include "model/RecognizeLicensePlateResult.h" +#include "model/RecognizePDFRequest.h" +#include "model/RecognizePDFResult.h" #include "model/RecognizePassportMRZRequest.h" #include "model/RecognizePassportMRZResult.h" #include "model/RecognizePoiNameRequest.h" #include "model/RecognizePoiNameResult.h" #include "model/RecognizeQrCodeRequest.h" #include "model/RecognizeQrCodeResult.h" +#include "model/RecognizeQuotaInvoiceRequest.h" +#include "model/RecognizeQuotaInvoiceResult.h" #include "model/RecognizeStampRequest.h" #include "model/RecognizeStampResult.h" #include "model/RecognizeTableRequest.h" @@ -60,6 +64,8 @@ #include "model/RecognizeTakeoutOrderResult.h" #include "model/RecognizeTaxiInvoiceRequest.h" #include "model/RecognizeTaxiInvoiceResult.h" +#include "model/RecognizeTicketInvoiceRequest.h" +#include "model/RecognizeTicketInvoiceResult.h" #include "model/RecognizeTrainTicketRequest.h" #include "model/RecognizeTrainTicketResult.h" #include "model/RecognizeVATInvoiceRequest.h" @@ -115,6 +121,9 @@ namespace AlibabaCloud typedef Outcome RecognizeLicensePlateOutcome; typedef std::future RecognizeLicensePlateOutcomeCallable; typedef std::function&)> RecognizeLicensePlateAsyncHandler; + typedef Outcome RecognizePDFOutcome; + typedef std::future RecognizePDFOutcomeCallable; + typedef std::function&)> RecognizePDFAsyncHandler; typedef Outcome RecognizePassportMRZOutcome; typedef std::future RecognizePassportMRZOutcomeCallable; typedef std::function&)> RecognizePassportMRZAsyncHandler; @@ -124,6 +133,9 @@ namespace AlibabaCloud typedef Outcome RecognizeQrCodeOutcome; typedef std::future RecognizeQrCodeOutcomeCallable; typedef std::function&)> RecognizeQrCodeAsyncHandler; + typedef Outcome RecognizeQuotaInvoiceOutcome; + typedef std::future RecognizeQuotaInvoiceOutcomeCallable; + typedef std::function&)> RecognizeQuotaInvoiceAsyncHandler; typedef Outcome RecognizeStampOutcome; typedef std::future RecognizeStampOutcomeCallable; typedef std::function&)> RecognizeStampAsyncHandler; @@ -136,6 +148,9 @@ namespace AlibabaCloud typedef Outcome RecognizeTaxiInvoiceOutcome; typedef std::future RecognizeTaxiInvoiceOutcomeCallable; typedef std::function&)> RecognizeTaxiInvoiceAsyncHandler; + typedef Outcome RecognizeTicketInvoiceOutcome; + typedef std::future RecognizeTicketInvoiceOutcomeCallable; + typedef std::function&)> RecognizeTicketInvoiceAsyncHandler; typedef Outcome RecognizeTrainTicketOutcome; typedef std::future RecognizeTrainTicketOutcomeCallable; typedef std::function&)> RecognizeTrainTicketAsyncHandler; @@ -192,6 +207,9 @@ namespace AlibabaCloud RecognizeLicensePlateOutcome recognizeLicensePlate(const Model::RecognizeLicensePlateRequest &request)const; void recognizeLicensePlateAsync(const Model::RecognizeLicensePlateRequest& request, const RecognizeLicensePlateAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; RecognizeLicensePlateOutcomeCallable recognizeLicensePlateCallable(const Model::RecognizeLicensePlateRequest& request) const; + RecognizePDFOutcome recognizePDF(const Model::RecognizePDFRequest &request)const; + void recognizePDFAsync(const Model::RecognizePDFRequest& request, const RecognizePDFAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + RecognizePDFOutcomeCallable recognizePDFCallable(const Model::RecognizePDFRequest& request) const; RecognizePassportMRZOutcome recognizePassportMRZ(const Model::RecognizePassportMRZRequest &request)const; void recognizePassportMRZAsync(const Model::RecognizePassportMRZRequest& request, const RecognizePassportMRZAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; RecognizePassportMRZOutcomeCallable recognizePassportMRZCallable(const Model::RecognizePassportMRZRequest& request) const; @@ -201,6 +219,9 @@ namespace AlibabaCloud RecognizeQrCodeOutcome recognizeQrCode(const Model::RecognizeQrCodeRequest &request)const; void recognizeQrCodeAsync(const Model::RecognizeQrCodeRequest& request, const RecognizeQrCodeAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; RecognizeQrCodeOutcomeCallable recognizeQrCodeCallable(const Model::RecognizeQrCodeRequest& request) const; + RecognizeQuotaInvoiceOutcome recognizeQuotaInvoice(const Model::RecognizeQuotaInvoiceRequest &request)const; + void recognizeQuotaInvoiceAsync(const Model::RecognizeQuotaInvoiceRequest& request, const RecognizeQuotaInvoiceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + RecognizeQuotaInvoiceOutcomeCallable recognizeQuotaInvoiceCallable(const Model::RecognizeQuotaInvoiceRequest& request) const; RecognizeStampOutcome recognizeStamp(const Model::RecognizeStampRequest &request)const; void recognizeStampAsync(const Model::RecognizeStampRequest& request, const RecognizeStampAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; RecognizeStampOutcomeCallable recognizeStampCallable(const Model::RecognizeStampRequest& request) const; @@ -213,6 +234,9 @@ namespace AlibabaCloud RecognizeTaxiInvoiceOutcome recognizeTaxiInvoice(const Model::RecognizeTaxiInvoiceRequest &request)const; void recognizeTaxiInvoiceAsync(const Model::RecognizeTaxiInvoiceRequest& request, const RecognizeTaxiInvoiceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; RecognizeTaxiInvoiceOutcomeCallable recognizeTaxiInvoiceCallable(const Model::RecognizeTaxiInvoiceRequest& request) const; + RecognizeTicketInvoiceOutcome recognizeTicketInvoice(const Model::RecognizeTicketInvoiceRequest &request)const; + void recognizeTicketInvoiceAsync(const Model::RecognizeTicketInvoiceRequest& request, const RecognizeTicketInvoiceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + RecognizeTicketInvoiceOutcomeCallable recognizeTicketInvoiceCallable(const Model::RecognizeTicketInvoiceRequest& request) const; RecognizeTrainTicketOutcome recognizeTrainTicket(const Model::RecognizeTrainTicketRequest &request)const; void recognizeTrainTicketAsync(const Model::RecognizeTrainTicketRequest& request, const RecognizeTrainTicketAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; RecognizeTrainTicketOutcomeCallable recognizeTrainTicketCallable(const Model::RecognizeTrainTicketRequest& request) const; diff --git a/ocr/include/alibabacloud/ocr/model/RecognizePDFRequest.h b/ocr/include/alibabacloud/ocr/model/RecognizePDFRequest.h new file mode 100644 index 000000000..0fdb16779 --- /dev/null +++ b/ocr/include/alibabacloud/ocr/model/RecognizePDFRequest.h @@ -0,0 +1,48 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_OCR_MODEL_RECOGNIZEPDFREQUEST_H_ +#define ALIBABACLOUD_OCR_MODEL_RECOGNIZEPDFREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Ocr + { + namespace Model + { + class ALIBABACLOUD_OCR_EXPORT RecognizePDFRequest : public RpcServiceRequest + { + + public: + RecognizePDFRequest(); + ~RecognizePDFRequest(); + + std::string getFileURL()const; + void setFileURL(const std::string& fileURL); + + private: + std::string fileURL_; + + }; + } + } +} +#endif // !ALIBABACLOUD_OCR_MODEL_RECOGNIZEPDFREQUEST_H_ \ No newline at end of file diff --git a/ocr/include/alibabacloud/ocr/model/RecognizePDFResult.h b/ocr/include/alibabacloud/ocr/model/RecognizePDFResult.h new file mode 100644 index 000000000..d59717e5c --- /dev/null +++ b/ocr/include/alibabacloud/ocr/model/RecognizePDFResult.h @@ -0,0 +1,80 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_OCR_MODEL_RECOGNIZEPDFRESULT_H_ +#define ALIBABACLOUD_OCR_MODEL_RECOGNIZEPDFRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Ocr + { + namespace Model + { + class ALIBABACLOUD_OCR_EXPORT RecognizePDFResult : public ServiceResult + { + public: + struct Data + { + struct WordsInfoItem + { + struct PositionsItem + { + long x; + long y; + }; + std::string word; + long angle; + std::vector positions; + long x; + long y; + long height; + long width; + }; + std::vector wordsInfo; + long orgWidth; + long angle; + long orgHeight; + long height; + long pageIndex; + long width; + }; + + + RecognizePDFResult(); + explicit RecognizePDFResult(const std::string &payload); + ~RecognizePDFResult(); + std::string getMessage()const; + Data getData()const; + std::string getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + Data data_; + std::string code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_OCR_MODEL_RECOGNIZEPDFRESULT_H_ \ No newline at end of file diff --git a/ocr/include/alibabacloud/ocr/model/RecognizeQuotaInvoiceRequest.h b/ocr/include/alibabacloud/ocr/model/RecognizeQuotaInvoiceRequest.h new file mode 100644 index 000000000..03b0388ce --- /dev/null +++ b/ocr/include/alibabacloud/ocr/model/RecognizeQuotaInvoiceRequest.h @@ -0,0 +1,48 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_OCR_MODEL_RECOGNIZEQUOTAINVOICEREQUEST_H_ +#define ALIBABACLOUD_OCR_MODEL_RECOGNIZEQUOTAINVOICEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Ocr + { + namespace Model + { + class ALIBABACLOUD_OCR_EXPORT RecognizeQuotaInvoiceRequest : public RpcServiceRequest + { + + public: + RecognizeQuotaInvoiceRequest(); + ~RecognizeQuotaInvoiceRequest(); + + std::string getImageURL()const; + void setImageURL(const std::string& imageURL); + + private: + std::string imageURL_; + + }; + } + } +} +#endif // !ALIBABACLOUD_OCR_MODEL_RECOGNIZEQUOTAINVOICEREQUEST_H_ \ No newline at end of file diff --git a/ocr/include/alibabacloud/ocr/model/RecognizeQuotaInvoiceResult.h b/ocr/include/alibabacloud/ocr/model/RecognizeQuotaInvoiceResult.h new file mode 100644 index 000000000..7c1151d31 --- /dev/null +++ b/ocr/include/alibabacloud/ocr/model/RecognizeQuotaInvoiceResult.h @@ -0,0 +1,85 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_OCR_MODEL_RECOGNIZEQUOTAINVOICERESULT_H_ +#define ALIBABACLOUD_OCR_MODEL_RECOGNIZEQUOTAINVOICERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Ocr + { + namespace Model + { + class ALIBABACLOUD_OCR_EXPORT RecognizeQuotaInvoiceResult : public ServiceResult + { + public: + struct Data + { + struct Content + { + std::string invoiceDetails; + std::string invoiceCode; + std::string invoiceNo; + std::string invoiceAmount; + std::string sumAmount; + }; + struct KeyValueInfosItem + { + struct ValuePositionsItem + { + long x; + long y; + }; + std::vector valuePositions; + std::string value; + float valueScore; + std::string key; + }; + long orgWidth; + long angle; + Content content; + std::vector keyValueInfos; + long orgHeight; + long height; + long width; + }; + + + RecognizeQuotaInvoiceResult(); + explicit RecognizeQuotaInvoiceResult(const std::string &payload); + ~RecognizeQuotaInvoiceResult(); + std::string getMessage()const; + Data getData()const; + std::string getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + Data data_; + std::string code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_OCR_MODEL_RECOGNIZEQUOTAINVOICERESULT_H_ \ No newline at end of file diff --git a/ocr/include/alibabacloud/ocr/model/RecognizeTicketInvoiceRequest.h b/ocr/include/alibabacloud/ocr/model/RecognizeTicketInvoiceRequest.h new file mode 100644 index 000000000..a1c0a1722 --- /dev/null +++ b/ocr/include/alibabacloud/ocr/model/RecognizeTicketInvoiceRequest.h @@ -0,0 +1,48 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_OCR_MODEL_RECOGNIZETICKETINVOICEREQUEST_H_ +#define ALIBABACLOUD_OCR_MODEL_RECOGNIZETICKETINVOICEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Ocr + { + namespace Model + { + class ALIBABACLOUD_OCR_EXPORT RecognizeTicketInvoiceRequest : public RpcServiceRequest + { + + public: + RecognizeTicketInvoiceRequest(); + ~RecognizeTicketInvoiceRequest(); + + std::string getImageURL()const; + void setImageURL(const std::string& imageURL); + + private: + std::string imageURL_; + + }; + } + } +} +#endif // !ALIBABACLOUD_OCR_MODEL_RECOGNIZETICKETINVOICEREQUEST_H_ \ No newline at end of file diff --git a/ocr/include/alibabacloud/ocr/model/RecognizeTicketInvoiceResult.h b/ocr/include/alibabacloud/ocr/model/RecognizeTicketInvoiceResult.h new file mode 100644 index 000000000..cecb54d70 --- /dev/null +++ b/ocr/include/alibabacloud/ocr/model/RecognizeTicketInvoiceResult.h @@ -0,0 +1,101 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_OCR_MODEL_RECOGNIZETICKETINVOICERESULT_H_ +#define ALIBABACLOUD_OCR_MODEL_RECOGNIZETICKETINVOICERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Ocr + { + namespace Model + { + class ALIBABACLOUD_OCR_EXPORT RecognizeTicketInvoiceResult : public ServiceResult + { + public: + struct Data + { + struct ResultsItem + { + struct Content + { + std::string payeeName; + std::string antiFakeCode; + std::string invoiceCode; + std::string payeeRegisterNo; + std::string payerRegisterNo; + std::string invoiceNumber; + std::string invoiceDate; + std::string payerName; + std::string sumAmount; + }; + struct KeyValueInfosItem + { + struct ValuePositionsItem + { + long x; + long y; + }; + std::vector valuePositions; + std::string value; + float valueScore; + std::string key; + }; + struct SliceRectangleItem + { + long x; + long y; + }; + std::string type; + std::vector sliceRectangle; + Content content; + std::vector keyValueInfos; + long index; + }; + long orgWidth; + std::vector results; + long orgHeight; + long height; + long count; + long width; + }; + + + RecognizeTicketInvoiceResult(); + explicit RecognizeTicketInvoiceResult(const std::string &payload); + ~RecognizeTicketInvoiceResult(); + std::string getMessage()const; + Data getData()const; + std::string getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + Data data_; + std::string code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_OCR_MODEL_RECOGNIZETICKETINVOICERESULT_H_ \ No newline at end of file diff --git a/ocr/src/OcrClient.cc b/ocr/src/OcrClient.cc index a75fdd3dc..98725d98b 100644 --- a/ocr/src/OcrClient.cc +++ b/ocr/src/OcrClient.cc @@ -483,6 +483,42 @@ OcrClient::RecognizeLicensePlateOutcomeCallable OcrClient::recognizeLicensePlate return task->get_future(); } +OcrClient::RecognizePDFOutcome OcrClient::recognizePDF(const RecognizePDFRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return RecognizePDFOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return RecognizePDFOutcome(RecognizePDFResult(outcome.result())); + else + return RecognizePDFOutcome(outcome.error()); +} + +void OcrClient::recognizePDFAsync(const RecognizePDFRequest& request, const RecognizePDFAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, recognizePDF(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +OcrClient::RecognizePDFOutcomeCallable OcrClient::recognizePDFCallable(const RecognizePDFRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->recognizePDF(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + OcrClient::RecognizePassportMRZOutcome OcrClient::recognizePassportMRZ(const RecognizePassportMRZRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); @@ -591,6 +627,42 @@ OcrClient::RecognizeQrCodeOutcomeCallable OcrClient::recognizeQrCodeCallable(con return task->get_future(); } +OcrClient::RecognizeQuotaInvoiceOutcome OcrClient::recognizeQuotaInvoice(const RecognizeQuotaInvoiceRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return RecognizeQuotaInvoiceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return RecognizeQuotaInvoiceOutcome(RecognizeQuotaInvoiceResult(outcome.result())); + else + return RecognizeQuotaInvoiceOutcome(outcome.error()); +} + +void OcrClient::recognizeQuotaInvoiceAsync(const RecognizeQuotaInvoiceRequest& request, const RecognizeQuotaInvoiceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, recognizeQuotaInvoice(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +OcrClient::RecognizeQuotaInvoiceOutcomeCallable OcrClient::recognizeQuotaInvoiceCallable(const RecognizeQuotaInvoiceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->recognizeQuotaInvoice(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + OcrClient::RecognizeStampOutcome OcrClient::recognizeStamp(const RecognizeStampRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); @@ -735,6 +807,42 @@ OcrClient::RecognizeTaxiInvoiceOutcomeCallable OcrClient::recognizeTaxiInvoiceCa return task->get_future(); } +OcrClient::RecognizeTicketInvoiceOutcome OcrClient::recognizeTicketInvoice(const RecognizeTicketInvoiceRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return RecognizeTicketInvoiceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return RecognizeTicketInvoiceOutcome(RecognizeTicketInvoiceResult(outcome.result())); + else + return RecognizeTicketInvoiceOutcome(outcome.error()); +} + +void OcrClient::recognizeTicketInvoiceAsync(const RecognizeTicketInvoiceRequest& request, const RecognizeTicketInvoiceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, recognizeTicketInvoice(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +OcrClient::RecognizeTicketInvoiceOutcomeCallable OcrClient::recognizeTicketInvoiceCallable(const RecognizeTicketInvoiceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->recognizeTicketInvoice(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + OcrClient::RecognizeTrainTicketOutcome OcrClient::recognizeTrainTicket(const RecognizeTrainTicketRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/ocr/src/model/RecognizePDFRequest.cc b/ocr/src/model/RecognizePDFRequest.cc new file mode 100644 index 000000000..c65600a1f --- /dev/null +++ b/ocr/src/model/RecognizePDFRequest.cc @@ -0,0 +1,40 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +using AlibabaCloud::Ocr::Model::RecognizePDFRequest; + +RecognizePDFRequest::RecognizePDFRequest() : + RpcServiceRequest("ocr", "2019-12-30", "RecognizePDF") +{ + setMethod(HttpRequest::Method::Post); +} + +RecognizePDFRequest::~RecognizePDFRequest() +{} + +std::string RecognizePDFRequest::getFileURL()const +{ + return fileURL_; +} + +void RecognizePDFRequest::setFileURL(const std::string& fileURL) +{ + fileURL_ = fileURL; + setBodyParameter("FileURL", fileURL); +} + diff --git a/ocr/src/model/RecognizePDFResult.cc b/ocr/src/model/RecognizePDFResult.cc new file mode 100644 index 000000000..c9f2c6925 --- /dev/null +++ b/ocr/src/model/RecognizePDFResult.cc @@ -0,0 +1,104 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud::Ocr; +using namespace AlibabaCloud::Ocr::Model; + +RecognizePDFResult::RecognizePDFResult() : + ServiceResult() +{} + +RecognizePDFResult::RecognizePDFResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +RecognizePDFResult::~RecognizePDFResult() +{} + +void RecognizePDFResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto dataNode = value["Data"]; + if(!dataNode["Height"].isNull()) + data_.height = std::stol(dataNode["Height"].asString()); + if(!dataNode["Width"].isNull()) + data_.width = std::stol(dataNode["Width"].asString()); + if(!dataNode["OrgHeight"].isNull()) + data_.orgHeight = std::stol(dataNode["OrgHeight"].asString()); + if(!dataNode["OrgWidth"].isNull()) + data_.orgWidth = std::stol(dataNode["OrgWidth"].asString()); + if(!dataNode["PageIndex"].isNull()) + data_.pageIndex = std::stol(dataNode["PageIndex"].asString()); + if(!dataNode["Angle"].isNull()) + data_.angle = std::stol(dataNode["Angle"].asString()); + auto allWordsInfoNode = dataNode["WordsInfo"]["wordsInfoItem"]; + for (auto dataNodeWordsInfowordsInfoItem : allWordsInfoNode) + { + Data::WordsInfoItem wordsInfoItemObject; + if(!dataNodeWordsInfowordsInfoItem["Angle"].isNull()) + wordsInfoItemObject.angle = std::stol(dataNodeWordsInfowordsInfoItem["Angle"].asString()); + if(!dataNodeWordsInfowordsInfoItem["Word"].isNull()) + wordsInfoItemObject.word = dataNodeWordsInfowordsInfoItem["Word"].asString(); + if(!dataNodeWordsInfowordsInfoItem["Height"].isNull()) + wordsInfoItemObject.height = std::stol(dataNodeWordsInfowordsInfoItem["Height"].asString()); + if(!dataNodeWordsInfowordsInfoItem["Width"].isNull()) + wordsInfoItemObject.width = std::stol(dataNodeWordsInfowordsInfoItem["Width"].asString()); + if(!dataNodeWordsInfowordsInfoItem["X"].isNull()) + wordsInfoItemObject.x = std::stol(dataNodeWordsInfowordsInfoItem["X"].asString()); + if(!dataNodeWordsInfowordsInfoItem["Y"].isNull()) + wordsInfoItemObject.y = std::stol(dataNodeWordsInfowordsInfoItem["Y"].asString()); + auto allPositionsNode = dataNodeWordsInfowordsInfoItem["Positions"]["positionsItem"]; + for (auto dataNodeWordsInfowordsInfoItemPositionspositionsItem : allPositionsNode) + { + Data::WordsInfoItem::PositionsItem positionsObject; + if(!dataNodeWordsInfowordsInfoItemPositionspositionsItem["X"].isNull()) + positionsObject.x = std::stol(dataNodeWordsInfowordsInfoItemPositionspositionsItem["X"].asString()); + if(!dataNodeWordsInfowordsInfoItemPositionspositionsItem["Y"].isNull()) + positionsObject.y = std::stol(dataNodeWordsInfowordsInfoItemPositionspositionsItem["Y"].asString()); + wordsInfoItemObject.positions.push_back(positionsObject); + } + data_.wordsInfo.push_back(wordsInfoItemObject); + } + if(!value["Code"].isNull()) + code_ = value["Code"].asString(); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string RecognizePDFResult::getMessage()const +{ + return message_; +} + +RecognizePDFResult::Data RecognizePDFResult::getData()const +{ + return data_; +} + +std::string RecognizePDFResult::getCode()const +{ + return code_; +} + diff --git a/ocr/src/model/RecognizeQuotaInvoiceRequest.cc b/ocr/src/model/RecognizeQuotaInvoiceRequest.cc new file mode 100644 index 000000000..f3321b36d --- /dev/null +++ b/ocr/src/model/RecognizeQuotaInvoiceRequest.cc @@ -0,0 +1,40 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +using AlibabaCloud::Ocr::Model::RecognizeQuotaInvoiceRequest; + +RecognizeQuotaInvoiceRequest::RecognizeQuotaInvoiceRequest() : + RpcServiceRequest("ocr", "2019-12-30", "RecognizeQuotaInvoice") +{ + setMethod(HttpRequest::Method::Post); +} + +RecognizeQuotaInvoiceRequest::~RecognizeQuotaInvoiceRequest() +{} + +std::string RecognizeQuotaInvoiceRequest::getImageURL()const +{ + return imageURL_; +} + +void RecognizeQuotaInvoiceRequest::setImageURL(const std::string& imageURL) +{ + imageURL_ = imageURL; + setBodyParameter("ImageURL", imageURL); +} + diff --git a/ocr/src/model/RecognizeQuotaInvoiceResult.cc b/ocr/src/model/RecognizeQuotaInvoiceResult.cc new file mode 100644 index 000000000..68ebaa3e0 --- /dev/null +++ b/ocr/src/model/RecognizeQuotaInvoiceResult.cc @@ -0,0 +1,107 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud::Ocr; +using namespace AlibabaCloud::Ocr::Model; + +RecognizeQuotaInvoiceResult::RecognizeQuotaInvoiceResult() : + ServiceResult() +{} + +RecognizeQuotaInvoiceResult::RecognizeQuotaInvoiceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +RecognizeQuotaInvoiceResult::~RecognizeQuotaInvoiceResult() +{} + +void RecognizeQuotaInvoiceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto dataNode = value["Data"]; + if(!dataNode["Angle"].isNull()) + data_.angle = std::stol(dataNode["Angle"].asString()); + if(!dataNode["Height"].isNull()) + data_.height = std::stol(dataNode["Height"].asString()); + if(!dataNode["Width"].isNull()) + data_.width = std::stol(dataNode["Width"].asString()); + if(!dataNode["OrgHeight"].isNull()) + data_.orgHeight = std::stol(dataNode["OrgHeight"].asString()); + if(!dataNode["OrgWidth"].isNull()) + data_.orgWidth = std::stol(dataNode["OrgWidth"].asString()); + auto allKeyValueInfosNode = dataNode["KeyValueInfos"]["keyValueInfosItem"]; + for (auto dataNodeKeyValueInfoskeyValueInfosItem : allKeyValueInfosNode) + { + Data::KeyValueInfosItem keyValueInfosItemObject; + if(!dataNodeKeyValueInfoskeyValueInfosItem["Key"].isNull()) + keyValueInfosItemObject.key = dataNodeKeyValueInfoskeyValueInfosItem["Key"].asString(); + if(!dataNodeKeyValueInfoskeyValueInfosItem["Value"].isNull()) + keyValueInfosItemObject.value = dataNodeKeyValueInfoskeyValueInfosItem["Value"].asString(); + if(!dataNodeKeyValueInfoskeyValueInfosItem["ValueScore"].isNull()) + keyValueInfosItemObject.valueScore = std::stof(dataNodeKeyValueInfoskeyValueInfosItem["ValueScore"].asString()); + auto allValuePositionsNode = dataNodeKeyValueInfoskeyValueInfosItem["ValuePositions"]["valuePositionsItem"]; + for (auto dataNodeKeyValueInfoskeyValueInfosItemValuePositionsvaluePositionsItem : allValuePositionsNode) + { + Data::KeyValueInfosItem::ValuePositionsItem valuePositionsObject; + if(!dataNodeKeyValueInfoskeyValueInfosItemValuePositionsvaluePositionsItem["X"].isNull()) + valuePositionsObject.x = std::stol(dataNodeKeyValueInfoskeyValueInfosItemValuePositionsvaluePositionsItem["X"].asString()); + if(!dataNodeKeyValueInfoskeyValueInfosItemValuePositionsvaluePositionsItem["Y"].isNull()) + valuePositionsObject.y = std::stol(dataNodeKeyValueInfoskeyValueInfosItemValuePositionsvaluePositionsItem["Y"].asString()); + keyValueInfosItemObject.valuePositions.push_back(valuePositionsObject); + } + data_.keyValueInfos.push_back(keyValueInfosItemObject); + } + auto contentNode = dataNode["Content"]; + if(!contentNode["SumAmount"].isNull()) + data_.content.sumAmount = contentNode["SumAmount"].asString(); + if(!contentNode["InvoiceCode"].isNull()) + data_.content.invoiceCode = contentNode["InvoiceCode"].asString(); + if(!contentNode["InvoiceNo"].isNull()) + data_.content.invoiceNo = contentNode["InvoiceNo"].asString(); + if(!contentNode["InvoiceAmount"].isNull()) + data_.content.invoiceAmount = contentNode["InvoiceAmount"].asString(); + if(!contentNode["InvoiceDetails"].isNull()) + data_.content.invoiceDetails = contentNode["InvoiceDetails"].asString(); + if(!value["Code"].isNull()) + code_ = value["Code"].asString(); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string RecognizeQuotaInvoiceResult::getMessage()const +{ + return message_; +} + +RecognizeQuotaInvoiceResult::Data RecognizeQuotaInvoiceResult::getData()const +{ + return data_; +} + +std::string RecognizeQuotaInvoiceResult::getCode()const +{ + return code_; +} + diff --git a/ocr/src/model/RecognizeTicketInvoiceRequest.cc b/ocr/src/model/RecognizeTicketInvoiceRequest.cc new file mode 100644 index 000000000..a75cc527d --- /dev/null +++ b/ocr/src/model/RecognizeTicketInvoiceRequest.cc @@ -0,0 +1,40 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +using AlibabaCloud::Ocr::Model::RecognizeTicketInvoiceRequest; + +RecognizeTicketInvoiceRequest::RecognizeTicketInvoiceRequest() : + RpcServiceRequest("ocr", "2019-12-30", "RecognizeTicketInvoice") +{ + setMethod(HttpRequest::Method::Post); +} + +RecognizeTicketInvoiceRequest::~RecognizeTicketInvoiceRequest() +{} + +std::string RecognizeTicketInvoiceRequest::getImageURL()const +{ + return imageURL_; +} + +void RecognizeTicketInvoiceRequest::setImageURL(const std::string& imageURL) +{ + imageURL_ = imageURL; + setBodyParameter("ImageURL", imageURL); +} + diff --git a/ocr/src/model/RecognizeTicketInvoiceResult.cc b/ocr/src/model/RecognizeTicketInvoiceResult.cc new file mode 100644 index 000000000..c1d16bcbb --- /dev/null +++ b/ocr/src/model/RecognizeTicketInvoiceResult.cc @@ -0,0 +1,135 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud::Ocr; +using namespace AlibabaCloud::Ocr::Model; + +RecognizeTicketInvoiceResult::RecognizeTicketInvoiceResult() : + ServiceResult() +{} + +RecognizeTicketInvoiceResult::RecognizeTicketInvoiceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +RecognizeTicketInvoiceResult::~RecognizeTicketInvoiceResult() +{} + +void RecognizeTicketInvoiceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto dataNode = value["Data"]; + if(!dataNode["Count"].isNull()) + data_.count = std::stol(dataNode["Count"].asString()); + if(!dataNode["Height"].isNull()) + data_.height = std::stol(dataNode["Height"].asString()); + if(!dataNode["Width"].isNull()) + data_.width = std::stol(dataNode["Width"].asString()); + if(!dataNode["OrgHeight"].isNull()) + data_.orgHeight = std::stol(dataNode["OrgHeight"].asString()); + if(!dataNode["OrgWidth"].isNull()) + data_.orgWidth = std::stol(dataNode["OrgWidth"].asString()); + auto allResultsNode = dataNode["Results"]["resultsItem"]; + for (auto dataNodeResultsresultsItem : allResultsNode) + { + Data::ResultsItem resultsItemObject; + if(!dataNodeResultsresultsItem["Index"].isNull()) + resultsItemObject.index = std::stol(dataNodeResultsresultsItem["Index"].asString()); + if(!dataNodeResultsresultsItem["Type"].isNull()) + resultsItemObject.type = dataNodeResultsresultsItem["Type"].asString(); + auto allKeyValueInfosNode = dataNodeResultsresultsItem["KeyValueInfos"]["keyValueInfosItem"]; + for (auto dataNodeResultsresultsItemKeyValueInfoskeyValueInfosItem : allKeyValueInfosNode) + { + Data::ResultsItem::KeyValueInfosItem keyValueInfosObject; + if(!dataNodeResultsresultsItemKeyValueInfoskeyValueInfosItem["Key"].isNull()) + keyValueInfosObject.key = dataNodeResultsresultsItemKeyValueInfoskeyValueInfosItem["Key"].asString(); + if(!dataNodeResultsresultsItemKeyValueInfoskeyValueInfosItem["Value"].isNull()) + keyValueInfosObject.value = dataNodeResultsresultsItemKeyValueInfoskeyValueInfosItem["Value"].asString(); + if(!dataNodeResultsresultsItemKeyValueInfoskeyValueInfosItem["ValueScore"].isNull()) + keyValueInfosObject.valueScore = std::stof(dataNodeResultsresultsItemKeyValueInfoskeyValueInfosItem["ValueScore"].asString()); + auto allValuePositionsNode = dataNodeResultsresultsItemKeyValueInfoskeyValueInfosItem["ValuePositions"]["valuePositionsItem"]; + for (auto dataNodeResultsresultsItemKeyValueInfoskeyValueInfosItemValuePositionsvaluePositionsItem : allValuePositionsNode) + { + Data::ResultsItem::KeyValueInfosItem::ValuePositionsItem valuePositionsObject; + if(!dataNodeResultsresultsItemKeyValueInfoskeyValueInfosItemValuePositionsvaluePositionsItem["X"].isNull()) + valuePositionsObject.x = std::stol(dataNodeResultsresultsItemKeyValueInfoskeyValueInfosItemValuePositionsvaluePositionsItem["X"].asString()); + if(!dataNodeResultsresultsItemKeyValueInfoskeyValueInfosItemValuePositionsvaluePositionsItem["Y"].isNull()) + valuePositionsObject.y = std::stol(dataNodeResultsresultsItemKeyValueInfoskeyValueInfosItemValuePositionsvaluePositionsItem["Y"].asString()); + keyValueInfosObject.valuePositions.push_back(valuePositionsObject); + } + resultsItemObject.keyValueInfos.push_back(keyValueInfosObject); + } + auto allSliceRectangleNode = dataNodeResultsresultsItem["SliceRectangle"]["sliceRectangleItem"]; + for (auto dataNodeResultsresultsItemSliceRectanglesliceRectangleItem : allSliceRectangleNode) + { + Data::ResultsItem::SliceRectangleItem sliceRectangleObject; + if(!dataNodeResultsresultsItemSliceRectanglesliceRectangleItem["X"].isNull()) + sliceRectangleObject.x = std::stol(dataNodeResultsresultsItemSliceRectanglesliceRectangleItem["X"].asString()); + if(!dataNodeResultsresultsItemSliceRectanglesliceRectangleItem["Y"].isNull()) + sliceRectangleObject.y = std::stol(dataNodeResultsresultsItemSliceRectanglesliceRectangleItem["Y"].asString()); + resultsItemObject.sliceRectangle.push_back(sliceRectangleObject); + } + auto contentNode = value["Content"]; + if(!contentNode["InvoiceCode"].isNull()) + resultsItemObject.content.invoiceCode = contentNode["InvoiceCode"].asString(); + if(!contentNode["InvoiceNumber"].isNull()) + resultsItemObject.content.invoiceNumber = contentNode["InvoiceNumber"].asString(); + if(!contentNode["InvoiceDate"].isNull()) + resultsItemObject.content.invoiceDate = contentNode["InvoiceDate"].asString(); + if(!contentNode["AntiFakeCode"].isNull()) + resultsItemObject.content.antiFakeCode = contentNode["AntiFakeCode"].asString(); + if(!contentNode["PayeeName"].isNull()) + resultsItemObject.content.payeeName = contentNode["PayeeName"].asString(); + if(!contentNode["PayeeRegisterNo"].isNull()) + resultsItemObject.content.payeeRegisterNo = contentNode["PayeeRegisterNo"].asString(); + if(!contentNode["PayerName"].isNull()) + resultsItemObject.content.payerName = contentNode["PayerName"].asString(); + if(!contentNode["PayerRegisterNo"].isNull()) + resultsItemObject.content.payerRegisterNo = contentNode["PayerRegisterNo"].asString(); + if(!contentNode["SumAmount"].isNull()) + resultsItemObject.content.sumAmount = contentNode["SumAmount"].asString(); + data_.results.push_back(resultsItemObject); + } + if(!value["Code"].isNull()) + code_ = value["Code"].asString(); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string RecognizeTicketInvoiceResult::getMessage()const +{ + return message_; +} + +RecognizeTicketInvoiceResult::Data RecognizeTicketInvoiceResult::getData()const +{ + return data_; +} + +std::string RecognizeTicketInvoiceResult::getCode()const +{ + return code_; +} +