r5sdk/r5dev/tier1/kverrorcontext.h
Kawe Mazidjatari ee82d5d8e0 Tier1: move KeyValues class to Tier1
The KeyValues class belongs here. Also reimplemented most loading methods for KeyValues, and adjusted the VPK building code to account for it. Pointers to the engine's implementation of KeyValues have been moved to a separate header ('keyvalues_iface.h'), as this allows external tools code to utilize the standalone KeyValues class implementation. Playlist utilities are completely separated from the KeyValues header; these have nothing to do with KeyValues other than manipulating a global KeyValues object for the playlists, and thus have been named as such and moved to rtech/playlists.
2024-04-05 17:42:05 +02:00

35 lines
591 B
C++

#ifndef KVERRORCONTEXT_H
#define KVERRORCONTEXT_H
#include "kverrorstack.h"
// a simple helper that creates stack entries as it goes in & out of scope
class CKeyErrorContext
{
public:
~CKeyErrorContext()
{
g_KeyValuesErrorStack.Pop();
}
explicit CKeyErrorContext(int symName)
{
Init(symName);
}
void Reset(int symName)
{
g_KeyValuesErrorStack.Reset(m_stackLevel, symName);
}
int GetStackLevel() const
{
return m_stackLevel;
}
private:
void Init(int symName)
{
m_stackLevel = g_KeyValuesErrorStack.Push(symName);
}
int m_stackLevel;
};
#endif // KVERRORCONTEXT_H