winVolume.h

Engine/source/platformWin32/winVolume.h

More...

Classes:

Namespaces:

namespace
namespace

Detailed Description

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#ifndef _WINVOLUME_H_
 25#define _WINVOLUME_H_
 26
 27#ifndef _VOLUME_H_
 28#include "core/volume.h"
 29#endif
 30
 31namespace Torque
 32{
 33using namespace FS;
 34
 35namespace Win32
 36{
 37
 38//-----------------------------------------------------------------------------
 39
 40class Win32FileSystem: public FileSystem
 41{
 42public:
 43   Win32FileSystem(String volume);
 44   ~<a href="/coding/class/classtorque_1_1win32_1_1win32filesystem/">Win32FileSystem</a>();
 45
 46   String   getTypeStr() const { return "Win32"; }
 47
 48   FileNodeRef resolve(const Path& path);
 49   void verifyCompatibility(const Path& _path, WIN32_FIND_DATAW _info);
 50   FileNodeRef create(const Path& path,FileNode::Mode);
 51   bool remove(const Path& path);
 52   bool rename(const Path& from,const Path& to);
 53   Path mapTo(const Path& path);
 54   Path mapFrom(const Path& path);
 55
 56private:
 57   String mVolume;
 58};
 59
 60
 61//-----------------------------------------------------------------------------
 62/// Win32 stdio file access.
 63/// This class makes use the fopen, fread and fwrite for buffered io.
 64class Win32File: public File
 65{
 66public:
 67   ~<a href="/coding/class/classtorque_1_1win32_1_1win32file/">Win32File</a>();
 68
 69   Path getName() const;
 70   NodeStatus getStatus() const;
 71   bool getAttributes(Attributes*);
 72   U64 getSize();
 73
 74   U32 getPosition();
 75   U32 setPosition(U32,SeekMode);
 76
 77   bool open(AccessMode);
 78   bool close();
 79
 80   U32 read(void* dst, U32 size);
 81   U32 write(const void* src, U32 size);
 82
 83private:
 84   friend class Win32FileSystem;
 85
 86   U32 calculateChecksum();
 87
 88   Path     mPath;
 89   String   mName;
 90   void     *mHandle;
 91   NodeStatus   mStatus;
 92
 93   Win32File(const Path &path, String name);
 94
 95   bool _updateInfo();
 96   void _updateStatus();
 97};
 98
 99
100//-----------------------------------------------------------------------------
101
102class Win32Directory: public Directory
103{
104public:
105   ~<a href="/coding/class/classtorque_1_1win32_1_1win32directory/">Win32Directory</a>();
106
107   Path getName() const;
108   NodeStatus getStatus() const;
109   bool getAttributes(Attributes*);
110
111   bool open();
112   bool close();
113   bool read(Attributes*);
114
115private:
116   friend class Win32FileSystem;
117
118   U32 calculateChecksum();
119
120   Path     mPath;
121   String   mName;
122   void     *mHandle;
123   NodeStatus   mStatus;
124
125   Win32Directory(const Path &path,String name);
126
127   void _updateStatus();
128};
129
130} // Namespace
131} // Namespace
132#endif
133