00001 /* 00002 * Copyright (C) Sergey P. Derevyago, 2008-2009. 00003 * 00004 * Permission to copy, use, modify, sell and distribute this software is granted 00005 * provided this copyright notice appears in all copies. 00006 * This software is provided "as is" without express or implied warranty, and 00007 * with no claim as to its suitability for any purpose. 00008 * 00009 */ 00010 00017 #ifndef __DERS__DIR_HPP__ 00018 #define __DERS__DIR_HPP__ 00019 00020 #include <ders/config.hpp> 00021 #include <ders/error.hpp> 00022 00023 namespace ders { // ::ders 00024 00028 class dir : virtual public destroyable { 00029 public: 00031 struct entry { 00032 sh_text name; 00033 bool isdir; 00034 unsigned long size; 00035 00036 entry(mem_pool& mp) : name(nt(mp)), isdir(false), size(0) {} 00037 }; 00038 00039 virtual bool find_next(entry& dent)=0; 00040 virtual sh_text full_name(const entry& dent)=0; 00041 }; 00042 00043 typedef sh_ptr<dir> sh_dir; 00044 00051 sh_dir new_dir(mem_pool& mp, const ch_rng& dname); 00052 00053 error make_dir(mem_pool& mp, const ch_rng& dname); 00054 error make_dirs(mem_pool& mp, const ch_rng& dname); 00055 00056 void ex_make_dir(mem_pool& mp, const ch_rng& dname); 00057 void ex_make_dirs(mem_pool& mp, const ch_rng& dname); 00058 00059 } // namespace ::ders 00060 00061 #endif // __DERS__DIR_HPP__ 00062