summaryrefslogtreecommitdiff
path: root/public/fgdlib/helperinfo.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /public/fgdlib/helperinfo.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'public/fgdlib/helperinfo.h')
-rw-r--r--public/fgdlib/helperinfo.h128
1 files changed, 128 insertions, 0 deletions
diff --git a/public/fgdlib/helperinfo.h b/public/fgdlib/helperinfo.h
new file mode 100644
index 0000000..affd566
--- /dev/null
+++ b/public/fgdlib/helperinfo.h
@@ -0,0 +1,128 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=============================================================================
+
+#ifndef HELPERINFO_H
+#define HELPERINFO_H
+#pragma once
+
+#include <tier0/dbg.h>
+#include <utlvector.h>
+
+
+#define MAX_HELPER_NAME_LEN 256
+
+
+typedef CUtlVector<char *> CParameterList;
+
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+class CHelperInfo
+{
+ public:
+
+ inline CHelperInfo(void);
+ inline ~CHelperInfo(void);
+
+ inline const char *GetName(void) const { return(m_szName); }
+ inline void SetName(const char *pszName);
+
+ inline bool AddParameter(const char *pszParameter);
+
+ inline int GetParameterCount(void) const { return(m_Parameters.Count()); }
+ inline const char *GetParameter(int nIndex) const;
+
+ protected:
+
+ char m_szName[MAX_HELPER_NAME_LEN];
+ CParameterList m_Parameters;
+};
+
+
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+inline CHelperInfo::CHelperInfo(void)
+{
+ m_szName[0] = '\0';
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+inline CHelperInfo::~CHelperInfo(void)
+{
+ int nCount = m_Parameters.Count();
+ for (int i = 0; i < nCount; i++)
+ {
+ char *pszParam = m_Parameters.Element(i);
+ Assert(pszParam != NULL);
+ if (pszParam != NULL)
+ {
+ delete [] pszParam;
+ }
+ }
+
+ m_Parameters.RemoveAll();
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose:
+// Input : char *pszParameter -
+// Output : Returns true on success, false on failure.
+//-----------------------------------------------------------------------------
+inline bool CHelperInfo::AddParameter(const char *pszParameter)
+{
+ if ((pszParameter != NULL) && (pszParameter[0] != '\0'))
+ {
+ int nLen = strlen(pszParameter);
+
+ if (nLen > 0)
+ {
+ char *pszNew = new char [nLen + 1];
+ if (pszNew != NULL)
+ {
+ strcpy(pszNew, pszParameter);
+ m_Parameters.AddToTail(pszNew);
+ return(true);
+ }
+ }
+ }
+
+ return(false);
+}
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+inline const char *CHelperInfo::GetParameter(int nIndex) const
+{
+ if (nIndex >= m_Parameters.Count())
+ return NULL;
+
+ return m_Parameters.Element(nIndex);
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose:
+// Input : char *pszName -
+//-----------------------------------------------------------------------------
+inline void CHelperInfo::SetName(const char *pszName)
+{
+ if (pszName != NULL)
+ {
+ strcpy(m_szName, pszName);
+ }
+}
+
+
+typedef CUtlVector<CHelperInfo *> CHelperInfoList;
+
+
+#endif // HELPERINFO_H