Merge pull request #363 from VoiDeD/datapack-pos
Introduce a datapack position tag.
This commit is contained in:
commit
7d153cf9f9
@ -35,6 +35,13 @@
|
|||||||
#endif
|
#endif
|
||||||
#define _datapack_included
|
#define _datapack_included
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opaque handle to a datapack position.
|
||||||
|
*/
|
||||||
|
enum DataPackPos: {};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new data pack.
|
* Creates a new data pack.
|
||||||
*
|
*
|
||||||
@ -134,20 +141,20 @@ native void ResetPack(Handle pack, bool clear=false);
|
|||||||
* Returns the read or write position in a data pack.
|
* Returns the read or write position in a data pack.
|
||||||
*
|
*
|
||||||
* @param pack Handle to the data pack.
|
* @param pack Handle to the data pack.
|
||||||
* @return Numerical position in the data pack.
|
* @return Position in the data pack, only usable with calls to SetPackPosition.
|
||||||
* @error Invalid handle.
|
* @error Invalid handle.
|
||||||
*/
|
*/
|
||||||
native int GetPackPosition(Handle pack);
|
native DataPackPos GetPackPosition(Handle pack);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the read/write position in a data pack.
|
* Sets the read/write position in a data pack.
|
||||||
*
|
*
|
||||||
* @param pack Handle to the data pack.
|
* @param pack Handle to the data pack.
|
||||||
* @param position New position to set.
|
* @param position New position to set. Must have been previously retrieved from a call to GetPackPosition.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
* @error Invalid handle, or position is beyond the pack bounds.
|
* @error Invalid handle, or position is beyond the pack bounds.
|
||||||
*/
|
*/
|
||||||
native void SetPackPosition(Handle pack, int position);
|
native void SetPackPosition(Handle pack, DataPackPos position);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether or not a specified number of bytes from the data pack
|
* Returns whether or not a specified number of bytes from the data pack
|
||||||
@ -174,7 +181,7 @@ methodmap DataPack < Handle
|
|||||||
public Reset() = ResetPack;
|
public Reset() = ResetPack;
|
||||||
public IsReadable() = IsPackReadable;
|
public IsReadable() = IsPackReadable;
|
||||||
|
|
||||||
property int Position {
|
property DataPackPos Position {
|
||||||
public get() = GetPackPosition;
|
public get() = GetPackPosition;
|
||||||
public set() = SetPackPosition;
|
public set() = SetPackPosition;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user