/*------------------------------------------------------------------------------------------------------------ * */ void Bitmap::initialize(const int width, const int height) { if (width <= 0) { throw MyError("width must be > 0\n", __FUNCTION__); } if (width % 4 != 0) { throw MyError("width must be a multiply of 4.", __FUNCTION__); } initFileHeader(); initInfoHeader(); mWidth = width; mHeight = height; const int absHeight = height > 0 ? height : height * -1; mTotalPixels = width * absHeight; mDataSize = mTotalPixels * 3; if (mData != 0) { delete [] mData; mData = 0; } mData = new unsigned char[mDataSize]; mInfoHeader.biWidth = width; mInfoHeader.biHeight = height; mFileHeader.bfSize = (MyDWORD)(mDataSize + sizeof(mFileHeader) + sizeof(mInfoHeader)); }
// Crea un archivo vacio con header en 0 y flags bandera para cada reg. int ArchivoRegistrosLongitudFija :: create (std::string dir, std::string fileName, int recSize, int p_maxRecs) { // Inicializo atributos del archivo recordSize = recSize; maxRecs = p_maxRecs; currentRecord = 0; if (! utilitarios::validFileName(fileName)) return RES_INVALID_FILENAME; // Abro el archivo file = fopen((dir+fileName).c_str(),"wb+"); if (file == NULL) return RES_ERROR; // Inicializo el file header con datos importantes if (initFileHeader() == RES_OK) { // Marco cada registro como libre if (initEmptyRecords() == RES_OK) return RES_OK; } return RES_ERROR; }
IfcPPModel::IfcPPModel() { m_unit_converter = std::make_shared<UnitConverter>(); m_unit_converter->setMessageTarget( this ); initFileHeader( "IfcPlusPlus-export.ifc" ); }
IfcAlignmentModel::IfcAlignmentModel() { m_unit_converter = shared_ptr<UnitConverter>( new UnitConverter() ); initFileHeader( "IfcAlignment-export.ifc" ); }