Update Imageaudit.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
2020-11-13 Version: patch
|
||||
- Update Imageaudit.
|
||||
|
||||
2020-11-13 Version: patch
|
||||
- Add DeccribeEngineVersion DescribeTasks DescribeInstanceConfig and more APIs.
|
||||
|
||||
|
||||
90
imageaudit/CMakeLists.txt
Normal file
90
imageaudit/CMakeLists.txt
Normal file
@@ -0,0 +1,90 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include)
|
||||
|
||||
set(imageaudit_public_header
|
||||
include/alibabacloud/imageaudit/ImageauditClient.h
|
||||
include/alibabacloud/imageaudit/ImageauditExport.h )
|
||||
|
||||
set(imageaudit_public_header_model
|
||||
include/alibabacloud/imageaudit/model/ScanImageRequest.h
|
||||
include/alibabacloud/imageaudit/model/ScanImageResult.h
|
||||
include/alibabacloud/imageaudit/model/ScanTextRequest.h
|
||||
include/alibabacloud/imageaudit/model/ScanTextResult.h )
|
||||
|
||||
set(imageaudit_src
|
||||
src/ImageauditClient.cc
|
||||
src/model/ScanImageRequest.cc
|
||||
src/model/ScanImageResult.cc
|
||||
src/model/ScanTextRequest.cc
|
||||
src/model/ScanTextResult.cc )
|
||||
|
||||
add_library(imageaudit ${LIB_TYPE}
|
||||
${imageaudit_public_header}
|
||||
${imageaudit_public_header_model}
|
||||
${imageaudit_src})
|
||||
|
||||
set_target_properties(imageaudit
|
||||
PROPERTIES
|
||||
LINKER_LANGUAGE CXX
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}imageaudit
|
||||
)
|
||||
|
||||
if(${LIB_TYPE} STREQUAL "SHARED")
|
||||
set_target_properties(imageaudit
|
||||
PROPERTIES
|
||||
DEFINE_SYMBOL ALIBABACLOUD_IMAGEAUDIT_LIBRARY)
|
||||
endif()
|
||||
|
||||
target_include_directories(imageaudit
|
||||
PRIVATE include
|
||||
${CMAKE_SOURCE_DIR}/core/include
|
||||
)
|
||||
target_link_libraries(imageaudit
|
||||
core)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
|
||||
set(jsoncpp_install_dir ${INSTALL_DIR})
|
||||
add_dependencies(imageaudit
|
||||
jsoncpp)
|
||||
target_include_directories(imageaudit
|
||||
PRIVATE ${jsoncpp_install_dir}/include)
|
||||
target_link_libraries(imageaudit
|
||||
${jsoncpp_install_dir}/lib/jsoncpp.lib)
|
||||
set_target_properties(imageaudit
|
||||
PROPERTIES
|
||||
COMPILE_OPTIONS "/bigobj")
|
||||
else()
|
||||
target_include_directories(imageaudit
|
||||
PRIVATE /usr/include/jsoncpp)
|
||||
target_link_libraries(imageaudit
|
||||
jsoncpp)
|
||||
endif()
|
||||
|
||||
install(FILES ${imageaudit_public_header}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/imageaudit)
|
||||
install(FILES ${imageaudit_public_header_model}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/imageaudit/model)
|
||||
install(TARGETS imageaudit
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_IMAGEAUDIT_IMAGEAUDITCLIENT_H_
|
||||
#define ALIBABACLOUD_IMAGEAUDIT_IMAGEAUDITCLIENT_H_
|
||||
|
||||
#include <future>
|
||||
#include <alibabacloud/core/AsyncCallerContext.h>
|
||||
#include <alibabacloud/core/EndpointProvider.h>
|
||||
#include <alibabacloud/core/RpcServiceClient.h>
|
||||
#include "ImageauditExport.h"
|
||||
#include "model/ScanImageRequest.h"
|
||||
#include "model/ScanImageResult.h"
|
||||
#include "model/ScanTextRequest.h"
|
||||
#include "model/ScanTextResult.h"
|
||||
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Imageaudit
|
||||
{
|
||||
class ALIBABACLOUD_IMAGEAUDIT_EXPORT ImageauditClient : public RpcServiceClient
|
||||
{
|
||||
public:
|
||||
typedef Outcome<Error, Model::ScanImageResult> ScanImageOutcome;
|
||||
typedef std::future<ScanImageOutcome> ScanImageOutcomeCallable;
|
||||
typedef std::function<void(const ImageauditClient*, const Model::ScanImageRequest&, const ScanImageOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ScanImageAsyncHandler;
|
||||
typedef Outcome<Error, Model::ScanTextResult> ScanTextOutcome;
|
||||
typedef std::future<ScanTextOutcome> ScanTextOutcomeCallable;
|
||||
typedef std::function<void(const ImageauditClient*, const Model::ScanTextRequest&, const ScanTextOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ScanTextAsyncHandler;
|
||||
|
||||
ImageauditClient(const Credentials &credentials, const ClientConfiguration &configuration);
|
||||
ImageauditClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
|
||||
ImageauditClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
|
||||
~ImageauditClient();
|
||||
ScanImageOutcome scanImage(const Model::ScanImageRequest &request)const;
|
||||
void scanImageAsync(const Model::ScanImageRequest& request, const ScanImageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
ScanImageOutcomeCallable scanImageCallable(const Model::ScanImageRequest& request) const;
|
||||
ScanTextOutcome scanText(const Model::ScanTextRequest &request)const;
|
||||
void scanTextAsync(const Model::ScanTextRequest& request, const ScanTextAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
ScanTextOutcomeCallable scanTextCallable(const Model::ScanTextRequest& request) const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<EndpointProvider> endpointProvider_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !ALIBABACLOUD_IMAGEAUDIT_IMAGEAUDITCLIENT_H_
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_IMAGEAUDIT_IMAGEAUDITEXPORT_H_
|
||||
#define ALIBABACLOUD_IMAGEAUDIT_IMAGEAUDITEXPORT_H_
|
||||
|
||||
#include <alibabacloud/core/Global.h>
|
||||
|
||||
#if defined(ALIBABACLOUD_SHARED)
|
||||
# if defined(ALIBABACLOUD_IMAGEAUDIT_LIBRARY)
|
||||
# define ALIBABACLOUD_IMAGEAUDIT_EXPORT ALIBABACLOUD_DECL_EXPORT
|
||||
# else
|
||||
# define ALIBABACLOUD_IMAGEAUDIT_EXPORT ALIBABACLOUD_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define ALIBABACLOUD_IMAGEAUDIT_EXPORT
|
||||
#endif
|
||||
|
||||
#endif // !ALIBABACLOUD_IMAGEAUDIT_IMAGEAUDITEXPORT_H_
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_IMAGEAUDIT_MODEL_SCANIMAGEREQUEST_H_
|
||||
#define ALIBABACLOUD_IMAGEAUDIT_MODEL_SCANIMAGEREQUEST_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <alibabacloud/imageaudit/ImageauditExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Imageaudit
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_IMAGEAUDIT_EXPORT ScanImageRequest : public RpcServiceRequest
|
||||
{
|
||||
public:
|
||||
struct Task
|
||||
{
|
||||
std::string dataId;
|
||||
std::string imageURL;
|
||||
int maxFrames;
|
||||
int interval;
|
||||
long imageTimeMillisecond;
|
||||
};
|
||||
|
||||
public:
|
||||
ScanImageRequest();
|
||||
~ScanImageRequest();
|
||||
|
||||
std::vector<std::string> getScene()const;
|
||||
void setScene(const std::vector<std::string>& scene);
|
||||
std::vector<Task> getTask()const;
|
||||
void setTask(const std::vector<Task>& task);
|
||||
|
||||
private:
|
||||
std::vector<std::string> scene_;
|
||||
std::vector<Task> task_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_IMAGEAUDIT_MODEL_SCANIMAGEREQUEST_H_
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_IMAGEAUDIT_MODEL_SCANIMAGERESULT_H_
|
||||
#define ALIBABACLOUD_IMAGEAUDIT_MODEL_SCANIMAGERESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/imageaudit/ImageauditExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Imageaudit
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_IMAGEAUDIT_EXPORT ScanImageResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
struct Data
|
||||
{
|
||||
struct Result
|
||||
{
|
||||
struct SubResult
|
||||
{
|
||||
struct Frame
|
||||
{
|
||||
float rate;
|
||||
std::string uRL;
|
||||
};
|
||||
struct HintWordsInfo
|
||||
{
|
||||
std::string context;
|
||||
};
|
||||
struct ProgramCodeData
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float height;
|
||||
float width;
|
||||
};
|
||||
struct LogoData
|
||||
{
|
||||
std::string type;
|
||||
float x;
|
||||
float y;
|
||||
float height;
|
||||
float width;
|
||||
std::string name;
|
||||
};
|
||||
struct SfaceData
|
||||
{
|
||||
struct Face
|
||||
{
|
||||
float rate;
|
||||
std::string id;
|
||||
std::string name;
|
||||
};
|
||||
float x;
|
||||
float y;
|
||||
float height;
|
||||
float width;
|
||||
std::vector<SfaceData::Face> faces;
|
||||
};
|
||||
std::vector<SubResult::Frame> frames;
|
||||
std::string suggestion;
|
||||
std::vector<SubResult::SfaceData> sfaceDataList;
|
||||
float rate;
|
||||
std::vector<std::string> oCRDataList;
|
||||
std::vector<SubResult::HintWordsInfo> hintWordsInfoList;
|
||||
std::string label;
|
||||
std::vector<SubResult::LogoData> logoDataList;
|
||||
std::string scene;
|
||||
std::vector<SubResult::ProgramCodeData> programCodeDataList;
|
||||
};
|
||||
std::string dataId;
|
||||
std::string taskId;
|
||||
std::string imageURL;
|
||||
std::vector<Result::SubResult> subResults;
|
||||
};
|
||||
std::vector<Result> results;
|
||||
};
|
||||
|
||||
|
||||
ScanImageResult();
|
||||
explicit ScanImageResult(const std::string &payload);
|
||||
~ScanImageResult();
|
||||
Data getData()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
Data data_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_IMAGEAUDIT_MODEL_SCANIMAGERESULT_H_
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_IMAGEAUDIT_MODEL_SCANTEXTREQUEST_H_
|
||||
#define ALIBABACLOUD_IMAGEAUDIT_MODEL_SCANTEXTREQUEST_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <alibabacloud/imageaudit/ImageauditExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Imageaudit
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_IMAGEAUDIT_EXPORT ScanTextRequest : public RpcServiceRequest
|
||||
{
|
||||
public:
|
||||
struct Labels
|
||||
{
|
||||
std::string label;
|
||||
};
|
||||
struct Tasks
|
||||
{
|
||||
std::string content;
|
||||
};
|
||||
|
||||
public:
|
||||
ScanTextRequest();
|
||||
~ScanTextRequest();
|
||||
|
||||
std::vector<Labels> getLabels()const;
|
||||
void setLabels(const std::vector<Labels>& labels);
|
||||
std::vector<Tasks> getTasks()const;
|
||||
void setTasks(const std::vector<Tasks>& tasks);
|
||||
|
||||
private:
|
||||
std::vector<Labels> labels_;
|
||||
std::vector<Tasks> tasks_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_IMAGEAUDIT_MODEL_SCANTEXTREQUEST_H_
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_IMAGEAUDIT_MODEL_SCANTEXTRESULT_H_
|
||||
#define ALIBABACLOUD_IMAGEAUDIT_MODEL_SCANTEXTRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/imageaudit/ImageauditExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Imageaudit
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_IMAGEAUDIT_EXPORT ScanTextResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
struct Data
|
||||
{
|
||||
struct Element
|
||||
{
|
||||
struct Result
|
||||
{
|
||||
struct Detail
|
||||
{
|
||||
struct Context
|
||||
{
|
||||
std::string context;
|
||||
};
|
||||
std::string label;
|
||||
std::vector<Detail::Context> contexts;
|
||||
};
|
||||
std::string suggestion;
|
||||
std::vector<Result::Detail> details;
|
||||
float rate;
|
||||
std::string label;
|
||||
};
|
||||
std::string taskId;
|
||||
std::vector<Element::Result> results;
|
||||
};
|
||||
std::vector<Element> elements;
|
||||
};
|
||||
|
||||
|
||||
ScanTextResult();
|
||||
explicit ScanTextResult(const std::string &payload);
|
||||
~ScanTextResult();
|
||||
Data getData()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
Data data_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_IMAGEAUDIT_MODEL_SCANTEXTRESULT_H_
|
||||
125
imageaudit/src/ImageauditClient.cc
Normal file
125
imageaudit/src/ImageauditClient.cc
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* 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/imageaudit/ImageauditClient.h>
|
||||
#include <alibabacloud/core/SimpleCredentialsProvider.h>
|
||||
|
||||
using namespace AlibabaCloud;
|
||||
using namespace AlibabaCloud::Location;
|
||||
using namespace AlibabaCloud::Imageaudit;
|
||||
using namespace AlibabaCloud::Imageaudit::Model;
|
||||
|
||||
namespace
|
||||
{
|
||||
const std::string SERVICE_NAME = "imageaudit";
|
||||
}
|
||||
|
||||
ImageauditClient::ImageauditClient(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, "imageaudit");
|
||||
}
|
||||
|
||||
ImageauditClient::ImageauditClient(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, "imageaudit");
|
||||
}
|
||||
|
||||
ImageauditClient::ImageauditClient(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, "imageaudit");
|
||||
}
|
||||
|
||||
ImageauditClient::~ImageauditClient()
|
||||
{}
|
||||
|
||||
ImageauditClient::ScanImageOutcome ImageauditClient::scanImage(const ScanImageRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return ScanImageOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return ScanImageOutcome(ScanImageResult(outcome.result()));
|
||||
else
|
||||
return ScanImageOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void ImageauditClient::scanImageAsync(const ScanImageRequest& request, const ScanImageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, scanImage(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
ImageauditClient::ScanImageOutcomeCallable ImageauditClient::scanImageCallable(const ScanImageRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<ScanImageOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->scanImage(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
ImageauditClient::ScanTextOutcome ImageauditClient::scanText(const ScanTextRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return ScanTextOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return ScanTextOutcome(ScanTextResult(outcome.result()));
|
||||
else
|
||||
return ScanTextOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void ImageauditClient::scanTextAsync(const ScanTextRequest& request, const ScanTextAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, scanText(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
ImageauditClient::ScanTextOutcomeCallable ImageauditClient::scanTextCallable(const ScanTextRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<ScanTextOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->scanText(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
61
imageaudit/src/model/ScanImageRequest.cc
Normal file
61
imageaudit/src/model/ScanImageRequest.cc
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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/imageaudit/model/ScanImageRequest.h>
|
||||
|
||||
using AlibabaCloud::Imageaudit::Model::ScanImageRequest;
|
||||
|
||||
ScanImageRequest::ScanImageRequest() :
|
||||
RpcServiceRequest("imageaudit", "2019-12-30", "ScanImage")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
ScanImageRequest::~ScanImageRequest()
|
||||
{}
|
||||
|
||||
std::vector<std::string> ScanImageRequest::getScene()const
|
||||
{
|
||||
return scene_;
|
||||
}
|
||||
|
||||
void ScanImageRequest::setScene(const std::vector<std::string>& scene)
|
||||
{
|
||||
scene_ = scene;
|
||||
for(int dep1 = 0; dep1!= scene.size(); dep1++) {
|
||||
setBodyParameter("Scene."+ std::to_string(dep1), scene.at(dep1));
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<ScanImageRequest::Task> ScanImageRequest::getTask()const
|
||||
{
|
||||
return task_;
|
||||
}
|
||||
|
||||
void ScanImageRequest::setTask(const std::vector<Task>& task)
|
||||
{
|
||||
task_ = task;
|
||||
for(int dep1 = 0; dep1!= task.size(); dep1++) {
|
||||
auto taskObj = task.at(dep1);
|
||||
std::string taskObjStr = "Task." + std::to_string(dep1 + 1);
|
||||
setParameter(taskObjStr + ".DataId", taskObj.dataId);
|
||||
setParameter(taskObjStr + ".ImageURL", taskObj.imageURL);
|
||||
setParameter(taskObjStr + ".MaxFrames", std::to_string(taskObj.maxFrames));
|
||||
setParameter(taskObjStr + ".Interval", std::to_string(taskObj.interval));
|
||||
setParameter(taskObjStr + ".ImageTimeMillisecond", std::to_string(taskObj.imageTimeMillisecond));
|
||||
}
|
||||
}
|
||||
|
||||
155
imageaudit/src/model/ScanImageResult.cc
Normal file
155
imageaudit/src/model/ScanImageResult.cc
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* 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/imageaudit/model/ScanImageResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Imageaudit;
|
||||
using namespace AlibabaCloud::Imageaudit::Model;
|
||||
|
||||
ScanImageResult::ScanImageResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
ScanImageResult::ScanImageResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
ScanImageResult::~ScanImageResult()
|
||||
{}
|
||||
|
||||
void ScanImageResult::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["DataId"].isNull())
|
||||
resultObject.dataId = dataNodeResultsResult["DataId"].asString();
|
||||
if(!dataNodeResultsResult["TaskId"].isNull())
|
||||
resultObject.taskId = dataNodeResultsResult["TaskId"].asString();
|
||||
if(!dataNodeResultsResult["ImageURL"].isNull())
|
||||
resultObject.imageURL = dataNodeResultsResult["ImageURL"].asString();
|
||||
auto allSubResultsNode = dataNodeResultsResult["SubResults"]["SubResult"];
|
||||
for (auto dataNodeResultsResultSubResultsSubResult : allSubResultsNode)
|
||||
{
|
||||
Data::Result::SubResult subResultsObject;
|
||||
if(!dataNodeResultsResultSubResultsSubResult["Label"].isNull())
|
||||
subResultsObject.label = dataNodeResultsResultSubResultsSubResult["Label"].asString();
|
||||
if(!dataNodeResultsResultSubResultsSubResult["Suggestion"].isNull())
|
||||
subResultsObject.suggestion = dataNodeResultsResultSubResultsSubResult["Suggestion"].asString();
|
||||
if(!dataNodeResultsResultSubResultsSubResult["Rate"].isNull())
|
||||
subResultsObject.rate = std::stof(dataNodeResultsResultSubResultsSubResult["Rate"].asString());
|
||||
if(!dataNodeResultsResultSubResultsSubResult["Scene"].isNull())
|
||||
subResultsObject.scene = dataNodeResultsResultSubResultsSubResult["Scene"].asString();
|
||||
auto allFramesNode = dataNodeResultsResultSubResultsSubResult["Frames"]["Frame"];
|
||||
for (auto dataNodeResultsResultSubResultsSubResultFramesFrame : allFramesNode)
|
||||
{
|
||||
Data::Result::SubResult::Frame framesObject;
|
||||
if(!dataNodeResultsResultSubResultsSubResultFramesFrame["Rate"].isNull())
|
||||
framesObject.rate = std::stof(dataNodeResultsResultSubResultsSubResultFramesFrame["Rate"].asString());
|
||||
if(!dataNodeResultsResultSubResultsSubResultFramesFrame["URL"].isNull())
|
||||
framesObject.uRL = dataNodeResultsResultSubResultsSubResultFramesFrame["URL"].asString();
|
||||
subResultsObject.frames.push_back(framesObject);
|
||||
}
|
||||
auto allHintWordsInfoListNode = dataNodeResultsResultSubResultsSubResult["HintWordsInfoList"]["HintWordsInfo"];
|
||||
for (auto dataNodeResultsResultSubResultsSubResultHintWordsInfoListHintWordsInfo : allHintWordsInfoListNode)
|
||||
{
|
||||
Data::Result::SubResult::HintWordsInfo hintWordsInfoListObject;
|
||||
if(!dataNodeResultsResultSubResultsSubResultHintWordsInfoListHintWordsInfo["Context"].isNull())
|
||||
hintWordsInfoListObject.context = dataNodeResultsResultSubResultsSubResultHintWordsInfoListHintWordsInfo["Context"].asString();
|
||||
subResultsObject.hintWordsInfoList.push_back(hintWordsInfoListObject);
|
||||
}
|
||||
auto allProgramCodeDataListNode = dataNodeResultsResultSubResultsSubResult["ProgramCodeDataList"]["ProgramCodeData"];
|
||||
for (auto dataNodeResultsResultSubResultsSubResultProgramCodeDataListProgramCodeData : allProgramCodeDataListNode)
|
||||
{
|
||||
Data::Result::SubResult::ProgramCodeData programCodeDataListObject;
|
||||
if(!dataNodeResultsResultSubResultsSubResultProgramCodeDataListProgramCodeData["X"].isNull())
|
||||
programCodeDataListObject.x = std::stof(dataNodeResultsResultSubResultsSubResultProgramCodeDataListProgramCodeData["X"].asString());
|
||||
if(!dataNodeResultsResultSubResultsSubResultProgramCodeDataListProgramCodeData["Y"].isNull())
|
||||
programCodeDataListObject.y = std::stof(dataNodeResultsResultSubResultsSubResultProgramCodeDataListProgramCodeData["Y"].asString());
|
||||
if(!dataNodeResultsResultSubResultsSubResultProgramCodeDataListProgramCodeData["Width"].isNull())
|
||||
programCodeDataListObject.width = std::stof(dataNodeResultsResultSubResultsSubResultProgramCodeDataListProgramCodeData["Width"].asString());
|
||||
if(!dataNodeResultsResultSubResultsSubResultProgramCodeDataListProgramCodeData["Height"].isNull())
|
||||
programCodeDataListObject.height = std::stof(dataNodeResultsResultSubResultsSubResultProgramCodeDataListProgramCodeData["Height"].asString());
|
||||
subResultsObject.programCodeDataList.push_back(programCodeDataListObject);
|
||||
}
|
||||
auto allLogoDataListNode = dataNodeResultsResultSubResultsSubResult["LogoDataList"]["LogoData"];
|
||||
for (auto dataNodeResultsResultSubResultsSubResultLogoDataListLogoData : allLogoDataListNode)
|
||||
{
|
||||
Data::Result::SubResult::LogoData logoDataListObject;
|
||||
if(!dataNodeResultsResultSubResultsSubResultLogoDataListLogoData["Type"].isNull())
|
||||
logoDataListObject.type = dataNodeResultsResultSubResultsSubResultLogoDataListLogoData["Type"].asString();
|
||||
if(!dataNodeResultsResultSubResultsSubResultLogoDataListLogoData["Name"].isNull())
|
||||
logoDataListObject.name = dataNodeResultsResultSubResultsSubResultLogoDataListLogoData["Name"].asString();
|
||||
if(!dataNodeResultsResultSubResultsSubResultLogoDataListLogoData["X"].isNull())
|
||||
logoDataListObject.x = std::stof(dataNodeResultsResultSubResultsSubResultLogoDataListLogoData["X"].asString());
|
||||
if(!dataNodeResultsResultSubResultsSubResultLogoDataListLogoData["Y"].isNull())
|
||||
logoDataListObject.y = std::stof(dataNodeResultsResultSubResultsSubResultLogoDataListLogoData["Y"].asString());
|
||||
if(!dataNodeResultsResultSubResultsSubResultLogoDataListLogoData["Width"].isNull())
|
||||
logoDataListObject.width = std::stof(dataNodeResultsResultSubResultsSubResultLogoDataListLogoData["Width"].asString());
|
||||
if(!dataNodeResultsResultSubResultsSubResultLogoDataListLogoData["Height"].isNull())
|
||||
logoDataListObject.height = std::stof(dataNodeResultsResultSubResultsSubResultLogoDataListLogoData["Height"].asString());
|
||||
subResultsObject.logoDataList.push_back(logoDataListObject);
|
||||
}
|
||||
auto allSfaceDataListNode = dataNodeResultsResultSubResultsSubResult["SfaceDataList"]["SfaceData"];
|
||||
for (auto dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceData : allSfaceDataListNode)
|
||||
{
|
||||
Data::Result::SubResult::SfaceData sfaceDataListObject;
|
||||
if(!dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceData["X"].isNull())
|
||||
sfaceDataListObject.x = std::stof(dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceData["X"].asString());
|
||||
if(!dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceData["Y"].isNull())
|
||||
sfaceDataListObject.y = std::stof(dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceData["Y"].asString());
|
||||
if(!dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceData["Width"].isNull())
|
||||
sfaceDataListObject.width = std::stof(dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceData["Width"].asString());
|
||||
if(!dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceData["Height"].isNull())
|
||||
sfaceDataListObject.height = std::stof(dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceData["Height"].asString());
|
||||
auto allFacesNode = dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceData["Faces"]["Face"];
|
||||
for (auto dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceDataFacesFace : allFacesNode)
|
||||
{
|
||||
Data::Result::SubResult::SfaceData::Face facesObject;
|
||||
if(!dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceDataFacesFace["Name"].isNull())
|
||||
facesObject.name = dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceDataFacesFace["Name"].asString();
|
||||
if(!dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceDataFacesFace["Rate"].isNull())
|
||||
facesObject.rate = std::stof(dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceDataFacesFace["Rate"].asString());
|
||||
if(!dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceDataFacesFace["Id"].isNull())
|
||||
facesObject.id = dataNodeResultsResultSubResultsSubResultSfaceDataListSfaceDataFacesFace["Id"].asString();
|
||||
sfaceDataListObject.faces.push_back(facesObject);
|
||||
}
|
||||
subResultsObject.sfaceDataList.push_back(sfaceDataListObject);
|
||||
}
|
||||
auto allOCRDataList = value["OCRDataList"]["OCRData"];
|
||||
for (auto value : allOCRDataList)
|
||||
subResultsObject.oCRDataList.push_back(value.asString());
|
||||
resultObject.subResults.push_back(subResultsObject);
|
||||
}
|
||||
data_.results.push_back(resultObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ScanImageResult::Data ScanImageResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
59
imageaudit/src/model/ScanTextRequest.cc
Normal file
59
imageaudit/src/model/ScanTextRequest.cc
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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/imageaudit/model/ScanTextRequest.h>
|
||||
|
||||
using AlibabaCloud::Imageaudit::Model::ScanTextRequest;
|
||||
|
||||
ScanTextRequest::ScanTextRequest() :
|
||||
RpcServiceRequest("imageaudit", "2019-12-30", "ScanText")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
ScanTextRequest::~ScanTextRequest()
|
||||
{}
|
||||
|
||||
std::vector<ScanTextRequest::Labels> ScanTextRequest::getLabels()const
|
||||
{
|
||||
return labels_;
|
||||
}
|
||||
|
||||
void ScanTextRequest::setLabels(const std::vector<Labels>& labels)
|
||||
{
|
||||
labels_ = labels;
|
||||
for(int dep1 = 0; dep1!= labels.size(); dep1++) {
|
||||
auto labelsObj = labels.at(dep1);
|
||||
std::string labelsObjStr = "Labels." + std::to_string(dep1 + 1);
|
||||
setParameter(labelsObjStr + ".Label", labelsObj.label);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<ScanTextRequest::Tasks> ScanTextRequest::getTasks()const
|
||||
{
|
||||
return tasks_;
|
||||
}
|
||||
|
||||
void ScanTextRequest::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 + ".Content", tasksObj.content);
|
||||
}
|
||||
}
|
||||
|
||||
86
imageaudit/src/model/ScanTextResult.cc
Normal file
86
imageaudit/src/model/ScanTextResult.cc
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* 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/imageaudit/model/ScanTextResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Imageaudit;
|
||||
using namespace AlibabaCloud::Imageaudit::Model;
|
||||
|
||||
ScanTextResult::ScanTextResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
ScanTextResult::ScanTextResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
ScanTextResult::~ScanTextResult()
|
||||
{}
|
||||
|
||||
void ScanTextResult::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();
|
||||
auto allResultsNode = dataNodeElementsElement["Results"]["Result"];
|
||||
for (auto dataNodeElementsElementResultsResult : allResultsNode)
|
||||
{
|
||||
Data::Element::Result resultsObject;
|
||||
if(!dataNodeElementsElementResultsResult["Label"].isNull())
|
||||
resultsObject.label = dataNodeElementsElementResultsResult["Label"].asString();
|
||||
if(!dataNodeElementsElementResultsResult["Suggestion"].isNull())
|
||||
resultsObject.suggestion = dataNodeElementsElementResultsResult["Suggestion"].asString();
|
||||
if(!dataNodeElementsElementResultsResult["Rate"].isNull())
|
||||
resultsObject.rate = std::stof(dataNodeElementsElementResultsResult["Rate"].asString());
|
||||
auto allDetailsNode = dataNodeElementsElementResultsResult["Details"]["Detail"];
|
||||
for (auto dataNodeElementsElementResultsResultDetailsDetail : allDetailsNode)
|
||||
{
|
||||
Data::Element::Result::Detail detailsObject;
|
||||
if(!dataNodeElementsElementResultsResultDetailsDetail["Label"].isNull())
|
||||
detailsObject.label = dataNodeElementsElementResultsResultDetailsDetail["Label"].asString();
|
||||
auto allContextsNode = dataNodeElementsElementResultsResultDetailsDetail["Contexts"]["Context"];
|
||||
for (auto dataNodeElementsElementResultsResultDetailsDetailContextsContext : allContextsNode)
|
||||
{
|
||||
Data::Element::Result::Detail::Context contextsObject;
|
||||
if(!dataNodeElementsElementResultsResultDetailsDetailContextsContext["Context"].isNull())
|
||||
contextsObject.context = dataNodeElementsElementResultsResultDetailsDetailContextsContext["Context"].asString();
|
||||
detailsObject.contexts.push_back(contextsObject);
|
||||
}
|
||||
resultsObject.details.push_back(detailsObject);
|
||||
}
|
||||
elementObject.results.push_back(resultsObject);
|
||||
}
|
||||
data_.elements.push_back(elementObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ScanTextResult::Data ScanTextResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user