📄 unit.h
字号:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright (C) Yeico S. A. de C. V. * xlsLib -- A multiplatform, C++ library for dynamic generation of Excel (TM) * files. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Source: /cvsroot/xlslib/xlslib/src/xlslib/unit.h,v $ * $Revision: 1.1.1.1 $ * $Author: darioglz $ * $Date: 2004/08/27 16:31:46 $ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * File description: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */#ifndef UNIT_H#define UNIT_H#include <config.h>#include "common.h"namespace xlslib_core{#define UNIT_MAX_SIZE (0xFFFF) // Error codes#define ERR_DATASTORAGE_EMPTY (-2)#define ERR_INVALID_INDEX (-3)#define ERR_UNNABLE_TOALLOCATE_MEMORY (-3) //Block definitions#define BIG_BLOCK_SIZE (0x200)#define SMALL_BLOCK_SIZE (0x040)#define PROP_BLOCK_SIZE (0x080) class CUnit { // Attributes protected: unsigned32_t m_nSize;// Size of data stored unsigned8_t* m_pData;// Data storage unsigned32_t m_nDataSize; // Next empty space // bool m_ShadowUnit; // Static attributes static const unsigned8_t DefaultInflateSize; // Operations public: CUnit(); virtual ~CUnit(); virtual unsigned8_t& operator[](const unsigned32_t index); virtual CUnit& operator=(CUnit& newvalue); virtual CUnit& operator+=(CUnit& from); virtual CUnit& operator+= ( unsigned8_t from ); virtual unsigned32_t GetSize (void); virtual unsigned32_t GetDataSize (void); unsigned8_t* GetBuffer (void); signed8_t Init (unsigned8_t* data, const unsigned32_t size, const unsigned32_t datasz); signed8_t AddDataArray (const unsigned8_t* newdata, unsigned32_t size); signed8_t AddFixedDataArray (const unsigned8_t value, unsigned32_t size); /* void SetShadow(bool shadowval); void CopyShadowUnit(unsigned8_t* data, unsigned32_t size); */ protected: signed8_t Append (CUnit& newunit); signed8_t SetAt(unsigned8_t newval, unsigned32_t index);// Modify specific position signed8_t AddValue16(unsigned16_t newval); signed8_t AddValue32(unsigned32_t newval); signed8_t AddValue64(unsigned64_t newval); signed8_t SetValueAt(signed16_t newval, unsigned32_t index); signed8_t SetValueAt(signed32_t newval, unsigned32_t index); signed8_t GetValue16From(signed16_t* val, unsigned32_t index); signed8_t GetValue32From(signed32_t* val, unsigned32_t index); signed8_t SetArrayAt (const unsigned8_t* newdata, unsigned32_t size, unsigned32_t index); signed8_t GetAt(signed8_t* data, unsigned32_t index);// Get specific data from storage // signed8_t GetData(unsigned8_t** data, unsigned32_t from, unsigned32_t to ); signed8_t RemoveTrailData (unsigned32_t remove_size); signed8_t AddData(unsigned8_t newdata); signed8_t InitFill (unsigned8_t data, unsigned32_t size); signed8_t Inflate(unsigned32_t increase = 0); };}#endif // UNIT_H/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * $Log: unit.h,v $ * Revision 1.1.1.1 2004/08/27 16:31:46 darioglz * Initial Import. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -