Panda3D

Loading...
Searching...
No Matches
dcPackData.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file dcPackData.h
10 * @author drose
11 * @date 2004-06-15
12 */
13
14#ifndef DCPACKDATA_H
15#define DCPACKDATA_H
16
17#include "dcbase.h"
18
19/**
20 * This is a block of data that receives the results of DCPacker.
21 */
22 class EXPCL_DIRECT_DCPARSER DCPackData {
23PUBLISHED:
24 INLINE DCPackData();
25 INLINE ~DCPackData();
26
27 INLINE void clear();
28
29 public:
30 INLINE void append_data(const char *buffer, size_t size);
31 INLINE char *get_write_pointer(size_t size);
32 INLINE void append_junk(size_t size);
33 INLINE void rewrite_data(size_t position, const char *buffer, size_t size);
34 INLINE char *get_rewrite_pointer(size_t position, size_t size);
35
36PUBLISHED:
37 INLINE std::string get_string() const;
38 INLINE size_t get_length() const;
39 public:
40 INLINE const char *get_data() const;
41 INLINE char *take_data();
42
43 private:
44 void set_used_length(size_t size);
45
46 private:
47 char *_buffer;
48 size_t _allocated_size;
49 size_t _used_length;
50};
51
52#include "dcPackData.I"
53
54#endif
DCPackData::get_data
const char * get_data() const
Returns the beginning of the data buffer.
Definition dcPackData.I:115
DCPackData::take_data
char * take_data()
Returns the pointer to the beginning of the data buffer, and transfers ownership of the buffer to the...
Definition dcPackData.I:129
DCPackData::get_rewrite_pointer
char * get_rewrite_pointer(size_t position, size_t size)
Returns a pointer into the middle of the data at the indicated point.
Definition dcPackData.I:84
DCPackData::append_junk
void append_junk(size_t size)
Adds some uninitialized bytes to the end of the data.
Definition dcPackData.I:66
DCPackData::append_data
void append_data(const char *buffer, size_t size)
Adds the indicated bytes to the end of the data.
Definition dcPackData.I:47
DCPackData::get_length
size_t get_length() const
Returns the current length of the buffer.
Definition dcPackData.I:102
DCPackData::rewrite_data
void rewrite_data(size_t position, const char *buffer, size_t size)
Changes the data at the indicated position to the given value.
Definition dcPackData.I:75
DCPackData::clear
void clear()
Empties the contents of the data (without necessarily freeing its allocated memory).
Definition dcPackData.I:39
DCPackData::get_string
std::string get_string() const
Returns the data buffer as a string.
Definition dcPackData.I:93
DCPackData::get_write_pointer
char * get_write_pointer(size_t size)
Adds the indicated number of bytes to the end of the data without initializing them,...
Definition dcPackData.I:57
dcPackData.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
dcbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.