tdesktop/Telegram/SourceFiles/data/data_abstract_structure.cpp

37 lines
756 B
C++
Raw Normal View History

2016-05-31 09:46:31 +00:00
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
2016-05-31 09:46:31 +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
*/
#include "data/data_abstract_structure.h"
2016-05-31 09:46:31 +00:00
namespace Data {
namespace {
2016-05-31 09:46:31 +00:00
using DataStructures = OrderedSet<AbstractStructure**>;
NeverFreedPointer<DataStructures> structures;
} // namespace
namespace internal {
void registerAbstractStructure(AbstractStructure **p) {
structures.createIfNull();
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