This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
#include <ofFileUtils.h>
Classes | |
struct | Line |
struct | Lines |
struct | RLine |
struct | RLines |
Public Member Functions | |
ofBuffer () | |
ofBuffer (const char *buffer, std::size_t size) | |
ofBuffer (std::istream &stream, std::size_t ioBlockSize=1024) | |
void | set (const char *buffer, std::size_t size) |
void | set (const std::string &text) |
bool | set (std::istream &stream, std::size_t ioBlockSize=1024) |
void | setall (char mem) |
void | append (const std::string &buffer) |
void | append (const char *buffer, std::size_t size) |
void | reserve (std::size_t size) |
bool | writeTo (std::ostream &stream) const |
Write contents of the buffer to an output stream. | |
void | clear () |
Remove all bytes from the buffer, leaving a size of 0. | |
void | allocate (std::size_t size) |
void | resize (std::size_t size) |
char * | getData () |
const char * | getData () const |
OF_DEPRECATED_MSG ("Use getData instead", char *getBinaryBuffer()) | |
OF_DEPRECATED_MSG ("Use getData instead", const char *getBinaryBuffer() const) | |
std::string | getText () const |
operator std::string () const | |
ofBuffer & | operator= (const std::string &text) |
set contents of the buffer from a string | |
std::size_t | size () const |
OF_DEPRECATED_MSG ("use a lines iterator instead", std::string getNextLine()) | |
OF_DEPRECATED_MSG ("use a lines iterator instead", std::string getFirstLine()) | |
OF_DEPRECATED_MSG ("use a lines iterator instead", bool isLastLine()) | |
OF_DEPRECATED_MSG ("use a lines iterator instead", void resetLineReader()) | |
std::vector< char >::iterator | begin () |
std::vector< char >::iterator | end () |
std::vector< char >::const_iterator | begin () const |
std::vector< char >::const_iterator | end () const |
std::vector< char >::reverse_iterator | rbegin () |
std::vector< char >::reverse_iterator | rend () |
std::vector< char >::const_reverse_iterator | rbegin () const |
std::vector< char >::const_reverse_iterator | rend () const |
Lines | getLines () |
RLines | getReverseLines () |
Friends | |
std::ostream & | operator<< (std::ostream &ostr, const ofBuffer &buf) |
std::istream & | operator>> (std::istream &istr, ofBuffer &buf) |
Detailed Description
A buffer of data which can be accessed as simple bytes or text.
Constructor & Destructor Documentation
◆ ofBuffer() [1/3]
ofBuffer::ofBuffer | ( | ) |
◆ ofBuffer() [2/3]
ofBuffer::ofBuffer | ( | const char * | buffer, |
std::size_t | size | ||
) |
Create a buffer and set its contents from a raw byte pointer.
- Parameters
-
buffer pointer to the raw byte buffer to copy data from size the number of bytes to read
- Warning
- buffer must not be NULL
- size must be <= the number of bytes allocated in buffer
◆ ofBuffer() [3/3]
ofBuffer::ofBuffer | ( | std::istream & | stream, |
std::size_t | ioBlockSize = 1024 |
||
) |
Create a buffer and set its contents from an input stream.
- Parameters
-
ioBlockSize the number of bytes to read from the stream in chunks
Member Function Documentation
◆ allocate()
void ofBuffer::allocate | ( | std::size_t | size | ) |
Request that the buffer capacity be at least enough to contain a specified number of bytes.
- Parameters
-
size number of bytes to reserve space for
◆ append() [1/2]
void ofBuffer::append | ( | const char * | buffer, |
std::size_t | size | ||
) |
Append bytes to the end of the buffer from a raw byte pointer.
- Warning
- buffer must not be NULL
- size must be <= the number of bytes allocated in buffer
- Parameters
-
buffer pointer to the raw byte buffer to copy data from size the number of bytes to read
◆ append() [2/2]
void ofBuffer::append | ( | const std::string & | buffer | ) |
Append bytes to the end of buffer from a string.
- Parameters
-
buffer string to copy bytes from
◆ begin() [1/2]
vector< char >::iterator ofBuffer::begin | ( | ) |
◆ begin() [2/2]
vector< char >::const_iterator ofBuffer::begin | ( | ) | const |
◆ clear()
void ofBuffer::clear | ( | ) |
Remove all bytes from the buffer, leaving a size of 0.
◆ end() [1/2]
vector< char >::iterator ofBuffer::end | ( | ) |
◆ end() [2/2]
vector< char >::const_iterator ofBuffer::end | ( | ) | const |
◆ getData() [1/2]
char * ofBuffer::getData | ( | ) |
Access the buffer's contents using a raw byte pointer.
- Warning
- Do not access bytes at indices beyond size()!
- Returns
- pointer to internal raw bytes
◆ getData() [2/2]
const char * ofBuffer::getData | ( | ) | const |
access the buffer's contents using a const raw byte pointer.
- Warning
- Do not access bytes at indices beyond size()!
- Returns
- const pointer to internal raw bytes
◆ getLines()
ofBuffer::Lines ofBuffer::getLines | ( | ) |
Access the contents of the buffer as a series of text lines.
If the buffer loads a text file with lines separated by an endline char '
', you can access each line individually using Line structs.
- Returns
- buffer text lines
◆ getReverseLines()
ofBuffer::RLines ofBuffer::getReverseLines | ( | ) |
Access the contents of the buffer as a series of text lines in reverse order
If the buffer loads a text file with lines separated by an endline char '
' or '\r
', you can access each line individually using Line structs.
- Returns
- buffer text lines
◆ getText()
string ofBuffer::getText | ( | ) | const |
get the contents of the buffer as a string.
- Returns
- buffer contents as a string
◆ OF_DEPRECATED_MSG() [1/6]
ofBuffer::OF_DEPRECATED_MSG | ( | "use a lines iterator instead" | , |
bool | isLastLine() | ||
) |
◆ OF_DEPRECATED_MSG() [2/6]
ofBuffer::OF_DEPRECATED_MSG | ( | "use a lines iterator instead" | , |
std::string | getFirstLine() | ||
) |
◆ OF_DEPRECATED_MSG() [3/6]
ofBuffer::OF_DEPRECATED_MSG | ( | "use a lines iterator instead" | , |
std::string | getNextLine() | ||
) |
◆ OF_DEPRECATED_MSG() [4/6]
ofBuffer::OF_DEPRECATED_MSG | ( | "use a lines iterator instead" | , |
void | resetLineReader() | ||
) |
◆ OF_DEPRECATED_MSG() [5/6]
ofBuffer::OF_DEPRECATED_MSG | ( | "Use getData instead" | , |
char * | getBinaryBuffer() | ||
) |
◆ OF_DEPRECATED_MSG() [6/6]
ofBuffer::OF_DEPRECATED_MSG | ( | "Use getData instead" | , |
const char *getBinaryBuffer() const | |||
) |
◆ operator std::string()
ofBuffer::operator std::string | ( | ) | const |
Use buffer as a string via cast.
- Returns
- buffer contents as a string
◆ operator=()
ofBuffer & ofBuffer::operator= | ( | const std::string & | text | ) |
set contents of the buffer from a string
◆ rbegin() [1/2]
vector< char >::reverse_iterator ofBuffer::rbegin | ( | ) |
◆ rbegin() [2/2]
vector< char >::const_reverse_iterator ofBuffer::rbegin | ( | ) | const |
◆ rend() [1/2]
vector< char >::reverse_iterator ofBuffer::rend | ( | ) |
◆ rend() [2/2]
vector< char >::const_reverse_iterator ofBuffer::rend | ( | ) | const |
◆ reserve()
void ofBuffer::reserve | ( | std::size_t | size | ) |
Request that the buffer capacity be at least enough to contain a specified number of bytes.
- Parameters
-
size number of bytes to reserve space for
◆ resize()
void ofBuffer::resize | ( | std::size_t | size | ) |
Resize the buffer to contain a specified number of bytes.
If size is < the current buffer size, the contents are reduced to size bytes & remaining bytes are removed. If size is > the current buffer size, the buffer's size is increased to size_ bytes.
- Parameters
-
size number of bytes to resize the buffer to
◆ set() [1/3]
void ofBuffer::set | ( | const char * | buffer, |
std::size_t | size | ||
) |
Set the contents of the buffer from a raw byte pointer.
- Warning
- buffer must not be NULL
- size must be <= the number of bytes allocated in buffer
- Parameters
-
buffer pointer to the raw byte buffer to copy data from size the number of bytes to read
◆ set() [2/3]
void ofBuffer::set | ( | const std::string & | text | ) |
Set contents of the buffer from a string.
- Parameters
-
text string to copy data from
◆ set() [3/3]
bool ofBuffer::set | ( | std::istream & | stream, |
std::size_t | ioBlockSize = 1024 |
||
) |
Set contents of the buffer from an input stream.
- Parameters
-
stream input stream to copy data from ioBlockSize the number of bytes to read from the stream in chunks
◆ setall()
void ofBuffer::setall | ( | char | mem | ) |
Set all bytes in the buffer to a given value.
- Parameters
-
mem byte value to set
◆ size()
std::size_t ofBuffer::size | ( | ) | const |
Check the buffer's size.
- Returns
- the size of the buffer's content in bytes
◆ writeTo()
bool ofBuffer::writeTo | ( | std::ostream & | stream | ) | const |
Write contents of the buffer to an output stream.
Friends And Related Symbol Documentation
◆ operator<<
|
friend |
◆ operator>>
|
friend |
The documentation for this class was generated from the following files:
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/utils/ofFileUtils.h
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/utils/ofFileUtils.cpp