Skip to content

Commit

Permalink
Update CKV3MemberName policy
Browse files Browse the repository at this point in the history
  • Loading branch information
Wend4r committed Nov 20, 2024
1 parent ab749e9 commit 1dfe7d9
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions public/tier1/keyvalues3.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,23 +256,28 @@ struct KV3BinaryBlob_t
class CKV3MemberName : public CUtlStringToken
{
public:
inline CKV3MemberName(const char* pszString): m_nHashCode(), m_pszString("")
{
if (!pszString || !pszString[0])
return;
template<int N>
FORCEINLINE CKV3MemberName(const char (&szInit)[N]) :
CUtlStringToken(szInit),
m_pszString((const char *)szInit)
{
Assert(szInit[0]);
}

static CKV3MemberName Make(const char *pszInit)
{
Assert(pszInit && pszInit[0]);

m_nHashCode = MakeStringToken( pszString );
m_pszString = pszString;
return CKV3MemberName(MakeStringToken(pszInit), pszInit);
}

inline CKV3MemberName(): m_nHashCode(), m_pszString("") {}
inline CKV3MemberName(unsigned int nHashCode, const char* pszString = ""): m_nHashCode(nHashCode), m_pszString(pszString) {}
inline CKV3MemberName(): CUtlStringToken(), m_pszString("") {}
inline CKV3MemberName(const CUtlStringToken &nToken, const char* pszString = ""): CUtlStringToken(nToken), m_pszString(pszString) {}
inline CKV3MemberName(unsigned int nHashCode, const char* pszString = ""): CUtlStringToken(nHashCode), m_pszString(pszString) {}

inline unsigned int GetHashCode() const { return m_nHashCode.GetHashCode(); }
inline const char* GetString() const { return m_pszString; }

private:
CUtlStringToken m_nHashCode;
const char* m_pszString;
};

Expand Down

0 comments on commit 1dfe7d9

Please sign in to comment.