core/CDataPack.h
author David Anderson <dvander@alliedmods.net>
Sun Jun 17 19:23:43 2007 +0000 (2007-06-17)
changeset 973 0407a17cb219
parent 653 ef60870067ff
child 1231 17badaf66ce4
permissions -rw-r--r--
fixed a bug where linux did not read dladdr() return value right for gameconfs
     1 /**
     2  * vim: set ts=4 :
     3  * ===============================================================
     4  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
     5  * ===============================================================
     6  *
     7  * This file is not open source and may not be copied without explicit
     8  * written permission of AlliedModders LLC.  This file may not be redistributed 
     9  * in whole or significant part.
    10  * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
    11  *
    12  * Version: $Id$
    13  */
    14 
    15 #ifndef _INCLUDE_SOURCEMOD_CDATAPACK_H_
    16 #define _INCLUDE_SOURCEMOD_CDATAPACK_H_
    17 
    18 #include <IDataPack.h>
    19 
    20 using namespace SourceMod;
    21 
    22 class CDataPack : public IDataPack
    23 {
    24 public:
    25 	CDataPack();
    26 	~CDataPack();
    27 public: //IDataReader
    28 	void Reset() const;
    29 	size_t GetPosition() const;
    30 	bool SetPosition(size_t pos) const;
    31 	cell_t ReadCell() const;
    32 	float ReadFloat() const;
    33 	bool IsReadable(size_t bytes) const;
    34 	const char *ReadString(size_t *len) const;
    35 	void *GetMemory() const;
    36 	void *ReadMemory(size_t *size) const;
    37 public: //IDataPack
    38 	void ResetSize();
    39 	void PackCell(cell_t cell);
    40 	void PackFloat(float val);
    41 	void PackString(const char *string);
    42 	size_t CreateMemory(size_t size, void **addr);
    43 public:
    44 	void Initialize();
    45 private:
    46 	void CheckSize(size_t sizetype);
    47 private:
    48 	char *m_pBase;
    49 	mutable char *m_curptr;
    50 	size_t m_capacity;
    51 	size_t m_size;
    52 };
    53 
    54 #endif //_INCLUDE_SOURCEMOD_CDATAPACK_H_