mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
more interfaces to get out the packed data
This commit is contained in:
parent
3ac771804b
commit
a5349528e9
@ -160,7 +160,9 @@ get_data() const {
|
||||
// non-NULL. This may (or may not) return NULL if the
|
||||
// buffer is empty.
|
||||
//
|
||||
// This also empties the DCPackData structure.
|
||||
// This also empties the DCPackData structure, and sets
|
||||
// its length to zero (so you should call get_length()
|
||||
// before calling this method).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE char *DCPackData::
|
||||
take_data() {
|
||||
|
@ -617,17 +617,6 @@ get_num_unpacked_bytes() const {
|
||||
return _unpack_p;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DCPacker::get_string
|
||||
// Access: Published
|
||||
// Description: Returns the packed data buffer as a string. Also see
|
||||
// get_data().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE string DCPacker::
|
||||
get_string() const {
|
||||
return _pack_data.get_string();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DCPacker::get_length
|
||||
// Access: Published
|
||||
@ -640,6 +629,28 @@ get_length() const {
|
||||
return _pack_data.get_length();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DCPacker::get_string
|
||||
// Access: Published
|
||||
// Description: Returns the packed data buffer as a string. Also see
|
||||
// get_data().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE string DCPacker::
|
||||
get_string() const {
|
||||
return _pack_data.get_string();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DCPacker::get_string
|
||||
// Access: Published
|
||||
// Description: Copies the packed data into the indicated string.
|
||||
// Also see get_data().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void DCPacker::
|
||||
get_string(string &data) const {
|
||||
data.assign(_pack_data.get_data(), _pack_data.get_length());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DCPacker::get_data
|
||||
// Access: Public
|
||||
@ -647,13 +658,34 @@ get_length() const {
|
||||
// is not null-terminated, but see also get_string().
|
||||
//
|
||||
// This may be used in conjunction with get_length() to
|
||||
// copy all of the bytes out of the buffer.
|
||||
// copy all of the bytes out of the buffer. Also see
|
||||
// take_data() to get the packed data without a copy
|
||||
// operation.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const char *DCPacker::
|
||||
get_data() const {
|
||||
return _pack_data.get_data();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DCPacker::take_data
|
||||
// Access: Public
|
||||
// Description: Returns the pointer to the beginning of the data
|
||||
// buffer, and transfers ownership of the buffer to the
|
||||
// caller. The caller is now responsible for ultimately
|
||||
// freeing the returned pointer with delete[], if it is
|
||||
// non-NULL. This may (or may not) return NULL if the
|
||||
// buffer is empty.
|
||||
//
|
||||
// This also empties the DCPackData structure, and sets
|
||||
// its length to zero (so you should call get_length()
|
||||
// before calling this method).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE char *DCPacker::
|
||||
take_data() {
|
||||
return _pack_data.take_data();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DCPacker::append_data
|
||||
// Access: Public
|
||||
|
@ -122,10 +122,12 @@ PUBLISHED:
|
||||
INLINE bool had_error() const;
|
||||
INLINE size_t get_num_unpacked_bytes() const;
|
||||
|
||||
INLINE string get_string() const;
|
||||
INLINE size_t get_length() const;
|
||||
INLINE string get_string() const;
|
||||
public:
|
||||
INLINE void get_string(string &data) const;
|
||||
INLINE const char *get_data() const;
|
||||
INLINE char *take_data();
|
||||
|
||||
INLINE void append_data(const char *buffer, size_t size);
|
||||
INLINE char *get_write_pointer(size_t size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user