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.
 
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

◆ makeFourCC()

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

Creates a FourCC identifier from a string of 4 characters.

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

Definition at line 18 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.