/*---------------------------------------------------------------------------* Project: Horizon File: fs_DirectoryBase.h Copyright (C)2009 Nintendo Co., Ltd. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Rev: 30789 $ *---------------------------------------------------------------------------*/ #ifndef NN_FS_CTR_MPCORE_FS_DIRECTORYBASE_H_ #define NN_FS_CTR_MPCORE_FS_DIRECTORYBASE_H_ #include #include #include #include #include #include #include namespace nn { namespace fs { namespace detail { class DirectoryBaseImpl : private nn::util::NonCopyable, private nn::fs::CTR::MPCore::detail::UserFileSystem { protected: DirectoryBaseImpl() : m_P(0) {} Result TryInitialize(const wchar_t* path) { return TryOpenDirectory(&m_P, path); } Result TryInitializeRaw(ArchiveHandle handle, const nn::fs::CTR::MPCore::Path& path) { return UserFileSystem::TryOpenDirectoryRaw(&m_P, handle, path); } void Finalize() { UserFileSystem::CloseDirectory(m_P); this->m_P = 0; } ~DirectoryBaseImpl() { Finalize(); } Result TryRead(s32* pOut, DirectoryEntry pEntries[], s32 numEntries) { return UserFileSystem::TryReadDirectory(pOut, m_P, pEntries, numEntries); } private: void* m_P; bool IsInitialized() const { return m_P != 0; } }; }}} #endif