aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public/tier2/p4helpers.h
diff options
context:
space:
mode:
authorMichael Sartain <[email protected]>2014-10-02 08:25:55 -0700
committerMichael Sartain <[email protected]>2014-10-02 08:25:55 -0700
commit55ed12f8d1eb6887d348be03aee5573d44177ffb (patch)
tree3686f7ca78c780cd9a3d367b79a9d9250c1be7c0 /mp/src/public/tier2/p4helpers.h
parent* Added support for Visual C++ 2013 Express to VPC (diff)
downloadsource-sdk-2013-55ed12f8d1eb6887d348be03aee5573d44177ffb.tar.xz
source-sdk-2013-55ed12f8d1eb6887d348be03aee5573d44177ffb.zip
Updated the SDK with the latest code from the TF and HL2 branches.
Diffstat (limited to 'mp/src/public/tier2/p4helpers.h')
-rw-r--r--mp/src/public/tier2/p4helpers.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/mp/src/public/tier2/p4helpers.h b/mp/src/public/tier2/p4helpers.h
index f4441974..8d4b3b3f 100644
--- a/mp/src/public/tier2/p4helpers.h
+++ b/mp/src/public/tier2/p4helpers.h
@@ -36,6 +36,9 @@ public:
// Is the file in perforce?
virtual bool IsFileInPerforce();
+ // Changes the file to the specified filetype.
+ virtual bool SetFileType( const CUtlString& desiredFileType );
+
protected:
// The filename that this class instance represents
CUtlString m_sFilename;
@@ -53,6 +56,7 @@ public:
virtual bool Edit( void ) { return true; }
virtual bool Add( void ) { return true; }
virtual bool IsFileInPerforce() { return false; }
+ virtual bool SetFileType(const CUtlString& desiredFileType) { return true; }
};
@@ -122,16 +126,35 @@ protected:
class CP4AutoEditAddFile
{
public:
- explicit CP4AutoEditAddFile( char const *szFilename ) : m_spImpl( g_p4factory->AccessFile( szFilename ) )
+ explicit CP4AutoEditAddFile( char const *szFilename )
+ : m_spImpl( g_p4factory->AccessFile( szFilename ) )
+ , m_bHasDesiredFileType( false )
+ {
+ m_spImpl->Edit();
+ }
+
+ explicit CP4AutoEditAddFile( char const *szFilename, const char *szFiletype )
+ : m_spImpl( g_p4factory->AccessFile( szFilename ) )
+ , m_sFileType(szFiletype)
+ , m_bHasDesiredFileType( true )
{
m_spImpl->Edit();
+ m_spImpl->SetFileType( m_sFileType );
+ }
+
+ ~CP4AutoEditAddFile( void )
+ {
+ m_spImpl->Add();
+ if ( m_bHasDesiredFileType )
+ m_spImpl->SetFileType( m_sFileType );
}
- ~CP4AutoEditAddFile( void ) { m_spImpl->Add(); }
CP4File * File() const { return m_spImpl.Get(); }
protected:
CPlainAutoPtr< CP4File > m_spImpl;
+ CUtlString m_sFileType;
+ bool m_bHasDesiredFileType;
};