Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.6 KiB

  1. //=========== Copyright Valve Corporation, All rights reserved. ===============//
  2. //
  3. // Purpose:
  4. //=============================================================================//
  5. #ifndef IUIFILESYSTEM_H
  6. #define IUIFILESYSTEM_H
  7. #ifdef _WIN32
  8. #pragma once
  9. #endif
  10. #include "panoramatypes.h"
  11. #include "utlbuffer.h"
  12. namespace panorama
  13. {
  14. typedef void( __cdecl *FileChangeCallback_t )( const char *pFullPath );
  15. //-----------------------------------------------------------------------------
  16. // Purpose: FileSystem support
  17. //-----------------------------------------------------------------------------
  18. typedef void (LoadFileIntoBufferCallback_t)( const char * pchFile, CUtlBuffer &buf, bool bSuccess );
  19. class IUIFileSystem
  20. {
  21. public:
  22. // fully load the file into the buffer object
  23. virtual bool LoadFileIntoBuffer( const char *pchFile, CUtlBuffer &buf, bool bText, FileChangeCallback_t fileChangeCallback = NULL ) = 0;
  24. virtual void LoadFileIntoBufferAsync( const char *pchFile, CUtlBuffer &buf, bool bText, CUtlDelegate< LoadFileIntoBufferCallback_t > del ) = 0;
  25. // replace this file with the contents of the buffer object
  26. virtual bool SaveBufferToFile( CUtlBuffer &buf, const char *pchFile ) = 0;
  27. // return true if this file is on disk (or in a resource file)
  28. virtual bool FileExists( const char *pchFile ) = 0;
  29. virtual bool RestoreContentFilename( const char *pchFile, CUtlString &fixedFilename ) { return false; }
  30. virtual bool RestoreResourceFilename( const char *pchFile, CUtlString &fixedFilename ) { return false; }
  31. // Run frame on main thread
  32. virtual void RunFrame() = 0;
  33. };
  34. }
  35. #endif // IUIFILESYSTEM_H