70 static void *
operator new(size_t) {
79 static void operator delete(
void *pBlock) {
289 bool FindSymbol(
const char *pszName,
const char **ppszValue,
bool bFail)
const;
301 bool FindInt(
const char *pszName,
int *pnValue,
bool bFail)
const;
313 bool FindFloat(
const char *pszName,
float *pfValue,
bool bFail)
const;
326 bool FindBool(
const char *pszName,
int *pnValue,
bool bFail)
const;
336 const char *
Sym(
int nIndex)
const;
346 int Int(
int nIndex)
const;
454 unsigned short mRefs;
466 void PrintNode(
PrnStream &stream,
int nIndex)
const;
475 bool HasArray()
const;
485 void SetType(
int nIndex,
int nType);
496 static int CompareKeys(
const void *pFirst,
const void *pSecond);
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
const char * Sym(int nIndex) const
Report a node as a symbol.
static DataArray * ReadText(const char *pszPath, BinStream *pStream)
Parse script text into an array, never the compiled form Read() prefers on the disc.
bool FindFloat(const char *pszName, float *pfValue, bool bFail) const
Find the floating-point number that follows a tag.
static void MakeCompiledPath(char *pszOut, const char *pszPath, bool bCompiled)
Build the path of the compiled copy of a data file.
int Int(int nIndex) const
Report a node as an integer.
int Size() const
Report the number of nodes.
Definition dataarray.h:158
NodeType
Kinds of node Type() reports, two bits each.
Definition dataarray.h:23
@ kNodeArray
Definition dataarray.h:27
@ kNodeInt
Definition dataarray.h:24
@ kNodeSymbol
Definition dataarray.h:25
@ kNodeFloat
Definition dataarray.h:26
void SetFileLine(const char *pszFile, int nLine)
Record the file and the line the array was read from.
DataArray(BinStream &stream, const std::vector< const char * > &files)
Read an array the compiler wrote, with one reference.
const char * GetFile() const
Definition dataarray.h:437
bool FindSymbol(const char *pszName, const char **ppszValue, bool bFail) const
Find the symbol that follows a tag.
void SortByKey()
Sort the child arrays by the value of their first nodes, and mark the array as sorted.
DataNode Node(int i)
Read a node of any type.
int Type(int nIndex) const
Report the kind of a node.
bool FindBool(const char *pszName, int *pnValue, bool bFail) const
Find the truth value that follows a tag.
float Float(int nIndex) const
Report a node as a float.
DataArray * FindArray(const char *pszTag, bool bFail) const
Find the child array whose first node is a tag.
static DataArray * FindMacro(const char *pszName)
Find the value of a script macro.
bool FindInt(const char *pszName, int *pnValue, bool bFail) const
Find the integer that follows a tag.
void Print(PrnStream &stream) const
Write the array as script text.
static DataArray * Concat(const std::vector< DataArray * > &arrays, bool bRelease)
Join the nodes of several arrays into a new array.
bool FindVector(const char *pszName, Vector3 *pValue, bool bFail) const
Find the three numbers that follow a tag.
bool FindVector(const char *pszName, Vector2 *pValue, bool bFail) const
Find the two numbers that follow a tag.
void Release()
Drop one reference and destroy the array when none remains.
DataArray * FindArray(int nTag) const
Find the child array whose first node is an integer tag.
void AddRef()
Take one more reference.
Node Value(int nIndex) const
Report a node's value without regard to its kind.
void Merge(const DataArray *pOther)
Add the child arrays of another array whose tags this array lacks, and merge the children whose tags ...
bool FindColor(const char *pszName, Color *pValue, bool bFail) const
Find the colour that follows a tag.
bool FindString(const char *pszName, String *pValue, bool bFail) const
Find the symbol that follows a tag and copy it into a string.
void Resize(int nSize)
Change the number of nodes, releasing the child arrays of the nodes removed.
static DataArray * New(int nSize)
Create an array of nodes with one reference.
static void DefineMacro(const char *pszName, DataArray *pValue)
Define a script macro, taking a reference on its value.
DataArray * Array(int nIndex) const
Report a node as an array.
static DataArray * Read(const char *pszPath, BinStream *pStream)
Parse script text into an array.
short GetLine() const
Definition dataarray.h:442
~DataArray()
Release the child arrays and the node storage.
void SetNode(int nIndex, Node value, int nType)
Replace a node with a value of a kind.
DataArray(int nSize)
Construct an array of cleared integer nodes with one reference.
Text output stream.
Definition prnstream.h:16
Growable text buffer that is also a PrnStream.
Definition string.h:19
void DataTerminate()
Release every array the data layer still retains.
void DataSetCompiled()
Make DataArray::Read() use the compiled copy of every data file.
void DataReserveSymbols()
Reserve the symbol table before the first data file is read.
void * PoolAlloc(int nSize, int nBlockSize, const char *pszTag, int nUnused)
Allocate a block from the small-block pool and bill it to a tag.
void PoolFree(int nSize, void *pBlock)
Return a block to the small-block pool.
Linear colour with four float components.
Definition color.h:12
Two-component vector, used for texture coordinates.
Definition vector2.h:12
Three-component vector, padded to a PlayStation 2 quadword.
Definition vector3.h:14
A node's value, read as the member its NodeType selects.
Definition dataarray.h:31
int mInt
Definition dataarray.h:32
DataArray * mArray
Definition dataarray.h:35
float mFloat
Definition dataarray.h:34
const char * mSymbol
Definition dataarray.h:33