mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-20 07:36:31 -05:00
New JSON config format
This commit is contained in:
30
include/core/orderedset.h
Normal file
30
include/core/orderedset.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
#ifndef ORDERED_SET_H
|
||||
#define ORDERED_SET_H
|
||||
|
||||
#include <QJsonArray>
|
||||
|
||||
template <typename T>
|
||||
class OrderedSet : public std::set<T>
|
||||
{
|
||||
using std::set<T>::set;
|
||||
|
||||
public:
|
||||
// Not introduced to std::set until C++20
|
||||
#if __cplusplus < 202002L
|
||||
bool contains(const T& value) const {
|
||||
return this->find(value) != this->end();
|
||||
}
|
||||
#endif
|
||||
QSet<T> toQSet() const {
|
||||
return QSet<T>(this->begin(), this->end());
|
||||
}
|
||||
static QSet<T> fromQSet(const QSet<T>& set) {
|
||||
return OrderedSet<T>(set.begin(), set.end());
|
||||
}
|
||||
bool isEmpty() const {
|
||||
return this->empty();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // ORDERED_SET_H
|
||||
Reference in New Issue
Block a user