acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
file_path.h
1#pragma once
2
3
11
12
13#include "acme/constant/path.h"
14
15
16//CLASS_DECL_ACME bool is_url(const ::scoped_string & scopedstrUrl);
17
18
19CLASS_DECL_ACME ::string file_path_name(const ::scoped_string & path);
20CLASS_DECL_ACME ::string file_path_final_extension(const ::scoped_string & path);
21CLASS_DECL_ACME ::string file_path_all_extensions(const ::scoped_string & path);
22CLASS_DECL_ACME ::string file_path_folder(const ::scoped_string & scopedstrPath);
23CLASS_DECL_ACME ::string file_path_title(const ::scoped_string & scopedstrPath);
24
25CLASS_DECL_ACME bool file_path_is_relative(const ::scoped_string & scopedstr);
26CLASS_DECL_ACME bool file_path_is_absolute(const ::scoped_string & scopedstr);
27
28
29CLASS_DECL_ACME bool file_path_is_dots(const ::scoped_string & scopedstr);
30
31CLASS_DECL_ACME bool file_path_is_equal(const ::file::path & path1, const ::file::path & path2);
32
33CLASS_DECL_ACME string url_dir_name_for_relative(const ::file::path & path);
34
35CLASS_DECL_ACME bool solve_relative_inplace(string & str, bool & bUrl, bool & bOnlyNativeFileSep, strsize_array & iaSlash);
36CLASS_DECL_ACME string solve_relative(const ::scoped_string & scopedstrParam, bool * pbUrl = nullptr);
37CLASS_DECL_ACME string defer_solve_relative(const ::scoped_string & scopedstrRelative, const ::scoped_string & scopedstrAbsolute);
38
39inline ::i8 file_path_separator(enum_path epath);
40
41inline const_char_pointer file_path_separator_sz(enum_path epath);
42
43inline ::i8 file_path_other_separator(enum_path epath);
44
45CLASS_DECL_ACME enum_path file_path_get_type(const ::scoped_string & scopedstr, enum_path epathForce = e_path_none);
46
47CLASS_DECL_ACME string file_path_normalize(const ::scoped_string & scopedstrPath, enum_path epath = e_path_none);
48
49CLASS_DECL_ACME bool file_path_normalize_inline(string & strPath, enum_path & epath);
50
51
52
53
54
55
56
57
58
59inline ::i8 file_path_separator(enum_path epath)
60{
61
62#ifdef WINDOWS
63
64 return epath == e_path_file ? '\\' : '/';
65
66#else
67
68 return '/';
69
70#endif
71
72}
73
74
75inline const_char_pointer file_path_separator_sz(enum_path epath)
76{
77
78#ifdef WINDOWS
79
80 return epath == e_path_file ? "\\" : "/";
81
82#else
83
84 return "/";
85
86#endif
87
88}
89
90inline ::i8 file_path_other_separator(enum_path epath)
91{
92
93#ifdef WINDOWS
94
95 return epath == e_path_file ? '/' : '\\';
96
97#else
98
99 return '\\';
100
101#endif
102
103}
104
105
106