1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: fs_FileOutputStream.h 4 5 Copyright (C)2009-2012 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: 46347 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_FS_FS_FILEOUTPUTSTREAM_H_ 17 #define NN_FS_FS_FILEOUTPUTSTREAM_H_ 18 19 #include <nn/fs/fs_IOutputStream.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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 */ 53 class FileOutputStream : public IOutputStream, public detail::FileBase, private nn::util::NonCopyable<FileOutputStream> 54 { 55 public: 56 57 /* Please see man pages for details 58 59 60 61 62 63 64 65 66 */ FileOutputStream()67 FileOutputStream() {} 68 69 /* Please see man pages for details 70 71 72 73 74 75 76 77 78 79 80 */ FileOutputStream(const wchar_t * pathName,bool createIfNotExist)81 FileOutputStream(const wchar_t* pathName, bool createIfNotExist) : 82 detail::FileBase(pathName, OPEN_MODE_WRITE | (createIfNotExist ? OPEN_MODE_CREATE : 0)) {} 83 84 /* Please see man pages for details 85 86 87 88 89 90 91 92 93 94 95 96 97 98 */ FileOutputStream(const char * pathName,bool createIfNotExist)99 FileOutputStream(const char* pathName, bool createIfNotExist) : 100 detail::FileBase(pathName, OPEN_MODE_WRITE | (createIfNotExist ? OPEN_MODE_CREATE : 0)) {} 101 102 /* Please see man pages for details 103 104 105 106 107 108 109 110 111 112 113 114 */ Initialize(const wchar_t * pathName,bool createIfNotExist)115 void Initialize(const wchar_t* pathName, bool createIfNotExist) 116 { detail::FileBase::Initialize(pathName, OPEN_MODE_WRITE | (createIfNotExist ? OPEN_MODE_CREATE : 0)); } 117 118 /* Please see man pages for details 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 */ Initialize(const char * pathName,bool createIfNotExist)134 void Initialize(const char* pathName, bool createIfNotExist) 135 { detail::FileBase::Initialize(pathName, OPEN_MODE_WRITE | (createIfNotExist ? OPEN_MODE_CREATE : 0)); } 136 137 /* Please see man pages for details 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 */ TryInitialize(const wchar_t * pathName,bool createIfNotExist)154 nn::Result TryInitialize(const wchar_t* pathName, bool createIfNotExist) 155 { return detail::FileBase::TryInitialize(pathName, OPEN_MODE_WRITE | (createIfNotExist ? OPEN_MODE_CREATE : 0)); } 156 157 /* Please see man pages for details 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 */ TryInitialize(const char * pathName,bool createIfNotExist)176 nn::Result TryInitialize(const char* pathName, bool createIfNotExist) 177 { return detail::FileBase::TryInitialize(pathName, OPEN_MODE_WRITE | (createIfNotExist ? OPEN_MODE_CREATE : 0)); } 178 179 /* Please see man pages for details 180 181 182 183 184 185 186 */ Finalize()187 void Finalize() { detail::FileBase::Finalize(); } 188 189 /* Please see man pages for details 190 191 192 193 194 195 196 */ ~FileOutputStream()197 virtual ~FileOutputStream() {} 198 199 /* Please see man pages for details 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 */ Write(const void * buffer,size_t size,bool flush)219 virtual s32 Write(const void* buffer, size_t size, bool flush) { return detail::FileBase::Write(buffer, size, flush); } 220 221 /* Please see man pages for details 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 */ TryWrite(s32 * pOut,const void * buffer,size_t size,bool flush)242 virtual Result TryWrite(s32* pOut, const void* buffer, size_t size, bool flush) { return detail::FileBase::TryWrite(pOut, buffer, size, flush); } 243 244 /* Please see man pages for details 245 246 247 248 249 250 251 252 253 254 */ Seek(s64 position,PositionBase base)255 virtual void Seek(s64 position, PositionBase base) { detail::FileBase::Seek(position, base); } 256 257 /* Please see man pages for details 258 259 260 261 262 263 264 265 266 */ TrySeek(s64 position,PositionBase base)267 virtual Result TrySeek(s64 position, PositionBase base) { return detail::FileBase::TrySeek(position, base); } 268 269 /* Please see man pages for details 270 271 272 273 */ GetPosition()274 virtual s64 GetPosition() const { return detail::FileBase::GetPosition(); } 275 276 /* Please see man pages for details 277 278 279 280 281 282 */ TryGetPosition(s64 * pOut)283 virtual Result TryGetPosition(s64* pOut) const { return detail::FileBase::TryGetPosition(pOut); } 284 285 /* Please see man pages for details 286 287 288 289 */ SetPosition(s64 position)290 virtual void SetPosition(s64 position) { detail::FileBase::SetPosition(position); } 291 292 /* Please see man pages for details 293 294 295 296 297 298 */ TrySetPosition(s64 position)299 virtual Result TrySetPosition(s64 position) { return detail::FileBase::TrySetPosition(position); } 300 301 /* Please see man pages for details 302 303 304 305 */ GetSize()306 virtual s64 GetSize() const { return detail::FileBase::GetSize(); } 307 308 /* Please see man pages for details 309 310 311 312 313 314 */ TryGetSize(s64 * pOut)315 virtual Result TryGetSize(s64* pOut) const { return detail::FileBase::TryGetSize(pOut); } 316 317 /* Please see man pages for details 318 319 320 321 */ SetSize(s64 size)322 virtual void SetSize(s64 size) { detail::FileBase::SetSize(size); } 323 324 /* Please see man pages for details 325 326 327 328 329 330 */ TrySetSize(s64 size)331 virtual Result TrySetSize(s64 size) { return detail::FileBase::TrySetSize(size); } 332 333 /* Please see man pages for details 334 335 336 */ Flush()337 virtual void Flush() { detail::FileBase::Flush(); } 338 339 /* Please see man pages for details 340 341 342 343 */ TryFlush()344 virtual Result TryFlush() { return detail::FileBase::TryFlush(); } 345 346 /* Please see man pages for details 347 348 349 350 351 352 353 354 */ SetPriority(s32 priority)355 void SetPriority(s32 priority) { detail::FileBase::SetPriority(priority); } 356 357 /* Please see man pages for details 358 359 360 361 362 363 364 365 366 367 */ TrySetPriority(s32 priority)368 Result TrySetPriority(s32 priority) { return detail::FileBase::TrySetPriority(priority); } 369 370 371 /* Please see man pages for details 372 373 374 375 376 377 378 379 380 */ GetPriority(s32 * pOut)381 void GetPriority(s32* pOut) const { detail::FileBase::GetPriority(pOut); } 382 383 /* Please see man pages for details 384 385 386 387 388 389 390 391 392 393 394 */ TryGetPriority(s32 * pOut)395 Result TryGetPriority(s32* pOut) const { return detail::FileBase::TryGetPriority(pOut); } 396 }; 397 398 }} 399 400 #endif 401