mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-20 15:21:39 +08:00
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@52920 954022d7-b5bf-4e40-9824-e11837661b57
48 lines
785 B
C++
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_
|