65 lines
1.3 KiB
C++
65 lines
1.3 KiB
C++
//-----------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, SH Software Co. Ltd.
|
|
// = FileName : XDbLayerTableRec.h
|
|
// = Version : ver2.0
|
|
// = Author : zjq
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: ÀàµÄÉùÃ÷
|
|
// = Maintainers:
|
|
//
|
|
//-----------------------------------------------------------------------------+
|
|
#ifndef _XDbLayerTableRec_H_
|
|
#define _XDbLayerTableRec_H_
|
|
|
|
class GEOAPI XDbLayerTableRec
|
|
{
|
|
public:
|
|
|
|
XDbLayerTableRec(const TCHAR *pszLayer, AcDb::OpenMode opMode);
|
|
|
|
~XDbLayerTableRec();
|
|
|
|
int operator !() ;
|
|
|
|
operator AcDbLayerTableRecord & ();
|
|
|
|
public:
|
|
|
|
AcDbLayerTableRecord *m_pLayer;
|
|
};
|
|
|
|
inline XDbLayerTableRec::XDbLayerTableRec(const TCHAR *pszLayer, AcDb::OpenMode opMode)
|
|
: m_pLayer(NULL)
|
|
{
|
|
AcDbLayerTable *pLayerTable;
|
|
Acad::ErrorStatus es = acdbCurDwg()->getLayerTable(pLayerTable, AcDb::kForRead);
|
|
if (es != Acad::eOk)
|
|
{
|
|
return;
|
|
}
|
|
|
|
es = pLayerTable->getAt(pszLayer, m_pLayer, opMode);
|
|
pLayerTable->close();
|
|
}
|
|
|
|
inline XDbLayerTableRec::~XDbLayerTableRec()
|
|
{
|
|
if (m_pLayer)
|
|
{
|
|
m_pLayer->close();
|
|
}
|
|
}
|
|
|
|
inline int XDbLayerTableRec::operator !()
|
|
{
|
|
return !m_pLayer;
|
|
}
|
|
|
|
inline XDbLayerTableRec::operator AcDbLayerTableRecord & ()
|
|
{
|
|
assert(m_pLayer);
|
|
|
|
return *m_pLayer;
|
|
}
|
|
#endif
|