macCarbVolume.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _MACCARBVOLUME_H_
  23. #define _MACCARBVOLUME_H_
  24. #ifndef _POSIXVOLUME_H_
  25. #include "platformPOSIX/posixVolume.h"
  26. #endif
  27. #ifndef _TVECTOR_H_
  28. #include "core/util/tVector.h"
  29. #endif
  30. class MacFileSystem;
  31. /// File system change notifications on Mac.
  32. class MacFileSystemChangeNotifier : public Torque::FS::FileSystemChangeNotifier
  33. {
  34. public:
  35. typedef Torque::FS::FileSystemChangeNotifier Parent;
  36. struct Event;
  37. protected:
  38. /// Array of FSEventStream events set up. Uses pointers to dynamically
  39. /// allocated memory rather than allocating inline with the array to be
  40. /// able to pass around pointers without colliding with array reallocation.
  41. Vector< Event* > mEvents;
  42. // FileSystemChangeNotifier.
  43. virtual void internalProcessOnce();
  44. virtual bool internalAddNotification( const Torque::Path& dir );
  45. virtual bool internalRemoveNotification( const Torque::Path& dir );
  46. public:
  47. MacFileSystemChangeNotifier( MacFileSystem* fs );
  48. virtual ~MacFileSystemChangeNotifier();
  49. };
  50. /// Mac filesystem.
  51. class MacFileSystem : public Torque::Posix::PosixFileSystem
  52. {
  53. public:
  54. typedef Torque::Posix::PosixFileSystem Parent;
  55. MacFileSystem( String volume )
  56. : Parent( volume )
  57. {
  58. mChangeNotifier = new MacFileSystemChangeNotifier( this );
  59. }
  60. };
  61. #endif // !_MACCARBVOLUME_H_