Cocos2d-x  v3.12
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
BundleReader Class Reference

BundleReader is an interface for reading sequence of bytes. More...

Inherits Ref.

Public Member Functions

 BundleReader ()
 Constructor.
 
 ~BundleReader ()
 Destructor.
 
void init (char *buffer, ssize_t length)
 Initialise The data buffer pointer The data buffer size.
 
ssize_t read (void *ptr, ssize_t size, ssize_t count)
 Reads an array of elements. More...
 
char * readLine (int num, char *line)
 Reads a line from the buffer. More...
 
bool eof ()
 Check if the file pointer is at the end of the buffer or not. More...
 
ssize_t length ()
 Returns the length of the buffer in bytes.
 
ssize_t tell ()
 Returns the position of the file pointer. More...
 
bool seek (long int offset, int origin)
 Sets the position of the file pointer. More...
 
bool rewind ()
 Sets the file pointer at the start of the file. More...
 
template<typename T >
bool read (T *ptr)
 Read binary typed value. More...
 
template<typename T >
bool readArray (unsigned int *length, std::vector< T > *values)
 Read binary typed value array. More...
 
std::string readString ()
 Read the string from the bundle, first read length, then read string text. More...
 
bool readMatrix (float *m)
 Read the matrix. More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
local retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
local getReferenceCount ()
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor.
 

Additional Inherited Members

- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
local _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
local _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
local _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 
local _rooted
 When true, it means that the object was already rooted.
 
bool _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 
local _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 

Detailed Description

BundleReader is an interface for reading sequence of bytes.

Member Function Documentation

ssize_t read ( void *  ptr,
ssize_t  size,
ssize_t  count 
)

Reads an array of elements.

The pointer to the memory to copy into. The available size should be at least bytes. The size of each element to be read, in bytes. The number of elements to read. The number of elements read.

char* readLine ( int  num,
char *  line 
)

Reads a line from the buffer.

The amount of lines to reads The result The result, same as line.

bool eof ( )

Check if the file pointer is at the end of the buffer or not.

Returns true if the end of the buffer has been reached, otherwise returns false.

ssize_t tell ( )

Returns the position of the file pointer.

The position of the file pointer

bool seek ( long int  offset,
int  origin 
)

Sets the position of the file pointer.

The offset The base position. The result of the seek

bool rewind ( )

Sets the file pointer at the start of the file.

The result of the rewind.

bool read ( T *  ptr)

Read binary typed value.

The specified type pointer. The result of the read.

bool readArray ( unsigned int *  length,
std::vector< T > *  values 
)

Read binary typed value array.

Length of the array Output array to store the result

std::string readString ( )

Read the string from the bundle, first read length, then read string text.

The result string.

bool readMatrix ( float *  m)

Read the matrix.

the matrix type must be the 4*4 float matrix The result matrix. The result of the reading.


The documentation for this class was generated from the following file: