1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: fs_FileInputStream.h 4 5 Copyright (C)2009 Nintendo Co., Ltd. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 36045 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_FS_FS_FILEINPUTSTREAM_H_ 17 #define NN_FS_FS_FILEINPUTSTREAM_H_ 18 19 #include <nn/fs/fs_IInputStream.h> 20 #include <nn/fs/fs_FileBase.h> 21 #include <nn/fnd/fnd_Storage.h> 22 23 namespace nn { namespace fs { 24 25 /* Please see man pages for details 26 27 28 29 30 31 32 33 34 35 */ 36 class FileInputStream : public IInputStream, public detail::FileBase, private nn::util::NonCopyable<FileInputStream> 37 { 38 public: 39 40 /* Please see man pages for details 41 42 43 44 45 46 47 48 */ FileInputStream()49 FileInputStream() {} 50 51 /* Please see man pages for details 52 53 54 55 56 57 58 59 */ FileInputStream(const wchar_t * pathName)60 explicit FileInputStream(const wchar_t* pathName) : detail::FileBase(pathName, OPEN_MODE_READ) {} 61 62 /* Please see man pages for details 63 64 65 66 67 68 69 70 71 72 73 */ FileInputStream(const char * pathName)74 explicit FileInputStream(const char* pathName) : detail::FileBase(pathName, OPEN_MODE_READ) {} 75 76 /* Please see man pages for details 77 78 79 80 81 82 83 84 85 */ Initialize(const wchar_t * pathName)86 void Initialize(const wchar_t* pathName) { detail::FileBase::Initialize(pathName, OPEN_MODE_READ); } 87 88 /* Please see man pages for details 89 90 91 92 93 94 95 96 97 98 99 100 */ Initialize(const char * pathName)101 void Initialize(const char* pathName) { detail::FileBase::Initialize(pathName, OPEN_MODE_READ); } 102 103 /* Please see man pages for details 104 105 106 107 108 109 110 111 112 113 114 115 116 */ TryInitialize(const wchar_t * pathName)117 Result TryInitialize(const wchar_t* pathName) { return detail::FileBase::TryInitialize(pathName, OPEN_MODE_READ); } 118 119 /* Please see man pages for details 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 */ TryInitialize(const char * pathName)136 Result TryInitialize(const char* pathName) { return detail::FileBase::TryInitialize(pathName, OPEN_MODE_READ); } 137 138 /* Please see man pages for details 139 140 141 142 */ Finalize()143 void Finalize() { detail::FileBase::Finalize(); } 144 145 /* Please see man pages for details 146 147 148 149 */ ~FileInputStream()150 virtual ~FileInputStream() {} 151 152 /* Please see man pages for details 153 154 155 156 157 158 159 160 161 162 163 164 */ Read(void * buffer,size_t size)165 virtual s32 Read(void* buffer, size_t size) { return detail::FileBase::Read(buffer, size); } 166 167 /* Please see man pages for details 168 169 170 171 172 173 174 175 176 177 178 179 180 */ TryRead(s32 * pOut,void * buffer,size_t size)181 virtual Result TryRead(s32* pOut, void* buffer, size_t size) { return detail::FileBase::TryRead(pOut, buffer, size); } 182 183 /* Please see man pages for details 184 185 186 187 188 189 190 */ Seek(s64 position,PositionBase base)191 virtual void Seek(s64 position, PositionBase base) { detail::FileBase::Seek(position, base); } 192 193 /* Please see man pages for details 194 195 196 197 198 199 200 201 202 */ TrySeek(s64 position,PositionBase base)203 virtual Result TrySeek(s64 position, PositionBase base) { return detail::FileBase::TrySeek(position, base); } 204 205 /* Please see man pages for details 206 207 208 209 */ GetPosition()210 virtual s64 GetPosition() const { return detail::FileBase::GetPosition(); } 211 212 /* Please see man pages for details 213 214 215 216 217 218 */ TryGetPosition(s64 * pOut)219 virtual Result TryGetPosition(s64* pOut) const { return detail::FileBase::TryGetPosition(pOut); } 220 221 /* Please see man pages for details 222 223 224 225 226 227 228 */ SetPosition(s64 position)229 virtual void SetPosition(s64 position) { detail::FileBase::SetPosition(position); } 230 231 /* Please see man pages for details 232 233 234 235 236 237 */ TrySetPosition(s64 position)238 virtual Result TrySetPosition(s64 position) { return detail::FileBase::TrySetPosition(position); } 239 240 /* Please see man pages for details 241 242 243 244 */ GetSize()245 virtual s64 GetSize() const { return detail::FileBase::GetSize(); } 246 247 /* Please see man pages for details 248 249 250 251 252 253 */ TryGetSize(s64 * pOut)254 virtual Result TryGetSize(s64* pOut) const { return detail::FileBase::TryGetSize(pOut); } 255 }; 256 257 }} 258 259 #endif 260