mirror of
https://gitee.com/openharmony/distributeddatamgr_udmf
synced 2024-10-07 05:43:56 +00:00
add udmf ndk code
Signed-off-by: lizhuojun <lizhuojun3@huawei.com>
This commit is contained in:
parent
9eaafafc74
commit
18bdc7515f
2
BUILD.gn
2
BUILD.gn
@ -21,6 +21,7 @@ group("udmf_packages") {
|
||||
"interfaces/jskits:udmf_data_napi",
|
||||
"interfaces/jskits:unifieddatachannel_napi",
|
||||
"interfaces/jskits:uniformtypedescriptor_napi",
|
||||
"interfaces/ndk:udmf_ndk",
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -31,6 +32,7 @@ group("unittest") {
|
||||
deps = [
|
||||
"framework/innerkitsimpl/test/unittest:unittest",
|
||||
"framework/jskitsimpl/unittest:unittest",
|
||||
"framework/ndkimpl/unittest:unittest",
|
||||
]
|
||||
}
|
||||
|
||||
|
11
bundle.json
11
bundle.json
@ -50,6 +50,17 @@
|
||||
"//foundation/distributeddatamgr/udmf:udmf_packages"
|
||||
],
|
||||
"inner_kits": [
|
||||
{
|
||||
"name": "//foundation/distributeddatamgr/udmf/interfaces/ndk:udmf_ndk",
|
||||
"header": {
|
||||
"header_files": [
|
||||
"udmf_meta.h",
|
||||
"uds.h",
|
||||
"utd.h"
|
||||
],
|
||||
"header_base":"//foundation/distributeddatamgr/udmf/interfaces/ndk/data"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "//foundation/distributeddatamgr/udmf/interfaces/innerkits:udmf_client",
|
||||
"header": {
|
||||
|
1
framework/common/logger.h
Executable file → Normal file
1
framework/common/logger.h
Executable file → Normal file
@ -28,6 +28,7 @@ enum UdmfSubModule {
|
||||
UDMF_KITS_NAPI, // for udmf napi kits module
|
||||
UDMF_CLIENT, // for udmf client module
|
||||
UDMF_SERVICE, // for udmf service module
|
||||
UDMF_NDK, // for udmf ndk module
|
||||
UDMF_TEST, // for udmf test module
|
||||
};
|
||||
|
||||
|
91
framework/ndkimpl/data/udmf_ndk_common.h
Normal file
91
framework/ndkimpl/data/udmf_ndk_common.h
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* 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 UDMF_NDK_COMMON_H
|
||||
#define UDMF_NDK_COMMON_H
|
||||
|
||||
#include "unified_record.h"
|
||||
#include "unified_data.h"
|
||||
#include <mutex>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
struct Uds_Object_Ptr {
|
||||
const int64_t id;
|
||||
std::shared_ptr<OHOS::UDMF::Object> obj;
|
||||
std::mutex mutex;
|
||||
Uds_Object_Ptr(int id);
|
||||
const char* GetUdsValue(const char* const ¶mName);
|
||||
int SetUdsValue(const char* const ¶mName, const char* const &pramValue);
|
||||
};
|
||||
|
||||
enum UDMF_NdkStructId : std::int64_t {
|
||||
UTD_STRUCT_ID = 1002930,
|
||||
UDS_PLAIN_TEXT_STRUCT_ID,
|
||||
UDS_HYPERLINK_STRUCT_ID,
|
||||
UDS_HTML_STRUCT_ID,
|
||||
UDS_APP_ITEM_STRUCT_ID,
|
||||
UDMF_UNIFIED_DATA_STRUCT_ID,
|
||||
UDMF_UNIFIED_RECORD_STRUCT_ID,
|
||||
UDMF_UNIFIED_DATA_PROPERTIES_ID,
|
||||
};
|
||||
|
||||
struct OH_Utd {
|
||||
const int64_t id = UTD_STRUCT_ID;
|
||||
std::mutex mutex;
|
||||
std::string typeId;
|
||||
const char** belongingToTypes;
|
||||
unsigned int belongingToTypesCount;
|
||||
const char** filenameExtensions;
|
||||
unsigned int filenameExtensionsCount;
|
||||
const char** mimeTypes;
|
||||
unsigned int mimeTypeCount;
|
||||
std::string description;
|
||||
std::string referenceURL;
|
||||
std::string iconFile;
|
||||
};
|
||||
|
||||
struct OH_UdsPlainText : public Uds_Object_Ptr {
|
||||
OH_UdsPlainText();
|
||||
};
|
||||
struct OH_UdsHyperlink : public Uds_Object_Ptr {
|
||||
OH_UdsHyperlink();
|
||||
};
|
||||
struct OH_UdsHtml : public Uds_Object_Ptr {
|
||||
OH_UdsHtml();
|
||||
};
|
||||
struct OH_UdsAppItem : public Uds_Object_Ptr {
|
||||
OH_UdsAppItem();
|
||||
};
|
||||
|
||||
|
||||
|
||||
constexpr const char* UNIFORM_DATA_TYPE = "uniformDataType";
|
||||
|
||||
constexpr const char* CONTENT = "content";
|
||||
constexpr const char* ABSTRACT = "abstract";
|
||||
constexpr const char* URL = "url";
|
||||
constexpr const char* DESCRIPTION = "description";
|
||||
constexpr const char* HTML_CONTENT = "htmlContent";
|
||||
constexpr const char* PLAIN_CONTENT = "plainContent";
|
||||
|
||||
constexpr const char* APP_ID = "appId";
|
||||
constexpr const char* APP_NAME = "appName";
|
||||
constexpr const char* APP_ICON_ID = "appIconId";
|
||||
constexpr const char* APP_LABEL_ID = "appLabelId";
|
||||
constexpr const char* BUNDLE_NAME = "bundleName";
|
||||
constexpr const char* ABILITY_NAME = "abilityName";
|
||||
|
||||
#endif
|
373
framework/ndkimpl/data/uds.cpp
Normal file
373
framework/ndkimpl/data/uds.cpp
Normal file
@ -0,0 +1,373 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* 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.
|
||||
*/
|
||||
#define LOG_TAG "Uds"
|
||||
|
||||
#include <string>
|
||||
#include "logger.h"
|
||||
#include "uds.h"
|
||||
#include "utd_common.h"
|
||||
#include "unified_record.h"
|
||||
#include "udmf_ndk_common.h"
|
||||
#include "udmf_meta.h"
|
||||
#include "udmf_err_code.h"
|
||||
|
||||
using namespace OHOS::UDMF;
|
||||
|
||||
static bool IsInvalidUdsObjectPtr(const Uds_Object_Ptr* const &pThis, const int id)
|
||||
{
|
||||
return pThis == nullptr || pThis->id != id || pThis->obj == nullptr;
|
||||
}
|
||||
|
||||
const char* Uds_Object_Ptr::GetUdsValue(const char* const ¶mName)
|
||||
{
|
||||
if(obj->value_.find(paramName) == obj->value_.end()) {
|
||||
LOG_ERROR(UDMF_NDK, "Don't have property %{public}s.", paramName);
|
||||
return nullptr;
|
||||
}
|
||||
return (std::get_if<std::string>(&(obj->value_[paramName])))->c_str();
|
||||
}
|
||||
|
||||
Uds_Object_Ptr::Uds_Object_Ptr(const int id) : id(id) {}
|
||||
|
||||
OH_UdsPlainText::OH_UdsPlainText() : Uds_Object_Ptr(UDS_PLAIN_TEXT_STRUCT_ID) {}
|
||||
|
||||
OH_UdsHyperlink::OH_UdsHyperlink() : Uds_Object_Ptr(UDS_HYPERLINK_STRUCT_ID) {}
|
||||
|
||||
OH_UdsHtml::OH_UdsHtml() : Uds_Object_Ptr(UDS_HTML_STRUCT_ID) {}
|
||||
|
||||
OH_UdsAppItem::OH_UdsAppItem() : Uds_Object_Ptr(UDS_APP_ITEM_STRUCT_ID) {}
|
||||
|
||||
int Uds_Object_Ptr::SetUdsValue(const char* const ¶mName, const char* const &pramValue)
|
||||
{
|
||||
if(obj->value_.find(paramName) == obj->value_.end()) {
|
||||
LOG_ERROR(UDMF_NDK, "Can't set property %{public}s.", paramName);
|
||||
return UDMF_E_INVAILD_PARAM;
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
obj->value_[paramName] = pramValue;
|
||||
return UDMF_E_OK;
|
||||
}
|
||||
|
||||
OH_UdsPlainText* OH_UdsPlainText_Create()
|
||||
{
|
||||
OH_UdsPlainText* plainText = new (std::nothrow) OH_UdsPlainText();
|
||||
if (plainText == nullptr) {
|
||||
LOG_ERROR(UDMF_NDK, "Failed to apply for memory.");
|
||||
return nullptr;
|
||||
}
|
||||
plainText->obj = std::make_shared<Object>();
|
||||
plainText->obj->value_[UNIFORM_DATA_TYPE] = UDMF_META_PLAIN_TEXT;
|
||||
plainText->obj->value_[CONTENT] = "";
|
||||
plainText->obj->value_[ABSTRACT] = "";
|
||||
return plainText;
|
||||
}
|
||||
|
||||
void OH_UdsPlainText_Destroy(OH_UdsPlainText* pThis)
|
||||
{
|
||||
if (pThis != nullptr && pThis->id == UDS_PLAIN_TEXT_STRUCT_ID) {
|
||||
delete pThis;
|
||||
}
|
||||
}
|
||||
|
||||
const char* OH_UdsPlainText_GetType(OH_UdsPlainText* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_PLAIN_TEXT_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(UNIFORM_DATA_TYPE);
|
||||
}
|
||||
|
||||
const char* OH_UdsPlainText_GetContent(OH_UdsPlainText* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_PLAIN_TEXT_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(CONTENT);
|
||||
}
|
||||
|
||||
const char* OH_UdsPlainText_GetAbstract(OH_UdsPlainText* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_PLAIN_TEXT_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(ABSTRACT);
|
||||
}
|
||||
|
||||
int OH_UdsPlainText_SetContent(OH_UdsPlainText* pThis, const char* content)
|
||||
{
|
||||
if (content == nullptr || IsInvalidUdsObjectPtr(pThis, UDS_PLAIN_TEXT_STRUCT_ID)) {
|
||||
return UDMF_E_INVAILD_PARAM;
|
||||
}
|
||||
return pThis->SetUdsValue(CONTENT, content);
|
||||
}
|
||||
|
||||
int OH_UdsPlainText_SetAbstract(OH_UdsPlainText* pThis, const char* abstract)
|
||||
{
|
||||
if (abstract == nullptr || IsInvalidUdsObjectPtr(pThis, UDS_PLAIN_TEXT_STRUCT_ID)) {
|
||||
return UDMF_E_INVAILD_PARAM;
|
||||
}
|
||||
return pThis->SetUdsValue(ABSTRACT, abstract);
|
||||
}
|
||||
|
||||
OH_UdsHyperlink* OH_UdsHyperlink_Create()
|
||||
{
|
||||
OH_UdsHyperlink* hyperlink = new (std::nothrow) OH_UdsHyperlink();
|
||||
if (hyperlink == nullptr) {
|
||||
LOG_ERROR(UDMF_NDK, "Failed to apply for memory.");
|
||||
return nullptr;
|
||||
}
|
||||
hyperlink->obj = std::make_shared<Object>();
|
||||
hyperlink->obj->value_[UNIFORM_DATA_TYPE] = UDMF_META_HYPERLINK;
|
||||
hyperlink->obj->value_[URL] = "";
|
||||
hyperlink->obj->value_[DESCRIPTION] = "";
|
||||
return hyperlink;
|
||||
}
|
||||
|
||||
void OH_UdsHyperlink_Destroy(OH_UdsHyperlink* pThis)
|
||||
{
|
||||
if (pThis != nullptr && pThis->id == UDS_HYPERLINK_STRUCT_ID) {
|
||||
delete pThis;
|
||||
}
|
||||
}
|
||||
|
||||
const char* OH_UdsHyperlink_GetType(OH_UdsHyperlink* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_HYPERLINK_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(UNIFORM_DATA_TYPE);
|
||||
}
|
||||
|
||||
const char* OH_UdsHyperlink_GetUrl(OH_UdsHyperlink* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_HYPERLINK_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(URL);
|
||||
}
|
||||
|
||||
const char* OH_UdsHyperlink_GetDescription(OH_UdsHyperlink* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_HYPERLINK_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(DESCRIPTION);
|
||||
}
|
||||
|
||||
int OH_UdsHyperlink_SetUrl(OH_UdsHyperlink* pThis, const char* url)
|
||||
{
|
||||
if (url == nullptr || IsInvalidUdsObjectPtr(pThis, UDS_HYPERLINK_STRUCT_ID)) {
|
||||
return UDMF_E_INVAILD_PARAM;
|
||||
}
|
||||
return pThis->SetUdsValue(URL, url);
|
||||
}
|
||||
|
||||
int OH_UdsHyperlink_SetDescription(OH_UdsHyperlink* pThis, const char* description)
|
||||
{
|
||||
if (description == nullptr || IsInvalidUdsObjectPtr(pThis, UDS_HYPERLINK_STRUCT_ID)) {
|
||||
return UDMF_E_INVAILD_PARAM;
|
||||
}
|
||||
return pThis->SetUdsValue(DESCRIPTION, description);
|
||||
}
|
||||
|
||||
OH_UdsHtml* OH_UdsHtml_Create()
|
||||
{
|
||||
OH_UdsHtml* html = new (std::nothrow) OH_UdsHtml();
|
||||
if (html == nullptr) {
|
||||
LOG_ERROR(UDMF_NDK, "Failed to apply for memory.");
|
||||
return nullptr;
|
||||
}
|
||||
html->obj = std::make_shared<Object>();
|
||||
html->obj->value_[UNIFORM_DATA_TYPE] = UDMF_META_HTML;
|
||||
html->obj->value_[HTML_CONTENT] = "";
|
||||
html->obj->value_[PLAIN_CONTENT] = "";
|
||||
return html;
|
||||
}
|
||||
|
||||
void OH_UdsHtml_Destroy(OH_UdsHtml* pThis)
|
||||
{
|
||||
if (pThis != nullptr && pThis->id == UDS_HTML_STRUCT_ID) {
|
||||
delete pThis;
|
||||
}
|
||||
}
|
||||
|
||||
const char* OH_UdsHtml_GetType(OH_UdsHtml* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_HTML_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(UNIFORM_DATA_TYPE);
|
||||
}
|
||||
|
||||
const char* OH_UdsHtml_GetContent(OH_UdsHtml* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_HTML_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(HTML_CONTENT);
|
||||
}
|
||||
|
||||
const char* OH_UdsHtml_GetPlainContent(OH_UdsHtml* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_HTML_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(PLAIN_CONTENT);
|
||||
}
|
||||
|
||||
int OH_UdsHtml_SetContent(OH_UdsHtml* pThis, const char* content)
|
||||
{
|
||||
if (content == nullptr || IsInvalidUdsObjectPtr(pThis, UDS_HTML_STRUCT_ID)) {
|
||||
return UDMF_E_INVAILD_PARAM;
|
||||
}
|
||||
return pThis->SetUdsValue(HTML_CONTENT, content);
|
||||
}
|
||||
|
||||
int OH_UdsHtml_SetPlainContent(OH_UdsHtml* pThis, const char* plainContent)
|
||||
{
|
||||
if (plainContent == nullptr || IsInvalidUdsObjectPtr(pThis, UDS_HTML_STRUCT_ID)) {
|
||||
return UDMF_E_INVAILD_PARAM;
|
||||
}
|
||||
return pThis->SetUdsValue(PLAIN_CONTENT, plainContent);
|
||||
}
|
||||
|
||||
OH_UdsAppItem* OH_UdsAppItem_Create()
|
||||
{
|
||||
OH_UdsAppItem* appItem = new (std::nothrow) OH_UdsAppItem();
|
||||
if (appItem == nullptr) {
|
||||
LOG_ERROR(UDMF_NDK, "Failed to apply for memory.");
|
||||
return nullptr;
|
||||
}
|
||||
appItem->obj = std::make_shared<Object>();
|
||||
appItem->obj->value_[UNIFORM_DATA_TYPE] = UDMF_META_OPENHARMONY_APP_ITEM;
|
||||
appItem->obj->value_[APP_ID] = "";
|
||||
appItem->obj->value_[APP_NAME] = "";
|
||||
appItem->obj->value_[APP_ICON_ID] = "";
|
||||
appItem->obj->value_[APP_LABEL_ID] = "";
|
||||
appItem->obj->value_[BUNDLE_NAME] = "";
|
||||
appItem->obj->value_[ABILITY_NAME] = "";
|
||||
return appItem;
|
||||
}
|
||||
|
||||
void OH_UdsAppItem_Destroy(OH_UdsAppItem* pThis)
|
||||
{
|
||||
if (pThis != nullptr && pThis->id == UDS_APP_ITEM_STRUCT_ID) {
|
||||
delete pThis;
|
||||
}
|
||||
}
|
||||
|
||||
const char* OH_UdsAppItem_GetType(OH_UdsAppItem* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_APP_ITEM_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(UNIFORM_DATA_TYPE);
|
||||
}
|
||||
|
||||
const char* OH_UdsAppItem_GetId(OH_UdsAppItem* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_APP_ITEM_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(APP_ID);
|
||||
}
|
||||
|
||||
const char* OH_UdsAppItem_GetName(OH_UdsAppItem* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_APP_ITEM_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(APP_NAME);
|
||||
}
|
||||
|
||||
const char* OH_UdsAppItem_GetIconId(OH_UdsAppItem* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_APP_ITEM_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(APP_ICON_ID);
|
||||
}
|
||||
|
||||
const char* OH_UdsAppItem_GetLabelId(OH_UdsAppItem* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_APP_ITEM_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(APP_LABEL_ID);
|
||||
}
|
||||
|
||||
const char* OH_UdsAppItem_GetBundleName(OH_UdsAppItem* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_APP_ITEM_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(BUNDLE_NAME);
|
||||
}
|
||||
|
||||
const char* OH_UdsAppItem_GetAbilityName(OH_UdsAppItem* pThis)
|
||||
{
|
||||
if (IsInvalidUdsObjectPtr(pThis, UDS_APP_ITEM_STRUCT_ID)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->GetUdsValue(ABILITY_NAME);
|
||||
}
|
||||
|
||||
int OH_UdsAppItem_SetId(OH_UdsAppItem* pThis, const char* appId)
|
||||
{
|
||||
if (appId == nullptr || IsInvalidUdsObjectPtr(pThis, UDS_APP_ITEM_STRUCT_ID)) {
|
||||
return UDMF_E_INVAILD_PARAM;
|
||||
}
|
||||
return pThis->SetUdsValue(APP_ID, appId);
|
||||
}
|
||||
|
||||
int OH_UdsAppItem_SetName(OH_UdsAppItem* pThis, const char* appName)
|
||||
{
|
||||
if (appName == nullptr || IsInvalidUdsObjectPtr(pThis, UDS_APP_ITEM_STRUCT_ID)) {
|
||||
return UDMF_E_INVAILD_PARAM;
|
||||
}
|
||||
return pThis->SetUdsValue(APP_NAME, appName);
|
||||
}
|
||||
|
||||
int OH_UdsAppItem_SetIconId(OH_UdsAppItem* pThis, const char* appIconId)
|
||||
{
|
||||
if (appIconId == nullptr || IsInvalidUdsObjectPtr(pThis, UDS_APP_ITEM_STRUCT_ID)) {
|
||||
return UDMF_E_INVAILD_PARAM;
|
||||
}
|
||||
return pThis->SetUdsValue(APP_ICON_ID, appIconId);
|
||||
}
|
||||
|
||||
int OH_UdsAppItem_SetLabelId(OH_UdsAppItem* pThis, const char* appLabelId)
|
||||
{
|
||||
if (appLabelId == nullptr || IsInvalidUdsObjectPtr(pThis, UDS_APP_ITEM_STRUCT_ID)) {
|
||||
return UDMF_E_INVAILD_PARAM;
|
||||
}
|
||||
return pThis->SetUdsValue(APP_LABEL_ID, appLabelId);
|
||||
}
|
||||
|
||||
int OH_UdsAppItem_SetBundleName(OH_UdsAppItem* pThis, const char* bundleName)
|
||||
{
|
||||
if (bundleName == nullptr || IsInvalidUdsObjectPtr(pThis, UDS_APP_ITEM_STRUCT_ID)) {
|
||||
return UDMF_E_INVAILD_PARAM;
|
||||
}
|
||||
return pThis->SetUdsValue(BUNDLE_NAME, bundleName);
|
||||
}
|
||||
|
||||
int OH_UdsAppItem_SetAbilityName(OH_UdsAppItem* pThis, const char* abilityName)
|
||||
{
|
||||
if (abilityName == nullptr || IsInvalidUdsObjectPtr(pThis, UDS_APP_ITEM_STRUCT_ID)) {
|
||||
return UDMF_E_INVAILD_PARAM;
|
||||
}
|
||||
return pThis->SetUdsValue(ABILITY_NAME, abilityName);
|
||||
}
|
252
framework/ndkimpl/data/utd.cpp
Normal file
252
framework/ndkimpl/data/utd.cpp
Normal file
@ -0,0 +1,252 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "Utd"
|
||||
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include "securec.h"
|
||||
#include "logger.h"
|
||||
#include "utd.h"
|
||||
#include "utd_client.h"
|
||||
#include "udmf_ndk_common.h"
|
||||
#include "udmf_err_code.h"
|
||||
|
||||
using namespace OHOS::UDMF;
|
||||
|
||||
typedef Status (UtdClient::*FuncPtr)(const std::string&, std::string&, std::string);
|
||||
|
||||
static void DestroyArrayPtr(const char** &arrayPtr, unsigned int& count)
|
||||
{
|
||||
if (arrayPtr == nullptr) {
|
||||
LOG_ERROR(UDMF_NDK, "Cannot delete arrayPtr because it's a nullptr.");
|
||||
return;
|
||||
}
|
||||
for (unsigned int i = 0; i < count; i++) {
|
||||
if (arrayPtr[i] != nullptr) {
|
||||
delete[] arrayPtr[i];
|
||||
arrayPtr[i] = nullptr;
|
||||
}
|
||||
}
|
||||
delete[] arrayPtr;
|
||||
arrayPtr = nullptr;
|
||||
count = 0;
|
||||
LOG_INFO(UDMF_NDK, "END TO DELETE arrayPtr.");
|
||||
}
|
||||
|
||||
static const char** CreateStrArrByVector(const std::vector<std::string>& paramVector, unsigned int* count)
|
||||
{
|
||||
*count = paramVector.size();
|
||||
auto charPtr = new char *[*count];
|
||||
for (unsigned int i = 0; i < *count; i++) {
|
||||
charPtr[i] = new char[paramVector[i].size() + 1];
|
||||
if (strcpy_s(charPtr[i], paramVector[i].size() + 1, paramVector[i].c_str()) != UDMF_E_OK) {
|
||||
LOG_ERROR(UDMF_NDK, "str copy error!");
|
||||
const char** arrayPtr = const_cast<const char**>(charPtr);
|
||||
DestroyArrayPtr(arrayPtr, *count);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return const_cast<const char**>(charPtr);
|
||||
}
|
||||
|
||||
static std::shared_ptr<TypeDescriptor> GetTypeDescriptorByUtdClient(const char* typeId)
|
||||
{
|
||||
std::shared_ptr<TypeDescriptor> typeDescriptor;
|
||||
UtdClient::GetInstance().GetTypeDescriptor(typeId, typeDescriptor);
|
||||
return typeDescriptor;
|
||||
}
|
||||
|
||||
static bool IsUtdInvalid(OH_Utd* pThis)
|
||||
{
|
||||
return pThis == nullptr || pThis->id != UTD_STRUCT_ID;
|
||||
}
|
||||
|
||||
static const char** GetTypesByCondition(const char* condition, unsigned int* count, FuncPtr funcPtr)
|
||||
{
|
||||
if (condition == nullptr || count == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
std::string typeIdStr;
|
||||
(UtdClient::GetInstance().*funcPtr)(condition, typeIdStr, DEFAULT_TYPE_ID);
|
||||
if (typeIdStr.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
char* typeId = new char[typeIdStr.size() + 1];
|
||||
if (strcpy_s(typeId, typeIdStr.size() + 1, typeIdStr.c_str()) != UDMF_E_OK) {
|
||||
LOG_ERROR(UDMF_NDK, "str copy error!");
|
||||
delete[] typeId;
|
||||
return nullptr;
|
||||
}
|
||||
*count = 1;
|
||||
char** typeIds = new char*[*count];
|
||||
typeIds[0] = typeId;
|
||||
return const_cast<const char**>(typeIds);
|
||||
}
|
||||
|
||||
OH_Utd* OH_Utd_Create(const char* typeId)
|
||||
{
|
||||
if (typeId == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
OH_Utd* pThis = new (std::nothrow) OH_Utd();
|
||||
if (pThis == nullptr) {
|
||||
LOG_ERROR(UDMF_NDK, "Failed to apply for memory.");
|
||||
return nullptr;
|
||||
}
|
||||
auto typeDescriptor = GetTypeDescriptorByUtdClient(typeId);
|
||||
pThis->typeId = typeDescriptor->GetTypeId();
|
||||
pThis->description = typeDescriptor->GetDescription();
|
||||
pThis->referenceURL = typeDescriptor->GetReferenceURL();
|
||||
pThis->iconFile = typeDescriptor->GetIconFile();
|
||||
pThis->belongingToTypes = CreateStrArrByVector(typeDescriptor->GetBelongingToTypes(),
|
||||
&(pThis->belongingToTypesCount));
|
||||
pThis->filenameExtensions = CreateStrArrByVector(typeDescriptor->GetFilenameExtensions(),
|
||||
&(pThis->filenameExtensionsCount));
|
||||
pThis->mimeTypes = CreateStrArrByVector(typeDescriptor->GetMimeTypes(),
|
||||
&(pThis->mimeTypeCount));
|
||||
return pThis;
|
||||
}
|
||||
|
||||
void OH_Utd_Destroy(OH_Utd* pThis)
|
||||
{
|
||||
if (IsUtdInvalid(pThis)) {
|
||||
LOG_ERROR(UDMF_NDK, "Failed to Destroy UTD, because pThis maybe nullptr or non-UTD struct ptr.");
|
||||
return;
|
||||
}
|
||||
DestroyArrayPtr(pThis->belongingToTypes, pThis->belongingToTypesCount);
|
||||
DestroyArrayPtr(pThis->filenameExtensions, pThis->filenameExtensionsCount);
|
||||
DestroyArrayPtr(pThis->mimeTypes, pThis->mimeTypeCount);
|
||||
delete pThis;
|
||||
LOG_INFO(UDMF_NDK, "OH_Utd ptr already be delete");
|
||||
}
|
||||
|
||||
const char* OH_Utd_GetTypeId(OH_Utd* pThis)
|
||||
{
|
||||
if (IsUtdInvalid(pThis)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->typeId.c_str();
|
||||
}
|
||||
|
||||
const char* OH_Utd_GetDescription(OH_Utd* pThis)
|
||||
{
|
||||
if (IsUtdInvalid(pThis)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->description.c_str();
|
||||
}
|
||||
|
||||
const char* OH_Utd_GetReferenceURL(OH_Utd* pThis)
|
||||
{
|
||||
if (IsUtdInvalid(pThis)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->referenceURL.c_str();
|
||||
}
|
||||
|
||||
const char* OH_Utd_GetIconFile(OH_Utd* pThis)
|
||||
{
|
||||
if (IsUtdInvalid(pThis)) {
|
||||
return nullptr;
|
||||
}
|
||||
return pThis->iconFile.c_str();
|
||||
}
|
||||
|
||||
const char** OH_Utd_GetBelongingToTypes(OH_Utd* pThis, unsigned int* count)
|
||||
{
|
||||
if (IsUtdInvalid(pThis) || count == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
*count = pThis->belongingToTypesCount;
|
||||
return pThis->belongingToTypes;
|
||||
}
|
||||
|
||||
const char** OH_Utd_GetFilenameExtensions(OH_Utd* pThis, unsigned int* count)
|
||||
{
|
||||
if (IsUtdInvalid(pThis) || count == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
*count = pThis->filenameExtensionsCount;
|
||||
return pThis->filenameExtensions;
|
||||
}
|
||||
|
||||
const char** OH_Utd_GetMimeTypes(OH_Utd* pThis, unsigned int* count)
|
||||
{
|
||||
if (IsUtdInvalid(pThis) || count == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
*count = pThis->mimeTypeCount;
|
||||
return pThis->mimeTypes;
|
||||
}
|
||||
|
||||
const char** OH_Utd_GetTypesByFilenameExtension(const char* extension, unsigned int* count)
|
||||
{
|
||||
FuncPtr funcPtr = &UtdClient::GetUniformDataTypeByFilenameExtension;
|
||||
return GetTypesByCondition(extension, count, funcPtr);
|
||||
}
|
||||
|
||||
const char** OH_Utd_GetTypesByMimeType(const char* mimeType, unsigned int* count)
|
||||
{
|
||||
FuncPtr funcPtr = &UtdClient::GetUniformDataTypeByMIMEType;
|
||||
return GetTypesByCondition(mimeType, count, funcPtr);
|
||||
}
|
||||
|
||||
bool OH_Utd_IsBelongsTo(const char* srcTypeId, const char* destTypeId)
|
||||
{
|
||||
if (srcTypeId == nullptr || destTypeId == nullptr) {
|
||||
return false;
|
||||
}
|
||||
auto typeDescriptor = GetTypeDescriptorByUtdClient(srcTypeId);
|
||||
bool checkResult = false;
|
||||
typeDescriptor->BelongsTo(destTypeId, checkResult);
|
||||
return checkResult;
|
||||
}
|
||||
|
||||
bool OH_Utd_IsLowerLevelType(const char* srcTypeId, const char* destTypeId)
|
||||
{
|
||||
if (srcTypeId == nullptr || destTypeId == nullptr) {
|
||||
return false;
|
||||
}
|
||||
auto typeDescriptor = GetTypeDescriptorByUtdClient(srcTypeId);
|
||||
bool checkResult = false;
|
||||
typeDescriptor->IsLowerLevelType(destTypeId, checkResult);
|
||||
return checkResult;
|
||||
}
|
||||
|
||||
bool OH_Utd_IsHigherLevelType(const char* srcTypeId, const char* destTypeId)
|
||||
{
|
||||
if (srcTypeId == nullptr || destTypeId == nullptr) {
|
||||
return false;
|
||||
}
|
||||
auto typeDescriptor = GetTypeDescriptorByUtdClient(srcTypeId);
|
||||
bool checkResult = false;
|
||||
typeDescriptor->IsHigherLevelType(destTypeId, checkResult);
|
||||
return checkResult;
|
||||
}
|
||||
|
||||
bool OH_Utd_IsEquals(OH_Utd* utd1, OH_Utd* utd2)
|
||||
{
|
||||
if (IsUtdInvalid(utd1) || IsUtdInvalid(utd2)) {
|
||||
return false;
|
||||
}
|
||||
return GetTypeDescriptorByUtdClient(utd1->typeId.c_str())->Equals(
|
||||
GetTypeDescriptorByUtdClient(utd2->typeId.c_str()));
|
||||
}
|
||||
|
||||
void OH_Utd_DestroyStringList(const char** list, unsigned int count)
|
||||
{
|
||||
DestroyArrayPtr(list, count);
|
||||
}
|
82
framework/ndkimpl/unittest/BUILD.gn
Normal file
82
framework/ndkimpl/unittest/BUILD.gn
Normal file
@ -0,0 +1,82 @@
|
||||
# Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
# 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.
|
||||
import("//build/test.gni")
|
||||
import("//foundation/distributeddatamgr/udmf/udmf.gni")
|
||||
|
||||
module_output_path = "udmf/ndkimpl"
|
||||
|
||||
###############################################################################
|
||||
config("module_private_config") {
|
||||
include_dirs = [
|
||||
"${udmf_interfaces_path}/ndk/data",
|
||||
"${udmf_interfaces_path}/innerkits/data",
|
||||
"${udmf_interfaces_path}/innerkits/common",
|
||||
"${udmf_framework_path}/common",
|
||||
"${udmf_framework_path}/ndkimpl/data",
|
||||
]
|
||||
}
|
||||
|
||||
common_deps = [ "${udmf_interfaces_path}/ndk:udmf_ndk" ]
|
||||
|
||||
common_external_deps = [
|
||||
"ability_base:want",
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"access_token:libnativetoken",
|
||||
"access_token:libtoken_setproc",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"c_utils:utils",
|
||||
"hilog:libhilog",
|
||||
"image_framework:image",
|
||||
"ipc:ipc_core",
|
||||
"kv_store:distributeddata_inner",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
|
||||
ohos_unittest("UtdTest") {
|
||||
module_out_path = module_output_path
|
||||
|
||||
sources = [
|
||||
"utd_test.cpp"
|
||||
]
|
||||
|
||||
configs = [ ":module_private_config" ]
|
||||
|
||||
deps = common_deps
|
||||
|
||||
external_deps = common_external_deps
|
||||
}
|
||||
|
||||
ohos_unittest("UdsTest") {
|
||||
module_out_path = module_output_path
|
||||
|
||||
sources = [
|
||||
"uds_test.cpp"
|
||||
]
|
||||
|
||||
configs = [ ":module_private_config" ]
|
||||
|
||||
deps = common_deps
|
||||
|
||||
external_deps = common_external_deps
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
group("unittest") {
|
||||
testonly = true
|
||||
|
||||
deps = [
|
||||
":UtdTest",
|
||||
":UdsTest"
|
||||
]
|
||||
}
|
||||
###############################################################################
|
769
framework/ndkimpl/unittest/uds_test.cpp
Normal file
769
framework/ndkimpl/unittest/uds_test.cpp
Normal file
@ -0,0 +1,769 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "UdsTest"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "token_setproc.h"
|
||||
#include "accesstoken_kit.h"
|
||||
#include "nativetoken_kit.h"
|
||||
|
||||
#include "logger.h"
|
||||
#include "uds.h"
|
||||
#include "udmf_ndk_common.h"
|
||||
#include "udmf_meta.h"
|
||||
#include "udmf_err_code.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
using namespace OHOS::Security::AccessToken;
|
||||
using namespace OHOS::UDMF;
|
||||
using namespace OHOS;
|
||||
|
||||
namespace OHOS::Test {
|
||||
class UdsTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase(void);
|
||||
static void TearDownTestCase(void);
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void UdsTest::SetUpTestCase(void){}
|
||||
|
||||
void UdsTest::TearDownTestCase(void){}
|
||||
|
||||
void UdsTest::SetUp(void){}
|
||||
|
||||
void UdsTest::TearDown(void){}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsPlainText_Create_001
|
||||
* @tc.desc: Normal testcase of OH_UdsPlainText_Create
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsPlainText_Create_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsPlainText_Create_001 begin.");
|
||||
auto plainText = OH_UdsPlainText_Create();
|
||||
EXPECT_EQ(UDMF_META_PLAIN_TEXT, *(std::get_if<std::string>(&(plainText->obj->value_[UNIFORM_DATA_TYPE]))));
|
||||
OH_UdsPlainText_Destroy(plainText);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsPlainText_Create_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsPlainText_GetType_001
|
||||
* @tc.desc: Normal testcase of OH_UdsPlainText_GetType
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsPlainText_GetType_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsPlainText_GetType_001 begin.");
|
||||
auto plainText = OH_UdsPlainText_Create();
|
||||
EXPECT_EQ(UDMF_META_PLAIN_TEXT, std::string(OH_UdsPlainText_GetType(plainText)));
|
||||
OH_UdsPlainText_Destroy(plainText);
|
||||
|
||||
OH_UdsPlainText* plainTextNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsPlainText_GetType(plainTextNullptr));
|
||||
|
||||
plainTextNullptr = new OH_UdsPlainText;
|
||||
EXPECT_EQ(nullptr, OH_UdsPlainText_GetType(plainTextNullptr));
|
||||
OH_UdsPlainText_Destroy(plainTextNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsPlainText_GetType_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsPlainText_GetContent_001
|
||||
* @tc.desc: Normal testcase of OH_UdsPlainText_GetContent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsPlainText_GetContent_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsPlainText_GetContent_001 begin.");
|
||||
auto plainText = OH_UdsPlainText_Create();
|
||||
plainText->obj->value_[CONTENT] = "doing something";
|
||||
EXPECT_EQ("doing something", std::string(OH_UdsPlainText_GetContent(plainText)));
|
||||
OH_UdsPlainText_Destroy(plainText);
|
||||
|
||||
OH_UdsPlainText* plainTextNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsPlainText_GetContent(plainTextNullptr));
|
||||
|
||||
plainTextNullptr = new OH_UdsPlainText;
|
||||
EXPECT_EQ(nullptr, OH_UdsPlainText_GetContent(plainTextNullptr));
|
||||
OH_UdsPlainText_Destroy(plainTextNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsPlainText_GetContent_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsPlainText_GetAbstract_001
|
||||
* @tc.desc: Normal testcase of OH_UdsPlainText_GetAbstract
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsPlainText_GetAbstract_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsPlainText_GetAbstract_001 begin.");
|
||||
auto plainText = OH_UdsPlainText_Create();
|
||||
plainText->obj->value_[ABSTRACT] = "doing something";
|
||||
EXPECT_EQ("doing something", std::string(OH_UdsPlainText_GetAbstract(plainText)));
|
||||
OH_UdsPlainText_Destroy(plainText);
|
||||
|
||||
OH_UdsPlainText* plainTextNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsPlainText_GetAbstract(plainTextNullptr));
|
||||
|
||||
plainTextNullptr = new OH_UdsPlainText;
|
||||
EXPECT_EQ(nullptr, OH_UdsPlainText_GetAbstract(plainTextNullptr));
|
||||
OH_UdsPlainText_Destroy(plainTextNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsPlainText_GetAbstract_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsPlainText_SetContent_001
|
||||
* @tc.desc: Normal testcase of OH_UdsPlainText_SetContent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsPlainText_SetContent_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsPlainText_SetContent_001 begin.");
|
||||
auto plainText = OH_UdsPlainText_Create();
|
||||
int result = OH_UdsPlainText_SetContent(plainText, "doing something");
|
||||
EXPECT_EQ(UDMF_E_OK, result);
|
||||
EXPECT_EQ("doing something", std::string(OH_UdsPlainText_GetContent(plainText)));
|
||||
|
||||
result = OH_UdsPlainText_SetContent(nullptr, "doing something");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
result = OH_UdsPlainText_SetContent(plainText, nullptr);
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
plainText->obj = nullptr;
|
||||
result = OH_UdsPlainText_SetContent(plainText, "doing something");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
OH_UdsPlainText_Destroy(plainText);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsPlainText_SetContent_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsPlainText_SetAbstract_001
|
||||
* @tc.desc: Normal testcase of OH_UdsPlainText_SetAbstract
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsPlainText_SetAbstract_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsPlainText_SetAbstract_001 begin.");
|
||||
auto plainText = OH_UdsPlainText_Create();
|
||||
int result = OH_UdsPlainText_SetAbstract(plainText, "doing something");
|
||||
EXPECT_EQ(UDMF_E_OK, result);
|
||||
EXPECT_EQ("doing something", std::string(OH_UdsPlainText_GetAbstract(plainText)));
|
||||
|
||||
result = OH_UdsPlainText_SetAbstract(nullptr, "doing something");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
result = OH_UdsPlainText_SetAbstract(plainText, nullptr);
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
plainText->obj = nullptr;
|
||||
result = OH_UdsPlainText_SetAbstract(plainText, "doing something");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
OH_UdsPlainText_Destroy(plainText);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsPlainText_SetAbstract_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsHyperlink_Create_001
|
||||
* @tc.desc: Normal testcase of OH_UdsHyperlink_Create
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsHyperlink_Create_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHyperlink_Create_001 begin.");
|
||||
auto hyperlink = OH_UdsHyperlink_Create();
|
||||
EXPECT_EQ(UDMF_META_HYPERLINK, *(std::get_if<std::string>(&(hyperlink->obj)->value_[UNIFORM_DATA_TYPE])));
|
||||
OH_UdsHyperlink_Destroy(hyperlink);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHyperlink_Create_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsHyperlink_GetType_001
|
||||
* @tc.desc: Normal testcase of OH_UdsHyperlink_GetType
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsHyperlink_GetType_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHyperlink_GetType_001 begin.");
|
||||
auto hyperlink = OH_UdsHyperlink_Create();
|
||||
EXPECT_EQ(UDMF_META_HYPERLINK, std::string(OH_UdsHyperlink_GetType(hyperlink)));
|
||||
OH_UdsHyperlink_Destroy(hyperlink);
|
||||
|
||||
OH_UdsHyperlink* hyperlinkNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsHyperlink_GetType(hyperlinkNullptr));
|
||||
|
||||
hyperlinkNullptr = new OH_UdsHyperlink;
|
||||
EXPECT_EQ(nullptr, OH_UdsHyperlink_GetType(hyperlinkNullptr));
|
||||
OH_UdsHyperlink_Destroy(hyperlinkNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHyperlink_GetType_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsHyperlink_GetUrl_001
|
||||
* @tc.desc: Normal testcase of OH_UdsHyperlink_GetUrl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsHyperlink_GetUrl_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHyperlink_GetUrl_001 begin.");
|
||||
auto hyperlink = OH_UdsHyperlink_Create();
|
||||
hyperlink->obj->value_[URL] = "www.huawei.com";
|
||||
EXPECT_EQ("www.huawei.com", std::string(OH_UdsHyperlink_GetUrl(hyperlink)));
|
||||
OH_UdsHyperlink_Destroy(hyperlink);
|
||||
|
||||
OH_UdsHyperlink* hyperlinkNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsHyperlink_GetUrl(hyperlinkNullptr));
|
||||
|
||||
hyperlinkNullptr = new OH_UdsHyperlink;
|
||||
EXPECT_EQ(nullptr, OH_UdsHyperlink_GetUrl(hyperlinkNullptr));
|
||||
OH_UdsHyperlink_Destroy(hyperlinkNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHyperlink_GetUrl_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsHyperlink_GetDescription_001
|
||||
* @tc.desc: Normal testcase of OH_UdsHyperlink_GetDescription
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsHyperlink_GetDescription_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHyperlink_GetDescription_001 begin.");
|
||||
auto hyperlink = OH_UdsHyperlink_Create();
|
||||
hyperlink->obj->value_[DESCRIPTION] = "do something";
|
||||
EXPECT_EQ("do something", std::string(OH_UdsHyperlink_GetDescription(hyperlink)));
|
||||
OH_UdsHyperlink_Destroy(hyperlink);
|
||||
|
||||
OH_UdsHyperlink* hyperlinkNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsHyperlink_GetDescription(hyperlinkNullptr));
|
||||
|
||||
hyperlinkNullptr = new OH_UdsHyperlink;
|
||||
EXPECT_EQ(nullptr, OH_UdsHyperlink_GetDescription(hyperlinkNullptr));
|
||||
OH_UdsHyperlink_Destroy(hyperlinkNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHyperlink_GetDescription_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsHyperlink_SetUrl_001
|
||||
* @tc.desc: Normal testcase of OH_UdsHyperlink_SetUrl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsHyperlink_SetUrl_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHyperlink_SetUrl_001 begin.");
|
||||
auto hyperlink = OH_UdsHyperlink_Create();
|
||||
int result = OH_UdsHyperlink_SetUrl(hyperlink, "www.huawei.com");
|
||||
EXPECT_EQ(UDMF_E_OK, result);
|
||||
EXPECT_EQ("www.huawei.com", std::string(OH_UdsHyperlink_GetUrl(hyperlink)));
|
||||
|
||||
result = OH_UdsHyperlink_SetUrl(nullptr, "www.huawei.com");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
result = OH_UdsHyperlink_SetUrl(hyperlink, nullptr);
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
hyperlink->obj = nullptr;
|
||||
result = OH_UdsHyperlink_SetUrl(hyperlink, "www.huawei.com");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
OH_UdsHyperlink_Destroy(hyperlink);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHyperlink_SetUrl_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsHyperlink_SetDescription_001
|
||||
* @tc.desc: Normal testcase of OH_UdsHyperlink_SetDescription
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsHyperlink_SetDescription_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHyperlink_SetDescription_001 begin.");
|
||||
auto hyperlink = OH_UdsHyperlink_Create();
|
||||
int result = OH_UdsHyperlink_SetDescription(hyperlink, "doing something");
|
||||
EXPECT_EQ(UDMF_E_OK, result);
|
||||
EXPECT_EQ("doing something", std::string(OH_UdsHyperlink_GetDescription(hyperlink)));
|
||||
|
||||
result = OH_UdsHyperlink_SetDescription(nullptr, "doing something");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
result = OH_UdsHyperlink_SetDescription(hyperlink, nullptr);
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
hyperlink->obj = nullptr;
|
||||
result = OH_UdsHyperlink_SetDescription(hyperlink, "doing something");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
OH_UdsHyperlink_Destroy(hyperlink);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHyperlink_SetDescription_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsHtml_Create_001
|
||||
* @tc.desc: Normal testcase of OH_UdsHtml_Create
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsHtml_Create_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHtml_Create_001 begin.");
|
||||
auto html = OH_UdsHtml_Create();
|
||||
EXPECT_EQ(UDMF_META_HTML, *(std::get_if<std::string>(&(html->obj)->value_[UNIFORM_DATA_TYPE])));
|
||||
OH_UdsHtml_Destroy(html);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHtml_Create_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsHtml_GetType_001
|
||||
* @tc.desc: Normal testcase of OH_UdsHtml_GetType
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsHtml_GetType_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHtml_GetType_001 begin.");
|
||||
auto html = OH_UdsHtml_Create();
|
||||
EXPECT_EQ(UDMF_META_HTML, std::string(OH_UdsHtml_GetType(html)));
|
||||
OH_UdsHtml_Destroy(html);
|
||||
|
||||
OH_UdsHtml* htmlNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsHtml_GetType(htmlNullptr));
|
||||
|
||||
htmlNullptr = new OH_UdsHtml;
|
||||
EXPECT_EQ(nullptr, OH_UdsHtml_GetType(htmlNullptr));
|
||||
OH_UdsHtml_Destroy(htmlNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHtml_GetType_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsHtml_GetContent_001
|
||||
* @tc.desc: Normal testcase of OH_UdsHtml_GetContent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsHtml_GetContent_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHtml_GetContent_001 begin.");
|
||||
auto html = OH_UdsHtml_Create();
|
||||
html->obj->value_[HTML_CONTENT] = "htmlxxxxx";
|
||||
EXPECT_EQ("htmlxxxxx", std::string(OH_UdsHtml_GetContent(html)));
|
||||
OH_UdsHtml_Destroy(html);
|
||||
|
||||
OH_UdsHtml* htmlNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsHtml_GetContent(htmlNullptr));
|
||||
|
||||
htmlNullptr = new OH_UdsHtml;
|
||||
EXPECT_EQ(nullptr, OH_UdsHtml_GetContent(htmlNullptr));
|
||||
OH_UdsHtml_Destroy(htmlNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHtml_GetContent_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsHtml_GetPlainContent_001
|
||||
* @tc.desc: Normal testcase of OH_UdsHtml_GetPlainContent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsHtml_GetPlainContent_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHtml_GetPlainContent_001 begin.");
|
||||
auto html = OH_UdsHtml_Create();
|
||||
html->obj->value_[PLAIN_CONTENT] = "do something";
|
||||
EXPECT_EQ("do something", std::string(OH_UdsHtml_GetPlainContent(html)));
|
||||
OH_UdsHtml_Destroy(html);
|
||||
|
||||
OH_UdsHtml* htmlNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsHtml_GetPlainContent(htmlNullptr));
|
||||
|
||||
htmlNullptr = new OH_UdsHtml;
|
||||
EXPECT_EQ(nullptr, OH_UdsHtml_GetPlainContent(htmlNullptr));
|
||||
OH_UdsHtml_Destroy(htmlNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHtml_GetPlainContent_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsHtml_SetContent_001
|
||||
* @tc.desc: Normal testcase of OH_UdsHtml_SetContent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsHtml_SetContent_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHtml_SetContent_001 begin.");
|
||||
auto html = OH_UdsHtml_Create();
|
||||
int result = OH_UdsHtml_SetContent(html, "htmlxxx");
|
||||
EXPECT_EQ(UDMF_E_OK, result);
|
||||
EXPECT_EQ("htmlxxx", std::string(OH_UdsHtml_GetContent(html)));
|
||||
|
||||
result = OH_UdsHtml_SetContent(nullptr, "htmlxxx");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
result = OH_UdsHtml_SetContent(html, nullptr);
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
html->obj = nullptr;
|
||||
result = OH_UdsHtml_SetContent(html, "htmlxxx");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
OH_UdsHtml_Destroy(html);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHtml_SetContent_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsHtml_SetPlainContent_001
|
||||
* @tc.desc: Normal testcase of OH_UdsHtml_SetPlainContent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsHtml_SetPlainContent_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHtml_SetPlainContent_001 begin.");
|
||||
auto html = OH_UdsHtml_Create();
|
||||
int result = OH_UdsHtml_SetPlainContent(html, "doing something");
|
||||
EXPECT_EQ(UDMF_E_OK, result);
|
||||
EXPECT_EQ("doing something", std::string(OH_UdsHtml_GetPlainContent(html)));
|
||||
|
||||
result = OH_UdsHtml_SetPlainContent(nullptr, "doing something");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
result = OH_UdsHtml_SetPlainContent(html, nullptr);
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
html->obj = nullptr;
|
||||
result = OH_UdsHtml_SetPlainContent(html, "doing something");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
OH_UdsHtml_Destroy(html);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsHtml_SetPlainContent_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsAppItem_Create_001
|
||||
* @tc.desc: Normal testcase of OH_UdsAppItem_Create
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsAppItem_Create_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_Create_001 begin.");
|
||||
auto appItem = OH_UdsAppItem_Create();
|
||||
EXPECT_EQ(UDMF_META_OPENHARMONY_APP_ITEM, *(std::get_if<std::string>(&(appItem->obj)->value_[UNIFORM_DATA_TYPE])));
|
||||
OH_UdsAppItem_Destroy(appItem);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_Create_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsAppItem_GetType_001
|
||||
* @tc.desc: Normal testcase of OH_UdsAppItem_GetType
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsAppItem_GetType_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_GetType_001 begin.");
|
||||
auto appItem = OH_UdsAppItem_Create();
|
||||
EXPECT_EQ(UDMF_META_OPENHARMONY_APP_ITEM, std::string(OH_UdsAppItem_GetType(appItem)));
|
||||
OH_UdsAppItem_Destroy(appItem);
|
||||
|
||||
OH_UdsAppItem* appItemNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsAppItem_GetType(appItemNullptr));
|
||||
|
||||
appItemNullptr = new OH_UdsAppItem;
|
||||
EXPECT_EQ(nullptr, OH_UdsAppItem_GetType(appItemNullptr));
|
||||
OH_UdsAppItem_Destroy(appItemNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_GetType_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsAppItem_GetId_001
|
||||
* @tc.desc: Normal testcase of OH_UdsAppItem_GetId
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsAppItem_GetId_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_GetId_001 begin.");
|
||||
auto appItem = OH_UdsAppItem_Create();
|
||||
appItem->obj->value_[APP_ID] = "com.huawei";
|
||||
EXPECT_EQ("com.huawei", std::string(OH_UdsAppItem_GetId(appItem)));
|
||||
OH_UdsAppItem_Destroy(appItem);
|
||||
|
||||
OH_UdsAppItem* appItemNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsAppItem_GetId(appItemNullptr));
|
||||
|
||||
appItemNullptr = new OH_UdsAppItem;
|
||||
EXPECT_EQ(nullptr, OH_UdsAppItem_GetId(appItemNullptr));
|
||||
OH_UdsAppItem_Destroy(appItemNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_GetId_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsAppItem_GetName_001
|
||||
* @tc.desc: Normal testcase of OH_UdsAppItem_GetName
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsAppItem_GetName_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_GetName_001 begin.");
|
||||
auto appItem = OH_UdsAppItem_Create();
|
||||
appItem->obj->value_[APP_NAME] = "OH";
|
||||
EXPECT_EQ("OH", std::string(OH_UdsAppItem_GetName(appItem)));
|
||||
OH_UdsAppItem_Destroy(appItem);
|
||||
|
||||
OH_UdsAppItem* appItemNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsAppItem_GetName(appItemNullptr));
|
||||
|
||||
appItemNullptr = new OH_UdsAppItem;
|
||||
EXPECT_EQ(nullptr, OH_UdsAppItem_GetName(appItemNullptr));
|
||||
OH_UdsAppItem_Destroy(appItemNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_GetName_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsAppItem_GetIconId_001
|
||||
* @tc.desc: Normal testcase of OH_UdsAppItem_GetIconId
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsAppItem_GetIconId_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_GetIconId_001 begin.");
|
||||
auto appItem = OH_UdsAppItem_Create();
|
||||
appItem->obj->value_[APP_ICON_ID] = "icon";
|
||||
EXPECT_EQ("icon", std::string(OH_UdsAppItem_GetIconId(appItem)));
|
||||
OH_UdsAppItem_Destroy(appItem);
|
||||
|
||||
OH_UdsAppItem* appItemNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsAppItem_GetIconId(appItemNullptr));
|
||||
|
||||
appItemNullptr = new OH_UdsAppItem;
|
||||
EXPECT_EQ(nullptr, OH_UdsAppItem_GetIconId(appItemNullptr));
|
||||
OH_UdsAppItem_Destroy(appItemNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_GetIconId_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsAppItem_GetLabelId_001
|
||||
* @tc.desc: Normal testcase of OH_UdsAppItem_GetLabelId
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsAppItem_GetLabelId_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_GetLabelId_001 begin.");
|
||||
auto appItem = OH_UdsAppItem_Create();
|
||||
appItem->obj->value_[APP_LABEL_ID] = "label";
|
||||
EXPECT_EQ("label", std::string(OH_UdsAppItem_GetLabelId(appItem)));
|
||||
OH_UdsAppItem_Destroy(appItem);
|
||||
|
||||
OH_UdsAppItem* appItemNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsAppItem_GetLabelId(appItemNullptr));
|
||||
|
||||
appItemNullptr = new OH_UdsAppItem;
|
||||
EXPECT_EQ(nullptr, OH_UdsAppItem_GetLabelId(appItemNullptr));
|
||||
OH_UdsAppItem_Destroy(appItemNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_GetLabelId_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsAppItem_GetBundleName_001
|
||||
* @tc.desc: Normal testcase of OH_UdsAppItem_GetBundleName
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsAppItem_GetBundleName_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_GetBundleName_001 begin.");
|
||||
auto appItem = OH_UdsAppItem_Create();
|
||||
appItem->obj->value_[BUNDLE_NAME] = "bundle";
|
||||
EXPECT_EQ("bundle", std::string(OH_UdsAppItem_GetBundleName(appItem)));
|
||||
OH_UdsAppItem_Destroy(appItem);
|
||||
|
||||
OH_UdsAppItem* appItemNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsAppItem_GetBundleName(appItemNullptr));
|
||||
|
||||
appItemNullptr = new OH_UdsAppItem;
|
||||
EXPECT_EQ(nullptr, OH_UdsAppItem_GetBundleName(appItemNullptr));
|
||||
OH_UdsAppItem_Destroy(appItemNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_GetBundleName_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsAppItem_GetAbilityName_001
|
||||
* @tc.desc: Normal testcase of OH_UdsAppItem_GetAbilityName
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsAppItem_GetAbilityName_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_GetAbilityName_001 begin.");
|
||||
auto appItem = OH_UdsAppItem_Create();
|
||||
appItem->obj->value_[ABILITY_NAME] = "ability";
|
||||
EXPECT_EQ("ability", std::string(OH_UdsAppItem_GetAbilityName(appItem)));
|
||||
OH_UdsAppItem_Destroy(appItem);
|
||||
|
||||
OH_UdsAppItem* appItemNullptr = nullptr;
|
||||
EXPECT_EQ(nullptr, OH_UdsAppItem_GetAbilityName(appItemNullptr));
|
||||
|
||||
appItemNullptr = new OH_UdsAppItem;
|
||||
EXPECT_EQ(nullptr, OH_UdsAppItem_GetAbilityName(appItemNullptr));
|
||||
OH_UdsAppItem_Destroy(appItemNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_GetAbilityName_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsAppItem_SetId_001
|
||||
* @tc.desc: Normal testcase of OH_UdsAppItem_SetId
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsAppItem_SetId_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_SetId_001 begin.");
|
||||
auto appItem = OH_UdsAppItem_Create();
|
||||
int result = OH_UdsAppItem_SetId(appItem, "com.huawei");
|
||||
EXPECT_EQ(UDMF_E_OK, result);
|
||||
EXPECT_EQ("com.huawei", std::string(OH_UdsAppItem_GetId(appItem)));
|
||||
|
||||
result = OH_UdsAppItem_SetId(nullptr, "com.huawei");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
result = OH_UdsAppItem_SetId(appItem, nullptr);
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
appItem->obj = nullptr;
|
||||
result = OH_UdsAppItem_SetId(appItem, "com.huawei");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
OH_UdsAppItem_Destroy(appItem);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_SetId_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsAppItem_SetName_001
|
||||
* @tc.desc: Normal testcase of OH_UdsAppItem_SetName
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsAppItem_SetName_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_SetName_001 begin.");
|
||||
auto appItem = OH_UdsAppItem_Create();
|
||||
int result = OH_UdsAppItem_SetName(appItem, "OH");
|
||||
EXPECT_EQ(UDMF_E_OK, result);
|
||||
EXPECT_EQ("OH", std::string(OH_UdsAppItem_GetName(appItem)));
|
||||
|
||||
result = OH_UdsAppItem_SetName(nullptr, "OH");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
result = OH_UdsAppItem_SetName(appItem, nullptr);
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
appItem->obj = nullptr;
|
||||
result = OH_UdsAppItem_SetName(appItem, "OH");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
OH_UdsAppItem_Destroy(appItem);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_SetName_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsAppItem_SetIconId_001
|
||||
* @tc.desc: Normal testcase of OH_UdsAppItem_SetIconId
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsAppItem_SetIconId_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_SetIconId_001 begin.");
|
||||
auto appItem = OH_UdsAppItem_Create();
|
||||
int result = OH_UdsAppItem_SetIconId(appItem, "icon");
|
||||
EXPECT_EQ(UDMF_E_OK, result);
|
||||
EXPECT_EQ("icon", std::string(OH_UdsAppItem_GetIconId(appItem)));
|
||||
|
||||
result = OH_UdsAppItem_SetIconId(nullptr, "icon");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
result = OH_UdsAppItem_SetIconId(appItem, nullptr);
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
appItem->obj = nullptr;
|
||||
result = OH_UdsAppItem_SetIconId(appItem, "icon");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
OH_UdsAppItem_Destroy(appItem);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_SetIconId_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsAppItem_SetLabelId_001
|
||||
* @tc.desc: Normal testcase of OH_UdsAppItem_SetLabelId
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsAppItem_SetLabelId_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_SetLabelId_001 begin.");
|
||||
auto appItem = OH_UdsAppItem_Create();
|
||||
int result = OH_UdsAppItem_SetLabelId(appItem, "label");
|
||||
EXPECT_EQ(UDMF_E_OK, result);
|
||||
EXPECT_EQ("label", std::string(OH_UdsAppItem_GetLabelId(appItem)));
|
||||
|
||||
result = OH_UdsAppItem_SetLabelId(nullptr, "label");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
result = OH_UdsAppItem_SetLabelId(appItem, nullptr);
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
appItem->obj = nullptr;
|
||||
result = OH_UdsAppItem_SetLabelId(appItem, "label");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
OH_UdsAppItem_Destroy(appItem);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_SetLabelId_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsAppItem_SetBundleName_001
|
||||
* @tc.desc: Normal testcase of OH_UdsAppItem_SetBundleName
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsAppItem_SetBundleName_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_SetBundleName_001 begin.");
|
||||
auto appItem = OH_UdsAppItem_Create();
|
||||
int result = OH_UdsAppItem_SetBundleName(appItem, "bundle");
|
||||
EXPECT_EQ(UDMF_E_OK, result);
|
||||
EXPECT_EQ("bundle", std::string(OH_UdsAppItem_GetBundleName(appItem)));
|
||||
|
||||
result = OH_UdsAppItem_SetBundleName(nullptr, "bundle");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
result = OH_UdsAppItem_SetBundleName(appItem, nullptr);
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
appItem->obj = nullptr;
|
||||
result = OH_UdsAppItem_SetBundleName(appItem, "bundle");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
OH_UdsAppItem_Destroy(appItem);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_SetBundleName_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_UdsAppItem_SetAbilityName_001
|
||||
* @tc.desc: Normal testcase of OH_UdsAppItem_SetAbilityName
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UdsTest, OH_UdsAppItem_SetAbilityName_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_SetAbilityName_001 begin.");
|
||||
auto appItem = OH_UdsAppItem_Create();
|
||||
int result = OH_UdsAppItem_SetAbilityName(appItem, "ability");
|
||||
EXPECT_EQ(UDMF_E_OK, result);
|
||||
EXPECT_EQ("ability", std::string(OH_UdsAppItem_GetAbilityName(appItem)));
|
||||
|
||||
result = OH_UdsAppItem_SetAbilityName(nullptr, "ability");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
result = OH_UdsAppItem_SetAbilityName(appItem, nullptr);
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
|
||||
appItem->obj = nullptr;
|
||||
result = OH_UdsAppItem_SetAbilityName(appItem, "ability");
|
||||
EXPECT_EQ(UDMF_E_INVAILD_PARAM, result);
|
||||
OH_UdsAppItem_Destroy(appItem);
|
||||
LOG_INFO(UDMF_TEST, "OH_UdsAppItem_SetAbilityName_001 end.");
|
||||
}
|
||||
|
||||
}
|
434
framework/ndkimpl/unittest/utd_test.cpp
Normal file
434
framework/ndkimpl/unittest/utd_test.cpp
Normal file
@ -0,0 +1,434 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "UtdTest"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "token_setproc.h"
|
||||
#include "accesstoken_kit.h"
|
||||
#include "nativetoken_kit.h"
|
||||
|
||||
#include "logger.h"
|
||||
#include "utd.h"
|
||||
#include "udmf_ndk_common.h"
|
||||
#include "udmf_meta.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
using namespace OHOS::Security::AccessToken;
|
||||
using namespace OHOS::UDMF;
|
||||
using namespace OHOS;
|
||||
|
||||
constexpr const char *REFERENCE_URL = "https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/"\
|
||||
"apis/js-apis-data-uniformTypeDescriptor.md#uniformdatatype";
|
||||
|
||||
namespace OHOS::Test {
|
||||
|
||||
OH_Utd* utd = nullptr;
|
||||
|
||||
class UtdTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase(void);
|
||||
static void TearDownTestCase(void);
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void UtdTest::SetUpTestCase(void){}
|
||||
|
||||
void UtdTest::TearDownTestCase(void){}
|
||||
|
||||
void UtdTest::SetUp(void){
|
||||
LOG_INFO(UDMF_TEST, "test case will be start");
|
||||
utd = OH_Utd_Create(UDMF_META_PLAIN_TEXT);
|
||||
}
|
||||
|
||||
void UtdTest::TearDown(void){
|
||||
OH_Utd_Destroy(utd);
|
||||
utd = nullptr;
|
||||
LOG_INFO(UDMF_TEST, "test case is complete");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_Create_001
|
||||
* @tc.desc: Normal testcase of OH_Utd_Create
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_Create_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_Create_001 begin.");
|
||||
EXPECT_EQ(utd->typeId, UDMF_META_PLAIN_TEXT);
|
||||
EXPECT_EQ(utd->belongingToTypesCount, 1);
|
||||
std::string belongingToType((utd->belongingToTypes)[0]);
|
||||
EXPECT_EQ(belongingToType, UDMF_META_TEXT);
|
||||
EXPECT_EQ(utd->description, "Text of unspecified encoding, with no markup.");
|
||||
|
||||
char* typeId = nullptr;
|
||||
OH_Utd* utdNullptr = OH_Utd_Create(typeId);
|
||||
EXPECT_EQ(nullptr, utdNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_Create_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_GetTypeId_001
|
||||
* @tc.desc: Normal testcase of OH_Utd_GetTypeId
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_GetTypeId_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetTypeId_001 begin.");
|
||||
std::string actualTypeId(OH_Utd_GetTypeId(utd));
|
||||
EXPECT_EQ(UDMF_META_PLAIN_TEXT, actualTypeId);
|
||||
|
||||
OH_Utd* utdNullptr = nullptr;
|
||||
const char* typeIdNullptr = OH_Utd_GetTypeId(utdNullptr);
|
||||
EXPECT_EQ(nullptr, typeIdNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetTypeId_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_GetDescription_001
|
||||
* @tc.desc: Normal testcase of OH_Utd_GetDescription
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_GetDescription_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetDescription_001 begin.");
|
||||
std::string description(OH_Utd_GetDescription(utd));
|
||||
EXPECT_EQ("Text of unspecified encoding, with no markup.", description);
|
||||
|
||||
OH_Utd* utdNullptr = nullptr;
|
||||
const char* descriptionNullptr = OH_Utd_GetDescription(utdNullptr);
|
||||
EXPECT_EQ(nullptr, descriptionNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetDescription_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_GetReferenceURL_001
|
||||
* @tc.desc: Normal testcase of OH_Utd_GetReferenceURL
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_GetReferenceURL_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetReferenceURL_001 begin.");
|
||||
std::string url(OH_Utd_GetReferenceURL(utd));
|
||||
EXPECT_EQ(REFERENCE_URL, url);
|
||||
|
||||
OH_Utd* utdNullptr = nullptr;
|
||||
const char* urlNullptr = OH_Utd_GetReferenceURL(utdNullptr);
|
||||
EXPECT_EQ(nullptr, urlNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetReferenceURL_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_GetIconFile_001
|
||||
* @tc.desc: Normal testcase of OH_Utd_GetIconFile
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_GetIconFile_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetIconFile_001 begin.");
|
||||
std::string iconFile(OH_Utd_GetIconFile(utd));
|
||||
EXPECT_EQ("sys.media.ohos_ic_normal_white_grid_txt", iconFile);
|
||||
|
||||
OH_Utd* utdNullptr = nullptr;
|
||||
const char* iconFileNullptr = OH_Utd_GetIconFile(utdNullptr);
|
||||
EXPECT_EQ(nullptr, iconFileNullptr);
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetIconFile_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_GetBelongingToTypes_001
|
||||
* @tc.desc: Normal testcase of OH_Utd_GetBelongingToTypes
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_GetBelongingToTypes_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetBelongingToTypes_001 begin.");
|
||||
unsigned int* count = new unsigned int;
|
||||
auto belongingToTypes = OH_Utd_GetBelongingToTypes(utd, count);
|
||||
std::string belongingToType(belongingToTypes[0]);
|
||||
EXPECT_EQ(UDMF_META_TEXT, belongingToType);
|
||||
EXPECT_EQ(1, *count);
|
||||
|
||||
OH_Utd* utdNullptr = nullptr;
|
||||
auto belongingToTypeNullptr = OH_Utd_GetBelongingToTypes(utdNullptr, count);
|
||||
EXPECT_EQ(nullptr, belongingToTypeNullptr);
|
||||
|
||||
unsigned int* countNullptr = nullptr;
|
||||
auto belongingToTypeNullptr2 = OH_Utd_GetBelongingToTypes(utd, countNullptr);
|
||||
EXPECT_EQ(nullptr, belongingToTypeNullptr2);
|
||||
delete count;
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetBelongingToTypes_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_GetFilenameExtensions_001
|
||||
* @tc.desc: Normal testcase of OH_Utd_GetFilenameExtensions
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_GetFilenameExtensions_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetFilenameExtensions_001 begin.");
|
||||
unsigned int* count = new unsigned int;
|
||||
auto filenameExtensions = OH_Utd_GetFilenameExtensions(utd, count);
|
||||
std::string filenameExtension(filenameExtensions[0]);
|
||||
EXPECT_EQ(".txt", filenameExtension);
|
||||
EXPECT_EQ(2, *count);
|
||||
|
||||
OH_Utd* utdNullptr = nullptr;
|
||||
auto filenameExtensionsNullptr = OH_Utd_GetFilenameExtensions(utdNullptr, count);
|
||||
EXPECT_EQ(nullptr, filenameExtensionsNullptr);
|
||||
|
||||
unsigned int* countNullptr = nullptr;
|
||||
auto filenameExtensionsNullptr2 = OH_Utd_GetFilenameExtensions(utd, countNullptr);
|
||||
EXPECT_EQ(nullptr, filenameExtensionsNullptr2);
|
||||
delete count;
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetFilenameExtensions_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_GetMimeTypes_001
|
||||
* @tc.desc: Normal testcase of OH_Utd_GetMimeTypes
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_GetMimeTypes_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetMimeTypes_001 begin.");
|
||||
unsigned int* count = new unsigned int;
|
||||
auto mimeTypes = OH_Utd_GetMimeTypes(utd, count);
|
||||
std::string mimeType(mimeTypes[0]);
|
||||
EXPECT_EQ("text/plain", mimeType);
|
||||
EXPECT_EQ(1, *count);
|
||||
|
||||
OH_Utd* utdNullptr = nullptr;
|
||||
auto mimeTypeNullptr = OH_Utd_GetMimeTypes(utdNullptr, count);
|
||||
EXPECT_EQ(nullptr, mimeTypeNullptr);
|
||||
|
||||
unsigned int* countNullptr = nullptr;
|
||||
auto mimeTypeNullptr2 = OH_Utd_GetMimeTypes(utd, countNullptr);
|
||||
EXPECT_EQ(nullptr, mimeTypeNullptr2);
|
||||
delete count;
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetMimeTypes_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_GetTypesByFilenameExtension_001
|
||||
* @tc.desc: Normal testcase of OH_Utd_GetTypesByFilenameExtension
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_GetTypesByFilenameExtension_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetTypesByFilenameExtension_001 begin.");
|
||||
unsigned int* count = new unsigned int;
|
||||
auto typeIds = OH_Utd_GetTypesByFilenameExtension(".txt", count);
|
||||
std::string typeId(typeIds[0]);
|
||||
EXPECT_EQ(UDMF_META_PLAIN_TEXT, typeId);
|
||||
EXPECT_EQ(1, *count);
|
||||
OH_Utd_DestroyStringList(typeIds, *count);
|
||||
|
||||
const char* extensionNullptr = nullptr;
|
||||
auto typeIdsNullptr = OH_Utd_GetTypesByFilenameExtension(extensionNullptr, count);
|
||||
EXPECT_EQ(nullptr, typeIdsNullptr);
|
||||
|
||||
unsigned int* countNullptr = nullptr;
|
||||
typeIds = OH_Utd_GetTypesByFilenameExtension(".txt", countNullptr);
|
||||
EXPECT_EQ(nullptr, typeIds);
|
||||
delete count;
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetTypesByFilenameExtension_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_GetTypesByMimeType_001
|
||||
* @tc.desc: Normal testcase of OH_Utd_GetTypesByMimeType
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_GetTypesByMimeType_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetTypesByMimeType_001 begin.");
|
||||
unsigned int* count = new unsigned int;
|
||||
auto typeIds = OH_Utd_GetTypesByMimeType("text/plain", count);
|
||||
std::string typeId(typeIds[0]);
|
||||
EXPECT_EQ(UDMF_META_PLAIN_TEXT, typeId);
|
||||
EXPECT_EQ(1, *count);
|
||||
OH_Utd_DestroyStringList(typeIds, *count);
|
||||
|
||||
const char* extensionNullptr = nullptr;
|
||||
auto typeIdsNullptr = OH_Utd_GetTypesByMimeType(extensionNullptr, count);
|
||||
EXPECT_EQ(nullptr, typeIdsNullptr);
|
||||
|
||||
unsigned int* countNullptr = nullptr;
|
||||
auto typeIdsNullptr2 = OH_Utd_GetTypesByMimeType("text/plain", countNullptr);
|
||||
EXPECT_EQ(nullptr, typeIdsNullptr2);
|
||||
delete count;
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_GetTypesByMimeType_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_IsBelongsTo_001
|
||||
* @tc.desc: test typeId1 belong to typeId2
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_IsBelongsTo_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsBelongsTo_001 begin.");
|
||||
EXPECT_TRUE(OH_Utd_IsBelongsTo(UDMF_META_PLAIN_TEXT, UDMF_META_TEXT));
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsBelongsTo_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_IsBelongsTo_002
|
||||
* @tc.desc: test typeId1 don't belong to typeId2
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_IsBelongsTo_002, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsBelongsTo_002 begin.");
|
||||
EXPECT_FALSE(OH_Utd_IsBelongsTo(UDMF_META_PLAIN_TEXT, UDMF_META_HTML));
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsBelongsTo_002 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_IsBelongsTo_003
|
||||
* @tc.desc: test param is nullptr
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_IsBelongsTo_003, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsBelongsTo_003 begin.");
|
||||
EXPECT_FALSE(OH_Utd_IsBelongsTo(UDMF_META_PLAIN_TEXT, nullptr));
|
||||
EXPECT_FALSE(OH_Utd_IsBelongsTo(nullptr, UDMF_META_PLAIN_TEXT));
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsBelongsTo_003 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_IsLowerLevelType_001
|
||||
* @tc.desc: test typeId1 is lower level of typeId2
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_IsLowerLevelType_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsLowerLevelType_001 begin.");
|
||||
EXPECT_TRUE(OH_Utd_IsLowerLevelType(UDMF_META_PLAIN_TEXT, UDMF_META_TEXT));
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsLowerLevelType_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_IsLowerLevelType_002
|
||||
* @tc.desc: test typeId1 isn't lower level of typeId2
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_IsLowerLevelType_002, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsLowerLevelType_002 begin.");
|
||||
EXPECT_FALSE(OH_Utd_IsLowerLevelType(UDMF_META_PLAIN_TEXT, UDMF_META_HTML));
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsLowerLevelType_002 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_IsLowerLevelType_003
|
||||
* @tc.desc: test param is nullptr
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_IsLowerLevelType_003, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsLowerLevelType_003 begin.");
|
||||
EXPECT_FALSE(OH_Utd_IsLowerLevelType(UDMF_META_PLAIN_TEXT, nullptr));
|
||||
EXPECT_FALSE(OH_Utd_IsLowerLevelType(nullptr, UDMF_META_PLAIN_TEXT));
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsLowerLevelType_003 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_IsHigherLevelType_001
|
||||
* @tc.desc: test typeId1 is higher level of typeId2
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_IsHigherLevelType_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsHigherLevelType_001 begin.");
|
||||
EXPECT_TRUE(OH_Utd_IsHigherLevelType(UDMF_META_TEXT, UDMF_META_PLAIN_TEXT));
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsHigherLevelType_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_IsHigherLevelType_002
|
||||
* @tc.desc: test typeId1 isn't higher level of typeId2
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_IsHigherLevelType_002, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsHigherLevelType_002 begin.");
|
||||
EXPECT_FALSE(OH_Utd_IsHigherLevelType(UDMF_META_PLAIN_TEXT, UDMF_META_HTML));
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsHigherLevelType_002 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_IsHigherLevelType_003
|
||||
* @tc.desc: test param is nullptr
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_IsHigherLevelType_003, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsHigherLevelType_003 begin.");
|
||||
EXPECT_FALSE(OH_Utd_IsHigherLevelType(UDMF_META_PLAIN_TEXT, nullptr));
|
||||
EXPECT_FALSE(OH_Utd_IsHigherLevelType(nullptr, UDMF_META_PLAIN_TEXT));
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsHigherLevelType_003 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_IsEquals_001
|
||||
* @tc.desc: test case1 is equals case2
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_IsEquals_001, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsEquals_001 begin.");
|
||||
auto utd2 = OH_Utd_Create(UDMF_META_PLAIN_TEXT);
|
||||
EXPECT_TRUE(OH_Utd_IsEquals(utd, utd2));
|
||||
OH_Utd_Destroy(utd2);
|
||||
utd2 = nullptr;
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsEquals_001 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_IsEquals_002
|
||||
* @tc.desc: test case1 is not equals case2
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_IsEquals_002, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsEquals_002 begin.");
|
||||
auto utd2 = OH_Utd_Create(UDMF_META_TEXT);
|
||||
EXPECT_FALSE(OH_Utd_IsEquals(utd, utd2));
|
||||
OH_Utd_Destroy(utd2);
|
||||
utd2 = nullptr;
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsEquals_002 end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OH_Utd_IsEquals_003
|
||||
* @tc.desc: test param is nullptr
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(UtdTest, OH_Utd_IsEquals_003, TestSize.Level1)
|
||||
{
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsEquals_003 begin.");
|
||||
EXPECT_FALSE(OH_Utd_IsEquals(utd, nullptr));
|
||||
EXPECT_FALSE(OH_Utd_IsEquals(nullptr, utd));
|
||||
LOG_INFO(UDMF_TEST, "OH_Utd_IsEquals_003 end.");
|
||||
}
|
||||
|
||||
}
|
52
interfaces/ndk/BUILD.gn
Normal file
52
interfaces/ndk/BUILD.gn
Normal file
@ -0,0 +1,52 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# 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.
|
||||
import("//build/ohos.gni")
|
||||
import("//foundation/distributeddatamgr/udmf/udmf.gni")
|
||||
|
||||
ohos_shared_library("udmf_ndk") {
|
||||
branch_protector_ret = "pac_ret"
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
|
||||
include_dirs = [
|
||||
"${udmf_interfaces_path}/ndk/data",
|
||||
"${udmf_interfaces_path}/innerkits/client",
|
||||
"${udmf_interfaces_path}/innerkits/common",
|
||||
"${udmf_interfaces_path}/innerkits/data",
|
||||
"${udmf_framework_path}/common",
|
||||
]
|
||||
sources = [
|
||||
"${udmf_framework_path}/ndkimpl/data/uds.cpp",
|
||||
"${udmf_framework_path}/ndkimpl/data/utd.cpp",
|
||||
]
|
||||
|
||||
defines = [ "API_EXPORT=__attribute__((visibility (\"default\")))" ]
|
||||
|
||||
deps = [ "${udmf_interfaces_path}/innerkits:udmf_client" ]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:base",
|
||||
"ability_base:want",
|
||||
"c_utils:utils",
|
||||
"hilog:libhilog",
|
||||
"image_framework:image",
|
||||
]
|
||||
|
||||
relative_install_dir="ndk"
|
||||
part_name = "udmf"
|
||||
subsystem_name = "distributeddatamgr"
|
||||
output_extension = "so"
|
||||
}
|
80
interfaces/ndk/data/udmf_err_code.h
Normal file
80
interfaces/ndk/data/udmf_err_code.h
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* 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 UDMF_ERR_CODE_H
|
||||
#define UDMF_ERR_CODE_H
|
||||
|
||||
/**
|
||||
* @addtogroup UDMF
|
||||
* @{
|
||||
*
|
||||
* @brief The Unified Data Management Framework(UDMF) aims to define various standards
|
||||
* for data across applications, devices, and platforms, providing a unified OpenHarmony
|
||||
* data language and standardized data access and reading paths.
|
||||
*
|
||||
* @syscap SystemCapability.DistributedDataManager.UDMF.Core
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file udmf_err_code.h
|
||||
*
|
||||
* @brief Declaration error code information.
|
||||
*
|
||||
* @library libudmf_ndk.so
|
||||
* @syscap SystemCapability.DistributedDataManager.UDMF.Core
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Indicates the error code information.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
typedef enum Udmf_ErrCode {
|
||||
/**
|
||||
* The error code in the correct case.
|
||||
*/
|
||||
UDMF_E_OK = 0,
|
||||
/**
|
||||
* @brief The error when the capability not supported.
|
||||
*/
|
||||
UDMF_E_NOT_SUPPORTED = 801,
|
||||
/**
|
||||
* @brief The error code for common exceptions.
|
||||
*/
|
||||
UDMF_ERR = 20400000,
|
||||
/**
|
||||
* @brief The error code for not support this data parse exceptions.
|
||||
*/
|
||||
UDMF_E_NOT_PARSE_DATA = (UDMF_ERR + 1),
|
||||
/**
|
||||
* @brief The error code for common invalid args.
|
||||
*/
|
||||
UDMF_E_INVAILD_PARAM = (UDMF_ERR + 2),
|
||||
} Udmf_ErrCode;
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
#endif
|
997
interfaces/ndk/data/udmf_meta.h
Normal file
997
interfaces/ndk/data/udmf_meta.h
Normal file
@ -0,0 +1,997 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* 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 UDMF_META_H
|
||||
#define UDMF_META_H
|
||||
|
||||
/**
|
||||
* @addtogroup UDMF
|
||||
* @{
|
||||
*
|
||||
* @brief The Unified Data Management Framework(UDMF) aims to define various standards
|
||||
* for data across applications, devices, and platforms, providing a unified OpenHarmony
|
||||
* data language and standardized data access and reading paths.
|
||||
*
|
||||
* @syscap SystemCapability.DistributedDataManager.UDMF.Core
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file udmf_meta.h
|
||||
*
|
||||
* @brief Declaration the uniform data type information.
|
||||
*
|
||||
* @library libudmf_ndk.so
|
||||
* @syscap SystemCapability.DistributedDataManager.UDMF.Core
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_ENTITY "general.entity"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OBJECT "general.object"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_COMPOSITE_OBJECT "general.composite-object"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_TEXT "general.text"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_PLAIN_TEXT "general.plain-text"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_HTML "general.html"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_HYPERLINK "general.hyperlink"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_XML "general.xml"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_SOURCE_CODE "general.source-code"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_SCRIPT "general.script"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_SHELL_SCRIPT "general.shell-script"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_CSH_SCRIPT "general.csh-script"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_PERL_SCRIPT "general.perl-script"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_PHP_SCRIPT "general.php-script"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_PYTHON_SCRIPT "general.python-script"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_RUBY_SCRIPT "general.ruby-script"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_TYPE_SCRIPT "general.type-script"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_JAVA_SCRIPT "general.java-script"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_C_HEADER "general.c-header"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_C_SOURCE "general.c-source"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_C_PLUS_PLUS_HEADER "general.c-plus-plus-header"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_C_PLUS_PLUS_SOURCE "general.c-plus-plus-source"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_JAVA_SOURCE "general.java-source"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_EBOOK "general.ebook"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_EPUB "general.epub"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_AZW "com.amazon.azw"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_AZW3 "com.amazon.azw3"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_KFX "com.amazon.kfx"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_MOBI "com.amazon.mobi"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_MEDIA "general.media"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_IMAGE "general.image"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_JPEG "general.jpeg"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_PNG "general.png"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_RAW_IMAGE "general.raw-image"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_TIFF "general.tiff"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_BMP "com.microsoft.bmp"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_ICO "com.microsoft.ico"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_PHOTOSHOP_IMAGE "com.adobe.photoshop-image"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_AI_IMAGE "com.adobe.illustrator.ai-image"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_WORD_DOC "com.microsoft.word.doc"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_EXCEL "com.microsoft.excel.xls"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_PPT "com.microsoft.powerpoint.ppt"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_PDF "com.adobe.pdf"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_POSTSCRIPT "com.adobe.postscript"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_ENCAPSULATED_POSTSCRIPT "com.adobe.encapsulated-postscript"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_VIDEO "general.video"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_AVI "general.avi"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_MPEG "general.mpeg"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_MPEG4 "general.mpeg-4"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_VIDEO_3GPP "general.3gpp"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_VIDEO_3GPP2 "general.3gpp2"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_WINDOWS_MEDIA_WM "com.microsoft.windows-media-wm"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_WINDOWS_MEDIA_WMV "com.microsoft.windows-media-wmv"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_WINDOWS_MEDIA_WMP "com.microsoft.windows-media-wmp"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_AUDIO "general.audio"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_AAC "general.aac"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_AIFF "general.aiff"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_ALAC "general.alac"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_FLAC "general.flac"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_MP3 "general.mp3"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OGG "general.ogg"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_PCM "general.pcm"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_WINDOWS_MEDIA_WMA "com.microsoft.windows-media-wma"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_WAVEFORM_AUDIO "com.microsoft.waveform-audio"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_WINDOWS_MEDIA_WMX "com.microsoft.windows-media-wmx"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_WINDOWS_MEDIA_WVX "com.microsoft.windows-media-wvx"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_WINDOWS_MEDIA_WAX "com.microsoft.windows-media-wax"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_general_FILE "general.file"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_DIRECTORY "general.directory"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_FOLDER "general.folder"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_SYMLINK "general.symlink"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_ARCHIVE "general.archive"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_BZ2_ARCHIVE "general.bz2-archive"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_DISK_IMAGE "general.disk-image"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_TAR_ARCHIVE "general.tar-archive"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_ZIP_ARCHIVE "general.zip-archive"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_JAVA_ARCHIVE "com.sun.java-archive"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_GNU_TAR_ARCHIVE "org.gnu.gnu-tar-archive"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_GNU_ZIP_ARCHIVE "org.gnu.gnu-zip-archive"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_GNU_ZIP_TAR_ARCHIVE "org.gnu.gnu-zip-tar-archive"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_CALENDAR "general.calendar"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_CONTACT "general.contact"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_DATABASE "general.database"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_MESSAGE "general.message"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_VCARD "general.vcard"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_NAVIGATION "general.navigation"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_LOCATION "general.location"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENHARMONY_FORM "openharmony.form"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENHARMONY_APP_ITEM "openharmony.app-item"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENHARMONY_PIXEL_MAP "openharmony.pixel-map"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENHARMONY_ATOMIC_SERVICE "openharmony.atomic-service"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENHARMONY_PACKAGE "openharmony.package"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENHARMONY_HAP "openharmony.hap"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_SMIL "com.real.smil"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_MARKDOWN "general.markdown"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_FAX "general.fax"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_JFX_FAX "com.j2.jfx-fax"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_EFX_FAX "com.js.efx-fax"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_XBITMAP_IMAGE "general.xbitmap-image"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_TGA_IMAGE "com.truevision.tga-image"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_SGI_IMAGE "com.sgi.sgi-image"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENEXR_IMAGE "com.ilm.openexr-image"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_FLASHPIX_IMAGE "com.kodak.flashpix.image"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_REALMEDIA "com.real.realmedia"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_AU_AUDIO "general.au-audio"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_AIFC_AUDIO "general.aifc-audio"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_SD2_AUDIO "com.digidesign.sd2-audio"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_REALAUDIO "com.real.realaudio"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENXML "org.openxmlformats.openxml"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_WORDPROCESSINGML_DOCUMENT "org.openxmlformats.wordprocessingml.document"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_SPREADSHEETML_SHEET "org.openxmlformats.spreadsheetml.sheet"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_PRESENTATIONML_PRESENTATION "org.openxmlformats.presentationml.presentation"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENDOCUMENT "org.oasis.opendocument"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENDOCUMENT_TEXT "org.oasis.opendocument.text"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENDOCUMENT_SPREADSHEET "org.oasis.opendocument.spreadsheet"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENDOCUMENT_PRESENTATION "org.oasis.opendocument.presentation"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENDOCUMENT_GRAPHICS "org.oasis.opendocument.graphics"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENDOCUMENT_FORMULA "org.oasis.opendocument.formula"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_STUFFIT_ARCHIVE "com.allume.stuffit-archive"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_VCS "general.vcs"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_ICS "general.ics"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_EXECUTABLE "general.executable"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_PORTABLE_EXECUTABLE "com.microsoft.portable-executable"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_SUN_JAVA_CLASS "com.sun.java-class"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_FONT "general.font"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_TRUETYPE_FONT "general.truetype-font"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_TRUETYPE_COLLECTION_FONT "general.truetype-collection-font"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENTYPE_FONT "general.opentype-font"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_POSTSCRIPT_FONT "com.adobe.postscript-font"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_POSTSCRIPT_PFB_FONT "com.adobe.postscript-pfb-font"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_POSTSCRIPT_PFA_FONT "com.adobe.postscript-pfa-font"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENHARMONY_HDOC "openharmony.hdoc"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENHARMONY_HINOTE "openharmony.hinote"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENHARMONY_STYLED_STRING "openharmony.styled-string"
|
||||
|
||||
/**
|
||||
* @brief A specific type of uniform data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
#define UDMF_META_OPENHARMONY_WANT "openharmony.want"
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
#endif
|
470
interfaces/ndk/data/uds.h
Normal file
470
interfaces/ndk/data/uds.h
Normal file
@ -0,0 +1,470 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* 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 UDS_H
|
||||
#define UDS_H
|
||||
|
||||
/**
|
||||
* @addtogroup UDMF
|
||||
* @{
|
||||
*
|
||||
* @brief The Unified Data Management Framework(UDMF) aims to define various standards
|
||||
* for data across applications, devices, and platforms, providing a unified OpenHarmony
|
||||
* data language and standardized data access and reading paths.
|
||||
*
|
||||
* @syscap SystemCapability.DistributedDataManager.UDMF.Core
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file uds.h
|
||||
*
|
||||
* @brief Provides uniform data struct(UDS).
|
||||
* @library libudmf_ndk.so
|
||||
* @syscap SystemCapability.DistributedDataManager.UDMF.Core
|
||||
* @since 12
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Describes the unified data struct of plaintext.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
typedef struct OH_UdsPlainText OH_UdsPlainText;
|
||||
|
||||
/**
|
||||
* @brief Describes the unified data struct of hyperlink.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
typedef struct OH_UdsHyperlink OH_UdsHyperlink;
|
||||
|
||||
/**
|
||||
* @brief Describes the unified data struct of html.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
typedef struct OH_UdsHtml OH_UdsHtml;
|
||||
|
||||
/**
|
||||
* @brief Describes the unified data struct of open harmony application item.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
typedef struct OH_UdsAppItem OH_UdsAppItem;
|
||||
|
||||
/**
|
||||
* @brief Creation a pointer to the instance of the {@link OH_UdsPlainText}.
|
||||
*
|
||||
* @return If the operation is successful, a pointer to the instance of the {@link OH_UdsPlainText}
|
||||
* structure is returned. If the operation is failed, nullptr is returned.
|
||||
* @see OH_UdsPlainText
|
||||
* @since 12
|
||||
*/
|
||||
OH_UdsPlainText* OH_UdsPlainText_Create();
|
||||
|
||||
/**
|
||||
* @brief Destroy a pointer that points to the {@link OH_UdsPlainText} instance.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsPlainText}.
|
||||
* @see OH_UdsPlainText
|
||||
* @since 12
|
||||
*/
|
||||
void OH_UdsPlainText_Destroy(OH_UdsPlainText* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get type id from the {@link OH_UdsPlainText}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsPlainText}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsPlainText
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsPlainText_GetType(OH_UdsPlainText* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get content from the {@link OH_UdsPlainText}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsPlainText}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsPlainText
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsPlainText_GetContent(OH_UdsPlainText* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get abstract from the {@link OH_UdsPlainText}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsPlainText}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsPlainText
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsPlainText_GetAbstract(OH_UdsPlainText* pThis);
|
||||
|
||||
/**
|
||||
* @brief Set content to the {@link OH_UdsPlainText}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsPlainText}.
|
||||
* @param content Represents a new content string.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVAILD_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdsPlainText Udmf_ErrCode
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdsPlainText_SetContent(OH_UdsPlainText* pThis, const char* content);
|
||||
|
||||
/**
|
||||
* @brief Set abstract to the {@link OH_UdsPlainText}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsPlainText}.
|
||||
* @param abstract Represents a new string value.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVAILD_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdsPlainText Udmf_ErrCode
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdsPlainText_SetAbstract(OH_UdsPlainText* pThis, const char* abstract);
|
||||
|
||||
/**
|
||||
* @brief Creation a pointer to the instance of the {@link OH_UdsHyperlink}.
|
||||
*
|
||||
* @return If the operation is successful, a pointer to the instance of {@link OH_UdsHyperlink}
|
||||
* structure is returned. If the operation is failed, nullptr is returned.
|
||||
* @see OH_UdsHyperlink
|
||||
* @since 12
|
||||
*/
|
||||
OH_UdsHyperlink* OH_UdsHyperlink_Create();
|
||||
|
||||
/**
|
||||
* @brief Destroy a pointer that points to the {@link OH_UdsHyperlink} instance.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsHyperlink}.
|
||||
* @see OH_UdsHyperlink
|
||||
* @since 12
|
||||
*/
|
||||
void OH_UdsHyperlink_Destroy(OH_UdsHyperlink* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get type from the {@link OH_UdsHyperlink}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsHyperlink}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsHyperlink
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsHyperlink_GetType(OH_UdsHyperlink* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get url from the {@link OH_UdsHyperlink}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsHyperlink}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsHyperlink
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsHyperlink_GetUrl(OH_UdsHyperlink* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get description from the {@link OH_UdsHyperlink}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsHyperlink}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsHyperlink
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsHyperlink_GetDescription(OH_UdsHyperlink* pThis);
|
||||
|
||||
/**
|
||||
* @brief Set url to the {@link OH_UdsHyperlink}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsHyperlink}.
|
||||
* @param url Represents a new string value.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVAILD_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdsHyperlink Udmf_ErrCode
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdsHyperlink_SetUrl(OH_UdsHyperlink* pThis, const char* url);
|
||||
|
||||
/**
|
||||
* @brief Set description to the {@link OH_UdsHyperlink}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsHyperlink}.
|
||||
* @param description Represents a new string value.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVAILD_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdsHyperlink Udmf_ErrCode
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdsHyperlink_SetDescription(OH_UdsHyperlink* pThis, const char* description);
|
||||
|
||||
/**
|
||||
* @brief Creation a pointer to the instance of the {@link OH_UdsHtml}.
|
||||
*
|
||||
* @return If the operation is successful, a pointer to the instance of the {@link OH_UdsHtml}
|
||||
* structure is returned. If the operation is failed, nullptr is returned.
|
||||
* @see OH_UdsHtml
|
||||
* @since 12
|
||||
*/
|
||||
OH_UdsHtml* OH_UdsHtml_Create();
|
||||
|
||||
/**
|
||||
* @brief Destroy a pointer that points to the {@link OH_UdsHtml} instance.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsHtml}.
|
||||
* @see OH_UdsHtml
|
||||
* @since 12
|
||||
*/
|
||||
void OH_UdsHtml_Destroy(OH_UdsHtml* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get html from the {@link OH_UdsHtml}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsHtml}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsHtml
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsHtml_GetType(OH_UdsHtml* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get content from the {@link OH_UdsHtml}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsHtml}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsHtml
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsHtml_GetContent(OH_UdsHtml* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get plain content from the {@link OH_UdsHtml}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsHtml}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsHtml
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsHtml_GetPlainContent(OH_UdsHtml* pThis);
|
||||
|
||||
/**
|
||||
* @brief Set content to the {@link OH_UdsHtml}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsHtml}.
|
||||
* @param content Represents a new string value.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVAILD_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdsHtml Udmf_ErrCode
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdsHtml_SetContent(OH_UdsHtml* pThis, const char* content);
|
||||
|
||||
/**
|
||||
* @brief Set plain content to the {@link OH_UdsHtml}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsHtml}.
|
||||
* @param plainContent Represents a new string value.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVAILD_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdsHtml Udmf_ErrCode
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdsHtml_SetPlainContent(OH_UdsHtml* pThis, const char* plainContent);
|
||||
|
||||
/**
|
||||
* @brief Creation a pointer to the instance of the {@link OH_UdsAppItem}.
|
||||
*
|
||||
* @return If the operation is successful, a pointer to the instance of the {@link OH_UdsAppItem}
|
||||
* structure is returned. sIf the operation is failed, nullptr is returned.
|
||||
* @see OH_UdsAppItem
|
||||
* @since 12
|
||||
*/
|
||||
OH_UdsAppItem* OH_UdsAppItem_Create();
|
||||
|
||||
/**
|
||||
* @brief Destroy a pointer that points to the {@link OH_UdsAppItem} instance.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsAppItem}.
|
||||
* @see OH_UdsAppItem
|
||||
* @since 12
|
||||
*/
|
||||
void OH_UdsAppItem_Destroy(OH_UdsAppItem* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get type from the {@link OH_UdsAppItem}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsAppItem}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsAppItem
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsAppItem_GetType(OH_UdsAppItem* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get app id from the {@link OH_UdsAppItem}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsAppItem}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsAppItem
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsAppItem_GetId(OH_UdsAppItem* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get app name from the {@link OH_UdsAppItem}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsAppItem}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsAppItem
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsAppItem_GetName(OH_UdsAppItem* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get app icon id from the {@link OH_UdsAppItem}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsAppItem}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsAppItem
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsAppItem_GetIconId(OH_UdsAppItem* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get app label id from the {@link OH_UdsAppItem}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsAppItem}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsAppItem
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsAppItem_GetLabelId(OH_UdsAppItem* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get bundle name from the {@link OH_UdsAppItem}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsAppItem}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsAppItem
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsAppItem_GetBundleName(OH_UdsAppItem* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get ability name from the {@link OH_UdsAppItem}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance {@link OH_UdsAppItem}.
|
||||
* @return Returns a pointer of the value string when input args normally, otherwise return nullptr.
|
||||
* @see OH_UdsAppItem
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdsAppItem_GetAbilityName(OH_UdsAppItem* pThis);
|
||||
|
||||
/**
|
||||
* @brief Set application id to the {@link OH_UdsAppItem}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsAppItem}.
|
||||
* @param appId Represents a new string value.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVAILD_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdsAppItem Udmf_ErrCode
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdsAppItem_SetId(OH_UdsAppItem* pThis, const char* appId);
|
||||
|
||||
/**
|
||||
* @brief Set application name to the {@link OH_UdsAppItem}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsAppItem}.
|
||||
* @param appName Represents a new string value.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVAILD_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdsAppItem Udmf_ErrCode
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdsAppItem_SetName(OH_UdsAppItem* pThis, const char* appName);
|
||||
|
||||
/**
|
||||
* @brief Set application icon id to the {@link OH_UdsAppItem}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsAppItem}.
|
||||
* @param appIconId Represents a new string value.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVAILD_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdsAppItem Udmf_ErrCode
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdsAppItem_SetIconId(OH_UdsAppItem* pThis, const char* appIconId);
|
||||
|
||||
/**
|
||||
* @brief Set application label id to the {@link OH_UdsAppItem}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsAppItem}.
|
||||
* @param appLabelId Represents a new string value.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVAILD_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdsAppItem Udmf_ErrCode
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdsAppItem_SetLabelId(OH_UdsAppItem* pThis, const char* appLabelId);
|
||||
|
||||
/**
|
||||
* @brief Set bundle name to the {@link OH_UdsAppItem}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsAppItem}.
|
||||
* @param bundleName Represents a new string value.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVAILD_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdsAppItem Udmf_ErrCode
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdsAppItem_SetBundleName(OH_UdsAppItem* pThis, const char* bundleName);
|
||||
|
||||
/**
|
||||
* @brief Set ability name to the {@link OH_UdsAppItem}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdsAppItem}.
|
||||
* @param abilityName Represents a new string value.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVAILD_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdsAppItem Udmf_ErrCode
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdsAppItem_SetAbilityName(OH_UdsAppItem* pThis, const char* abilityName);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
#endif
|
230
interfaces/ndk/data/utd.h
Normal file
230
interfaces/ndk/data/utd.h
Normal file
@ -0,0 +1,230 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* 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 UTD_H
|
||||
#define UTD_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* @addtogroup UDMF
|
||||
* @{
|
||||
*
|
||||
* @brief The Unified Data Management Framework(UDMF) aims to define various standards
|
||||
* for data across applications, devices, and platforms, providing a unified OpenHarmony
|
||||
* data language and standardized data access and reading paths.
|
||||
*
|
||||
* @syscap SystemCapability.DistributedDataManager.UDMF.Core
|
||||
* @since 12
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file utd.h
|
||||
*
|
||||
* @brief Provides uniform type descriptor(UTD) related functions and struct.
|
||||
* @library libudmf_ndk.so
|
||||
* @syscap SystemCapability.DistributedDataManager.UDMF.Core
|
||||
* @since 12
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Describes the unified data type descriptor.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
typedef struct OH_Utd OH_Utd;
|
||||
|
||||
/**
|
||||
* @brief Prouct a pointer to the instance of the {@link OH_Utd}.
|
||||
*
|
||||
* @param typeId Represents type of UTD, reference udmf_meta.h.
|
||||
* @return If the operation is successful, a pointer to the instance of the {@link OH_Utd}
|
||||
* structure is returned.If the operation is failed, nullptr is returned.
|
||||
* Must be destroyed with {@link OH_Utd_DestroyTypeDescriptor} when not needed.
|
||||
* @see OH_Utd.
|
||||
* @since 12
|
||||
*/
|
||||
OH_Utd* OH_Utd_Create(const char* typeId);
|
||||
|
||||
/**
|
||||
* @brief Destroy a pointer that points to the {@link OH_Utd} instance.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_Utd}.
|
||||
* @see OH_Utd.
|
||||
* @since 12
|
||||
*/
|
||||
void OH_Utd_Destroy(OH_Utd* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get type id from the {@link OH_Utd}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_Utd}.
|
||||
* @return Returns a string pointer when input args normally, otherwise return nullptr.
|
||||
* @see OH_Utd.
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_Utd_GetTypeId(OH_Utd* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get description from the {@link OH_Utd}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_Utd}.
|
||||
* @return Returns a string pointer when input args normally, otherwise return nullptr.
|
||||
* @see OH_Utd.
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_Utd_GetDescription(OH_Utd* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get url from the {@link OH_Utd}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_Utd}.
|
||||
* @return Returns a string pointer when input args normally, otherwise return nullptr.
|
||||
* @see OH_Utd.
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_Utd_GetReferenceURL(OH_Utd* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get icon file from the {@link OH_Utd}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_Utd}.
|
||||
* @return Returns a string pointer when input args normally, otherwise return nullptr.
|
||||
* @see OH_Utd.
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_Utd_GetIconFile(OH_Utd* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get belong to type id of the current {@link OH_Utd}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_Utd}.
|
||||
* @param count Represents the return types count.
|
||||
* @return Returns string array when input args normally, otherwise return nullptr.
|
||||
* @see OH_Utd.
|
||||
* @since 12
|
||||
*/
|
||||
const char** OH_Utd_GetBelongingToTypes(OH_Utd* pThis, unsigned int* count);
|
||||
|
||||
/**
|
||||
* @brief Get filename extensions of the current {@link OH_Utd}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_Utd}.
|
||||
* @param count Represents the return file extensions count.
|
||||
* @return Returns string array when input args normally, otherwise return nullptr.
|
||||
* @see OH_Utd.
|
||||
* @since 12
|
||||
*/
|
||||
const char** OH_Utd_GetFilenameExtensions(OH_Utd* pThis, unsigned int* count);
|
||||
|
||||
/**
|
||||
* @brief Get mime types of the current {@link OH_Utd}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_Utd}.
|
||||
* @param count Represents the mime types count.
|
||||
* @return Returns string array when input args normally, otherwise return nullptr.
|
||||
* @see OH_Utd.
|
||||
* @since 12
|
||||
*/
|
||||
const char** OH_Utd_GetMimeTypes(OH_Utd* pThis, unsigned int* count);
|
||||
|
||||
/**
|
||||
* @brief Get type id by file name extension.
|
||||
*
|
||||
* @param extension Represents file name extension.
|
||||
* @param count Represents the types count.
|
||||
* @return Returns string list of types. Must be destroyed with {@link OH_Utd_DestroyStringList} when not needed.
|
||||
* @since 12
|
||||
*/
|
||||
const char** OH_Utd_GetTypesByFilenameExtension(const char* extension, unsigned int* count);
|
||||
|
||||
/**
|
||||
* @brief Get type id by mime type.
|
||||
*
|
||||
* @param mimeType Represents mime type
|
||||
* @param count Represents the types count.
|
||||
* @return Returns string list of types. Must be destroyed with {@link OH_Utd_DestroyStringList} when not needed.
|
||||
* @since 12
|
||||
*/
|
||||
const char** OH_Utd_GetTypesByMimeType(const char* mimeType, unsigned int* count);
|
||||
|
||||
/**
|
||||
* @brief Calculate relationships of two types.
|
||||
*
|
||||
* @param srcTypeId Represents source type id.
|
||||
* @param destTypeId Represents target type id.
|
||||
* @return Returns the status code of the execution.
|
||||
* {@code false} Represents srcTypeId not belongs to destTypeId.
|
||||
* {@code true} Represents srcTypeId belongs to destTypeId.
|
||||
* @since 12
|
||||
*/
|
||||
bool OH_Utd_IsBelongsTo(const char* srcTypeId, const char* destTypeId);
|
||||
|
||||
/**
|
||||
* @brief Calculate relationships of two types.
|
||||
*
|
||||
* @param srcTypeId Represents source type id.
|
||||
* @param destTypeId Represents target type id.
|
||||
* @return Returns the status code of the execution.
|
||||
* {@code false} Represents srcTypeId not lower level to destTypeId.
|
||||
* {@code true} Represents srcTypeId lower level to destTypeId.
|
||||
* @since 12
|
||||
*/
|
||||
bool OH_Utd_IsLowerLevelType(const char* srcTypeId, const char* destTypeId);
|
||||
|
||||
/**
|
||||
* @brief Calculate relationships of two types.
|
||||
*
|
||||
* @param srcTypeId Represents source type id.
|
||||
* @param destTypeId Represents target type id.
|
||||
* @return Returns the status code of the execution.
|
||||
* {@code false} Represents srcTypeId not higher level to destTypeId.
|
||||
* {@code true} Represents srcTypeId higher level to destTypeId.
|
||||
* @since 12
|
||||
*/
|
||||
bool OH_Utd_IsHigherLevelType(const char* srcTypeId, const char* destTypeId);
|
||||
|
||||
/**
|
||||
* @brief Calculate two {@link OH_Utd}s are equal.
|
||||
*
|
||||
* @param utd1 Represents a pointer to {@link OH_Utd} instance.
|
||||
* @param utd2 Represents a pointer to {@link OH_Utd} instance.
|
||||
* @return Returns the status code of the execution.
|
||||
* {@code false} Represents utd1 and utd2 are not equal.
|
||||
* {@code true} Represents utd1 and utd2 are equal.
|
||||
* @since 12
|
||||
*/
|
||||
bool OH_Utd_IsEquals(OH_Utd* utd1, OH_Utd* utd2);
|
||||
|
||||
/**
|
||||
* @brief Destroy string list memory.
|
||||
*
|
||||
* @param list Represents a point to string list.
|
||||
* @param count Represents string count in list.
|
||||
* @since 12
|
||||
*/
|
||||
void OH_Utd_DestroyStringList(const char** list, unsigned int count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user