SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
sourcepp::parser::binary Namespace Reference

Functions

consteval uint32_t makeFourCC (const char fourCC[4])
 Creates a FourCC identifier from a string of 4 characters.
consteval uint64_t makeEightCC (const char eightCC[8])
 Creates a EightCC identifier from a string of 8 characters.
void readStringAtOffset (BufferStream &stream, std::string &str, std::ios::seekdir offsetFrom=std::ios::cur, std::size_t subtractFromOffset=sizeof(int32_t))
 Reads an integer from the stream, seeks there, reads a string, and seeks back.

Function Documentation

◆ makeEightCC()

uint64_t sourcepp::parser::binary::makeEightCC ( const char eightCC[8])
nodiscardconsteval

Creates a EightCC identifier from a string of 8 characters.

Parameters
eightCCThe human-readable FourCC.
Returns
The EightCC identifier.

Definition at line 29 of file Binary.h.

◆ makeFourCC()

uint32_t sourcepp::parser::binary::makeFourCC ( const char fourCC[4])
nodiscardconsteval

Creates a FourCC identifier from a string of 4 characters.

Parameters
fourCCThe human-readable FourCC.
Returns
The FourCC identifier.

Definition at line 20 of file Binary.h.

◆ readStringAtOffset()

void sourcepp::parser::binary::readStringAtOffset ( BufferStream & stream,
std::string & str,
std::ios::seekdir offsetFrom = std::ios::cur,
std::size_t subtractFromOffset = sizeof(int32_t) )

Reads an integer from the stream, seeks there, reads a string, and seeks back.

Parameters
streamThe BufferStream to modify.
strString contents are read into this.
offsetFromThe seek direction when reading the string.
subtractFromOffsetThis offset is subtracted from the read integer. Defaults to the size of an integer since an integer was read from the stream before seeking to the string.

Definition at line 7 of file Binary.cpp.