virtual_directory.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2011 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Magnus Norddahl
00027 **    Harry Storbacka
00028 */
00029 
00032 
00033 #pragma once
00034 
00035 #include "../api_core.h"
00036 #include "../System/sharedptr.h"
00037 #include "file.h"
00038 
00039 class CL_IODevice;
00040 class CL_VirtualFileSystem;
00041 class CL_VirtualDirectory_Impl;
00042 class CL_VirtualDirectoryListing;
00043 
00047 class CL_API_CORE CL_VirtualDirectory
00048 {
00051 
00052 public:
00054 
00056         CL_VirtualDirectory();
00057 
00059 
00061         CL_VirtualDirectory(const CL_VirtualFileSystem &file_system, const CL_String &base_path);
00062 
00063         ~CL_VirtualDirectory();
00064 
00068 
00069 public:
00071 
00072         CL_VirtualFileSystem get_file_system();
00073 
00075 
00078         const CL_String &get_path() const;
00079 
00081 
00082         CL_VirtualDirectoryListing get_directory_listing();
00083 
00088         CL_String get_identifier() const;
00089 
00093 
00094 public:
00096 
00098         CL_VirtualDirectory open_directory(const CL_String &path);
00099 
00101 
00109         CL_IODevice open_file(
00110                 const CL_String &filename,
00111                 CL_File::OpenMode mode = CL_File::open_existing,
00112                 unsigned int access = CL_File::access_read | CL_File::access_write,
00113                 unsigned int share = CL_File::share_all,
00114                 unsigned int flags = 0);
00115 
00117         CL_IODevice open_file_read(
00118                 const CL_String &filename) const;
00119 
00121 
00125         CL_String make_path_absolute(const CL_String &relative_path) const;
00126 
00128 
00132         CL_String make_path_relative(const CL_String &absolute_path) const;
00133 
00135 
00143         void mount(const CL_String &mount_point, CL_VirtualFileSystem &fs);
00144 
00146 
00151         void mount(const CL_String &mount_point, const CL_String &path);
00152 
00154 
00156         void unmount(const CL_String &mount_point);
00157 
00161 
00162 private:
00163         CL_SharedPtr<CL_VirtualDirectory_Impl> impl;
00165 };
00166