class BinaryParser: public ParserMode
{
private:
- typedef std::map<int, StatementInfo> Dictionary;
- typedef std::map<unsigned, std::string> StringMap;
+ using Dictionary = std::map<int, StatementInfo>;
+ using StringMap = std::map<unsigned int, std::string>;
Dictionary dict;
StringMap strings;
class BinaryWriter: public WriterMode
{
private:
- typedef std::map<StatementKey, int> Dictionary;
- typedef std::map<std::string, unsigned> StringMap;
+ using Dictionary = std::map<StatementKey, int>;
+ using StringMap = std::map<std::string, unsigned>;
Dictionary dict;
unsigned next_kwd_id = 1;
};
template<>
-struct BinFloat::MatchingInt<float> { typedef std::uint32_t Type; };
+struct BinFloat::MatchingInt<float> { using Type = std::uint32_t; };
template<>
-struct BinFloat::MatchingInt<double> { typedef std::uint64_t Type; };
+struct BinFloat::MatchingInt<double> { using Type = std::uint64_t; };
template<typename T>
inline BinFloat BinFloat::explode_iec559(T v)
template<typename T>
struct CollectionItemTypeChooser<T, true>
-{ typedef LoadableCollectionItemType<T> Type; };
+{ using Type = LoadableCollectionItemType<T>; };
template<typename T>
struct CollectionItemTypeChooser<T, false>
-{ typedef CollectionItemType<T> Type; };
+{ using Type = CollectionItemType<T>; };
/**
A collection of objects that can be loaded from a datafile. Each object is
class ItemLoader;
private:
- typedef std::map<std::string, Variant> ItemMap;
+ using ItemMap = std::map<std::string, Variant>;
std::vector<CollectionItemTypeBase *> types;
ItemMap items;
if(!item)
throw std::invalid_argument("Collection::add(item)");
- typedef typename std::remove_cv<T>::type NCT;
+ using NCT = typename std::remove_cv<T>::type;
RefPtr<NCT> ptr(item);
try
{
template<typename T>
T &get(const std::string &name)
{
- typedef typename std::remove_cv<T>::type NCT;
+ using NCT = typename std::remove_cv<T>::type;
return extract<NCT>(get_var(name, get_type<NCT>(name)));
}
template<typename T>
T *find(const std::string &name)
{
- typedef typename std::remove_cv<T>::type NCT;
+ using NCT = typename std::remove_cv<T>::type;
const Variant *var = find_var(name, get_type<NCT>(name));
return (var ? &extract<NCT>(*var) : 0);
}
template<typename T>
const std::string &get_name(T *d) const
{
- typedef RefPtr<typename std::remove_cv<T>::type> RPNCT;
+ using RPNCT = RefPtr<typename std::remove_cv<T>::type>;
for(const auto &kvp: items)
if(kvp.second.has_type<RPNCT>())
class MSPDATAFILE_API CollectionSource
{
public:
- typedef std::list<std::string> NameList;
+ using NameList = std::list<std::string>;
protected:
CollectionSource() = default;
class MSPDATAFILE_API DirectorySource: public CollectionSource
{
private:
- typedef std::map<std::string, FS::Path> ObjectMap;
+ using ObjectMap = std::map<std::string, FS::Path>;
ObjectMap objects;
class DynamicObjectLoader: public Loader
{
public:
- typedef C Collection;
+ using Collection = C;
protected:
template<typename U>
void operator()(const std::string &, DynamicObjectLoader &) const;
};
- typedef Msp::TypeRegistry<CreateObject, DynamicObjectLoader &> TypeRegistry;
+ using TypeRegistry = Msp::TypeRegistry<CreateObject, DynamicObjectLoader &>;
Collection *coll = nullptr;
T *object = nullptr;
class LoaderFunc0: public LoaderAction
{
private:
- typedef void (L::*FuncType)();
+ using FuncType = void (L::*)();
FuncType func;
class LoaderFunc1: public LoaderAction
{
private:
- typedef void (L::*FuncType)(A0);
+ using FuncType = void (L::*)(A0);
FuncType func;
class LoaderFunc1<L, const std::vector<A0> &>: public LoaderAction
{
private:
- typedef void (L::*FuncType)(const std::vector<A0> &);
+ using FuncType = void (L::*)(const std::vector<A0> &);
FuncType func;
class LoaderFunc1<L, const Statement &>: public LoaderAction
{
private:
- typedef void (L::*FuncType)(const Statement &);
+ using FuncType = void (L::*)(const Statement &);
FuncType func;
class LoaderFuncN: public LoaderAction
{
protected:
- typedef void (L::*FuncType)(Args...);
+ using FuncType = void (L::*)(Args...);
FuncType func;
class LoaderFuncNBound1: public LoaderAction
{
protected:
- typedef void (L::*FuncType)(B0, Args...);
- typedef typename std::remove_reference<B0>::type Bound0Type;
+ using FuncType = void (L::*)(B0, Args...);
+ using Bound0Type = typename std::remove_reference<B0>::type;
FuncType func;
Bound0Type bound0;
class LoadValue1: public LoaderAction
{
private:
- typedef T0 L::*Pointer0Type;
+ using Pointer0Type = T0 L::*;
Pointer0Type ptr0;
class LoadValue1<L, T0 *>: public LoaderAction
{
private:
- typedef T0 *L::*Pointer0Type;
+ using Pointer0Type = T0 *L::*;
Pointer0Type ptr0;
class LoadValue2: public LoaderAction
{
private:
- typedef T0 L::*Pointer0Type;
- typedef T1 L::*Pointer1Type;
+ using Pointer0Type = T0 L::*;
+ using Pointer1Type = T1 L::*;
Pointer0Type ptr0;
Pointer1Type ptr1;
namespace DataFile {
/**
-Helper struct to determine whether a Loader has a Collection typedef.
+Helper struct to determine whether a Loader has a Collection type alias.
*/
struct CheckCollectionType: Sfinae
{
class ObjectLoader: virtual public Loader
{
public:
- typedef O Object;
+ using Object = O;
protected:
O &obj;
class DerivedObjectLoader: public B
{
public:
- typedef O Object;
+ using Object = O;
protected:
O &obj;
class CollectionObjectLoader: public ObjectLoader<O>
{
public:
- typedef C Collection;
+ using Collection = C;
protected:
C *coll = nullptr;
class File;
class Object;
- typedef std::map<std::string, const File *> FileMap;
- typedef std::map<std::string, const Object *> ObjectMap;
+ using FileMap = std::map<std::string, const File *>;
+ using ObjectMap = std::map<std::string, const Object *>;
class Pack
{
struct MSPDATAFILE_API Statement
{
- typedef std::vector<Value> Arguments;
+ using Arguments = std::vector<Value>;
std::string keyword;
Arguments args;
struct IntType
{
static const char signature = 'i';
- typedef std::int64_t Store;
- typedef Store Load;
+ using Store = std::int64_t;
+ using Load = Store;
};
struct FloatType
{
static const char signature = 'f';
- typedef double Store;
- typedef Store Load;
+ using Store = double;
+ using Load = Store;
};
struct BoolType
{
static const char signature = 'b';
- typedef bool Store;
- typedef Store Load;
+ using Store = bool;
+ using Load = Store;
};
struct StringType
{
static const char signature = 's';
- typedef std::string Store;
- typedef Store Load;
+ using Store = std::string;
+ using Load = Store;
};
struct SymbolType
{
// For backward compatibility
static const char signature = 'e';
- typedef Symbol Store;
+ using Store = Symbol;
};
const char valid_signatures[] =
template<typename T>
struct TypeInfo<T, true>: TypeInfo<typename T::LoadType>
-{ typedef typename T::LoadType Load; };
+{ using Load = typename T::LoadType; };
template<typename T>
struct TypeInfo<T, false>: SymbolType
-{ typedef T Load; };
+{ using Load = T; };
} // namespace DataFile
} // namespace Msp