?? asdkemployeedetails.cpp
字號:
// (C) Copyright 2002-2005 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
//-----------------------------------------------------------------------------
//----- AsdkEmployeeDetails.cpp : Implementation of AsdkEmployeeDetails
//-----------------------------------------------------------------------------
#include "StdAfx.h"
#include "AsdkEmployeeDetails.h"
//-----------------------------------------------------------------------------
Adesk::UInt32 AsdkEmployeeDetails::kCurrentVersionNumber =5;
//-----------------------------------------------------------------------------
ACRX_DXF_DEFINE_MEMBERS (
AsdkEmployeeDetails, AcDbObject,
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
AcDbProxyEntity::kNoOperation, AsdkEMPLOYEEDETAILS,
"AsdkEMPLOYEEDETAILSAPP"
"|Product Desc: A description for your object"
"|Company: Your company name"
"|WEB Address: Your company WEB site address"
)
//-----------------------------------------------------------------------------
AsdkEmployeeDetails::AsdkEmployeeDetails () : AcDbObject (){
m_lastName = NULL ;
m_firstName = NULL ;
}
AsdkEmployeeDetails::~AsdkEmployeeDetails () {
delete [] m_lastName ;
delete [] m_firstName ;
}
//-----------------------------------------------------------------------------
//----- AcDbObject protocols
//- Dwg Filing protocol
Acad::ErrorStatus AsdkEmployeeDetails::dwgOutFields (AcDbDwgFiler *pFiler) const {
assertReadEnabled () ;
//----- Save parent class information first.
Acad::ErrorStatus es =AcDbObject::dwgOutFields (pFiler) ;
if ( es != Acad::eOk )
return (es) ;
//----- Object version number needs to be saved first
if ( (es =pFiler->writeUInt32 (AsdkEmployeeDetails::kCurrentVersionNumber)) != Acad::eOk )
return (es) ;
//----- Output params
//.....
pFiler->writeItem (m_ID) ;
pFiler->writeItem (m_Cube) ;
pFiler->writeString (m_firstName) ;
pFiler->writeString (m_lastName) ;
return (pFiler->filerStatus ()) ;
}
Acad::ErrorStatus AsdkEmployeeDetails::dwgInFields (AcDbDwgFiler *pFiler) {
assertWriteEnabled () ;
//----- Read parent class information first.
Acad::ErrorStatus es =AcDbObject::dwgInFields (pFiler) ;
if ( es != Acad::eOk )
return (es) ;
//----- Object version number needs to be read first
Adesk::UInt32 version =0 ;
if ( (es =pFiler->readUInt32 (&version)) != Acad::eOk )
return (es) ;
if ( version > AsdkEmployeeDetails::kCurrentVersionNumber )
return (Acad::eMakeMeProxy) ;
//- Uncomment the 2 following lines if your current object implementation cannot
//- support previous version of that object.
//if ( version < AsdkEmployeeDetails::kCurrentVersionNumber )
// return (Acad::eMakeMeProxy) ;
//----- Read params
//.....
if ( version >= 2 /*&& version <= endVersion*/ ) pFiler->readItem (&m_ID) ;
if ( version >= 3 /*&& version <= endVersion*/ ) pFiler->readItem (&m_Cube) ;
if ( version >= 4 /*&& version <= endVersion*/ ) {
delete [] m_firstName ; m_firstName =NULL ;
pFiler->readString (&m_firstName) ;
}
if ( version >= 5 /*&& version <= endVersion*/ ) {
delete [] m_lastName ; m_lastName =NULL ;
pFiler->readString (&m_lastName) ;
}
return (pFiler->filerStatus ()) ;
}
//- Dxf Filing protocol
Acad::ErrorStatus AsdkEmployeeDetails::dxfOutFields (AcDbDxfFiler *pFiler) const {
assertReadEnabled () ;
//----- Save parent class information first.
Acad::ErrorStatus es =AcDbObject::dxfOutFields (pFiler) ;
if ( es != Acad::eOk )
return (es) ;
es =pFiler->writeItem (AcDb::kDxfSubclass, _RXST("AsdkEmployeeDetails")) ;
if ( es != Acad::eOk )
return (es) ;
//----- Object version number needs to be saved first
if ( (es =pFiler->writeUInt32 (kDxfInt32, AsdkEmployeeDetails::kCurrentVersionNumber)) != Acad::eOk )
return (es) ;
//----- Output params
//.....
return (pFiler->filerStatus ()) ;
}
Acad::ErrorStatus AsdkEmployeeDetails::dxfInFields (AcDbDxfFiler *pFiler) {
assertWriteEnabled () ;
//----- Read parent class information first.
Acad::ErrorStatus es =AcDbObject::dxfInFields (pFiler) ;
if ( es != Acad::eOk || !pFiler->atSubclassData (_RXST("AsdkEmployeeDetails")) )
return (pFiler->filerStatus ()) ;
//----- Object version number needs to be read first
struct resbuf rb ;
pFiler->readItem (&rb) ;
if ( rb.restype != AcDb::kDxfInt32 ) {
pFiler->pushBackItem () ;
pFiler->setError (Acad::eInvalidDxfCode, _RXST("\nError: expected group code %d (version #)"), AcDb::kDxfInt32) ;
return (pFiler->filerStatus ()) ;
}
Adesk::UInt32 version =(Adesk::UInt32)rb.resval.rlong ;
if ( version > AsdkEmployeeDetails::kCurrentVersionNumber )
return (Acad::eMakeMeProxy) ;
//- Uncomment the 2 following lines if your current object implementation cannot
//- support previous version of that object.
//if ( version < AsdkEmployeeDetails::kCurrentVersionNumber )
// return (Acad::eMakeMeProxy) ;
//----- Read params in non order dependant manner
while ( es == Acad::eOk && (es =pFiler->readResBuf (&rb)) == Acad::eOk ) {
switch ( rb.restype ) {
//----- Read params by looking at their DXF code (example below)
//case AcDb::kDxfXCoord:
// if ( version == 1 )
// cen3d =asPnt3d (rb.resval.rpoint) ;
// else
// cen2d =asPnt2d (rb.resval.rpoint) ;
// break ;
//.....
default:
//----- An unrecognized group. Push it back so that the subclass can read it again.
pFiler->pushBackItem () ;
es =Acad::eEndOfFile ;
break ;
}
}
//----- At this point the es variable must contain eEndOfFile
//----- - either from readResBuf() or from pushback. If not,
//----- it indicates that an error happened and we should
//----- return immediately.
if ( es != Acad::eEndOfFile )
return (Acad::eInvalidResBuf) ;
return (pFiler->filerStatus ()) ;
}
Acad::ErrorStatus AsdkEmployeeDetails::ID(Adesk::Int32& ID)
{
assertReadEnabled () ; ID = m_ID;
return (Acad::eOk);
}
Acad::ErrorStatus AsdkEmployeeDetails::setID(const Adesk::Int32 ID)
{
assertWriteEnabled () ; m_ID = ID ; return (Acad::eOk) ;}
Acad::ErrorStatus AsdkEmployeeDetails::cube(Adesk::Int32& cube)
{
assertReadEnabled () ; cube = m_Cube;
return (Acad::eOk);
}
Acad::ErrorStatus AsdkEmployeeDetails::setCube(const Adesk::Int32 cube)
{
assertWriteEnabled () ; m_Cube = cube ; return (Acad::eOk) ;}
Acad::ErrorStatus AsdkEmployeeDetails::firstName(char*& firstName)
{
assertReadEnabled () ; firstName = strdup(m_firstName);
return (Acad::eOk);
}
Acad::ErrorStatus AsdkEmployeeDetails::setFirstName(const char* firstName)
{
assertWriteEnabled () ; delete [] m_firstName ; m_firstName = strdup (firstName) ; return (Acad::eOk) ;}
Acad::ErrorStatus AsdkEmployeeDetails::lastName(char*& lastName)
{
assertReadEnabled () ; lastName = strdup(m_lastName);
return (Acad::eOk);
}
Acad::ErrorStatus AsdkEmployeeDetails::setLastName(const char* lastName)
{
assertWriteEnabled () ; delete [] m_lastName ; m_lastName = strdup (lastName) ; return (Acad::eOk) ;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -