13e5483f6Sopenharmony_ci/* 23e5483f6Sopenharmony_ci * Copyright (C) 2024 Huawei Device Co., Ltd. 33e5483f6Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 43e5483f6Sopenharmony_ci * you may not use this file except in compliance with the License. 53e5483f6Sopenharmony_ci * You may obtain a copy of the License at 63e5483f6Sopenharmony_ci * 73e5483f6Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 83e5483f6Sopenharmony_ci * 93e5483f6Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 103e5483f6Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 113e5483f6Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 123e5483f6Sopenharmony_ci * See the License for the specific language governing permissions and 133e5483f6Sopenharmony_ci * limitations under the License. 143e5483f6Sopenharmony_ci */ 153e5483f6Sopenharmony_ci 163e5483f6Sopenharmony_ci#ifndef RINGTONE_METADATA_H 173e5483f6Sopenharmony_ci#define RINGTONE_METADATA_H 183e5483f6Sopenharmony_ci 193e5483f6Sopenharmony_ci#include "ringtone_db_const.h" 203e5483f6Sopenharmony_ci#include "ringtone_type.h" 213e5483f6Sopenharmony_ci 223e5483f6Sopenharmony_ci 233e5483f6Sopenharmony_cinamespace OHOS { 243e5483f6Sopenharmony_cinamespace Media { 253e5483f6Sopenharmony_ci#define EXPORT __attribute__ ((visibility ("default"))) 263e5483f6Sopenharmony_ci 273e5483f6Sopenharmony_ciclass RingtoneMetadata { 283e5483f6Sopenharmony_cipublic: 293e5483f6Sopenharmony_ci EXPORT RingtoneMetadata(); 303e5483f6Sopenharmony_ci EXPORT ~RingtoneMetadata() = default; 313e5483f6Sopenharmony_ci using VariantData = std::variant<int32_t, std::string, int64_t, double>; 323e5483f6Sopenharmony_ci 333e5483f6Sopenharmony_ci EXPORT void SetToneId(const VariantData &toneId); 343e5483f6Sopenharmony_ci EXPORT int32_t GetToneId() const; 353e5483f6Sopenharmony_ci 363e5483f6Sopenharmony_ci EXPORT void SetData(const VariantData &data); 373e5483f6Sopenharmony_ci EXPORT const std::string &GetData() const; 383e5483f6Sopenharmony_ci 393e5483f6Sopenharmony_ci EXPORT void SetSize(const VariantData &size); 403e5483f6Sopenharmony_ci EXPORT int64_t GetSize() const; 413e5483f6Sopenharmony_ci 423e5483f6Sopenharmony_ci EXPORT void SetDisplayName(const VariantData &displayName); 433e5483f6Sopenharmony_ci EXPORT const std::string &GetDisplayName() const; 443e5483f6Sopenharmony_ci 453e5483f6Sopenharmony_ci EXPORT void SetTitle(const VariantData &title); 463e5483f6Sopenharmony_ci EXPORT const std::string &GetTitle() const; 473e5483f6Sopenharmony_ci 483e5483f6Sopenharmony_ci EXPORT void SetMediaType(const VariantData &mediaType); 493e5483f6Sopenharmony_ci EXPORT int32_t GetMediaType() const; 503e5483f6Sopenharmony_ci 513e5483f6Sopenharmony_ci EXPORT void SetToneType(const VariantData &toneType); 523e5483f6Sopenharmony_ci EXPORT int32_t GetToneType() const; 533e5483f6Sopenharmony_ci 543e5483f6Sopenharmony_ci EXPORT void SetMimeType(const VariantData &mimeType); 553e5483f6Sopenharmony_ci EXPORT const std::string &GetMimeType() const; 563e5483f6Sopenharmony_ci 573e5483f6Sopenharmony_ci EXPORT void SetSourceType(const VariantData &toneType); 583e5483f6Sopenharmony_ci EXPORT int32_t GetSourceType() const; 593e5483f6Sopenharmony_ci 603e5483f6Sopenharmony_ci EXPORT void SetDateAdded(const VariantData &dateAdded); 613e5483f6Sopenharmony_ci EXPORT int64_t GetDateAdded() const; 623e5483f6Sopenharmony_ci 633e5483f6Sopenharmony_ci EXPORT void SetDateModified(const VariantData &dateModified); 643e5483f6Sopenharmony_ci EXPORT int64_t GetDateModified() const; 653e5483f6Sopenharmony_ci 663e5483f6Sopenharmony_ci EXPORT void SetDateTaken(const VariantData &dateTaken); 673e5483f6Sopenharmony_ci EXPORT int64_t GetDateTaken() const; 683e5483f6Sopenharmony_ci 693e5483f6Sopenharmony_ci EXPORT void SetDuration(const VariantData &duration); 703e5483f6Sopenharmony_ci EXPORT int32_t GetDuration() const; 713e5483f6Sopenharmony_ci 723e5483f6Sopenharmony_ci EXPORT void SetShotToneType(const VariantData &shotToneType); 733e5483f6Sopenharmony_ci EXPORT int32_t GetShotToneType() const; 743e5483f6Sopenharmony_ci 753e5483f6Sopenharmony_ci EXPORT void SetShotToneSourceType(const VariantData &shotToneSourceType); 763e5483f6Sopenharmony_ci EXPORT int32_t GetShotToneSourceType() const; 773e5483f6Sopenharmony_ci 783e5483f6Sopenharmony_ci EXPORT void SetNotificationToneType(const VariantData ¬ificationToneType); 793e5483f6Sopenharmony_ci EXPORT int32_t GetNotificationToneType() const; 803e5483f6Sopenharmony_ci 813e5483f6Sopenharmony_ci EXPORT void SetNotificationToneSourceType(const VariantData ¬ificationToneSourceType); 823e5483f6Sopenharmony_ci EXPORT int32_t GetNotificationToneSourceType() const; 833e5483f6Sopenharmony_ci 843e5483f6Sopenharmony_ci EXPORT void SetRingToneType(const VariantData &ringToneType); 853e5483f6Sopenharmony_ci EXPORT int32_t GetRingToneType() const; 863e5483f6Sopenharmony_ci 873e5483f6Sopenharmony_ci EXPORT void SetRingToneSourceType(const VariantData &ringToneSourceType); 883e5483f6Sopenharmony_ci EXPORT int32_t GetRingToneSourceType() const; 893e5483f6Sopenharmony_ci 903e5483f6Sopenharmony_ci EXPORT void SetAlarmToneType(const VariantData &alarmToneType); 913e5483f6Sopenharmony_ci EXPORT int32_t GetAlarmToneType() const; 923e5483f6Sopenharmony_ci 933e5483f6Sopenharmony_ci EXPORT void SetAlarmToneSourceType(const VariantData &alarmToneSourceType); 943e5483f6Sopenharmony_ci EXPORT int32_t GetAlarmToneSourceType() const; 953e5483f6Sopenharmony_ci 963e5483f6Sopenharmony_ci EXPORT void Init(); 973e5483f6Sopenharmony_ci 983e5483f6Sopenharmony_ci using RingtoneMetadataFnPtr = void (RingtoneMetadata::*)(const VariantData &); 993e5483f6Sopenharmony_ci std::unordered_map<std::string, std::pair<RingtoneResultSetDataType, RingtoneMetadataFnPtr>> memberFuncMap_; 1003e5483f6Sopenharmony_ci 1013e5483f6Sopenharmony_ci EXPORT std::string ToString() const; 1023e5483f6Sopenharmony_ciprivate: 1033e5483f6Sopenharmony_ci int32_t toneId_; 1043e5483f6Sopenharmony_ci std::string data_; 1053e5483f6Sopenharmony_ci int64_t size_; 1063e5483f6Sopenharmony_ci std::string displayName_; 1073e5483f6Sopenharmony_ci std::string title_; 1083e5483f6Sopenharmony_ci int32_t mediaType_; 1093e5483f6Sopenharmony_ci int32_t toneType_; 1103e5483f6Sopenharmony_ci std::string mimeType_; 1113e5483f6Sopenharmony_ci int32_t sourceType_; 1123e5483f6Sopenharmony_ci int64_t dateAdded_; 1133e5483f6Sopenharmony_ci int64_t dateModified_; 1143e5483f6Sopenharmony_ci int64_t dateTaken_; 1153e5483f6Sopenharmony_ci int32_t duration_; 1163e5483f6Sopenharmony_ci int32_t shotToneType_; 1173e5483f6Sopenharmony_ci int32_t shotToneSourceType_; 1183e5483f6Sopenharmony_ci int32_t notificationToneType_; 1193e5483f6Sopenharmony_ci int32_t notificationToneSourceType_; 1203e5483f6Sopenharmony_ci int32_t ringToneType_; 1213e5483f6Sopenharmony_ci int32_t ringToneSourceType_; 1223e5483f6Sopenharmony_ci int32_t alarmToneType_; 1233e5483f6Sopenharmony_ci int32_t alarmToneSourceType_; 1243e5483f6Sopenharmony_ci}; 1253e5483f6Sopenharmony_ci} // namespace Media 1263e5483f6Sopenharmony_ci} // namespace OHOS 1273e5483f6Sopenharmony_ci 1283e5483f6Sopenharmony_ci#endif // RINGTONE_METADATA_H 129