1 /* 2 * Copyright (C) 2024-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_MEDIA_DISPLAY_NAME_INFO_H 17 #define OHOS_MEDIA_DISPLAY_NAME_INFO_H 18 19 #include <string> 20 21 #include "photo_asset_info.h" 22 23 namespace OHOS::Media { 24 class DisplayNameInfo { 25 public: 26 explicit DisplayNameInfo(const PhotoAssetInfo &photoAssetInfo); 27 std::string ToString(); 28 std::string Next(); 29 30 private: 31 void ParseDisplayName(const PhotoAssetInfo &photoAssetInfo); 32 void ParseBurstDisplayName(const PhotoAssetInfo &photoAssetInfo); 33 int32_t ToNumber(const std::string &str); 34 void ParseNormalDisplayName(const PhotoAssetInfo &photoAssetInfo); 35 int32_t GetPrefixStrLength(std::string yearMonthDayStr, std::string hourMinuteSecondStr); 36 37 private: 38 enum { 39 YEAR_MONTH_DAY_LENGTH = 8, 40 HOUR_MINUTE_SECOND_LENGTH = 6, 41 BURST_DISPLAY_NAME_MIN_LENGTH = 20, 42 BURST_DISPLAY_NAME_YEAR_INDEX = 1, 43 BURST_DISPLAY_NAME_HOUR_INDEX = 2, 44 BURST_DISPLAY_NAME_MIN_SUBLINE_COUNT = 3, 45 MAX_DISPLAY_NAME_LENGTH = 255, 46 }; 47 std::string prefix; 48 int32_t yearMonthDay = 0; 49 int32_t hourMinuteSecond = 0; 50 std::string suffix; 51 }; 52 } // namespace OHOS::Media 53 #endif // OHOS_MEDIA_DISPLAY_NAME_INFO_H