dvander@428: /** ds@475: * vim: set ts=4 : dvander@428: * =============================================================== dvander@428: * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved. dvander@428: * =============================================================== dvander@428: * dvander@428: * This file is part of the SourceMod/SourcePawn SDK. This file may only be used dvander@428: * or modified under the Terms and Conditions of its License Agreement, which is found dvander@428: * in LICENSE.txt. The Terms and Conditions for making SourceMod extensions/plugins dvander@428: * may change at any time. To view the latest information, see: dvander@428: * http://www.sourcemod.net/license.php dvander@428: * dvander@428: * Version: $Id$ dvander@428: */ dvander@428: dvander@428: #if defined _datapack_included dvander@428: #endinput dvander@428: #endif dvander@428: #define _datapack_included dvander@428: dvander@428: /** dvander@428: * Creates a new data pack. dvander@428: * ds@475: * @return A Handle to the data pack. Must be closed with CloseHandle(). dvander@428: */ dvander@428: native Handle:CreateDataPack(); dvander@428: dvander@428: /** dvander@428: * Packs a normal cell into a data pack. dvander@428: * dvander@428: * @param pack Handle to the data pack. dvander@428: * @param cell Cell to add. dvander@428: * @noreturn dvander@428: * @error Invalid handle. dvander@428: */ dvander@428: native WritePackCell(Handle:pack, cell); dvander@428: dvander@428: /** faluco@461: * Packs a float into a data pack. faluco@461: * faluco@461: * @param pack Handle to the data pack. faluco@461: * @param val Float to add. faluco@461: * @noreturn faluco@461: * @error Invalid handle. faluco@461: */ faluco@461: native WritePackFloat(Handle:pack, Float:val); faluco@461: faluco@461: /** faluco@461: * Packs a string into a data pack. faluco@461: * faluco@461: * @param pack Handle to the data pack. faluco@461: * @param str String to add. faluco@461: * @noreturn faluco@461: * @error Invalid handle. faluco@461: */ faluco@461: native WritePackString(Handle:pack, String:str[]); faluco@461: faluco@461: /** dvander@428: * Reads a cell from a data pack. dvander@428: * dvander@428: * @param pack Handle to the data pack. dvander@428: * @return Cell value. dvander@428: * @error Invalid handle, or bounds error. dvander@428: */ dvander@428: native ReadPackCell(Handle:pack); dvander@428: dvander@428: /** faluco@461: * Reads a float from a data pack. faluco@461: * faluco@461: * @param pack Handle to the data pack. faluco@461: * @return Float value. faluco@461: * @error Invalid handle, or bounds error. faluco@461: */ faluco@461: native Float:ReadPackFloat(Handle:pack); faluco@461: faluco@461: /** faluco@461: * Reads a string from a data pack. faluco@461: * faluco@461: * @param pack Handle to the data pack. faluco@461: * @param buffer Destination string buffer. faluco@461: * @param maxlen Maximum length of output string buffer. faluco@461: * @noreturn faluco@461: * @error Invalid handle, or bounds error. faluco@461: */ faluco@461: native ReadPackString(Handle:pack, String:buffer[], maxlen); faluco@461: faluco@461: /** dvander@428: * Resets the position in a data pack. dvander@428: * dvander@428: * @param pack Handle to the data pack. dvander@428: * @param clear If true, clears the contained data. dvander@428: * @noreturn ds@475: * @error Invalid handle. dvander@428: */ dvander@428: native ResetPack(Handle:pack, bool:clear=false); dvander@428: dvander@428: /** dvander@428: * Returns the read or write position in a data pack. dvander@428: * dvander@428: * @param pack Handle to the data pack. dvander@428: * @return Numerical position in the data pack. ds@475: * @error Invalid handle. dvander@428: */ dvander@428: native GetPackPosition(Handle:pack); dvander@428: dvander@428: /** dvander@428: * Sets the read/write position in a data pack. dvander@428: * dvander@428: * @param pack Handle to the data pack. dvander@428: * @param position New position to set. dvander@428: * @noreturn faluco@461: * @error Invalid handle, or position is beyond the pack bounds. dvander@428: */ faluco@461: native SetPackPosition(Handle:pack, position); faluco@461: faluco@461: /** faluco@461: * Returns whether or not a specified number of bytes from the data pack faluco@461: * position to the end can be read. faluco@461: * faluco@461: * @param pack Handle to the data pack. faluco@461: * @param bytes Number of bytes to simulate reading. ds@475: * @return True if can be read, false otherwise. ds@475: * @error Invalid handle. faluco@461: */ faluco@461: native bool:IsPackReadable(Handle:pack, bytes);