Design Pro

Generation

fix invalid codeSun, 12 Feb 2023

class CustomLine : public AcDbEntity { public: // Constructor /* * This constructor initializes the class */ ACRX_DECLARE_MEMBERS(CustomLine); CustomLine(); /* * This destructor deallocates the memory */ virtual ~CustomLine(); /* * This function reads data from a DWG file * @param pFiler : pointer to the DWG file * @return : Error status */ virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler* pFiler); /* * This function writes data to a DWG file * @param pFiler : pointer to the DWG file * @return : Error status */ virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const; /* * This function lists the data in the entity */ virtual void list() const; // Data members /* * Character pointer to store text */ char* mText; /* * Integer to store length of text */ int mLength; /* * Point to store start point of line */ AcGePoint3d mStartPoint; /* * Point to store end point of line */ AcGePoint3d mEndPoint; }; // Register the custom line entity ACDB_REGISTER_OBJECT_ENTRY_AUTO(CustomLine) // Constructor /* * This constructor initializes the class */ CustomLine::CustomLine() { mText = nullptr; mLength = 0; } // Destructor /* * This destructor deallocates the memory */ CustomLine::~CustomLine() { if (mText) delete[] mText; } // Read data from a DWG file /* * This function reads data from a DWG file * @param pFiler : pointer to the DWG file * @return : Error status */ Acad::ErrorStatus CustomLine::dwgInFields(AcDbDwgFiler* pFiler) { assertWriteEnabled(); Acad::ErrorStatus es; // Call the parent class es = AcDbEntity::dwgInFields(pFiler); if (es != Acad::eOk) return es; // Read data members if ((es = pFiler->readItem(&mStartPoint)) != Acad::eOk) return es; if ((es = pFiler->readItem(&mEndPoint)) != Acad::eOk) return es; if ((es = pFiler->readItem(&mLength)) != Acad::eOk) return es; // Allocate memory for text mText = new char[mLength + 1]; // Read text from DWG file if ((es = pFiler->readString(mText, mLength)) != Acad::eOk) return es; return Acad::eOk; }

Questions about programming?Chat with your personal AI assistant