Update RecognizeTable.
This commit is contained in:
845
ocr/src/OcrClient.cc
Normal file
845
ocr/src/OcrClient.cc
Normal file
@@ -0,0 +1,845 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/OcrClient.h>
|
||||
#include <alibabacloud/core/SimpleCredentialsProvider.h>
|
||||
|
||||
using namespace AlibabaCloud;
|
||||
using namespace AlibabaCloud::Location;
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
namespace
|
||||
{
|
||||
const std::string SERVICE_NAME = "ocr";
|
||||
}
|
||||
|
||||
OcrClient::OcrClient(const Credentials &credentials, const ClientConfiguration &configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "ocr");
|
||||
}
|
||||
|
||||
OcrClient::OcrClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "ocr");
|
||||
}
|
||||
|
||||
OcrClient::OcrClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "ocr");
|
||||
}
|
||||
|
||||
OcrClient::~OcrClient()
|
||||
{}
|
||||
|
||||
OcrClient::GetAsyncJobResultOutcome OcrClient::getAsyncJobResult(const GetAsyncJobResultRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetAsyncJobResultOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetAsyncJobResultOutcome(GetAsyncJobResultResult(outcome.result()));
|
||||
else
|
||||
return GetAsyncJobResultOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::getAsyncJobResultAsync(const GetAsyncJobResultRequest& request, const GetAsyncJobResultAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getAsyncJobResult(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::GetAsyncJobResultOutcomeCallable OcrClient::getAsyncJobResultCallable(const GetAsyncJobResultRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetAsyncJobResultOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getAsyncJobResult(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeAccountPageOutcome OcrClient::recognizeAccountPage(const RecognizeAccountPageRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeAccountPageOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeAccountPageOutcome(RecognizeAccountPageResult(outcome.result()));
|
||||
else
|
||||
return RecognizeAccountPageOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeAccountPageAsync(const RecognizeAccountPageRequest& request, const RecognizeAccountPageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeAccountPage(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeAccountPageOutcomeCallable OcrClient::recognizeAccountPageCallable(const RecognizeAccountPageRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeAccountPageOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeAccountPage(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeBankCardOutcome OcrClient::recognizeBankCard(const RecognizeBankCardRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeBankCardOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeBankCardOutcome(RecognizeBankCardResult(outcome.result()));
|
||||
else
|
||||
return RecognizeBankCardOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeBankCardAsync(const RecognizeBankCardRequest& request, const RecognizeBankCardAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeBankCard(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeBankCardOutcomeCallable OcrClient::recognizeBankCardCallable(const RecognizeBankCardRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeBankCardOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeBankCard(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeBusinessCardOutcome OcrClient::recognizeBusinessCard(const RecognizeBusinessCardRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeBusinessCardOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeBusinessCardOutcome(RecognizeBusinessCardResult(outcome.result()));
|
||||
else
|
||||
return RecognizeBusinessCardOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeBusinessCardAsync(const RecognizeBusinessCardRequest& request, const RecognizeBusinessCardAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeBusinessCard(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeBusinessCardOutcomeCallable OcrClient::recognizeBusinessCardCallable(const RecognizeBusinessCardRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeBusinessCardOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeBusinessCard(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeBusinessLicenseOutcome OcrClient::recognizeBusinessLicense(const RecognizeBusinessLicenseRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeBusinessLicenseOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeBusinessLicenseOutcome(RecognizeBusinessLicenseResult(outcome.result()));
|
||||
else
|
||||
return RecognizeBusinessLicenseOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeBusinessLicenseAsync(const RecognizeBusinessLicenseRequest& request, const RecognizeBusinessLicenseAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeBusinessLicense(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeBusinessLicenseOutcomeCallable OcrClient::recognizeBusinessLicenseCallable(const RecognizeBusinessLicenseRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeBusinessLicenseOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeBusinessLicense(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeCharacterOutcome OcrClient::recognizeCharacter(const RecognizeCharacterRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeCharacterOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeCharacterOutcome(RecognizeCharacterResult(outcome.result()));
|
||||
else
|
||||
return RecognizeCharacterOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeCharacterAsync(const RecognizeCharacterRequest& request, const RecognizeCharacterAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeCharacter(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeCharacterOutcomeCallable OcrClient::recognizeCharacterCallable(const RecognizeCharacterRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeCharacterOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeCharacter(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeChinapassportOutcome OcrClient::recognizeChinapassport(const RecognizeChinapassportRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeChinapassportOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeChinapassportOutcome(RecognizeChinapassportResult(outcome.result()));
|
||||
else
|
||||
return RecognizeChinapassportOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeChinapassportAsync(const RecognizeChinapassportRequest& request, const RecognizeChinapassportAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeChinapassport(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeChinapassportOutcomeCallable OcrClient::recognizeChinapassportCallable(const RecognizeChinapassportRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeChinapassportOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeChinapassport(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeDriverLicenseOutcome OcrClient::recognizeDriverLicense(const RecognizeDriverLicenseRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeDriverLicenseOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeDriverLicenseOutcome(RecognizeDriverLicenseResult(outcome.result()));
|
||||
else
|
||||
return RecognizeDriverLicenseOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeDriverLicenseAsync(const RecognizeDriverLicenseRequest& request, const RecognizeDriverLicenseAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeDriverLicense(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeDriverLicenseOutcomeCallable OcrClient::recognizeDriverLicenseCallable(const RecognizeDriverLicenseRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeDriverLicenseOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeDriverLicense(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeDrivingLicenseOutcome OcrClient::recognizeDrivingLicense(const RecognizeDrivingLicenseRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeDrivingLicenseOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeDrivingLicenseOutcome(RecognizeDrivingLicenseResult(outcome.result()));
|
||||
else
|
||||
return RecognizeDrivingLicenseOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeDrivingLicenseAsync(const RecognizeDrivingLicenseRequest& request, const RecognizeDrivingLicenseAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeDrivingLicense(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeDrivingLicenseOutcomeCallable OcrClient::recognizeDrivingLicenseCallable(const RecognizeDrivingLicenseRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeDrivingLicenseOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeDrivingLicense(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeIdentityCardOutcome OcrClient::recognizeIdentityCard(const RecognizeIdentityCardRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeIdentityCardOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeIdentityCardOutcome(RecognizeIdentityCardResult(outcome.result()));
|
||||
else
|
||||
return RecognizeIdentityCardOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeIdentityCardAsync(const RecognizeIdentityCardRequest& request, const RecognizeIdentityCardAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeIdentityCard(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeIdentityCardOutcomeCallable OcrClient::recognizeIdentityCardCallable(const RecognizeIdentityCardRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeIdentityCardOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeIdentityCard(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeLicensePlateOutcome OcrClient::recognizeLicensePlate(const RecognizeLicensePlateRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeLicensePlateOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeLicensePlateOutcome(RecognizeLicensePlateResult(outcome.result()));
|
||||
else
|
||||
return RecognizeLicensePlateOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeLicensePlateAsync(const RecognizeLicensePlateRequest& request, const RecognizeLicensePlateAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeLicensePlate(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeLicensePlateOutcomeCallable OcrClient::recognizeLicensePlateCallable(const RecognizeLicensePlateRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeLicensePlateOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeLicensePlate(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizePassportMRZOutcome OcrClient::recognizePassportMRZ(const RecognizePassportMRZRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizePassportMRZOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizePassportMRZOutcome(RecognizePassportMRZResult(outcome.result()));
|
||||
else
|
||||
return RecognizePassportMRZOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizePassportMRZAsync(const RecognizePassportMRZRequest& request, const RecognizePassportMRZAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizePassportMRZ(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizePassportMRZOutcomeCallable OcrClient::recognizePassportMRZCallable(const RecognizePassportMRZRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizePassportMRZOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizePassportMRZ(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeQrCodeOutcome OcrClient::recognizeQrCode(const RecognizeQrCodeRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeQrCodeOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeQrCodeOutcome(RecognizeQrCodeResult(outcome.result()));
|
||||
else
|
||||
return RecognizeQrCodeOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeQrCodeAsync(const RecognizeQrCodeRequest& request, const RecognizeQrCodeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeQrCode(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeQrCodeOutcomeCallable OcrClient::recognizeQrCodeCallable(const RecognizeQrCodeRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeQrCodeOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeQrCode(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeStampOutcome OcrClient::recognizeStamp(const RecognizeStampRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeStampOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeStampOutcome(RecognizeStampResult(outcome.result()));
|
||||
else
|
||||
return RecognizeStampOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeStampAsync(const RecognizeStampRequest& request, const RecognizeStampAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeStamp(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeStampOutcomeCallable OcrClient::recognizeStampCallable(const RecognizeStampRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeStampOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeStamp(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeTableOutcome OcrClient::recognizeTable(const RecognizeTableRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeTableOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeTableOutcome(RecognizeTableResult(outcome.result()));
|
||||
else
|
||||
return RecognizeTableOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeTableAsync(const RecognizeTableRequest& request, const RecognizeTableAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeTable(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeTableOutcomeCallable OcrClient::recognizeTableCallable(const RecognizeTableRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeTableOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeTable(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeTakeoutOrderOutcome OcrClient::recognizeTakeoutOrder(const RecognizeTakeoutOrderRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeTakeoutOrderOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeTakeoutOrderOutcome(RecognizeTakeoutOrderResult(outcome.result()));
|
||||
else
|
||||
return RecognizeTakeoutOrderOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeTakeoutOrderAsync(const RecognizeTakeoutOrderRequest& request, const RecognizeTakeoutOrderAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeTakeoutOrder(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeTakeoutOrderOutcomeCallable OcrClient::recognizeTakeoutOrderCallable(const RecognizeTakeoutOrderRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeTakeoutOrderOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeTakeoutOrder(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeTaxiInvoiceOutcome OcrClient::recognizeTaxiInvoice(const RecognizeTaxiInvoiceRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeTaxiInvoiceOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeTaxiInvoiceOutcome(RecognizeTaxiInvoiceResult(outcome.result()));
|
||||
else
|
||||
return RecognizeTaxiInvoiceOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeTaxiInvoiceAsync(const RecognizeTaxiInvoiceRequest& request, const RecognizeTaxiInvoiceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeTaxiInvoice(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeTaxiInvoiceOutcomeCallable OcrClient::recognizeTaxiInvoiceCallable(const RecognizeTaxiInvoiceRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeTaxiInvoiceOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeTaxiInvoice(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeTrainTicketOutcome OcrClient::recognizeTrainTicket(const RecognizeTrainTicketRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeTrainTicketOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeTrainTicketOutcome(RecognizeTrainTicketResult(outcome.result()));
|
||||
else
|
||||
return RecognizeTrainTicketOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeTrainTicketAsync(const RecognizeTrainTicketRequest& request, const RecognizeTrainTicketAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeTrainTicket(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeTrainTicketOutcomeCallable OcrClient::recognizeTrainTicketCallable(const RecognizeTrainTicketRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeTrainTicketOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeTrainTicket(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeVATInvoiceOutcome OcrClient::recognizeVATInvoice(const RecognizeVATInvoiceRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeVATInvoiceOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeVATInvoiceOutcome(RecognizeVATInvoiceResult(outcome.result()));
|
||||
else
|
||||
return RecognizeVATInvoiceOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeVATInvoiceAsync(const RecognizeVATInvoiceRequest& request, const RecognizeVATInvoiceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeVATInvoice(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeVATInvoiceOutcomeCallable OcrClient::recognizeVATInvoiceCallable(const RecognizeVATInvoiceRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeVATInvoiceOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeVATInvoice(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeVINCodeOutcome OcrClient::recognizeVINCode(const RecognizeVINCodeRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeVINCodeOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeVINCodeOutcome(RecognizeVINCodeResult(outcome.result()));
|
||||
else
|
||||
return RecognizeVINCodeOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeVINCodeAsync(const RecognizeVINCodeRequest& request, const RecognizeVINCodeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeVINCode(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeVINCodeOutcomeCallable OcrClient::recognizeVINCodeCallable(const RecognizeVINCodeRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeVINCodeOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeVINCode(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::RecognizeVerificationcodeOutcome OcrClient::recognizeVerificationcode(const RecognizeVerificationcodeRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RecognizeVerificationcodeOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RecognizeVerificationcodeOutcome(RecognizeVerificationcodeResult(outcome.result()));
|
||||
else
|
||||
return RecognizeVerificationcodeOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::recognizeVerificationcodeAsync(const RecognizeVerificationcodeRequest& request, const RecognizeVerificationcodeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, recognizeVerificationcode(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::RecognizeVerificationcodeOutcomeCallable OcrClient::recognizeVerificationcodeCallable(const RecognizeVerificationcodeRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RecognizeVerificationcodeOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->recognizeVerificationcode(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
OcrClient::TrimDocumentOutcome OcrClient::trimDocument(const TrimDocumentRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return TrimDocumentOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return TrimDocumentOutcome(TrimDocumentResult(outcome.result()));
|
||||
else
|
||||
return TrimDocumentOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OcrClient::trimDocumentAsync(const TrimDocumentRequest& request, const TrimDocumentAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, trimDocument(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OcrClient::TrimDocumentOutcomeCallable OcrClient::trimDocumentCallable(const TrimDocumentRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<TrimDocumentOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->trimDocument(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
51
ocr/src/model/GetAsyncJobResultRequest.cc
Normal file
51
ocr/src/model/GetAsyncJobResultRequest.cc
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/GetAsyncJobResultRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::GetAsyncJobResultRequest;
|
||||
|
||||
GetAsyncJobResultRequest::GetAsyncJobResultRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "GetAsyncJobResult")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
GetAsyncJobResultRequest::~GetAsyncJobResultRequest()
|
||||
{}
|
||||
|
||||
bool GetAsyncJobResultRequest::getAsync()const
|
||||
{
|
||||
return async_;
|
||||
}
|
||||
|
||||
void GetAsyncJobResultRequest::setAsync(bool async)
|
||||
{
|
||||
async_ = async;
|
||||
setBodyParameter("Async", async ? "true" : "false");
|
||||
}
|
||||
|
||||
std::string GetAsyncJobResultRequest::getJobId()const
|
||||
{
|
||||
return jobId_;
|
||||
}
|
||||
|
||||
void GetAsyncJobResultRequest::setJobId(const std::string& jobId)
|
||||
{
|
||||
jobId_ = jobId;
|
||||
setBodyParameter("JobId", jobId);
|
||||
}
|
||||
|
||||
60
ocr/src/model/GetAsyncJobResultResult.cc
Normal file
60
ocr/src/model/GetAsyncJobResultResult.cc
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/GetAsyncJobResultResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
GetAsyncJobResultResult::GetAsyncJobResultResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
GetAsyncJobResultResult::GetAsyncJobResultResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
GetAsyncJobResultResult::~GetAsyncJobResultResult()
|
||||
{}
|
||||
|
||||
void GetAsyncJobResultResult::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["ErrorCode"].isNull())
|
||||
data_.errorCode = dataNode["ErrorCode"].asString();
|
||||
if(!dataNode["ErrorMessage"].isNull())
|
||||
data_.errorMessage = dataNode["ErrorMessage"].asString();
|
||||
if(!dataNode["JobId"].isNull())
|
||||
data_.jobId = dataNode["JobId"].asString();
|
||||
if(!dataNode["Result"].isNull())
|
||||
data_.result = dataNode["Result"].asString();
|
||||
if(!dataNode["Status"].isNull())
|
||||
data_.status = dataNode["Status"].asString();
|
||||
|
||||
}
|
||||
|
||||
GetAsyncJobResultResult::Data GetAsyncJobResultResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
51
ocr/src/model/RecognizeAccountPageRequest.cc
Normal file
51
ocr/src/model/RecognizeAccountPageRequest.cc
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeAccountPageRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeAccountPageRequest;
|
||||
|
||||
RecognizeAccountPageRequest::RecognizeAccountPageRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeAccountPage")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeAccountPageRequest::~RecognizeAccountPageRequest()
|
||||
{}
|
||||
|
||||
int RecognizeAccountPageRequest::getImageType()const
|
||||
{
|
||||
return imageType_;
|
||||
}
|
||||
|
||||
void RecognizeAccountPageRequest::setImageType(int imageType)
|
||||
{
|
||||
imageType_ = imageType;
|
||||
setBodyParameter("ImageType", std::to_string(imageType));
|
||||
}
|
||||
|
||||
std::string RecognizeAccountPageRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeAccountPageRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
133
ocr/src/model/RecognizeAccountPageResult.cc
Normal file
133
ocr/src/model/RecognizeAccountPageResult.cc
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeAccountPageResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeAccountPageResult::RecognizeAccountPageResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeAccountPageResult::RecognizeAccountPageResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeAccountPageResult::~RecognizeAccountPageResult()
|
||||
{}
|
||||
|
||||
void RecognizeAccountPageResult::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::stof(dataNode["Angle"].asString());
|
||||
if(!dataNode["Name"].isNull())
|
||||
data_.name = dataNode["Name"].asString();
|
||||
if(!dataNode["Gender"].isNull())
|
||||
data_.gender = dataNode["Gender"].asString();
|
||||
if(!dataNode["Relation"].isNull())
|
||||
data_.relation = dataNode["Relation"].asString();
|
||||
if(!dataNode["BirthPlace"].isNull())
|
||||
data_.birthPlace = dataNode["BirthPlace"].asString();
|
||||
if(!dataNode["Nationality"].isNull())
|
||||
data_.nationality = dataNode["Nationality"].asString();
|
||||
if(!dataNode["NativePlace"].isNull())
|
||||
data_.nativePlace = dataNode["NativePlace"].asString();
|
||||
if(!dataNode["BirthDate"].isNull())
|
||||
data_.birthDate = dataNode["BirthDate"].asString();
|
||||
if(!dataNode["IDNumber"].isNull())
|
||||
data_.iDNumber = dataNode["IDNumber"].asString();
|
||||
auto allInvalidStampAreasNode = dataNode["InvalidStampAreas"]["InvalidStampArea"];
|
||||
for (auto dataNodeInvalidStampAreasInvalidStampArea : allInvalidStampAreasNode)
|
||||
{
|
||||
Data::InvalidStampArea invalidStampAreaObject;
|
||||
if(!dataNodeInvalidStampAreasInvalidStampArea["Left"].isNull())
|
||||
invalidStampAreaObject.left = std::stoi(dataNodeInvalidStampAreasInvalidStampArea["Left"].asString());
|
||||
if(!dataNodeInvalidStampAreasInvalidStampArea["Top"].isNull())
|
||||
invalidStampAreaObject.top = std::stoi(dataNodeInvalidStampAreasInvalidStampArea["Top"].asString());
|
||||
if(!dataNodeInvalidStampAreasInvalidStampArea["Height"].isNull())
|
||||
invalidStampAreaObject.height = std::stoi(dataNodeInvalidStampAreasInvalidStampArea["Height"].asString());
|
||||
if(!dataNodeInvalidStampAreasInvalidStampArea["Width"].isNull())
|
||||
invalidStampAreaObject.width = std::stoi(dataNodeInvalidStampAreasInvalidStampArea["Width"].asString());
|
||||
data_.invalidStampAreas.push_back(invalidStampAreaObject);
|
||||
}
|
||||
auto allUndertakeStampAreasNode = dataNode["UndertakeStampAreas"]["UndertakeStampArea"];
|
||||
for (auto dataNodeUndertakeStampAreasUndertakeStampArea : allUndertakeStampAreasNode)
|
||||
{
|
||||
Data::UndertakeStampArea undertakeStampAreaObject;
|
||||
if(!dataNodeUndertakeStampAreasUndertakeStampArea["Left"].isNull())
|
||||
undertakeStampAreaObject.left = std::stoi(dataNodeUndertakeStampAreasUndertakeStampArea["Left"].asString());
|
||||
if(!dataNodeUndertakeStampAreasUndertakeStampArea["Top"].isNull())
|
||||
undertakeStampAreaObject.top = std::stoi(dataNodeUndertakeStampAreasUndertakeStampArea["Top"].asString());
|
||||
if(!dataNodeUndertakeStampAreasUndertakeStampArea["Height"].isNull())
|
||||
undertakeStampAreaObject.height = std::stoi(dataNodeUndertakeStampAreasUndertakeStampArea["Height"].asString());
|
||||
if(!dataNodeUndertakeStampAreasUndertakeStampArea["Width"].isNull())
|
||||
undertakeStampAreaObject.width = std::stoi(dataNodeUndertakeStampAreasUndertakeStampArea["Width"].asString());
|
||||
data_.undertakeStampAreas.push_back(undertakeStampAreaObject);
|
||||
}
|
||||
auto allRegisterStampAreasNode = dataNode["RegisterStampAreas"]["RegisterStampArea"];
|
||||
for (auto dataNodeRegisterStampAreasRegisterStampArea : allRegisterStampAreasNode)
|
||||
{
|
||||
Data::RegisterStampArea registerStampAreaObject;
|
||||
if(!dataNodeRegisterStampAreasRegisterStampArea["Left"].isNull())
|
||||
registerStampAreaObject.left = std::stoi(dataNodeRegisterStampAreasRegisterStampArea["Left"].asString());
|
||||
if(!dataNodeRegisterStampAreasRegisterStampArea["Top"].isNull())
|
||||
registerStampAreaObject.top = std::stoi(dataNodeRegisterStampAreasRegisterStampArea["Top"].asString());
|
||||
if(!dataNodeRegisterStampAreasRegisterStampArea["Height"].isNull())
|
||||
registerStampAreaObject.height = std::stoi(dataNodeRegisterStampAreasRegisterStampArea["Height"].asString());
|
||||
if(!dataNodeRegisterStampAreasRegisterStampArea["Width"].isNull())
|
||||
registerStampAreaObject.width = std::stoi(dataNodeRegisterStampAreasRegisterStampArea["Width"].asString());
|
||||
data_.registerStampAreas.push_back(registerStampAreaObject);
|
||||
}
|
||||
auto allOtherStampAreasNode = dataNode["OtherStampAreas"]["OtherStampArea"];
|
||||
for (auto dataNodeOtherStampAreasOtherStampArea : allOtherStampAreasNode)
|
||||
{
|
||||
Data::OtherStampArea otherStampAreaObject;
|
||||
if(!dataNodeOtherStampAreasOtherStampArea["Left"].isNull())
|
||||
otherStampAreaObject.left = std::stoi(dataNodeOtherStampAreasOtherStampArea["Left"].asString());
|
||||
if(!dataNodeOtherStampAreasOtherStampArea["Top"].isNull())
|
||||
otherStampAreaObject.top = std::stoi(dataNodeOtherStampAreasOtherStampArea["Top"].asString());
|
||||
if(!dataNodeOtherStampAreasOtherStampArea["Height"].isNull())
|
||||
otherStampAreaObject.height = std::stoi(dataNodeOtherStampAreasOtherStampArea["Height"].asString());
|
||||
if(!dataNodeOtherStampAreasOtherStampArea["Width"].isNull())
|
||||
otherStampAreaObject.width = std::stoi(dataNodeOtherStampAreasOtherStampArea["Width"].asString());
|
||||
data_.otherStampAreas.push_back(otherStampAreaObject);
|
||||
}
|
||||
auto titleAreaNode = dataNode["TitleArea"];
|
||||
if(!titleAreaNode["Left"].isNull())
|
||||
data_.titleArea.left = std::stoi(titleAreaNode["Left"].asString());
|
||||
if(!titleAreaNode["Top"].isNull())
|
||||
data_.titleArea.top = std::stoi(titleAreaNode["Top"].asString());
|
||||
if(!titleAreaNode["Height"].isNull())
|
||||
data_.titleArea.height = std::stoi(titleAreaNode["Height"].asString());
|
||||
if(!titleAreaNode["Width"].isNull())
|
||||
data_.titleArea.width = std::stoi(titleAreaNode["Width"].asString());
|
||||
|
||||
}
|
||||
|
||||
RecognizeAccountPageResult::Data RecognizeAccountPageResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
51
ocr/src/model/RecognizeBankCardRequest.cc
Normal file
51
ocr/src/model/RecognizeBankCardRequest.cc
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeBankCardRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeBankCardRequest;
|
||||
|
||||
RecognizeBankCardRequest::RecognizeBankCardRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeBankCard")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeBankCardRequest::~RecognizeBankCardRequest()
|
||||
{}
|
||||
|
||||
int RecognizeBankCardRequest::getImageType()const
|
||||
{
|
||||
return imageType_;
|
||||
}
|
||||
|
||||
void RecognizeBankCardRequest::setImageType(int imageType)
|
||||
{
|
||||
imageType_ = imageType;
|
||||
setBodyParameter("ImageType", std::to_string(imageType));
|
||||
}
|
||||
|
||||
std::string RecognizeBankCardRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeBankCardRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
56
ocr/src/model/RecognizeBankCardResult.cc
Normal file
56
ocr/src/model/RecognizeBankCardResult.cc
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeBankCardResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeBankCardResult::RecognizeBankCardResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeBankCardResult::RecognizeBankCardResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeBankCardResult::~RecognizeBankCardResult()
|
||||
{}
|
||||
|
||||
void RecognizeBankCardResult::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["BankName"].isNull())
|
||||
data_.bankName = dataNode["BankName"].asString();
|
||||
if(!dataNode["CardNumber"].isNull())
|
||||
data_.cardNumber = dataNode["CardNumber"].asString();
|
||||
if(!dataNode["ValidDate"].isNull())
|
||||
data_.validDate = dataNode["ValidDate"].asString();
|
||||
|
||||
}
|
||||
|
||||
RecognizeBankCardResult::Data RecognizeBankCardResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
51
ocr/src/model/RecognizeBusinessCardRequest.cc
Normal file
51
ocr/src/model/RecognizeBusinessCardRequest.cc
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeBusinessCardRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeBusinessCardRequest;
|
||||
|
||||
RecognizeBusinessCardRequest::RecognizeBusinessCardRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeBusinessCard")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeBusinessCardRequest::~RecognizeBusinessCardRequest()
|
||||
{}
|
||||
|
||||
int RecognizeBusinessCardRequest::getImageType()const
|
||||
{
|
||||
return imageType_;
|
||||
}
|
||||
|
||||
void RecognizeBusinessCardRequest::setImageType(int imageType)
|
||||
{
|
||||
imageType_ = imageType;
|
||||
setBodyParameter("ImageType", std::to_string(imageType));
|
||||
}
|
||||
|
||||
std::string RecognizeBusinessCardRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeBusinessCardRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
73
ocr/src/model/RecognizeBusinessCardResult.cc
Normal file
73
ocr/src/model/RecognizeBusinessCardResult.cc
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeBusinessCardResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeBusinessCardResult::RecognizeBusinessCardResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeBusinessCardResult::RecognizeBusinessCardResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeBusinessCardResult::~RecognizeBusinessCardResult()
|
||||
{}
|
||||
|
||||
void RecognizeBusinessCardResult::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["Name"].isNull())
|
||||
data_.name = dataNode["Name"].asString();
|
||||
auto allCompanies = dataNode["Companies"]["Company"];
|
||||
for (auto value : allCompanies)
|
||||
data_.companies.push_back(value.asString());
|
||||
auto allDepartments = dataNode["Departments"]["Department"];
|
||||
for (auto value : allDepartments)
|
||||
data_.departments.push_back(value.asString());
|
||||
auto allTitles = dataNode["Titles"]["Title"];
|
||||
for (auto value : allTitles)
|
||||
data_.titles.push_back(value.asString());
|
||||
auto allCellPhoneNumbers = dataNode["CellPhoneNumbers"]["CellPhoneNumber"];
|
||||
for (auto value : allCellPhoneNumbers)
|
||||
data_.cellPhoneNumbers.push_back(value.asString());
|
||||
auto allOfficePhoneNumbers = dataNode["OfficePhoneNumbers"]["OfficePhoneNumber"];
|
||||
for (auto value : allOfficePhoneNumbers)
|
||||
data_.officePhoneNumbers.push_back(value.asString());
|
||||
auto allAddresses = dataNode["Addresses"]["Address"];
|
||||
for (auto value : allAddresses)
|
||||
data_.addresses.push_back(value.asString());
|
||||
auto allEmails = dataNode["Emails"]["Email"];
|
||||
for (auto value : allEmails)
|
||||
data_.emails.push_back(value.asString());
|
||||
|
||||
}
|
||||
|
||||
RecognizeBusinessCardResult::Data RecognizeBusinessCardResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
51
ocr/src/model/RecognizeBusinessLicenseRequest.cc
Normal file
51
ocr/src/model/RecognizeBusinessLicenseRequest.cc
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeBusinessLicenseRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeBusinessLicenseRequest;
|
||||
|
||||
RecognizeBusinessLicenseRequest::RecognizeBusinessLicenseRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeBusinessLicense")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeBusinessLicenseRequest::~RecognizeBusinessLicenseRequest()
|
||||
{}
|
||||
|
||||
int RecognizeBusinessLicenseRequest::getImageType()const
|
||||
{
|
||||
return imageType_;
|
||||
}
|
||||
|
||||
void RecognizeBusinessLicenseRequest::setImageType(int imageType)
|
||||
{
|
||||
imageType_ = imageType;
|
||||
setBodyParameter("ImageType", std::to_string(imageType));
|
||||
}
|
||||
|
||||
std::string RecognizeBusinessLicenseRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeBusinessLicenseRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
106
ocr/src/model/RecognizeBusinessLicenseResult.cc
Normal file
106
ocr/src/model/RecognizeBusinessLicenseResult.cc
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeBusinessLicenseResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeBusinessLicenseResult::RecognizeBusinessLicenseResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeBusinessLicenseResult::RecognizeBusinessLicenseResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeBusinessLicenseResult::~RecognizeBusinessLicenseResult()
|
||||
{}
|
||||
|
||||
void RecognizeBusinessLicenseResult::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 = dataNode["Angle"].asString();
|
||||
if(!dataNode["RegisterNumber"].isNull())
|
||||
data_.registerNumber = dataNode["RegisterNumber"].asString();
|
||||
if(!dataNode["Name"].isNull())
|
||||
data_.name = dataNode["Name"].asString();
|
||||
if(!dataNode["Type"].isNull())
|
||||
data_.type = dataNode["Type"].asString();
|
||||
if(!dataNode["LegalPerson"].isNull())
|
||||
data_.legalPerson = dataNode["LegalPerson"].asString();
|
||||
if(!dataNode["EstablishDate"].isNull())
|
||||
data_.establishDate = dataNode["EstablishDate"].asString();
|
||||
if(!dataNode["ValidPeriod"].isNull())
|
||||
data_.validPeriod = dataNode["ValidPeriod"].asString();
|
||||
if(!dataNode["Address"].isNull())
|
||||
data_.address = dataNode["Address"].asString();
|
||||
if(!dataNode["Capital"].isNull())
|
||||
data_.capital = dataNode["Capital"].asString();
|
||||
if(!dataNode["Business"].isNull())
|
||||
data_.business = dataNode["Business"].asString();
|
||||
auto emblemNode = dataNode["Emblem"];
|
||||
if(!emblemNode["Top"].isNull())
|
||||
data_.emblem.top = std::stoi(emblemNode["Top"].asString());
|
||||
if(!emblemNode["Left"].isNull())
|
||||
data_.emblem.left = std::stoi(emblemNode["Left"].asString());
|
||||
if(!emblemNode["Height"].isNull())
|
||||
data_.emblem.height = std::stoi(emblemNode["Height"].asString());
|
||||
if(!emblemNode["Width"].isNull())
|
||||
data_.emblem.width = std::stoi(emblemNode["Width"].asString());
|
||||
auto titleNode = dataNode["Title"];
|
||||
if(!titleNode["Top"].isNull())
|
||||
data_.title.top = std::stoi(titleNode["Top"].asString());
|
||||
if(!titleNode["Left"].isNull())
|
||||
data_.title.left = std::stoi(titleNode["Left"].asString());
|
||||
if(!titleNode["Height"].isNull())
|
||||
data_.title.height = std::stoi(titleNode["Height"].asString());
|
||||
if(!titleNode["Width"].isNull())
|
||||
data_.title.width = std::stoi(titleNode["Width"].asString());
|
||||
auto stampNode = dataNode["Stamp"];
|
||||
if(!stampNode["Top"].isNull())
|
||||
data_.stamp.top = std::stoi(stampNode["Top"].asString());
|
||||
if(!stampNode["Left"].isNull())
|
||||
data_.stamp.left = std::stoi(stampNode["Left"].asString());
|
||||
if(!stampNode["Height"].isNull())
|
||||
data_.stamp.height = std::stoi(stampNode["Height"].asString());
|
||||
if(!stampNode["Width"].isNull())
|
||||
data_.stamp.width = std::stoi(stampNode["Width"].asString());
|
||||
auto qRCodeNode = dataNode["QRCode"];
|
||||
if(!qRCodeNode["Top"].isNull())
|
||||
data_.qRCode.top = std::stoi(qRCodeNode["Top"].asString());
|
||||
if(!qRCodeNode["Left"].isNull())
|
||||
data_.qRCode.left = std::stoi(qRCodeNode["Left"].asString());
|
||||
if(!qRCodeNode["Height"].isNull())
|
||||
data_.qRCode.height = std::stoi(qRCodeNode["Height"].asString());
|
||||
if(!qRCodeNode["Width"].isNull())
|
||||
data_.qRCode.width = std::stoi(qRCodeNode["Width"].asString());
|
||||
|
||||
}
|
||||
|
||||
RecognizeBusinessLicenseResult::Data RecognizeBusinessLicenseResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
73
ocr/src/model/RecognizeCharacterRequest.cc
Normal file
73
ocr/src/model/RecognizeCharacterRequest.cc
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeCharacterRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeCharacterRequest;
|
||||
|
||||
RecognizeCharacterRequest::RecognizeCharacterRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeCharacter")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeCharacterRequest::~RecognizeCharacterRequest()
|
||||
{}
|
||||
|
||||
int RecognizeCharacterRequest::getImageType()const
|
||||
{
|
||||
return imageType_;
|
||||
}
|
||||
|
||||
void RecognizeCharacterRequest::setImageType(int imageType)
|
||||
{
|
||||
imageType_ = imageType;
|
||||
setBodyParameter("ImageType", std::to_string(imageType));
|
||||
}
|
||||
|
||||
bool RecognizeCharacterRequest::getOutputProbability()const
|
||||
{
|
||||
return outputProbability_;
|
||||
}
|
||||
|
||||
void RecognizeCharacterRequest::setOutputProbability(bool outputProbability)
|
||||
{
|
||||
outputProbability_ = outputProbability;
|
||||
setBodyParameter("OutputProbability", outputProbability ? "true" : "false");
|
||||
}
|
||||
|
||||
std::string RecognizeCharacterRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeCharacterRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
int RecognizeCharacterRequest::getMinHeight()const
|
||||
{
|
||||
return minHeight_;
|
||||
}
|
||||
|
||||
void RecognizeCharacterRequest::setMinHeight(int minHeight)
|
||||
{
|
||||
minHeight_ = minHeight;
|
||||
setBodyParameter("MinHeight", std::to_string(minHeight));
|
||||
}
|
||||
|
||||
71
ocr/src/model/RecognizeCharacterResult.cc
Normal file
71
ocr/src/model/RecognizeCharacterResult.cc
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeCharacterResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeCharacterResult::RecognizeCharacterResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeCharacterResult::RecognizeCharacterResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeCharacterResult::~RecognizeCharacterResult()
|
||||
{}
|
||||
|
||||
void RecognizeCharacterResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
auto allResultsNode = dataNode["Results"]["Result"];
|
||||
for (auto dataNodeResultsResult : allResultsNode)
|
||||
{
|
||||
Data::Result resultObject;
|
||||
if(!dataNodeResultsResult["Probability"].isNull())
|
||||
resultObject.probability = std::stof(dataNodeResultsResult["Probability"].asString());
|
||||
if(!dataNodeResultsResult["Text"].isNull())
|
||||
resultObject.text = dataNodeResultsResult["Text"].asString();
|
||||
auto textRectanglesNode = value["TextRectangles"];
|
||||
if(!textRectanglesNode["Angle"].isNull())
|
||||
resultObject.textRectangles.angle = std::stoi(textRectanglesNode["Angle"].asString());
|
||||
if(!textRectanglesNode["Left"].isNull())
|
||||
resultObject.textRectangles.left = std::stoi(textRectanglesNode["Left"].asString());
|
||||
if(!textRectanglesNode["Top"].isNull())
|
||||
resultObject.textRectangles.top = std::stoi(textRectanglesNode["Top"].asString());
|
||||
if(!textRectanglesNode["Width"].isNull())
|
||||
resultObject.textRectangles.width = std::stoi(textRectanglesNode["Width"].asString());
|
||||
if(!textRectanglesNode["Height"].isNull())
|
||||
resultObject.textRectangles.height = std::stoi(textRectanglesNode["Height"].asString());
|
||||
data_.results.push_back(resultObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RecognizeCharacterResult::Data RecognizeCharacterResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
40
ocr/src/model/RecognizeChinapassportRequest.cc
Normal file
40
ocr/src/model/RecognizeChinapassportRequest.cc
Normal file
@@ -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 <alibabacloud/ocr/model/RecognizeChinapassportRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeChinapassportRequest;
|
||||
|
||||
RecognizeChinapassportRequest::RecognizeChinapassportRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeChinapassport")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeChinapassportRequest::~RecognizeChinapassportRequest()
|
||||
{}
|
||||
|
||||
std::string RecognizeChinapassportRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeChinapassportRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
94
ocr/src/model/RecognizeChinapassportResult.cc
Normal file
94
ocr/src/model/RecognizeChinapassportResult.cc
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeChinapassportResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeChinapassportResult::RecognizeChinapassportResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeChinapassportResult::RecognizeChinapassportResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeChinapassportResult::~RecognizeChinapassportResult()
|
||||
{}
|
||||
|
||||
void RecognizeChinapassportResult::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["Authority"].isNull())
|
||||
data_.authority = dataNode["Authority"].asString();
|
||||
if(!dataNode["BirthDate"].isNull())
|
||||
data_.birthDate = dataNode["BirthDate"].asString();
|
||||
if(!dataNode["BirthDay"].isNull())
|
||||
data_.birthDay = dataNode["BirthDay"].asString();
|
||||
if(!dataNode["BirthPlace"].isNull())
|
||||
data_.birthPlace = dataNode["BirthPlace"].asString();
|
||||
if(!dataNode["BirthPlaceRaw"].isNull())
|
||||
data_.birthPlaceRaw = dataNode["BirthPlaceRaw"].asString();
|
||||
if(!dataNode["Country"].isNull())
|
||||
data_.country = dataNode["Country"].asString();
|
||||
if(!dataNode["ExpiryDate"].isNull())
|
||||
data_.expiryDate = dataNode["ExpiryDate"].asString();
|
||||
if(!dataNode["ExpiryDay"].isNull())
|
||||
data_.expiryDay = dataNode["ExpiryDay"].asString();
|
||||
if(!dataNode["IssueDate"].isNull())
|
||||
data_.issueDate = dataNode["IssueDate"].asString();
|
||||
if(!dataNode["IssuePlace"].isNull())
|
||||
data_.issuePlace = dataNode["IssuePlace"].asString();
|
||||
if(!dataNode["IssuePlaceRaw"].isNull())
|
||||
data_.issuePlaceRaw = dataNode["IssuePlaceRaw"].asString();
|
||||
if(!dataNode["LineZero"].isNull())
|
||||
data_.lineZero = dataNode["LineZero"].asString();
|
||||
if(!dataNode["LineOne"].isNull())
|
||||
data_.lineOne = dataNode["LineOne"].asString();
|
||||
if(!dataNode["Name"].isNull())
|
||||
data_.name = dataNode["Name"].asString();
|
||||
if(!dataNode["NameChinese"].isNull())
|
||||
data_.nameChinese = dataNode["NameChinese"].asString();
|
||||
if(!dataNode["NameChineseRaw"].isNull())
|
||||
data_.nameChineseRaw = dataNode["NameChineseRaw"].asString();
|
||||
if(!dataNode["PassportNo"].isNull())
|
||||
data_.passportNo = dataNode["PassportNo"].asString();
|
||||
if(!dataNode["PersonId"].isNull())
|
||||
data_.personId = dataNode["PersonId"].asString();
|
||||
if(!dataNode["Sex"].isNull())
|
||||
data_.sex = dataNode["Sex"].asString();
|
||||
if(!dataNode["SourceCountry"].isNull())
|
||||
data_.sourceCountry = dataNode["SourceCountry"].asString();
|
||||
if(!dataNode["Success"].isNull())
|
||||
data_.success = dataNode["Success"].asString() == "true";
|
||||
if(!dataNode["Type"].isNull())
|
||||
data_.type = dataNode["Type"].asString();
|
||||
|
||||
}
|
||||
|
||||
RecognizeChinapassportResult::Data RecognizeChinapassportResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
62
ocr/src/model/RecognizeDriverLicenseRequest.cc
Normal file
62
ocr/src/model/RecognizeDriverLicenseRequest.cc
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeDriverLicenseRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeDriverLicenseRequest;
|
||||
|
||||
RecognizeDriverLicenseRequest::RecognizeDriverLicenseRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeDriverLicense")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeDriverLicenseRequest::~RecognizeDriverLicenseRequest()
|
||||
{}
|
||||
|
||||
int RecognizeDriverLicenseRequest::getImageType()const
|
||||
{
|
||||
return imageType_;
|
||||
}
|
||||
|
||||
void RecognizeDriverLicenseRequest::setImageType(int imageType)
|
||||
{
|
||||
imageType_ = imageType;
|
||||
setBodyParameter("ImageType", std::to_string(imageType));
|
||||
}
|
||||
|
||||
std::string RecognizeDriverLicenseRequest::getSide()const
|
||||
{
|
||||
return side_;
|
||||
}
|
||||
|
||||
void RecognizeDriverLicenseRequest::setSide(const std::string& side)
|
||||
{
|
||||
side_ = side;
|
||||
setBodyParameter("Side", side);
|
||||
}
|
||||
|
||||
std::string RecognizeDriverLicenseRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeDriverLicenseRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
70
ocr/src/model/RecognizeDriverLicenseResult.cc
Normal file
70
ocr/src/model/RecognizeDriverLicenseResult.cc
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeDriverLicenseResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeDriverLicenseResult::RecognizeDriverLicenseResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeDriverLicenseResult::RecognizeDriverLicenseResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeDriverLicenseResult::~RecognizeDriverLicenseResult()
|
||||
{}
|
||||
|
||||
void RecognizeDriverLicenseResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
auto faceResultNode = dataNode["FaceResult"];
|
||||
if(!faceResultNode["Name"].isNull())
|
||||
data_.faceResult.name = faceResultNode["Name"].asString();
|
||||
if(!faceResultNode["LicenseNumber"].isNull())
|
||||
data_.faceResult.licenseNumber = faceResultNode["LicenseNumber"].asString();
|
||||
if(!faceResultNode["VehicleType"].isNull())
|
||||
data_.faceResult.vehicleType = faceResultNode["VehicleType"].asString();
|
||||
if(!faceResultNode["StartDate"].isNull())
|
||||
data_.faceResult.startDate = faceResultNode["StartDate"].asString();
|
||||
if(!faceResultNode["EndDate"].isNull())
|
||||
data_.faceResult.endDate = faceResultNode["EndDate"].asString();
|
||||
if(!faceResultNode["IssueDate"].isNull())
|
||||
data_.faceResult.issueDate = faceResultNode["IssueDate"].asString();
|
||||
if(!faceResultNode["Address"].isNull())
|
||||
data_.faceResult.address = faceResultNode["Address"].asString();
|
||||
if(!faceResultNode["Gender"].isNull())
|
||||
data_.faceResult.gender = faceResultNode["Gender"].asString();
|
||||
auto backResultNode = dataNode["BackResult"];
|
||||
if(!backResultNode["ArchiveNumber"].isNull())
|
||||
data_.backResult.archiveNumber = backResultNode["ArchiveNumber"].asString();
|
||||
|
||||
}
|
||||
|
||||
RecognizeDriverLicenseResult::Data RecognizeDriverLicenseResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
62
ocr/src/model/RecognizeDrivingLicenseRequest.cc
Normal file
62
ocr/src/model/RecognizeDrivingLicenseRequest.cc
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeDrivingLicenseRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeDrivingLicenseRequest;
|
||||
|
||||
RecognizeDrivingLicenseRequest::RecognizeDrivingLicenseRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeDrivingLicense")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeDrivingLicenseRequest::~RecognizeDrivingLicenseRequest()
|
||||
{}
|
||||
|
||||
int RecognizeDrivingLicenseRequest::getImageType()const
|
||||
{
|
||||
return imageType_;
|
||||
}
|
||||
|
||||
void RecognizeDrivingLicenseRequest::setImageType(int imageType)
|
||||
{
|
||||
imageType_ = imageType;
|
||||
setBodyParameter("ImageType", std::to_string(imageType));
|
||||
}
|
||||
|
||||
std::string RecognizeDrivingLicenseRequest::getSide()const
|
||||
{
|
||||
return side_;
|
||||
}
|
||||
|
||||
void RecognizeDrivingLicenseRequest::setSide(const std::string& side)
|
||||
{
|
||||
side_ = side;
|
||||
setBodyParameter("Side", side);
|
||||
}
|
||||
|
||||
std::string RecognizeDrivingLicenseRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeDrivingLicenseRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
92
ocr/src/model/RecognizeDrivingLicenseResult.cc
Normal file
92
ocr/src/model/RecognizeDrivingLicenseResult.cc
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeDrivingLicenseResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeDrivingLicenseResult::RecognizeDrivingLicenseResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeDrivingLicenseResult::RecognizeDrivingLicenseResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeDrivingLicenseResult::~RecognizeDrivingLicenseResult()
|
||||
{}
|
||||
|
||||
void RecognizeDrivingLicenseResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
auto faceResultNode = dataNode["FaceResult"];
|
||||
if(!faceResultNode["PlateNumber"].isNull())
|
||||
data_.faceResult.plateNumber = faceResultNode["PlateNumber"].asString();
|
||||
if(!faceResultNode["VehicleType"].isNull())
|
||||
data_.faceResult.vehicleType = faceResultNode["VehicleType"].asString();
|
||||
if(!faceResultNode["Owner"].isNull())
|
||||
data_.faceResult.owner = faceResultNode["Owner"].asString();
|
||||
if(!faceResultNode["UseCharacter"].isNull())
|
||||
data_.faceResult.useCharacter = faceResultNode["UseCharacter"].asString();
|
||||
if(!faceResultNode["Address"].isNull())
|
||||
data_.faceResult.address = faceResultNode["Address"].asString();
|
||||
if(!faceResultNode["Model"].isNull())
|
||||
data_.faceResult.model = faceResultNode["Model"].asString();
|
||||
if(!faceResultNode["Vin"].isNull())
|
||||
data_.faceResult.vin = faceResultNode["Vin"].asString();
|
||||
if(!faceResultNode["EngineNumber"].isNull())
|
||||
data_.faceResult.engineNumber = faceResultNode["EngineNumber"].asString();
|
||||
if(!faceResultNode["RegisterDate"].isNull())
|
||||
data_.faceResult.registerDate = faceResultNode["RegisterDate"].asString();
|
||||
if(!faceResultNode["IssueDate"].isNull())
|
||||
data_.faceResult.issueDate = faceResultNode["IssueDate"].asString();
|
||||
auto backResultNode = dataNode["BackResult"];
|
||||
if(!backResultNode["ApprovedPassengerCapacity"].isNull())
|
||||
data_.backResult.approvedPassengerCapacity = backResultNode["ApprovedPassengerCapacity"].asString();
|
||||
if(!backResultNode["ApprovedLoad"].isNull())
|
||||
data_.backResult.approvedLoad = backResultNode["ApprovedLoad"].asString();
|
||||
if(!backResultNode["FileNumber"].isNull())
|
||||
data_.backResult.fileNumber = backResultNode["FileNumber"].asString();
|
||||
if(!backResultNode["GrossMass"].isNull())
|
||||
data_.backResult.grossMass = backResultNode["GrossMass"].asString();
|
||||
if(!backResultNode["EnergyType"].isNull())
|
||||
data_.backResult.energyType = backResultNode["EnergyType"].asString();
|
||||
if(!backResultNode["InspectionRecord"].isNull())
|
||||
data_.backResult.inspectionRecord = backResultNode["InspectionRecord"].asString();
|
||||
if(!backResultNode["OverallDimension"].isNull())
|
||||
data_.backResult.overallDimension = backResultNode["OverallDimension"].asString();
|
||||
if(!backResultNode["TractionMass"].isNull())
|
||||
data_.backResult.tractionMass = backResultNode["TractionMass"].asString();
|
||||
if(!backResultNode["UnladenMass"].isNull())
|
||||
data_.backResult.unladenMass = backResultNode["UnladenMass"].asString();
|
||||
if(!backResultNode["PlateNumber"].isNull())
|
||||
data_.backResult.plateNumber = backResultNode["PlateNumber"].asString();
|
||||
|
||||
}
|
||||
|
||||
RecognizeDrivingLicenseResult::Data RecognizeDrivingLicenseResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
62
ocr/src/model/RecognizeIdentityCardRequest.cc
Normal file
62
ocr/src/model/RecognizeIdentityCardRequest.cc
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeIdentityCardRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeIdentityCardRequest;
|
||||
|
||||
RecognizeIdentityCardRequest::RecognizeIdentityCardRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeIdentityCard")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeIdentityCardRequest::~RecognizeIdentityCardRequest()
|
||||
{}
|
||||
|
||||
int RecognizeIdentityCardRequest::getImageType()const
|
||||
{
|
||||
return imageType_;
|
||||
}
|
||||
|
||||
void RecognizeIdentityCardRequest::setImageType(int imageType)
|
||||
{
|
||||
imageType_ = imageType;
|
||||
setBodyParameter("ImageType", std::to_string(imageType));
|
||||
}
|
||||
|
||||
std::string RecognizeIdentityCardRequest::getSide()const
|
||||
{
|
||||
return side_;
|
||||
}
|
||||
|
||||
void RecognizeIdentityCardRequest::setSide(const std::string& side)
|
||||
{
|
||||
side_ = side;
|
||||
setBodyParameter("Side", side);
|
||||
}
|
||||
|
||||
std::string RecognizeIdentityCardRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeIdentityCardRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
103
ocr/src/model/RecognizeIdentityCardResult.cc
Normal file
103
ocr/src/model/RecognizeIdentityCardResult.cc
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeIdentityCardResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeIdentityCardResult::RecognizeIdentityCardResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeIdentityCardResult::RecognizeIdentityCardResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeIdentityCardResult::~RecognizeIdentityCardResult()
|
||||
{}
|
||||
|
||||
void RecognizeIdentityCardResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
auto frontResultNode = dataNode["FrontResult"];
|
||||
if(!frontResultNode["Address"].isNull())
|
||||
data_.frontResult.address = frontResultNode["Address"].asString();
|
||||
if(!frontResultNode["Name"].isNull())
|
||||
data_.frontResult.name = frontResultNode["Name"].asString();
|
||||
if(!frontResultNode["Nationality"].isNull())
|
||||
data_.frontResult.nationality = frontResultNode["Nationality"].asString();
|
||||
if(!frontResultNode["IDNumber"].isNull())
|
||||
data_.frontResult.iDNumber = frontResultNode["IDNumber"].asString();
|
||||
if(!frontResultNode["Gender"].isNull())
|
||||
data_.frontResult.gender = frontResultNode["Gender"].asString();
|
||||
if(!frontResultNode["BirthDate"].isNull())
|
||||
data_.frontResult.birthDate = frontResultNode["BirthDate"].asString();
|
||||
auto allCardAreasNode = frontResultNode["CardAreas"]["CardArea"];
|
||||
for (auto frontResultNodeCardAreasCardArea : allCardAreasNode)
|
||||
{
|
||||
Data::FrontResult::CardArea cardAreaObject;
|
||||
if(!frontResultNodeCardAreasCardArea["X"].isNull())
|
||||
cardAreaObject.x = std::stof(frontResultNodeCardAreasCardArea["X"].asString());
|
||||
if(!frontResultNodeCardAreasCardArea["Y"].isNull())
|
||||
cardAreaObject.y = std::stof(frontResultNodeCardAreasCardArea["Y"].asString());
|
||||
data_.frontResult.cardAreas.push_back(cardAreaObject);
|
||||
}
|
||||
auto allFaceRectVerticesNode = frontResultNode["FaceRectVertices"]["FaceRectVertice"];
|
||||
for (auto frontResultNodeFaceRectVerticesFaceRectVertice : allFaceRectVerticesNode)
|
||||
{
|
||||
Data::FrontResult::FaceRectVertice faceRectVerticeObject;
|
||||
if(!frontResultNodeFaceRectVerticesFaceRectVertice["X"].isNull())
|
||||
faceRectVerticeObject.x = std::stof(frontResultNodeFaceRectVerticesFaceRectVertice["X"].asString());
|
||||
if(!frontResultNodeFaceRectVerticesFaceRectVertice["Y"].isNull())
|
||||
faceRectVerticeObject.y = std::stof(frontResultNodeFaceRectVerticesFaceRectVertice["Y"].asString());
|
||||
data_.frontResult.faceRectVertices.push_back(faceRectVerticeObject);
|
||||
}
|
||||
auto faceRectangleNode = frontResultNode["FaceRectangle"];
|
||||
if(!faceRectangleNode["Angle"].isNull())
|
||||
data_.frontResult.faceRectangle.angle = std::stof(faceRectangleNode["Angle"].asString());
|
||||
auto centerNode = faceRectangleNode["Center"];
|
||||
if(!centerNode["X"].isNull())
|
||||
data_.frontResult.faceRectangle.center.x = std::stof(centerNode["X"].asString());
|
||||
if(!centerNode["Y"].isNull())
|
||||
data_.frontResult.faceRectangle.center.y = std::stof(centerNode["Y"].asString());
|
||||
auto sizeNode = faceRectangleNode["Size"];
|
||||
if(!sizeNode["Height"].isNull())
|
||||
data_.frontResult.faceRectangle.size.height = std::stof(sizeNode["Height"].asString());
|
||||
if(!sizeNode["Width"].isNull())
|
||||
data_.frontResult.faceRectangle.size.width = std::stof(sizeNode["Width"].asString());
|
||||
auto backResultNode = dataNode["BackResult"];
|
||||
if(!backResultNode["StartDate"].isNull())
|
||||
data_.backResult.startDate = backResultNode["StartDate"].asString();
|
||||
if(!backResultNode["EndDate"].isNull())
|
||||
data_.backResult.endDate = backResultNode["EndDate"].asString();
|
||||
if(!backResultNode["Issue"].isNull())
|
||||
data_.backResult.issue = backResultNode["Issue"].asString();
|
||||
|
||||
}
|
||||
|
||||
RecognizeIdentityCardResult::Data RecognizeIdentityCardResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
51
ocr/src/model/RecognizeLicensePlateRequest.cc
Normal file
51
ocr/src/model/RecognizeLicensePlateRequest.cc
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeLicensePlateRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeLicensePlateRequest;
|
||||
|
||||
RecognizeLicensePlateRequest::RecognizeLicensePlateRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeLicensePlate")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeLicensePlateRequest::~RecognizeLicensePlateRequest()
|
||||
{}
|
||||
|
||||
int RecognizeLicensePlateRequest::getImageType()const
|
||||
{
|
||||
return imageType_;
|
||||
}
|
||||
|
||||
void RecognizeLicensePlateRequest::setImageType(int imageType)
|
||||
{
|
||||
imageType_ = imageType;
|
||||
setBodyParameter("ImageType", std::to_string(imageType));
|
||||
}
|
||||
|
||||
std::string RecognizeLicensePlateRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeLicensePlateRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
73
ocr/src/model/RecognizeLicensePlateResult.cc
Normal file
73
ocr/src/model/RecognizeLicensePlateResult.cc
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeLicensePlateResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeLicensePlateResult::RecognizeLicensePlateResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeLicensePlateResult::RecognizeLicensePlateResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeLicensePlateResult::~RecognizeLicensePlateResult()
|
||||
{}
|
||||
|
||||
void RecognizeLicensePlateResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
auto allPlatesNode = dataNode["Plates"]["Plate"];
|
||||
for (auto dataNodePlatesPlate : allPlatesNode)
|
||||
{
|
||||
Data::Plate plateObject;
|
||||
if(!dataNodePlatesPlate["Confidence"].isNull())
|
||||
plateObject.confidence = std::stof(dataNodePlatesPlate["Confidence"].asString());
|
||||
if(!dataNodePlatesPlate["PlateNumber"].isNull())
|
||||
plateObject.plateNumber = dataNodePlatesPlate["PlateNumber"].asString();
|
||||
if(!dataNodePlatesPlate["PlateType"].isNull())
|
||||
plateObject.plateType = dataNodePlatesPlate["PlateType"].asString();
|
||||
if(!dataNodePlatesPlate["PlateTypeConfidence"].isNull())
|
||||
plateObject.plateTypeConfidence = std::stof(dataNodePlatesPlate["PlateTypeConfidence"].asString());
|
||||
auto roiNode = value["Roi"];
|
||||
if(!roiNode["H"].isNull())
|
||||
plateObject.roi.h = std::stoi(roiNode["H"].asString());
|
||||
if(!roiNode["W"].isNull())
|
||||
plateObject.roi.w = std::stoi(roiNode["W"].asString());
|
||||
if(!roiNode["X"].isNull())
|
||||
plateObject.roi.x = std::stoi(roiNode["X"].asString());
|
||||
if(!roiNode["Y"].isNull())
|
||||
plateObject.roi.y = std::stoi(roiNode["Y"].asString());
|
||||
data_.plates.push_back(plateObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RecognizeLicensePlateResult::Data RecognizeLicensePlateResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
40
ocr/src/model/RecognizePassportMRZRequest.cc
Normal file
40
ocr/src/model/RecognizePassportMRZRequest.cc
Normal file
@@ -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 <alibabacloud/ocr/model/RecognizePassportMRZRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizePassportMRZRequest;
|
||||
|
||||
RecognizePassportMRZRequest::RecognizePassportMRZRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizePassportMRZ")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizePassportMRZRequest::~RecognizePassportMRZRequest()
|
||||
{}
|
||||
|
||||
std::string RecognizePassportMRZRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizePassportMRZRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
67
ocr/src/model/RecognizePassportMRZResult.cc
Normal file
67
ocr/src/model/RecognizePassportMRZResult.cc
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizePassportMRZResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizePassportMRZResult::RecognizePassportMRZResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizePassportMRZResult::RecognizePassportMRZResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizePassportMRZResult::~RecognizePassportMRZResult()
|
||||
{}
|
||||
|
||||
void RecognizePassportMRZResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
auto allRegionsNode = dataNode["Regions"]["Region"];
|
||||
for (auto dataNodeRegionsRegion : allRegionsNode)
|
||||
{
|
||||
Data::Region regionObject;
|
||||
if(!dataNodeRegionsRegion["Name"].isNull())
|
||||
regionObject.name = dataNodeRegionsRegion["Name"].asString();
|
||||
if(!dataNodeRegionsRegion["RecognitionScore"].isNull())
|
||||
regionObject.recognitionScore = std::stof(dataNodeRegionsRegion["RecognitionScore"].asString());
|
||||
if(!dataNodeRegionsRegion["Content"].isNull())
|
||||
regionObject.content = dataNodeRegionsRegion["Content"].asString();
|
||||
if(!dataNodeRegionsRegion["DetectionScore"].isNull())
|
||||
regionObject.detectionScore = std::stof(dataNodeRegionsRegion["DetectionScore"].asString());
|
||||
auto allBandBoxes = value["BandBoxes"]["BandBox"];
|
||||
for (auto value : allBandBoxes)
|
||||
regionObject.bandBoxes.push_back(value.asString());
|
||||
data_.regions.push_back(regionObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RecognizePassportMRZResult::Data RecognizePassportMRZResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
44
ocr/src/model/RecognizeQrCodeRequest.cc
Normal file
44
ocr/src/model/RecognizeQrCodeRequest.cc
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeQrCodeRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeQrCodeRequest;
|
||||
|
||||
RecognizeQrCodeRequest::RecognizeQrCodeRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeQrCode")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeQrCodeRequest::~RecognizeQrCodeRequest()
|
||||
{}
|
||||
|
||||
std::vector<RecognizeQrCodeRequest::Tasks> RecognizeQrCodeRequest::getTasks()const
|
||||
{
|
||||
return tasks_;
|
||||
}
|
||||
|
||||
void RecognizeQrCodeRequest::setTasks(const std::vector<Tasks>& tasks)
|
||||
{
|
||||
tasks_ = tasks;
|
||||
for(int dep1 = 0; dep1!= tasks.size(); dep1++) {
|
||||
auto tasksObj = tasks.at(dep1);
|
||||
std::string tasksObjStr = "Tasks." + std::to_string(dep1 + 1);
|
||||
setParameter(tasksObjStr + ".ImageURL", tasksObj.imageURL);
|
||||
}
|
||||
}
|
||||
|
||||
75
ocr/src/model/RecognizeQrCodeResult.cc
Normal file
75
ocr/src/model/RecognizeQrCodeResult.cc
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeQrCodeResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeQrCodeResult::RecognizeQrCodeResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeQrCodeResult::RecognizeQrCodeResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeQrCodeResult::~RecognizeQrCodeResult()
|
||||
{}
|
||||
|
||||
void RecognizeQrCodeResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
auto allElementsNode = dataNode["Elements"]["Element"];
|
||||
for (auto dataNodeElementsElement : allElementsNode)
|
||||
{
|
||||
Data::Element elementObject;
|
||||
if(!dataNodeElementsElement["TaskId"].isNull())
|
||||
elementObject.taskId = dataNodeElementsElement["TaskId"].asString();
|
||||
if(!dataNodeElementsElement["ImageURL"].isNull())
|
||||
elementObject.imageURL = dataNodeElementsElement["ImageURL"].asString();
|
||||
auto allResultsNode = allElementsNode["Results"]["Result"];
|
||||
for (auto allElementsNodeResultsResult : allResultsNode)
|
||||
{
|
||||
Data::Element::Result resultsObject;
|
||||
if(!allElementsNodeResultsResult["Label"].isNull())
|
||||
resultsObject.label = allElementsNodeResultsResult["Label"].asString();
|
||||
if(!allElementsNodeResultsResult["Suggestion"].isNull())
|
||||
resultsObject.suggestion = allElementsNodeResultsResult["Suggestion"].asString();
|
||||
if(!allElementsNodeResultsResult["Rate"].isNull())
|
||||
resultsObject.rate = std::stof(allElementsNodeResultsResult["Rate"].asString());
|
||||
auto allQrCodesData = value["QrCodesData"]["QrCodeData"];
|
||||
for (auto value : allQrCodesData)
|
||||
resultsObject.qrCodesData.push_back(value.asString());
|
||||
elementObject.results.push_back(resultsObject);
|
||||
}
|
||||
data_.elements.push_back(elementObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RecognizeQrCodeResult::Data RecognizeQrCodeResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
51
ocr/src/model/RecognizeStampRequest.cc
Normal file
51
ocr/src/model/RecognizeStampRequest.cc
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeStampRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeStampRequest;
|
||||
|
||||
RecognizeStampRequest::RecognizeStampRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeStamp")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeStampRequest::~RecognizeStampRequest()
|
||||
{}
|
||||
|
||||
int RecognizeStampRequest::getImageType()const
|
||||
{
|
||||
return imageType_;
|
||||
}
|
||||
|
||||
void RecognizeStampRequest::setImageType(int imageType)
|
||||
{
|
||||
imageType_ = imageType;
|
||||
setBodyParameter("ImageType", std::to_string(imageType));
|
||||
}
|
||||
|
||||
std::string RecognizeStampRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeStampRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
80
ocr/src/model/RecognizeStampResult.cc
Normal file
80
ocr/src/model/RecognizeStampResult.cc
Normal file
@@ -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.
|
||||
*/
|
||||
|
||||
#include <alibabacloud/ocr/model/RecognizeStampResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeStampResult::RecognizeStampResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeStampResult::RecognizeStampResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeStampResult::~RecognizeStampResult()
|
||||
{}
|
||||
|
||||
void RecognizeStampResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
auto allResultsNode = dataNode["Results"]["ResultsItem"];
|
||||
for (auto dataNodeResultsResultsItem : allResultsNode)
|
||||
{
|
||||
Data::ResultsItem resultsItemObject;
|
||||
auto allGeneralTextNode = allResultsNode["GeneralText"]["GeneralTextItem"];
|
||||
for (auto allResultsNodeGeneralTextGeneralTextItem : allGeneralTextNode)
|
||||
{
|
||||
Data::ResultsItem::GeneralTextItem generalTextObject;
|
||||
if(!allResultsNodeGeneralTextGeneralTextItem["Content"].isNull())
|
||||
generalTextObject.content = allResultsNodeGeneralTextGeneralTextItem["Content"].asString();
|
||||
if(!allResultsNodeGeneralTextGeneralTextItem["Confidence"].isNull())
|
||||
generalTextObject.confidence = std::stof(allResultsNodeGeneralTextGeneralTextItem["Confidence"].asString());
|
||||
resultsItemObject.generalText.push_back(generalTextObject);
|
||||
}
|
||||
auto roiNode = value["Roi"];
|
||||
if(!roiNode["Left"].isNull())
|
||||
resultsItemObject.roi.left = std::stoi(roiNode["Left"].asString());
|
||||
if(!roiNode["Top"].isNull())
|
||||
resultsItemObject.roi.top = std::stoi(roiNode["Top"].asString());
|
||||
if(!roiNode["Width"].isNull())
|
||||
resultsItemObject.roi.width = std::stoi(roiNode["Width"].asString());
|
||||
if(!roiNode["Height"].isNull())
|
||||
resultsItemObject.roi.height = std::stoi(roiNode["Height"].asString());
|
||||
auto textNode = value["Text"];
|
||||
if(!textNode["Content"].isNull())
|
||||
resultsItemObject.text.content = textNode["Content"].asString();
|
||||
if(!textNode["Confidence"].isNull())
|
||||
resultsItemObject.text.confidence = std::stof(textNode["Confidence"].asString());
|
||||
data_.results.push_back(resultsItemObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RecognizeStampResult::Data RecognizeStampResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
106
ocr/src/model/RecognizeTableRequest.cc
Normal file
106
ocr/src/model/RecognizeTableRequest.cc
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeTableRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeTableRequest;
|
||||
|
||||
RecognizeTableRequest::RecognizeTableRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeTable")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeTableRequest::~RecognizeTableRequest()
|
||||
{}
|
||||
|
||||
int RecognizeTableRequest::getImageType()const
|
||||
{
|
||||
return imageType_;
|
||||
}
|
||||
|
||||
void RecognizeTableRequest::setImageType(int imageType)
|
||||
{
|
||||
imageType_ = imageType;
|
||||
setBodyParameter("ImageType", std::to_string(imageType));
|
||||
}
|
||||
|
||||
bool RecognizeTableRequest::getUseFinanceModel()const
|
||||
{
|
||||
return useFinanceModel_;
|
||||
}
|
||||
|
||||
void RecognizeTableRequest::setUseFinanceModel(bool useFinanceModel)
|
||||
{
|
||||
useFinanceModel_ = useFinanceModel;
|
||||
setBodyParameter("UseFinanceModel", useFinanceModel ? "true" : "false");
|
||||
}
|
||||
|
||||
bool RecognizeTableRequest::getSkipDetection()const
|
||||
{
|
||||
return skipDetection_;
|
||||
}
|
||||
|
||||
void RecognizeTableRequest::setSkipDetection(bool skipDetection)
|
||||
{
|
||||
skipDetection_ = skipDetection;
|
||||
setBodyParameter("SkipDetection", skipDetection ? "true" : "false");
|
||||
}
|
||||
|
||||
std::string RecognizeTableRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeTableRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
std::string RecognizeTableRequest::getOutputFormat()const
|
||||
{
|
||||
return outputFormat_;
|
||||
}
|
||||
|
||||
void RecognizeTableRequest::setOutputFormat(const std::string& outputFormat)
|
||||
{
|
||||
outputFormat_ = outputFormat;
|
||||
setBodyParameter("OutputFormat", outputFormat);
|
||||
}
|
||||
|
||||
bool RecognizeTableRequest::getAssureDirection()const
|
||||
{
|
||||
return assureDirection_;
|
||||
}
|
||||
|
||||
void RecognizeTableRequest::setAssureDirection(bool assureDirection)
|
||||
{
|
||||
assureDirection_ = assureDirection;
|
||||
setBodyParameter("AssureDirection", assureDirection ? "true" : "false");
|
||||
}
|
||||
|
||||
bool RecognizeTableRequest::getHasLine()const
|
||||
{
|
||||
return hasLine_;
|
||||
}
|
||||
|
||||
void RecognizeTableRequest::setHasLine(bool hasLine)
|
||||
{
|
||||
hasLine_ = hasLine;
|
||||
setBodyParameter("HasLine", hasLine ? "true" : "false");
|
||||
}
|
||||
|
||||
91
ocr/src/model/RecognizeTableResult.cc
Normal file
91
ocr/src/model/RecognizeTableResult.cc
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeTableResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeTableResult::RecognizeTableResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeTableResult::RecognizeTableResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeTableResult::~RecognizeTableResult()
|
||||
{}
|
||||
|
||||
void RecognizeTableResult::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["FileContent"].isNull())
|
||||
data_.fileContent = dataNode["FileContent"].asString();
|
||||
auto allTablesNode = dataNode["Tables"]["Table"];
|
||||
for (auto dataNodeTablesTable : allTablesNode)
|
||||
{
|
||||
Data::Table tableObject;
|
||||
auto allTableRowsNode = allTablesNode["TableRows"]["TableRow"];
|
||||
for (auto allTablesNodeTableRowsTableRow : allTableRowsNode)
|
||||
{
|
||||
Data::Table::TableRow tableRowsObject;
|
||||
auto allTableColumnsNode = allTableRowsNode["TableColumns"]["TableColumn"];
|
||||
for (auto allTableRowsNodeTableColumnsTableColumn : allTableColumnsNode)
|
||||
{
|
||||
Data::Table::TableRow::TableColumn tableColumnsObject;
|
||||
if(!allTableRowsNodeTableColumnsTableColumn["StartColumn"].isNull())
|
||||
tableColumnsObject.startColumn = std::stoi(allTableRowsNodeTableColumnsTableColumn["StartColumn"].asString());
|
||||
if(!allTableRowsNodeTableColumnsTableColumn["StartRow"].isNull())
|
||||
tableColumnsObject.startRow = std::stoi(allTableRowsNodeTableColumnsTableColumn["StartRow"].asString());
|
||||
if(!allTableRowsNodeTableColumnsTableColumn["EndColumn"].isNull())
|
||||
tableColumnsObject.endColumn = std::stoi(allTableRowsNodeTableColumnsTableColumn["EndColumn"].asString());
|
||||
if(!allTableRowsNodeTableColumnsTableColumn["EndRow"].isNull())
|
||||
tableColumnsObject.endRow = std::stoi(allTableRowsNodeTableColumnsTableColumn["EndRow"].asString());
|
||||
if(!allTableRowsNodeTableColumnsTableColumn["Height"].isNull())
|
||||
tableColumnsObject.height = std::stoi(allTableRowsNodeTableColumnsTableColumn["Height"].asString());
|
||||
if(!allTableRowsNodeTableColumnsTableColumn["Width"].isNull())
|
||||
tableColumnsObject.width = std::stoi(allTableRowsNodeTableColumnsTableColumn["Width"].asString());
|
||||
auto allTexts = value["Texts"]["Text"];
|
||||
for (auto value : allTexts)
|
||||
tableColumnsObject.texts.push_back(value.asString());
|
||||
tableRowsObject.tableColumns.push_back(tableColumnsObject);
|
||||
}
|
||||
tableObject.tableRows.push_back(tableRowsObject);
|
||||
}
|
||||
auto allHead = value["Head"]["Head"];
|
||||
for (auto value : allHead)
|
||||
tableObject.head.push_back(value.asString());
|
||||
auto allTail = value["Tail"]["Tail"];
|
||||
for (auto value : allTail)
|
||||
tableObject.tail.push_back(value.asString());
|
||||
data_.tables.push_back(tableObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RecognizeTableResult::Data RecognizeTableResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
40
ocr/src/model/RecognizeTakeoutOrderRequest.cc
Normal file
40
ocr/src/model/RecognizeTakeoutOrderRequest.cc
Normal file
@@ -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 <alibabacloud/ocr/model/RecognizeTakeoutOrderRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeTakeoutOrderRequest;
|
||||
|
||||
RecognizeTakeoutOrderRequest::RecognizeTakeoutOrderRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeTakeoutOrder")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeTakeoutOrderRequest::~RecognizeTakeoutOrderRequest()
|
||||
{}
|
||||
|
||||
std::string RecognizeTakeoutOrderRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeTakeoutOrderRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
65
ocr/src/model/RecognizeTakeoutOrderResult.cc
Normal file
65
ocr/src/model/RecognizeTakeoutOrderResult.cc
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeTakeoutOrderResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeTakeoutOrderResult::RecognizeTakeoutOrderResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeTakeoutOrderResult::RecognizeTakeoutOrderResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeTakeoutOrderResult::~RecognizeTakeoutOrderResult()
|
||||
{}
|
||||
|
||||
void RecognizeTakeoutOrderResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
auto allElementsNode = dataNode["Elements"]["Element"];
|
||||
for (auto dataNodeElementsElement : allElementsNode)
|
||||
{
|
||||
Data::Element elementObject;
|
||||
if(!dataNodeElementsElement["Score"].isNull())
|
||||
elementObject.score = std::stof(dataNodeElementsElement["Score"].asString());
|
||||
if(!dataNodeElementsElement["Name"].isNull())
|
||||
elementObject.name = dataNodeElementsElement["Name"].asString();
|
||||
if(!dataNodeElementsElement["Value"].isNull())
|
||||
elementObject.value = dataNodeElementsElement["Value"].asString();
|
||||
auto allBoxes = value["Boxes"]["Box"];
|
||||
for (auto value : allBoxes)
|
||||
elementObject.boxes.push_back(value.asString());
|
||||
data_.elements.push_back(elementObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RecognizeTakeoutOrderResult::Data RecognizeTakeoutOrderResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
51
ocr/src/model/RecognizeTaxiInvoiceRequest.cc
Normal file
51
ocr/src/model/RecognizeTaxiInvoiceRequest.cc
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeTaxiInvoiceRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeTaxiInvoiceRequest;
|
||||
|
||||
RecognizeTaxiInvoiceRequest::RecognizeTaxiInvoiceRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeTaxiInvoice")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeTaxiInvoiceRequest::~RecognizeTaxiInvoiceRequest()
|
||||
{}
|
||||
|
||||
int RecognizeTaxiInvoiceRequest::getImageType()const
|
||||
{
|
||||
return imageType_;
|
||||
}
|
||||
|
||||
void RecognizeTaxiInvoiceRequest::setImageType(int imageType)
|
||||
{
|
||||
imageType_ = imageType;
|
||||
setBodyParameter("ImageType", std::to_string(imageType));
|
||||
}
|
||||
|
||||
std::string RecognizeTaxiInvoiceRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeTaxiInvoiceRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
88
ocr/src/model/RecognizeTaxiInvoiceResult.cc
Normal file
88
ocr/src/model/RecognizeTaxiInvoiceResult.cc
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeTaxiInvoiceResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeTaxiInvoiceResult::RecognizeTaxiInvoiceResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeTaxiInvoiceResult::RecognizeTaxiInvoiceResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeTaxiInvoiceResult::~RecognizeTaxiInvoiceResult()
|
||||
{}
|
||||
|
||||
void RecognizeTaxiInvoiceResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
auto allInvoicesNode = dataNode["Invoices"]["Invoice"];
|
||||
for (auto dataNodeInvoicesInvoice : allInvoicesNode)
|
||||
{
|
||||
Data::Invoice invoiceObject;
|
||||
if(!dataNodeInvoicesInvoice["RotateType"].isNull())
|
||||
invoiceObject.rotateType = std::stoi(dataNodeInvoicesInvoice["RotateType"].asString());
|
||||
auto allItemsNode = allInvoicesNode["Items"]["Item"];
|
||||
for (auto allInvoicesNodeItemsItem : allItemsNode)
|
||||
{
|
||||
Data::Invoice::Item itemsObject;
|
||||
if(!allInvoicesNodeItemsItem["Text"].isNull())
|
||||
itemsObject.text = allInvoicesNodeItemsItem["Text"].asString();
|
||||
auto itemRoiNode = value["ItemRoi"];
|
||||
if(!itemRoiNode["Angle"].isNull())
|
||||
itemsObject.itemRoi.angle = std::stof(itemRoiNode["Angle"].asString());
|
||||
auto centerNode = itemRoiNode["Center"];
|
||||
if(!centerNode["X"].isNull())
|
||||
itemsObject.itemRoi.center.x = std::stof(centerNode["X"].asString());
|
||||
if(!centerNode["Y"].isNull())
|
||||
itemsObject.itemRoi.center.y = std::stof(centerNode["Y"].asString());
|
||||
auto sizeNode = itemRoiNode["Size"];
|
||||
if(!sizeNode["H"].isNull())
|
||||
itemsObject.itemRoi.size.h = std::stof(sizeNode["H"].asString());
|
||||
if(!sizeNode["W"].isNull())
|
||||
itemsObject.itemRoi.size.w = std::stof(sizeNode["W"].asString());
|
||||
invoiceObject.items.push_back(itemsObject);
|
||||
}
|
||||
auto invoiceRoiNode = value["InvoiceRoi"];
|
||||
if(!invoiceRoiNode["H"].isNull())
|
||||
invoiceObject.invoiceRoi.h = std::stof(invoiceRoiNode["H"].asString());
|
||||
if(!invoiceRoiNode["W"].isNull())
|
||||
invoiceObject.invoiceRoi.w = std::stof(invoiceRoiNode["W"].asString());
|
||||
if(!invoiceRoiNode["X"].isNull())
|
||||
invoiceObject.invoiceRoi.x = std::stof(invoiceRoiNode["X"].asString());
|
||||
if(!invoiceRoiNode["Y"].isNull())
|
||||
invoiceObject.invoiceRoi.y = std::stof(invoiceRoiNode["Y"].asString());
|
||||
data_.invoices.push_back(invoiceObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RecognizeTaxiInvoiceResult::Data RecognizeTaxiInvoiceResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
51
ocr/src/model/RecognizeTrainTicketRequest.cc
Normal file
51
ocr/src/model/RecognizeTrainTicketRequest.cc
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeTrainTicketRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeTrainTicketRequest;
|
||||
|
||||
RecognizeTrainTicketRequest::RecognizeTrainTicketRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeTrainTicket")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeTrainTicketRequest::~RecognizeTrainTicketRequest()
|
||||
{}
|
||||
|
||||
int RecognizeTrainTicketRequest::getImageType()const
|
||||
{
|
||||
return imageType_;
|
||||
}
|
||||
|
||||
void RecognizeTrainTicketRequest::setImageType(int imageType)
|
||||
{
|
||||
imageType_ = imageType;
|
||||
setBodyParameter("ImageType", std::to_string(imageType));
|
||||
}
|
||||
|
||||
std::string RecognizeTrainTicketRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeTrainTicketRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
66
ocr/src/model/RecognizeTrainTicketResult.cc
Normal file
66
ocr/src/model/RecognizeTrainTicketResult.cc
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeTrainTicketResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeTrainTicketResult::RecognizeTrainTicketResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeTrainTicketResult::RecognizeTrainTicketResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeTrainTicketResult::~RecognizeTrainTicketResult()
|
||||
{}
|
||||
|
||||
void RecognizeTrainTicketResult::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["Date"].isNull())
|
||||
data_.date = dataNode["Date"].asString();
|
||||
if(!dataNode["Destination"].isNull())
|
||||
data_.destination = dataNode["Destination"].asString();
|
||||
if(!dataNode["Level"].isNull())
|
||||
data_.level = dataNode["Level"].asString();
|
||||
if(!dataNode["Number"].isNull())
|
||||
data_.number = dataNode["Number"].asString();
|
||||
if(!dataNode["Name"].isNull())
|
||||
data_.name = dataNode["Name"].asString();
|
||||
if(!dataNode["DepartureStation"].isNull())
|
||||
data_.departureStation = dataNode["DepartureStation"].asString();
|
||||
if(!dataNode["Seat"].isNull())
|
||||
data_.seat = dataNode["Seat"].asString();
|
||||
if(!dataNode["Price"].isNull())
|
||||
data_.price = std::stof(dataNode["Price"].asString());
|
||||
|
||||
}
|
||||
|
||||
RecognizeTrainTicketResult::Data RecognizeTrainTicketResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
51
ocr/src/model/RecognizeVATInvoiceRequest.cc
Normal file
51
ocr/src/model/RecognizeVATInvoiceRequest.cc
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeVATInvoiceRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeVATInvoiceRequest;
|
||||
|
||||
RecognizeVATInvoiceRequest::RecognizeVATInvoiceRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeVATInvoice")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeVATInvoiceRequest::~RecognizeVATInvoiceRequest()
|
||||
{}
|
||||
|
||||
std::string RecognizeVATInvoiceRequest::getFileType()const
|
||||
{
|
||||
return fileType_;
|
||||
}
|
||||
|
||||
void RecognizeVATInvoiceRequest::setFileType(const std::string& fileType)
|
||||
{
|
||||
fileType_ = fileType;
|
||||
setBodyParameter("FileType", fileType);
|
||||
}
|
||||
|
||||
std::string RecognizeVATInvoiceRequest::getFileURL()const
|
||||
{
|
||||
return fileURL_;
|
||||
}
|
||||
|
||||
void RecognizeVATInvoiceRequest::setFileURL(const std::string& fileURL)
|
||||
{
|
||||
fileURL_ = fileURL;
|
||||
setBodyParameter("FileURL", fileURL);
|
||||
}
|
||||
|
||||
147
ocr/src/model/RecognizeVATInvoiceResult.cc
Normal file
147
ocr/src/model/RecognizeVATInvoiceResult.cc
Normal file
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeVATInvoiceResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeVATInvoiceResult::RecognizeVATInvoiceResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeVATInvoiceResult::RecognizeVATInvoiceResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeVATInvoiceResult::~RecognizeVATInvoiceResult()
|
||||
{}
|
||||
|
||||
void RecognizeVATInvoiceResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
auto contentNode = dataNode["Content"];
|
||||
if(!contentNode["InvoiceCode"].isNull())
|
||||
data_.content.invoiceCode = contentNode["InvoiceCode"].asString();
|
||||
if(!contentNode["InvoiceNo"].isNull())
|
||||
data_.content.invoiceNo = contentNode["InvoiceNo"].asString();
|
||||
if(!contentNode["InvoiceDate"].isNull())
|
||||
data_.content.invoiceDate = contentNode["InvoiceDate"].asString();
|
||||
if(!contentNode["AntiFakeCode"].isNull())
|
||||
data_.content.antiFakeCode = contentNode["AntiFakeCode"].asString();
|
||||
if(!contentNode["PayerName"].isNull())
|
||||
data_.content.payerName = contentNode["PayerName"].asString();
|
||||
if(!contentNode["PayerRegisterNo"].isNull())
|
||||
data_.content.payerRegisterNo = contentNode["PayerRegisterNo"].asString();
|
||||
if(!contentNode["PayerAddress"].isNull())
|
||||
data_.content.payerAddress = contentNode["PayerAddress"].asString();
|
||||
if(!contentNode["PayerBankName"].isNull())
|
||||
data_.content.payerBankName = contentNode["PayerBankName"].asString();
|
||||
if(!contentNode["WithoutTaxAmount"].isNull())
|
||||
data_.content.withoutTaxAmount = contentNode["WithoutTaxAmount"].asString();
|
||||
if(!contentNode["TaxAmount"].isNull())
|
||||
data_.content.taxAmount = contentNode["TaxAmount"].asString();
|
||||
if(!contentNode["SumAmount"].isNull())
|
||||
data_.content.sumAmount = contentNode["SumAmount"].asString();
|
||||
if(!contentNode["InvoiceAmount"].isNull())
|
||||
data_.content.invoiceAmount = contentNode["InvoiceAmount"].asString();
|
||||
if(!contentNode["PayeeName"].isNull())
|
||||
data_.content.payeeName = contentNode["PayeeName"].asString();
|
||||
if(!contentNode["PayeeRegisterNo"].isNull())
|
||||
data_.content.payeeRegisterNo = contentNode["PayeeRegisterNo"].asString();
|
||||
if(!contentNode["PayeeAddress"].isNull())
|
||||
data_.content.payeeAddress = contentNode["PayeeAddress"].asString();
|
||||
if(!contentNode["PayeeBankName"].isNull())
|
||||
data_.content.payeeBankName = contentNode["PayeeBankName"].asString();
|
||||
if(!contentNode["Payee"].isNull())
|
||||
data_.content.payee = contentNode["Payee"].asString();
|
||||
if(!contentNode["Checker"].isNull())
|
||||
data_.content.checker = contentNode["Checker"].asString();
|
||||
if(!contentNode["Clerk"].isNull())
|
||||
data_.content.clerk = contentNode["Clerk"].asString();
|
||||
auto boxNode = dataNode["Box"];
|
||||
auto allInvoiceCodes = boxNode["InvoiceCodes"]["InvoiceCode"];
|
||||
for (auto value : allInvoiceCodes)
|
||||
data_.box.invoiceCodes.push_back(value.asString());
|
||||
auto allInvoiceNoes = boxNode["InvoiceNoes"]["InvoiceNo"];
|
||||
for (auto value : allInvoiceNoes)
|
||||
data_.box.invoiceNoes.push_back(value.asString());
|
||||
auto allInvoiceDates = boxNode["InvoiceDates"]["InvoiceDate"];
|
||||
for (auto value : allInvoiceDates)
|
||||
data_.box.invoiceDates.push_back(value.asString());
|
||||
auto allInvoiceFakeCodes = boxNode["InvoiceFakeCodes"]["InvoiceFakeCode"];
|
||||
for (auto value : allInvoiceFakeCodes)
|
||||
data_.box.invoiceFakeCodes.push_back(value.asString());
|
||||
auto allPayerNames = boxNode["PayerNames"]["PayerName"];
|
||||
for (auto value : allPayerNames)
|
||||
data_.box.payerNames.push_back(value.asString());
|
||||
auto allPayerRegisterNoes = boxNode["PayerRegisterNoes"]["PayerRegisterNo"];
|
||||
for (auto value : allPayerRegisterNoes)
|
||||
data_.box.payerRegisterNoes.push_back(value.asString());
|
||||
auto allPayerAddresses = boxNode["PayerAddresses"]["PayerAddress"];
|
||||
for (auto value : allPayerAddresses)
|
||||
data_.box.payerAddresses.push_back(value.asString());
|
||||
auto allPayerBankNames = boxNode["PayerBankNames"]["PayerBankNames"];
|
||||
for (auto value : allPayerBankNames)
|
||||
data_.box.payerBankNames.push_back(value.asString());
|
||||
auto allWithoutTaxAmounts = boxNode["WithoutTaxAmounts"]["WithoutTaxAmount"];
|
||||
for (auto value : allWithoutTaxAmounts)
|
||||
data_.box.withoutTaxAmounts.push_back(value.asString());
|
||||
auto allTaxAmounts = boxNode["TaxAmounts"]["TaxAmount"];
|
||||
for (auto value : allTaxAmounts)
|
||||
data_.box.taxAmounts.push_back(value.asString());
|
||||
auto allSumAmounts = boxNode["SumAmounts"]["SumAmount"];
|
||||
for (auto value : allSumAmounts)
|
||||
data_.box.sumAmounts.push_back(value.asString());
|
||||
auto allInvoiceAmounts = boxNode["InvoiceAmounts"]["InvoiceAmount"];
|
||||
for (auto value : allInvoiceAmounts)
|
||||
data_.box.invoiceAmounts.push_back(value.asString());
|
||||
auto allPayeeNames = boxNode["PayeeNames"]["PayeeName"];
|
||||
for (auto value : allPayeeNames)
|
||||
data_.box.payeeNames.push_back(value.asString());
|
||||
auto allPayeeRegisterNoes = boxNode["PayeeRegisterNoes"]["PayeeRegisterNo"];
|
||||
for (auto value : allPayeeRegisterNoes)
|
||||
data_.box.payeeRegisterNoes.push_back(value.asString());
|
||||
auto allPayeeAddresses = boxNode["PayeeAddresses"]["PayeeAddress"];
|
||||
for (auto value : allPayeeAddresses)
|
||||
data_.box.payeeAddresses.push_back(value.asString());
|
||||
auto allPayeeBankNames = boxNode["PayeeBankNames"]["PayeeBankName"];
|
||||
for (auto value : allPayeeBankNames)
|
||||
data_.box.payeeBankNames.push_back(value.asString());
|
||||
auto allPayees = boxNode["Payees"]["Payee"];
|
||||
for (auto value : allPayees)
|
||||
data_.box.payees.push_back(value.asString());
|
||||
auto allCheckers = boxNode["Checkers"]["Checker"];
|
||||
for (auto value : allCheckers)
|
||||
data_.box.checkers.push_back(value.asString());
|
||||
auto allClerks = boxNode["Clerks"]["Clerk"];
|
||||
for (auto value : allClerks)
|
||||
data_.box.clerks.push_back(value.asString());
|
||||
|
||||
}
|
||||
|
||||
RecognizeVATInvoiceResult::Data RecognizeVATInvoiceResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
51
ocr/src/model/RecognizeVINCodeRequest.cc
Normal file
51
ocr/src/model/RecognizeVINCodeRequest.cc
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeVINCodeRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeVINCodeRequest;
|
||||
|
||||
RecognizeVINCodeRequest::RecognizeVINCodeRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeVINCode")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeVINCodeRequest::~RecognizeVINCodeRequest()
|
||||
{}
|
||||
|
||||
int RecognizeVINCodeRequest::getImageType()const
|
||||
{
|
||||
return imageType_;
|
||||
}
|
||||
|
||||
void RecognizeVINCodeRequest::setImageType(int imageType)
|
||||
{
|
||||
imageType_ = imageType;
|
||||
setParameter("ImageType", std::to_string(imageType));
|
||||
}
|
||||
|
||||
std::string RecognizeVINCodeRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeVINCodeRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
52
ocr/src/model/RecognizeVINCodeResult.cc
Normal file
52
ocr/src/model/RecognizeVINCodeResult.cc
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeVINCodeResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeVINCodeResult::RecognizeVINCodeResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeVINCodeResult::RecognizeVINCodeResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeVINCodeResult::~RecognizeVINCodeResult()
|
||||
{}
|
||||
|
||||
void RecognizeVINCodeResult::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["VinCode"].isNull())
|
||||
data_.vinCode = dataNode["VinCode"].asString();
|
||||
|
||||
}
|
||||
|
||||
RecognizeVINCodeResult::Data RecognizeVINCodeResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
40
ocr/src/model/RecognizeVerificationcodeRequest.cc
Normal file
40
ocr/src/model/RecognizeVerificationcodeRequest.cc
Normal file
@@ -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 <alibabacloud/ocr/model/RecognizeVerificationcodeRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::RecognizeVerificationcodeRequest;
|
||||
|
||||
RecognizeVerificationcodeRequest::RecognizeVerificationcodeRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "RecognizeVerificationcode")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RecognizeVerificationcodeRequest::~RecognizeVerificationcodeRequest()
|
||||
{}
|
||||
|
||||
std::string RecognizeVerificationcodeRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void RecognizeVerificationcodeRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
52
ocr/src/model/RecognizeVerificationcodeResult.cc
Normal file
52
ocr/src/model/RecognizeVerificationcodeResult.cc
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/RecognizeVerificationcodeResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
RecognizeVerificationcodeResult::RecognizeVerificationcodeResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RecognizeVerificationcodeResult::RecognizeVerificationcodeResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RecognizeVerificationcodeResult::~RecognizeVerificationcodeResult()
|
||||
{}
|
||||
|
||||
void RecognizeVerificationcodeResult::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["Content"].isNull())
|
||||
data_.content = dataNode["Content"].asString();
|
||||
|
||||
}
|
||||
|
||||
RecognizeVerificationcodeResult::Data RecognizeVerificationcodeResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
73
ocr/src/model/TrimDocumentRequest.cc
Normal file
73
ocr/src/model/TrimDocumentRequest.cc
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/TrimDocumentRequest.h>
|
||||
|
||||
using AlibabaCloud::Ocr::Model::TrimDocumentRequest;
|
||||
|
||||
TrimDocumentRequest::TrimDocumentRequest() :
|
||||
RpcServiceRequest("ocr", "2019-12-30", "TrimDocument")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
TrimDocumentRequest::~TrimDocumentRequest()
|
||||
{}
|
||||
|
||||
std::string TrimDocumentRequest::getFileType()const
|
||||
{
|
||||
return fileType_;
|
||||
}
|
||||
|
||||
void TrimDocumentRequest::setFileType(const std::string& fileType)
|
||||
{
|
||||
fileType_ = fileType;
|
||||
setBodyParameter("FileType", fileType);
|
||||
}
|
||||
|
||||
bool TrimDocumentRequest::getAsync()const
|
||||
{
|
||||
return async_;
|
||||
}
|
||||
|
||||
void TrimDocumentRequest::setAsync(bool async)
|
||||
{
|
||||
async_ = async;
|
||||
setBodyParameter("Async", async ? "true" : "false");
|
||||
}
|
||||
|
||||
std::string TrimDocumentRequest::getFileURL()const
|
||||
{
|
||||
return fileURL_;
|
||||
}
|
||||
|
||||
void TrimDocumentRequest::setFileURL(const std::string& fileURL)
|
||||
{
|
||||
fileURL_ = fileURL;
|
||||
setBodyParameter("FileURL", fileURL);
|
||||
}
|
||||
|
||||
std::string TrimDocumentRequest::getOutputType()const
|
||||
{
|
||||
return outputType_;
|
||||
}
|
||||
|
||||
void TrimDocumentRequest::setOutputType(const std::string& outputType)
|
||||
{
|
||||
outputType_ = outputType;
|
||||
setBodyParameter("OutputType", outputType);
|
||||
}
|
||||
|
||||
52
ocr/src/model/TrimDocumentResult.cc
Normal file
52
ocr/src/model/TrimDocumentResult.cc
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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 <alibabacloud/ocr/model/TrimDocumentResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ocr;
|
||||
using namespace AlibabaCloud::Ocr::Model;
|
||||
|
||||
TrimDocumentResult::TrimDocumentResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
TrimDocumentResult::TrimDocumentResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
TrimDocumentResult::~TrimDocumentResult()
|
||||
{}
|
||||
|
||||
void TrimDocumentResult::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["Content"].isNull())
|
||||
data_.content = dataNode["Content"].asString();
|
||||
|
||||
}
|
||||
|
||||
TrimDocumentResult::Data TrimDocumentResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user