aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public/tier1/KeyValues.h
diff options
context:
space:
mode:
authorJohn Schoenick <[email protected]>2015-09-09 18:35:41 -0700
committerJohn Schoenick <[email protected]>2015-09-09 18:35:41 -0700
commit0d8dceea4310fde5706b3ce1c70609d72a38efdf (patch)
treec831ef32c2c801a5c5a80401736b52c7b5a528ec /mp/src/public/tier1/KeyValues.h
parentUpdated the SDK with the latest code from the TF and HL2 branches. (diff)
downloadsource-sdk-2013-master.tar.xz
source-sdk-2013-master.zip
Updated the SDK with the latest code from the TF and HL2 branches.HEADmaster
Diffstat (limited to 'mp/src/public/tier1/KeyValues.h')
-rw-r--r--mp/src/public/tier1/KeyValues.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/mp/src/public/tier1/KeyValues.h b/mp/src/public/tier1/KeyValues.h
index 0fdffb08..97ae69c2 100644
--- a/mp/src/public/tier1/KeyValues.h
+++ b/mp/src/public/tier1/KeyValues.h
@@ -120,8 +120,8 @@ public:
// File access. Set UsesEscapeSequences true, if resource file/buffer uses Escape Sequences (eg \n, \t)
void UsesEscapeSequences(bool state); // default false
void UsesConditionals(bool state); // default true
- bool LoadFromFile( IBaseFileSystem *filesystem, const char *resourceName, const char *pathID = NULL );
- bool SaveToFile( IBaseFileSystem *filesystem, const char *resourceName, const char *pathID = NULL, bool sortKeys = false, bool bAllowEmptyString = false );
+ bool LoadFromFile( IBaseFileSystem *filesystem, const char *resourceName, const char *pathID = NULL, bool refreshCache = false );
+ bool SaveToFile( IBaseFileSystem *filesystem, const char *resourceName, const char *pathID = NULL, bool sortKeys = false, bool bAllowEmptyString = false, bool bCacheResult = false );
// Read from a buffer... Note that the buffer must be null terminated
bool LoadFromBuffer( char const *resourceName, const char *pBuffer, IBaseFileSystem* pFileSystem = NULL, const char *pPathID = NULL );
@@ -144,6 +144,8 @@ public:
//
KeyValues *GetFirstSubKey() { return m_pSub; } // returns the first subkey in the list
KeyValues *GetNextKey() { return m_pPeer; } // returns the next subkey
+ const KeyValues *GetNextKey() const { return m_pPeer; } // returns the next subkey
+
void SetNextKey( KeyValues * pDat);
KeyValues *FindLastSubKey(); // returns the LAST subkey in the list. This requires a linked list iteration to find the key. Returns NULL if we don't have any children
@@ -203,7 +205,7 @@ public:
void operator delete( void *pMem );
void operator delete( void *pMem, int nBlockUse, const char *pFileName, int nLine );
- KeyValues& operator=( KeyValues& src );
+ KeyValues& operator=( const KeyValues& src );
// Adds a chain... if we don't find stuff in this keyvalue, we'll look
// in the one we're chained to.
@@ -217,6 +219,10 @@ public:
// Allocate & create a new copy of the keys
KeyValues *MakeCopy( void ) const;
+ // Allocate & create a new copy of the keys, including the next keys. This is useful for top level files
+ // that don't use the usual convention of a root key with lots of children (like soundscape files).
+ KeyValues *MakeCopy( bool copySiblings ) const;
+
// Make a new copy of all subkeys, add them all to the passed-in keyvalues
void CopySubkeys( KeyValues *pParent ) const;
@@ -270,7 +276,9 @@ private:
KeyValues* CreateKeyUsingKnownLastChild( const char *keyName, KeyValues *pLastChild );
void AddSubkeyUsingKnownLastChild( KeyValues *pSubKey, KeyValues *pLastChild );
- void RecursiveCopyKeyValues( KeyValues& src );
+ void CopyKeyValuesFromRecursive( const KeyValues& src );
+ void CopyKeyValue( const KeyValues& src, size_t tmpBufferSizeB, char* tmpBuffer );
+
void RemoveEverything();
// void RecursiveSaveToFile( IBaseFileSystem *filesystem, CUtlBuffer &buffer, int indentLevel );
// void WriteConvertedString( CUtlBuffer &buffer, const char *pszString );