mirror of
https://github.com/vale981/tdesktop
synced 2025-03-08 19:21:39 -05:00
102 lines
2.7 KiB
C++
102 lines
2.7 KiB
C++
![]() |
/*
|
||
|
This file is part of Telegram Desktop,
|
||
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
||
|
|
||
|
Telegram Desktop is free software: you can redistribute it and/or modify
|
||
|
it under the terms of the GNU General Public License as published by
|
||
|
the Free Software Foundation, either version 3 of the License, or
|
||
|
(at your option) any later version.
|
||
|
|
||
|
It is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
GNU General Public License for more details.
|
||
|
|
||
|
In addition, as a special exception, the copyright holders give permission
|
||
|
to link the code of portions of this program with the OpenSSL library.
|
||
|
|
||
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||
|
*/
|
||
|
#include "storage/storage_facade.h"
|
||
|
|
||
|
#include "storage/storage_shared_media.h"
|
||
|
|
||
|
namespace Storage {
|
||
|
|
||
|
class Facade::Impl {
|
||
|
public:
|
||
|
void add(SharedMediaAddNew &&query);
|
||
|
void add(SharedMediaAddExisting &&query);
|
||
|
void add(SharedMediaAddSlice &&query);
|
||
|
void remove(SharedMediaRemoveOne &&query);
|
||
|
void remove(SharedMediaRemoveAll &&query);
|
||
|
void query(
|
||
|
SharedMediaQuery &&query,
|
||
|
base::lambda_once<void(SharedMediaResult&&)> &&callback);
|
||
|
|
||
|
private:
|
||
|
SharedMedia _sharedMedia;
|
||
|
|
||
|
};
|
||
|
|
||
|
void Facade::Impl::add(SharedMediaAddNew &&query) {
|
||
|
_sharedMedia.add(std::move(query));
|
||
|
}
|
||
|
|
||
|
void Facade::Impl::add(SharedMediaAddExisting &&query) {
|
||
|
_sharedMedia.add(std::move(query));
|
||
|
}
|
||
|
|
||
|
void Facade::Impl::add(SharedMediaAddSlice &&query) {
|
||
|
_sharedMedia.add(std::move(query));
|
||
|
}
|
||
|
|
||
|
void Facade::Impl::remove(SharedMediaRemoveOne &&query) {
|
||
|
_sharedMedia.remove(std::move(query));
|
||
|
}
|
||
|
|
||
|
void Facade::Impl::remove(SharedMediaRemoveAll &&query) {
|
||
|
_sharedMedia.remove(std::move(query));
|
||
|
}
|
||
|
|
||
|
void Facade::Impl::query(
|
||
|
SharedMediaQuery &&query,
|
||
|
base::lambda_once<void(SharedMediaResult&&)> &&callback) {
|
||
|
_sharedMedia.query(query, std::move(callback));
|
||
|
}
|
||
|
|
||
|
|
||
|
Facade::Facade() : _impl(std::make_unique<Impl>()) {
|
||
|
}
|
||
|
|
||
|
void Facade::add(SharedMediaAddNew &&query) {
|
||
|
_impl->add(std::move(query));
|
||
|
}
|
||
|
|
||
|
void Facade::add(SharedMediaAddExisting &&query) {
|
||
|
_impl->add(std::move(query));
|
||
|
}
|
||
|
|
||
|
void Facade::add(SharedMediaAddSlice &&query) {
|
||
|
_impl->add(std::move(query));
|
||
|
}
|
||
|
|
||
|
void Facade::remove(SharedMediaRemoveOne &&query) {
|
||
|
_impl->remove(std::move(query));
|
||
|
}
|
||
|
|
||
|
void Facade::remove(SharedMediaRemoveAll &&query) {
|
||
|
_impl->remove(std::move(query));
|
||
|
}
|
||
|
|
||
|
void Facade::query(
|
||
|
SharedMediaQuery &&query,
|
||
|
base::lambda_once<void(SharedMediaResult&&)> &&callback) {
|
||
|
_impl->query(std::move(query), std::move(callback));
|
||
|
}
|
||
|
|
||
|
Facade::~Facade() = default;
|
||
|
|
||
|
} // namespace Storage
|