2019-02-07 22:00:26 +01:00
|
|
|
//
|
2022-12-31 22:28:08 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
2019-02-07 22:00:26 +01:00
|
|
|
//
|
|
|
|
// 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/files/FileLocation.h"
|
|
|
|
|
|
|
|
#include "td/telegram/files/FileType.h"
|
2019-06-12 13:42:06 +02:00
|
|
|
#include "td/telegram/net/DcId.h"
|
2019-06-19 02:18:44 +02:00
|
|
|
#include "td/telegram/PhotoSizeSource.hpp"
|
2019-06-11 12:10:14 +02:00
|
|
|
#include "td/telegram/Version.h"
|
2019-02-07 22:00:26 +01:00
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
#include "td/utils/tl_helpers.h"
|
|
|
|
#include "td/utils/Variant.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void PartialRemoteFileLocation::store(StorerT &storer) const {
|
|
|
|
using td::store;
|
|
|
|
store(file_id_, storer);
|
|
|
|
store(part_count_, storer);
|
|
|
|
store(part_size_, storer);
|
|
|
|
store(ready_part_count_, storer);
|
|
|
|
store(is_big_, storer);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void PartialRemoteFileLocation::parse(ParserT &parser) {
|
|
|
|
using td::parse;
|
|
|
|
parse(file_id_, parser);
|
|
|
|
parse(part_count_, parser);
|
|
|
|
parse(part_size_, parser);
|
|
|
|
parse(ready_part_count_, parser);
|
|
|
|
parse(is_big_, parser);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void PhotoRemoteFileLocation::store(StorerT &storer) const {
|
|
|
|
using td::store;
|
|
|
|
store(id_, storer);
|
|
|
|
store(access_hash_, storer);
|
2019-06-19 02:53:11 +02:00
|
|
|
store(source_, storer);
|
2019-02-07 22:00:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void PhotoRemoteFileLocation::parse(ParserT &parser) {
|
|
|
|
using td::parse;
|
|
|
|
parse(id_, parser);
|
|
|
|
parse(access_hash_, parser);
|
2021-04-16 16:43:51 +02:00
|
|
|
if (parser.version() >= static_cast<int32>(Version::RemovePhotoVolumeAndLocalId)) {
|
2019-06-11 12:10:14 +02:00
|
|
|
parse(source_, parser);
|
2019-06-19 01:48:34 +02:00
|
|
|
} else {
|
2021-04-16 16:43:51 +02:00
|
|
|
int64 volume_id;
|
|
|
|
PhotoSizeSource source;
|
|
|
|
int32 local_id;
|
|
|
|
parse(volume_id, parser);
|
|
|
|
if (parser.version() >= static_cast<int32>(Version::AddPhotoSizeSource)) {
|
|
|
|
parse(source, parser);
|
|
|
|
parse(local_id, parser);
|
|
|
|
} else {
|
|
|
|
int64 secret;
|
|
|
|
parse(secret, parser);
|
|
|
|
parse(local_id, parser);
|
2021-10-27 15:52:22 +02:00
|
|
|
source = PhotoSizeSource::full_legacy(volume_id, local_id, secret);
|
2021-04-16 16:43:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (parser.get_error() != nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-14 08:47:02 +01:00
|
|
|
switch (source.get_type("PhotoRemoteFileLocation::parse")) {
|
2021-04-16 16:43:51 +02:00
|
|
|
case PhotoSizeSource::Type::Legacy:
|
2021-10-27 15:52:22 +02:00
|
|
|
source_ = PhotoSizeSource::full_legacy(volume_id, local_id, source.legacy().secret);
|
2021-04-16 16:43:51 +02:00
|
|
|
break;
|
|
|
|
case PhotoSizeSource::Type::FullLegacy:
|
|
|
|
case PhotoSizeSource::Type::Thumbnail:
|
|
|
|
source_ = source;
|
|
|
|
break;
|
|
|
|
case PhotoSizeSource::Type::DialogPhotoSmall:
|
|
|
|
case PhotoSizeSource::Type::DialogPhotoBig: {
|
|
|
|
auto &dialog_photo = source.dialog_photo();
|
2021-11-14 08:47:02 +01:00
|
|
|
bool is_big = source.get_type("PhotoRemoteFileLocation::parse") == PhotoSizeSource::Type::DialogPhotoBig;
|
2021-10-27 15:52:22 +02:00
|
|
|
source_ = PhotoSizeSource::dialog_photo_legacy(dialog_photo.dialog_id, dialog_photo.dialog_access_hash, is_big,
|
|
|
|
volume_id, local_id);
|
2021-04-16 16:43:51 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case PhotoSizeSource::Type::StickerSetThumbnail: {
|
|
|
|
auto &sticker_set_thumbnail = source.sticker_set_thumbnail();
|
2021-10-27 15:52:22 +02:00
|
|
|
source_ = PhotoSizeSource::sticker_set_thumbnail_legacy(
|
|
|
|
sticker_set_thumbnail.sticker_set_id, sticker_set_thumbnail.sticker_set_access_hash, volume_id, local_id);
|
2021-04-16 16:43:51 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
parser.set_error("Invalid PhotoSizeSource in legacy PhotoRemoteFileLocation");
|
|
|
|
break;
|
|
|
|
}
|
2019-06-11 12:10:14 +02:00
|
|
|
}
|
2019-02-07 22:00:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void PhotoRemoteFileLocation::AsKey::store(StorerT &storer) const {
|
|
|
|
using td::store;
|
2021-04-16 16:43:51 +02:00
|
|
|
auto unique = key.source_.get_unique();
|
2021-11-14 08:47:02 +01:00
|
|
|
switch (key.source_.get_type("PhotoRemoteFileLocation::AsKey::store")) {
|
2021-04-16 16:43:51 +02:00
|
|
|
case PhotoSizeSource::Type::Legacy:
|
|
|
|
case PhotoSizeSource::Type::StickerSetThumbnail:
|
|
|
|
UNREACHABLE();
|
|
|
|
break;
|
|
|
|
case PhotoSizeSource::Type::FullLegacy:
|
|
|
|
case PhotoSizeSource::Type::DialogPhotoSmallLegacy:
|
|
|
|
case PhotoSizeSource::Type::DialogPhotoBigLegacy:
|
|
|
|
case PhotoSizeSource::Type::StickerSetThumbnailLegacy: // 12/20 bytes
|
|
|
|
if (!is_unique) {
|
|
|
|
store(key.id_, storer);
|
|
|
|
}
|
|
|
|
storer.store_slice(unique); // volume_id + local_id
|
|
|
|
break;
|
|
|
|
case PhotoSizeSource::Type::DialogPhotoSmall:
|
|
|
|
case PhotoSizeSource::Type::DialogPhotoBig:
|
|
|
|
case PhotoSizeSource::Type::Thumbnail: // 8 + 1 bytes
|
|
|
|
store(key.id_, storer); // photo_id or document_id
|
|
|
|
storer.store_slice(unique);
|
|
|
|
break;
|
|
|
|
case PhotoSizeSource::Type::StickerSetThumbnailVersion: // 13 bytes
|
2021-12-02 12:15:37 +01:00
|
|
|
// sticker set thumbnails have no photo_id or document_id
|
2021-04-16 16:43:51 +02:00
|
|
|
storer.store_slice(unique);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
UNREACHABLE();
|
|
|
|
break;
|
2019-12-23 02:32:02 +01:00
|
|
|
}
|
2019-02-07 22:00:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void WebRemoteFileLocation::store(StorerT &storer) const {
|
|
|
|
using td::store;
|
|
|
|
store(url_, storer);
|
|
|
|
store(access_hash_, storer);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void WebRemoteFileLocation::parse(ParserT &parser) {
|
|
|
|
using td::parse;
|
|
|
|
parse(url_, parser);
|
|
|
|
parse(access_hash_, parser);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void WebRemoteFileLocation::AsKey::store(StorerT &storer) const {
|
|
|
|
td::store(key.url_, storer);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void CommonRemoteFileLocation::store(StorerT &storer) const {
|
|
|
|
using td::store;
|
|
|
|
store(id_, storer);
|
|
|
|
store(access_hash_, storer);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void CommonRemoteFileLocation::parse(ParserT &parser) {
|
|
|
|
using td::parse;
|
|
|
|
parse(id_, parser);
|
|
|
|
parse(access_hash_, parser);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void CommonRemoteFileLocation::AsKey::store(StorerT &storer) const {
|
|
|
|
td::store(key.id_, storer);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void FullRemoteFileLocation::store(StorerT &storer) const {
|
|
|
|
using ::td::store;
|
2019-10-25 16:18:51 +02:00
|
|
|
bool has_file_reference = !file_reference_.empty();
|
|
|
|
auto type = key_type();
|
|
|
|
if (has_file_reference) {
|
|
|
|
type |= FILE_REFERENCE_FLAG;
|
|
|
|
}
|
|
|
|
store(type, storer);
|
2019-02-07 22:00:26 +01:00
|
|
|
store(dc_id_.get_value(), storer);
|
2019-10-25 16:18:51 +02:00
|
|
|
if (has_file_reference) {
|
2019-02-07 22:00:26 +01:00
|
|
|
store(file_reference_, storer);
|
|
|
|
}
|
|
|
|
variant_.visit([&](auto &&value) {
|
|
|
|
using td::store;
|
|
|
|
store(value, storer);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void FullRemoteFileLocation::parse(ParserT &parser) {
|
|
|
|
using ::td::parse;
|
|
|
|
int32 raw_type;
|
|
|
|
parse(raw_type, parser);
|
2019-10-25 16:46:35 +02:00
|
|
|
bool is_web = (raw_type & WEB_LOCATION_FLAG) != 0;
|
2019-02-07 22:00:26 +01:00
|
|
|
raw_type &= ~WEB_LOCATION_FLAG;
|
|
|
|
bool has_file_reference = (raw_type & FILE_REFERENCE_FLAG) != 0;
|
|
|
|
raw_type &= ~FILE_REFERENCE_FLAG;
|
|
|
|
if (raw_type < 0 || raw_type >= static_cast<int32>(FileType::Size)) {
|
|
|
|
return parser.set_error("Invalid FileType in FullRemoteFileLocation");
|
|
|
|
}
|
|
|
|
file_type_ = static_cast<FileType>(raw_type);
|
|
|
|
int32 dc_id_value;
|
|
|
|
parse(dc_id_value, parser);
|
|
|
|
dc_id_ = DcId::from_value(dc_id_value);
|
|
|
|
|
|
|
|
if (has_file_reference) {
|
|
|
|
parse(file_reference_, parser);
|
2020-01-16 02:52:36 +01:00
|
|
|
if (file_reference_ == FileReferenceView::invalid_file_reference()) {
|
|
|
|
file_reference_.clear();
|
|
|
|
}
|
2019-10-25 16:46:35 +02:00
|
|
|
}
|
|
|
|
if (is_web) {
|
|
|
|
variant_ = WebRemoteFileLocation();
|
|
|
|
return web().parse(parser);
|
2019-02-07 22:00:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (location_type()) {
|
2019-06-20 02:51:37 +02:00
|
|
|
case LocationType::Web:
|
2019-10-25 16:46:35 +02:00
|
|
|
UNREACHABLE();
|
|
|
|
break;
|
2019-06-20 02:51:37 +02:00
|
|
|
case LocationType::Photo:
|
2019-02-07 22:00:26 +01:00
|
|
|
variant_ = PhotoRemoteFileLocation();
|
2019-06-20 02:51:37 +02:00
|
|
|
photo().parse(parser);
|
|
|
|
if (parser.get_error() != nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
2021-11-14 08:47:02 +01:00
|
|
|
switch (photo().source_.get_type("FullRemoteFileLocation::parse")) {
|
2019-06-20 02:51:37 +02:00
|
|
|
case PhotoSizeSource::Type::Legacy:
|
2021-04-16 16:43:51 +02:00
|
|
|
case PhotoSizeSource::Type::FullLegacy:
|
2019-06-20 02:51:37 +02:00
|
|
|
break;
|
|
|
|
case PhotoSizeSource::Type::Thumbnail:
|
2021-11-14 08:47:02 +01:00
|
|
|
if (photo().source_.get_file_type("FullRemoteFileLocation::parse") != file_type_ ||
|
2022-12-21 15:37:16 +01:00
|
|
|
(file_type_ != FileType::Photo && file_type_ != FileType::Thumbnail &&
|
|
|
|
file_type_ != FileType::EncryptedThumbnail)) {
|
2019-06-20 02:51:37 +02:00
|
|
|
parser.set_error("Invalid FileType in PhotoRemoteFileLocation Thumbnail");
|
|
|
|
}
|
|
|
|
break;
|
2019-06-20 03:35:08 +02:00
|
|
|
case PhotoSizeSource::Type::DialogPhotoSmall:
|
|
|
|
case PhotoSizeSource::Type::DialogPhotoBig:
|
2021-04-16 16:43:51 +02:00
|
|
|
case PhotoSizeSource::Type::DialogPhotoSmallLegacy:
|
|
|
|
case PhotoSizeSource::Type::DialogPhotoBigLegacy:
|
2019-06-20 02:51:37 +02:00
|
|
|
if (file_type_ != FileType::ProfilePhoto) {
|
|
|
|
parser.set_error("Invalid FileType in PhotoRemoteFileLocation DialogPhoto");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PhotoSizeSource::Type::StickerSetThumbnail:
|
2021-04-16 16:43:51 +02:00
|
|
|
case PhotoSizeSource::Type::StickerSetThumbnailLegacy:
|
|
|
|
case PhotoSizeSource::Type::StickerSetThumbnailVersion:
|
2019-06-20 02:51:37 +02:00
|
|
|
if (file_type_ != FileType::Thumbnail) {
|
|
|
|
parser.set_error("Invalid FileType in PhotoRemoteFileLocation StickerSetThumbnail");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
UNREACHABLE();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
case LocationType::Common:
|
2019-02-07 22:00:26 +01:00
|
|
|
variant_ = CommonRemoteFileLocation();
|
|
|
|
return common().parse(parser);
|
2019-06-20 02:51:37 +02:00
|
|
|
case LocationType::None:
|
2019-02-07 22:00:26 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
parser.set_error("Invalid FileType in FullRemoteFileLocation");
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void FullRemoteFileLocation::AsKey::store(StorerT &storer) const {
|
|
|
|
using td::store;
|
|
|
|
store(key.key_type(), storer);
|
|
|
|
key.variant_.visit([&](auto &&value) {
|
|
|
|
using td::store;
|
2019-12-23 02:32:02 +01:00
|
|
|
store(value.as_key(false), storer);
|
2019-02-07 22:00:26 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-10-25 16:04:01 +02:00
|
|
|
template <class StorerT>
|
|
|
|
void FullRemoteFileLocation::AsUnique::store(StorerT &storer) const {
|
|
|
|
using td::store;
|
|
|
|
|
2019-10-25 17:01:33 +02:00
|
|
|
int32 type = [key = &key] {
|
|
|
|
if (key->is_web()) {
|
|
|
|
return 0;
|
|
|
|
}
|
2022-04-21 21:14:12 +02:00
|
|
|
return static_cast<int32>(get_file_type_class(key->file_type_)) + 1;
|
2019-10-25 17:01:33 +02:00
|
|
|
}();
|
|
|
|
store(type, storer);
|
2019-10-25 16:04:01 +02:00
|
|
|
key.variant_.visit([&](auto &&value) {
|
|
|
|
using td::store;
|
2019-12-23 02:32:02 +01:00
|
|
|
store(value.as_key(true), storer);
|
2019-10-25 16:04:01 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-02-07 22:00:26 +01:00
|
|
|
template <class StorerT>
|
|
|
|
void RemoteFileLocation::store(StorerT &storer) const {
|
2019-06-19 01:48:34 +02:00
|
|
|
td::store(variant_, storer);
|
2019-02-07 22:00:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void RemoteFileLocation::parse(ParserT &parser) {
|
2019-06-19 01:48:34 +02:00
|
|
|
td::parse(variant_, parser);
|
2019-02-07 22:00:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void PartialLocalFileLocation::store(StorerT &storer) const {
|
|
|
|
using td::store;
|
|
|
|
store(file_type_, storer);
|
|
|
|
store(path_, storer);
|
2022-05-11 16:17:20 +02:00
|
|
|
store(static_cast<int32>(part_size_ & 0x7FFFFFFF), storer);
|
|
|
|
int32 deprecated_ready_part_count = part_size_ > 0x7FFFFFFF ? -2 : -1;
|
2019-02-07 22:00:26 +01:00
|
|
|
store(deprecated_ready_part_count, storer);
|
|
|
|
store(iv_, storer);
|
|
|
|
store(ready_bitmask_, storer);
|
2022-05-11 16:17:20 +02:00
|
|
|
if (deprecated_ready_part_count == -2) {
|
2022-06-02 15:19:16 +02:00
|
|
|
CHECK(part_size_ < (static_cast<int64>(1) << 62));
|
2022-05-11 16:17:20 +02:00
|
|
|
store(static_cast<int32>(part_size_ >> 31), storer);
|
|
|
|
}
|
2019-02-07 22:00:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void PartialLocalFileLocation::parse(ParserT &parser) {
|
|
|
|
using td::parse;
|
|
|
|
parse(file_type_, parser);
|
|
|
|
if (file_type_ < FileType::Thumbnail || file_type_ >= FileType::Size) {
|
|
|
|
return parser.set_error("Invalid type in PartialLocalFileLocation");
|
|
|
|
}
|
|
|
|
parse(path_, parser);
|
2022-05-11 16:17:20 +02:00
|
|
|
int32 part_size_low;
|
|
|
|
parse(part_size_low, parser);
|
|
|
|
part_size_ = part_size_low;
|
2019-02-07 22:00:26 +01:00
|
|
|
int32 deprecated_ready_part_count;
|
|
|
|
parse(deprecated_ready_part_count, parser);
|
|
|
|
parse(iv_, parser);
|
2022-05-11 16:17:20 +02:00
|
|
|
if (deprecated_ready_part_count == -1 || deprecated_ready_part_count == -2) {
|
2019-02-07 22:00:26 +01:00
|
|
|
parse(ready_bitmask_, parser);
|
2022-05-11 16:17:20 +02:00
|
|
|
if (deprecated_ready_part_count == -2) {
|
|
|
|
int32 part_size_high;
|
|
|
|
parse(part_size_high, parser);
|
|
|
|
part_size_ += static_cast<int64>(part_size_high) << 31;
|
|
|
|
}
|
2019-02-07 22:00:26 +01:00
|
|
|
} else {
|
|
|
|
CHECK(0 <= deprecated_ready_part_count);
|
|
|
|
CHECK(deprecated_ready_part_count <= (1 << 22));
|
|
|
|
ready_bitmask_ = Bitmask(Bitmask::Ones{}, deprecated_ready_part_count).encode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void FullLocalFileLocation::store(StorerT &storer) const {
|
|
|
|
using td::store;
|
|
|
|
store(file_type_, storer);
|
|
|
|
store(mtime_nsec_, storer);
|
|
|
|
store(path_, storer);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void FullLocalFileLocation::parse(ParserT &parser) {
|
|
|
|
using td::parse;
|
|
|
|
parse(file_type_, parser);
|
|
|
|
if (file_type_ < FileType::Thumbnail || file_type_ >= FileType::Size) {
|
|
|
|
return parser.set_error("Invalid type in FullLocalFileLocation");
|
|
|
|
}
|
|
|
|
parse(mtime_nsec_, parser);
|
|
|
|
parse(path_, parser);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void PartialLocalFileLocationPtr::store(StorerT &storer) const {
|
|
|
|
td::store(*location_, storer);
|
|
|
|
}
|
|
|
|
|
2019-06-19 01:48:34 +02:00
|
|
|
template <class ParserT>
|
|
|
|
void PartialLocalFileLocationPtr::parse(ParserT &parser) {
|
|
|
|
td::parse(*location_, parser);
|
|
|
|
}
|
|
|
|
|
2019-02-07 22:00:26 +01:00
|
|
|
template <class StorerT>
|
|
|
|
void LocalFileLocation::store(StorerT &storer) const {
|
2019-06-19 01:48:34 +02:00
|
|
|
td::store(variant_, storer);
|
2019-02-07 22:00:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void LocalFileLocation::parse(ParserT &parser) {
|
2019-06-19 01:48:34 +02:00
|
|
|
td::parse(variant_, parser);
|
2019-02-07 22:00:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void FullGenerateFileLocation::store(StorerT &storer) const {
|
|
|
|
using td::store;
|
|
|
|
store(file_type_, storer);
|
|
|
|
store(original_path_, storer);
|
|
|
|
store(conversion_, storer);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void FullGenerateFileLocation::parse(ParserT &parser) {
|
|
|
|
using td::parse;
|
|
|
|
parse(file_type_, parser);
|
|
|
|
parse(original_path_, parser);
|
|
|
|
parse(conversion_, parser);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void GenerateFileLocation::store(StorerT &storer) const {
|
|
|
|
td::store(type_, storer);
|
|
|
|
switch (type_) {
|
|
|
|
case Type::Empty:
|
|
|
|
return;
|
|
|
|
case Type::Full:
|
|
|
|
return td::store(full_, storer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void GenerateFileLocation::parse(ParserT &parser) {
|
|
|
|
td::parse(type_, parser);
|
|
|
|
switch (type_) {
|
|
|
|
case Type::Empty:
|
|
|
|
return;
|
|
|
|
case Type::Full:
|
|
|
|
return td::parse(full_, parser);
|
|
|
|
}
|
|
|
|
return parser.set_error("Invalid type in GenerateFileLocation");
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace td
|