Files
core/Common/ASCDocxFormat/Source/Utility/IItemable.h
Alexey.Musinov 9ea51f5678 выпиливание boost'a
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@52920 954022d7-b5bf-4e40-9824-e11837661b57
2016-05-20 22:33:45 +03:00

48 lines
785 B
C++

#pragma once
#ifndef IITEMABLE_INCLUDE_H_
#define IITEMABLE_INCLUDE_H_
#include "../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
template<class Item>
class IItemable
{
public:
IItemable() {};
IItemable(Item* item) : m_item(item) {};
~IItemable() {}
public:
template<class T> const bool is() const
{
return m_item.is<T>();
}
template<class T> T& as()
{
return static_cast<T&>(*m_item);
}
template<class T> const T& as() const
{
return static_cast<const T&>(*m_item);
}
public:
template<class T> void create()
{
m_item.reset(new T());
}
template<class T> void create(const T& value)
{
m_item.reset(new T(value));
}
protected:
NSCommon::smart_ptr<Item> m_item;
};
#endif // IITEMABLE_INCLUDE_H_