1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00
OpenMW/apps/openmw/mwworld/containerstore.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

427 lines
15 KiB
C++
Raw Normal View History

2010-08-04 14:37:23 +02:00
#ifndef GAME_MWWORLD_CONTAINERSTORE_H
#define GAME_MWWORLD_CONTAINERSTORE_H
2012-03-13 13:31:11 +01:00
#include <iterator>
#include <map>
#include <memory>
2015-11-10 19:18:02 +01:00
#include <utility>
2012-03-13 13:31:11 +01:00
#include <components/esm3/loadalch.hpp>
#include <components/esm3/loadappa.hpp>
#include <components/esm3/loadarmo.hpp>
#include <components/esm3/loadbook.hpp>
#include <components/esm3/loadclot.hpp>
#include <components/esm3/loadingr.hpp>
#include <components/esm3/loadligh.hpp>
#include <components/esm3/loadlock.hpp>
#include <components/esm3/loadmisc.hpp>
#include <components/esm3/loadprob.hpp>
#include <components/esm3/loadrepa.hpp>
#include <components/esm3/loadweap.hpp>
2014-02-23 20:11:05 +01:00
#include <components/misc/rng.hpp>
2015-01-10 01:00:52 +01:00
#include "cellreflist.hpp"
#include "ptr.hpp"
namespace ESM
{
struct InventoryList;
struct InventoryState;
}
namespace MWClass
{
class Container;
}
2010-08-04 14:37:23 +02:00
namespace MWWorld
{
class ContainerStore;
template <class PtrType>
class ContainerStoreIteratorBase;
typedef ContainerStoreIteratorBase<Ptr> ContainerStoreIterator;
typedef ContainerStoreIteratorBase<ConstPtr> ConstContainerStoreIterator;
class ResolutionListener
{
ContainerStore& mStore;
2022-09-22 21:26:05 +03:00
public:
ResolutionListener(ContainerStore& store)
: mStore(store)
{
}
~ResolutionListener();
};
class ResolutionHandle
{
std::shared_ptr<ResolutionListener> mListener;
2022-09-22 21:26:05 +03:00
public:
ResolutionHandle(std::shared_ptr<ResolutionListener> listener)
: mListener(listener)
{
}
ResolutionHandle() = default;
};
2022-09-22 21:26:05 +03:00
class ContainerStoreListener
{
public:
virtual void itemAdded(const ConstPtr& item, int count) {}
virtual void itemRemoved(const ConstPtr& item, int count) {}
virtual ~ContainerStoreListener() = default;
};
class ContainerStore
2010-08-04 14:37:23 +02:00
{
public:
static constexpr int Type_Potion = 0x0001;
static constexpr int Type_Apparatus = 0x0002;
static constexpr int Type_Armor = 0x0004;
static constexpr int Type_Book = 0x0008;
static constexpr int Type_Clothing = 0x0010;
static constexpr int Type_Ingredient = 0x0020;
static constexpr int Type_Light = 0x0040;
static constexpr int Type_Lockpick = 0x0080;
static constexpr int Type_Miscellaneous = 0x0100;
static constexpr int Type_Probe = 0x0200;
static constexpr int Type_Repair = 0x0400;
static constexpr int Type_Weapon = 0x0800;
2022-09-22 21:26:05 +03:00
static constexpr int Type_Last = Type_Weapon;
2022-09-22 21:26:05 +03:00
static constexpr int Type_All = 0xffff;
2022-09-22 21:26:05 +03:00
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
static const ESM::RefId sGoldId;
2022-09-22 21:26:05 +03:00
protected:
ContainerStoreListener* mListener;
2022-09-22 21:26:05 +03:00
// Used in clone() to unset refnums of copies.
// (RefNum should be unique, copy can not have the same RefNum).
void clearRefNums();
// (item, max charge)
typedef std::vector<std::pair<ContainerStoreIterator, float>> TRechargingItems;
TRechargingItems mRechargingItems;
2022-09-22 21:26:05 +03:00
bool mRechargingItemsUpToDate;
2022-09-22 21:26:05 +03:00
// Non-empty only if is InventoryStore.
// The actor whose inventory it is.
// TODO: Consider merging mActor and mPtr.
MWWorld::Ptr mActor;
private:
MWWorld::CellRefList<ESM::Potion> potions;
MWWorld::CellRefList<ESM::Apparatus> appas;
MWWorld::CellRefList<ESM::Armor> armors;
MWWorld::CellRefList<ESM::Book> books;
MWWorld::CellRefList<ESM::Clothing> clothes;
MWWorld::CellRefList<ESM::Ingredient> ingreds;
MWWorld::CellRefList<ESM::Light> lights;
MWWorld::CellRefList<ESM::Lockpick> lockpicks;
MWWorld::CellRefList<ESM::Miscellaneous> miscItems;
MWWorld::CellRefList<ESM::Probe> probes;
MWWorld::CellRefList<ESM::Repair> repairs;
MWWorld::CellRefList<ESM::Weapon> weapons;
2022-09-22 21:26:05 +03:00
mutable float mCachedWeight;
mutable bool mWeightUpToDate;
2022-09-22 21:26:05 +03:00
bool mModified;
bool mResolved;
unsigned int mSeed;
MWWorld::Ptr mPtr; // Container that contains this store. Set in MWClass::Container::getContainerStore
std::weak_ptr<ResolutionListener> mResolutionListener;
2022-09-22 21:26:05 +03:00
ContainerStoreIterator addImp(const Ptr& ptr, int count, bool markModified = true);
2022-08-24 20:38:52 +02:00
void addInitialItem(
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
const ESM::RefId& id, const ESM::RefId& owner, int count, Misc::Rng::Generator* prng, bool topLevel = true);
void addInitialItemImp(const MWWorld::Ptr& ptr, const ESM::RefId& owner, int count, Misc::Rng::Generator* prng,
bool topLevel = true);
2022-09-22 21:26:05 +03:00
template <typename T>
ContainerStoreIterator getState(CellRefList<T>& collection, const ESM::ObjectState& state);
2022-09-22 21:26:05 +03:00
template <typename T>
void storeState(const LiveCellRef<T>& ref, ESM::ObjectState& state) const;
2022-09-22 21:26:05 +03:00
template <typename T>
void storeStates(
const CellRefList<T>& collection, ESM::InventoryState& inventory, int& index, bool equipable = false) const;
2022-09-22 21:26:05 +03:00
void updateRechargingItems();
2022-09-22 21:26:05 +03:00
virtual void storeEquipmentState(
const MWWorld::LiveCellRefBase& ref, int index, ESM::InventoryState& inventory) const;
2022-09-22 21:26:05 +03:00
virtual void readEquipmentState(
const MWWorld::ContainerStoreIterator& iter, int index, const ESM::InventoryState& inventory);
2022-09-22 21:26:05 +03:00
public:
2012-03-21 12:48:05 +01:00
ContainerStore();
2022-09-22 21:26:05 +03:00
virtual ~ContainerStore();
2022-09-22 21:26:05 +03:00
virtual std::unique_ptr<ContainerStore> clone()
{
auto res = std::make_unique<ContainerStore>(*this);
res->clearRefNums();
return res;
}
2022-09-22 21:26:05 +03:00
ConstContainerStoreIterator cbegin(int mask = Type_All) const;
ConstContainerStoreIterator cend() const;
ConstContainerStoreIterator begin(int mask = Type_All) const;
ConstContainerStoreIterator end() const;
2022-09-22 21:26:05 +03:00
ContainerStoreIterator begin(int mask = Type_All);
ContainerStoreIterator end();
2022-09-22 21:26:05 +03:00
bool hasVisibleItems() const;
2022-09-22 21:26:05 +03:00
virtual ContainerStoreIterator add(
const Ptr& itemPtr, int count, bool allowAutoEquip = true, bool resolve = true);
///< Add the item pointed to by \a ptr to this container. (Stacks automatically if needed)
2022-09-22 21:26:05 +03:00
///
/// \note The item pointed to is not required to exist beyond this function call.
2022-09-22 21:26:05 +03:00
///
/// \attention Do not add items to an existing stack by increasing the count instead of
/// calling this function!
2022-09-22 21:26:05 +03:00
///
/// @return if stacking happened, return iterator to the item that was stacked against, otherwise iterator to
/// the newly inserted item.
ContainerStoreIterator add(const ESM::RefId& id, int count);
2012-05-13 11:52:17 +02:00
///< Utility to construct a ManualRef and call add(ptr, count, actorPtr, true)
int remove(const ESM::RefId& itemId, int count, bool equipReplacement = 0, bool resolve = true);
///< Remove \a count item(s) designated by \a itemId from this container.
2022-09-22 21:26:05 +03:00
///
/// @return the number of items actually removed
virtual int remove(const Ptr& item, int count, bool equipReplacement = 0, bool resolve = true);
///< Remove \a count item(s) designated by \a item from this inventory.
///
/// @return the number of items actually removed
2020-10-26 20:13:24 +01:00
void rechargeItems(float duration);
///< Restore charge on enchanted items. Note this should only be done for the player.
ContainerStoreIterator unstack(const Ptr& ptr, int count = 1);
///< Unstack an item in this container. The item's count will be set to count, then a new stack will be added
///< with (origCount-count).
2022-09-22 21:26:05 +03:00
///
/// @return an iterator to the new stack, or end() if no new stack was created.
MWWorld::ContainerStoreIterator restack(const MWWorld::Ptr& item);
///< Attempt to re-stack an item in this container.
/// If a compatible stack is found, the item's count is added to that stack, then the original is deleted.
/// @return If the item was stacked, return the stack, otherwise return the old (untouched) item.
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
int count(const ESM::RefId& id) const;
///< @return How many items with refID \a id are in this container?
ContainerStoreListener* getContListener() const;
void setContListener(ContainerStoreListener* listener);
2012-05-13 11:52:17 +02:00
protected:
ContainerStoreIterator addNewStack(const ConstPtr& ptr, int count);
///< Add the item to this container (do not try to stack it onto existing items)
2012-05-13 11:52:17 +02:00
2013-12-27 18:28:54 +01:00
virtual void flagAsModified();
/// + and - operations that can deal with negative stacks
/// Note that negativity is infectious
static int addItems(int count1, int count2);
static int subtractItems(int count1, int count2);
2013-05-11 18:38:27 +02:00
2022-09-22 21:26:05 +03:00
public:
virtual bool stacks(const ConstPtr& ptr1, const ConstPtr& ptr2) const;
2012-05-13 14:58:38 +02:00
///< @return true if the two specified objects can stack with each other
2012-05-13 11:52:17 +02:00
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
void fill(const ESM::InventoryList& items, const ESM::RefId& owner, Misc::Rng::Generator& seed);
///< Insert items into *this.
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
void fillNonRandom(const ESM::InventoryList& items, const ESM::RefId& owner, unsigned int seed);
///< Insert items into *this, excluding leveled items
virtual void clear();
///< Empty container.
float getWeight() const;
///< Return total weight of the items contained in *this.
static int getType(const ConstPtr& ptr);
///< This function throws an exception, if ptr does not point to an object, that can be
/// put into a container.
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
Ptr findReplacement(const ESM::RefId& id);
///< Returns replacement for object with given id. Prefer used items (with low durability left).
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
Ptr search(const ESM::RefId& id);
virtual void writeState(ESM::InventoryState& state) const;
virtual void readState(const ESM::InventoryState& state);
bool isResolved() const;
void resolve();
ResolutionHandle resolveTemporarily();
void unresolve();
friend class ContainerStoreIteratorBase<Ptr>;
friend class ContainerStoreIteratorBase<ConstPtr>;
friend class ResolutionListener;
friend class MWClass::Container;
};
template <class PtrType>
class ContainerStoreIteratorBase
{
template <class From, class To, class Dummy>
struct IsConvertible
{
static constexpr bool value = true;
};
template <class Dummy>
struct IsConvertible<ConstPtr, Ptr, Dummy>
{
static constexpr bool value = false;
};
template <class T, class U>
struct IteratorTrait
{
typedef typename MWWorld::CellRefList<T>::List::iterator type;
};
template <class T>
struct IteratorTrait<T, ConstPtr>
{
typedef typename MWWorld::CellRefList<T>::List::const_iterator type;
};
template <class T>
struct Iterator : IteratorTrait<T, PtrType>
{
};
template <class T, class Dummy>
struct ContainerStoreTrait
{
typedef ContainerStore* type;
};
2022-09-22 21:26:05 +03:00
template <class Dummy>
struct ContainerStoreTrait<ConstPtr, Dummy>
{
typedef const ContainerStore* type;
};
typedef typename ContainerStoreTrait<PtrType, void>::type ContainerStoreType;
int mType;
int mMask;
ContainerStoreType mContainer;
mutable PtrType mPtr;
typename Iterator<ESM::Potion>::type mPotion;
typename Iterator<ESM::Apparatus>::type mApparatus;
typename Iterator<ESM::Armor>::type mArmor;
typename Iterator<ESM::Book>::type mBook;
typename Iterator<ESM::Clothing>::type mClothing;
typename Iterator<ESM::Ingredient>::type mIngredient;
typename Iterator<ESM::Light>::type mLight;
typename Iterator<ESM::Lockpick>::type mLockpick;
typename Iterator<ESM::Miscellaneous>::type mMiscellaneous;
typename Iterator<ESM::Probe>::type mProbe;
typename Iterator<ESM::Repair>::type mRepair;
typename Iterator<ESM::Weapon>::type mWeapon;
ContainerStoreIteratorBase(ContainerStoreType container);
///< End-iterator
ContainerStoreIteratorBase(int mask, ContainerStoreType container);
///< Begin-iterator
// construct iterator using a CellRefList iterator
ContainerStoreIteratorBase(ContainerStoreType container, typename Iterator<ESM::Potion>::type);
ContainerStoreIteratorBase(ContainerStoreType container, typename Iterator<ESM::Apparatus>::type);
ContainerStoreIteratorBase(ContainerStoreType container, typename Iterator<ESM::Armor>::type);
ContainerStoreIteratorBase(ContainerStoreType container, typename Iterator<ESM::Book>::type);
ContainerStoreIteratorBase(ContainerStoreType container, typename Iterator<ESM::Clothing>::type);
ContainerStoreIteratorBase(ContainerStoreType container, typename Iterator<ESM::Ingredient>::type);
ContainerStoreIteratorBase(ContainerStoreType container, typename Iterator<ESM::Light>::type);
ContainerStoreIteratorBase(ContainerStoreType container, typename Iterator<ESM::Lockpick>::type);
ContainerStoreIteratorBase(ContainerStoreType container, typename Iterator<ESM::Miscellaneous>::type);
ContainerStoreIteratorBase(ContainerStoreType container, typename Iterator<ESM::Probe>::type);
ContainerStoreIteratorBase(ContainerStoreType container, typename Iterator<ESM::Repair>::type);
ContainerStoreIteratorBase(ContainerStoreType container, typename Iterator<ESM::Weapon>::type);
2022-09-22 21:26:05 +03:00
template <class T>
void copy(const ContainerStoreIteratorBase<T>& src);
2022-09-22 21:26:05 +03:00
void incType();
2022-09-22 21:26:05 +03:00
void nextType();
2022-09-22 21:26:05 +03:00
bool resetIterator();
///< Reset iterator for selected type.
///
/// \return Type not empty?
bool incIterator();
///< Increment iterator for selected type.
///
/// \return reached the end?
public:
using iterator_category = std::forward_iterator_tag;
using value_type = PtrType;
using difference_type = std::ptrdiff_t;
using pointer = PtrType*;
using reference = PtrType&;
2022-09-22 21:26:05 +03:00
template <class T>
ContainerStoreIteratorBase(const ContainerStoreIteratorBase<T>& other)
{
char CANNOT_CONVERT_CONST_ITERATOR_TO_ITERATOR[IsConvertible<T, PtrType, void>::value ? 1 : -1];
((void)CANNOT_CONVERT_CONST_ITERATOR_TO_ITERATOR);
copy(other);
}
2022-09-22 21:26:05 +03:00
template <class T>
bool isEqual(const ContainerStoreIteratorBase<T>& other) const;
2022-09-22 21:26:05 +03:00
PtrType* operator->() const;
PtrType operator*() const;
2022-09-22 21:26:05 +03:00
ContainerStoreIteratorBase& operator++();
ContainerStoreIteratorBase operator++(int);
ContainerStoreIteratorBase& operator=(const ContainerStoreIteratorBase& rhs);
ContainerStoreIteratorBase(const ContainerStoreIteratorBase& rhs) = default;
2022-09-22 21:26:05 +03:00
int getType() const;
2012-03-13 14:04:19 +01:00
const ContainerStore* getContainerStore() const;
2022-09-22 21:26:05 +03:00
friend class ContainerStore;
friend class ContainerStoreIteratorBase<Ptr>;
friend class ContainerStoreIteratorBase<ConstPtr>;
2010-08-04 14:37:23 +02:00
};
template <class T, class U>
bool operator==(const ContainerStoreIteratorBase<T>& left, const ContainerStoreIteratorBase<U>& right);
template <class T, class U>
bool operator!=(const ContainerStoreIteratorBase<T>& left, const ContainerStoreIteratorBase<U>& right);
2010-08-04 14:37:23 +02:00
}
#endif