mirror of https://github.com/OpenMW/openmw.git
replaced createAndDelete flag with a new class hierarhy (Creator)
parent
4327b81bc3
commit
ba5ca5beed
@ -0,0 +1,12 @@
|
||||
|
||||
#include "creator.hpp"
|
||||
|
||||
CSVWorld::Creator:: ~Creator() {}
|
||||
|
||||
CSVWorld::CreatorFactoryBase::~CreatorFactoryBase() {}
|
||||
|
||||
|
||||
CSVWorld::Creator *CSVWorld::NullCreatorFactory::makeCreator() const
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
#ifndef CSV_WORLD_CREATOR_H
|
||||
#define CSV_WORLD_CREATOR_H
|
||||
|
||||
namespace CSVWorld
|
||||
{
|
||||
/// \brief Record creator UI base class
|
||||
class Creator
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~Creator();
|
||||
};
|
||||
|
||||
/// \brief Base class for Creator factory
|
||||
class CreatorFactoryBase
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~CreatorFactoryBase();
|
||||
|
||||
virtual Creator *makeCreator() const = 0;
|
||||
///< The ownership of the returned Creator is transferred to the caller.
|
||||
///
|
||||
/// \note The function can return a 0-pointer, which means no UI for creating/deleting
|
||||
/// records should be provided.
|
||||
};
|
||||
|
||||
/// \brief Creator factory that does not produces any creator
|
||||
class NullCreatorFactory : public CreatorFactoryBase
|
||||
{
|
||||
public:
|
||||
|
||||
virtual Creator *makeCreator() const;
|
||||
///< The ownership of the returned Creator is transferred to the caller.
|
||||
///
|
||||
/// \note The function always returns 0.
|
||||
};
|
||||
|
||||
template<class CreatorT>
|
||||
class CreatorFactory : public CreatorFactoryBase
|
||||
{
|
||||
public:
|
||||
|
||||
virtual Creator *makeCreator() const;
|
||||
///< The ownership of the returned Creator is transferred to the caller.
|
||||
///
|
||||
/// \note The function can return a 0-pointer, which means no UI for creating/deleting
|
||||
/// records should be provided.
|
||||
};
|
||||
|
||||
template<class CreatorT>
|
||||
Creator *CreatorFactory<CreatorT>::makeCreator() const
|
||||
{
|
||||
return new CreatorT;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,2 @@
|
||||
|
||||
#include "genericcreator.hpp"
|
@ -0,0 +1,14 @@
|
||||
#ifndef CSV_WORLD_GENERICCREATOR_H
|
||||
#define CSV_WORLD_GENERICCREATOR_H
|
||||
|
||||
#include "creator.hpp"
|
||||
|
||||
namespace CSVWorld
|
||||
{
|
||||
class GenericCreator : public Creator
|
||||
{
|
||||
public:
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue