// // Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022 // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #pragma once #include "td/telegram/AudiosManager.h" #include "td/telegram/files/FileId.hpp" #include "td/telegram/PhotoSize.hpp" #include "td/telegram/Version.h" #include "td/utils/common.h" #include "td/utils/tl_helpers.h" #include "td/telegram/ConfigShared.h" namespace td { template void AudiosManager::store_audio(FileId file_id, StorerT &storer) const { auto it = audios_.find(file_id); CHECK(it != audios_.end()); const Audio *audio = it->second.get(); bool has_file_name = !audio->file_name.empty(); bool has_mime_type = !audio->mime_type.empty(); bool has_duration = audio->duration != 0; bool has_title = !audio->title.empty(); bool has_performer = !audio->performer.empty(); bool has_minithumbnail = !audio->minithumbnail.empty(); bool has_thumbnail = audio->thumbnail.file_id.is_valid(); bool has_date = audio->date != 0; BEGIN_STORE_FLAGS(); STORE_FLAG(has_file_name); STORE_FLAG(has_mime_type); STORE_FLAG(has_duration); STORE_FLAG(has_title); STORE_FLAG(has_performer); STORE_FLAG(has_minithumbnail); STORE_FLAG(has_thumbnail); STORE_FLAG(has_date); END_STORE_FLAGS(); if (has_file_name) { store(audio->file_name, storer); } if (has_mime_type) { store(audio->mime_type, storer); } if (has_duration) { store(audio->duration, storer); } if (has_title) { store(audio->title, storer); } if (has_performer) { store(audio->performer, storer); } if (has_minithumbnail) { store(audio->minithumbnail, storer); } if (has_thumbnail) { store(audio->thumbnail, storer); } if (has_date) { store(audio->date, storer); } store(file_id, storer); } template FileId AudiosManager::parse_audio(ParserT &parser) { auto audio = make_unique