2016-05-31 09:46:31 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-05-31 09:46:31 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-05-31 09:46:31 +00:00
|
|
|
*/
|
2016-06-09 11:51:24 +00:00
|
|
|
#include "data/data_abstract_structure.h"
|
2016-05-31 09:46:31 +00:00
|
|
|
|
|
|
|
namespace Data {
|
2016-06-09 11:51:24 +00:00
|
|
|
namespace {
|
2016-05-31 09:46:31 +00:00
|
|
|
|
2016-06-09 11:51:24 +00:00
|
|
|
using DataStructures = OrderedSet<AbstractStructure**>;
|
|
|
|
NeverFreedPointer<DataStructures> structures;
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
void registerAbstractStructure(AbstractStructure **p) {
|
2016-10-12 19:34:25 +00:00
|
|
|
structures.createIfNull();
|
2016-06-09 11:51:24 +00:00
|
|
|
structures->insert(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
|
|
|
|
void clearGlobalStructures() {
|
|
|
|
if (!structures) return;
|
|
|
|
for (auto &p : *structures) {
|
|
|
|
delete (*p);
|
|
|
|
*p = nullptr;
|
|
|
|
}
|
|
|
|
structures.clear();
|
|
|
|
}
|
2016-05-31 09:46:31 +00:00
|
|
|
|
|
|
|
} // namespace Data
|