1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     fslow_IArchive.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: 20645 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_FSLOW_FSLOW_IFILE_H_
17 #define NN_FSLOW_FSLOW_IFILE_H_
18 
19 #include <nn/types.h>
20 #include <nn/Result.h>
21 #include <nn/fs/fs_Result.h>
22 #include <nn/fs/fs_Parameters.h>
23 #include <nn/fslow/fslow_Common.h>
24 
25 namespace nn { namespace fslow {
26 
27 template <class TArchiveTypeInfo>
28 class IFile
29 {
30 public:
31     virtual Result Close() = 0;
32     virtual Result ReadBytes(s32* pRead, s64 offset, void* buffer, size_t size) = 0;
33     virtual Result WriteBytes(s32* pWritten, s64 offset, const void* buffer, size_t size) = 0;
34     virtual Result GetSize(s64* pOut) = 0;
35     virtual Result SetSize(s64 size) = 0;
36     virtual Result GetAttributes(nn::fs::Attributes* pOut) = 0;
37     virtual Result SetAttributes(nn::fs::Attributes attributes) = 0;
38 protected:
~IFile()39     virtual ~IFile() {}
40 };
41 
42 template <class TBase>
43 class ReadOnlyFileBase : public TBase
44 {
45 public:
WriteBytes(s32 *,s64,const void *,size_t)46     virtual Result WriteBytes(s32*, s64, const void*, size_t) { return nn::fs::ResultUnsupportedOperation(); }
SetSize(s64)47     virtual Result SetSize(s64) { return nn::fs::ResultUnsupportedOperation(); }
SetAttributes(nn::fs::Attributes)48     virtual Result SetAttributes(nn::fs::Attributes) { return nn::fs::ResultUnsupportedOperation(); }
49 };
50 
51 }}
52 
53 #endif
54