path.hpp

Go to the documentation of this file.
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__PATH_HPP__
00018 #define __DERS__PATH_HPP__
00019 
00020 #include <ders/config.hpp>
00021 #include <vector>
00022 #include <ders/text.hpp>
00023 
00024 namespace ders {  // ::ders
00025 
00029 struct path_elmt {
00031        enum type {
00032             drive,  // "A:"            : drive [root] [name ...]
00033             name,   // "name"          : name [name ...]
00034             root,   // "\"             : root [name ...]
00035             share   // "\\server\share": share [name ...]
00036        };
00037 
00038        type tp;
00039        ch_rng nm;
00040 
00041        path_elmt(type t, const ch_rng& n) : tp(t), nm(n) {}
00042 };
00043 
00047 extern const char pathSepr;
00048 
00055 void parse_path(mem_pool& mp, const ch_rng& path, std::vector<path_elmt>& ret);
00056 
00065 sh_text make_path(mem_pool& mp, const path_elmt* beg, const path_elmt* end, char
00066   spr=pathSepr);
00067 
00074 sh_text normalize_path(mem_pool& mp, const ch_rng& path);
00075 
00082 sh_text get_path(mem_pool& mp, const ch_rng& path);
00083 
00090 sh_text get_name(mem_pool& mp, const ch_rng& path);
00091 
00092 }  // namespace ::ders
00093 
00094 #endif  // __DERS__PATH_HPP__
00095 

Generated on Tue Dec 8 11:35:32 2009 for derslib by  doxygen 1.5.5