data_asset.h

Overview

Defines data asset structures.

Asset is a data struct used in data management. You can use it to set and obtain file attributes, including the name, absolute path, relative path, creation time, modification time, status, and size of a file.

Library: libnative_rdb_ndk.z.so

Since: 11

Related module: Data

Summary

Types

Name Description
Data_AssetStatus Defines an enum for data asset statuses.
Data_Asset Defines a struct for an asset.

Enums

Name Description
Data_AssetStatus {
ASSET_NULL = 0, ASSET_NORMAL, ASSET_INSERT, ASSET_UPDATE,
ASSET_DELETE, ASSET_ABNORMAL, ASSET_DOWNLOADING
}
Enumerates data asset statuses.

Functions

Name Description
OH_Data_Asset_SetName (Data_Asset *asset, const char *name) Sets the name of an asset.
OH_Data_Asset_SetUri (Data_Asset *asset, const char *uri) Sets the absolute path (URI) of an asset in the system.
OH_Data_Asset_SetPath (Data_Asset *asset, const char *path) Sets the relative path of an asset in the application sandbox directory.
OH_Data_Asset_SetCreateTime (Data_Asset *asset, int64_t createTime) Sets the creation time for an asset.
OH_Data_Asset_SetModifyTime (Data_Asset *asset, int64_t modifyTime) Sets the last modification time for an asset.
OH_Data_Asset_SetSize (Data_Asset *asset, size_t size) Sets the size of an asset.
OH_Data_Asset_SetStatus (Data_Asset *asset, Data_AssetStatus status) Sets the status of an asset.
OH_Data_Asset_GetName (Data_Asset *asset, char *name, size_t *length) Obtains the name of an asset.
OH_Data_Asset_GetUri (Data_Asset *asset, char *uri, size_t *length) Obtains the absolute path of an asset.
OH_Data_Asset_GetPath (Data_Asset *asset, char *path, size_t *length) Obtains the relative path of an asset.
OH_Data_Asset_GetCreateTime (Data_Asset *asset, int64_t *createTime) Obtains the creation time of an asset.
OH_Data_Asset_GetModifyTime (Data_Asset *asset, int64_t *modifyTime) Obtains the last modification time of an asset.
OH_Data_Asset_GetSize (Data_Asset *asset, size_t *size) Obtains the space occupied by an asset.
OH_Data_Asset_GetStatus (Data_Asset *asset, Data_AssetStatus *status) Obtains the status of an asset.
OH_Data_Asset_CreateOne () Creates a Data_Asset instance.
OH_Data_Asset_DestroyOne (Data_Asset *asset) Destroys a Data_Asset instance.
OH_Data_Asset_CreateMultiple (uint32_t count) Creates multiple Data_Asset instances.
OH_Data_Asset_DestroyMultiple (Data_Asset **assets, uint32_t count) Destroys multiple Data_Asset instances.