You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/index.md
+35-28Lines changed: 35 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,96 +4,103 @@ description: A complete reference of the cpj path library for C/C++.
4
4
---
5
5
6
6
## Basics
7
+
7
8
These are some basic, helpful functions available in the library. The basename is the last portion of the path which determines the name of the file or folder which is being pointed to. For instance, the path ``/var/log/test.txt`` would have the basename ``test.txt``. The dirname is the opposite - the path up to the basename. In that example the dirname would be ``/var/log``.
8
9
9
10
### Functions
10
-
***[cpj_path_get_basename_test]({{ site.baseurl }}{% link reference/cpj_path_get_basename_test.md %})**
11
+
12
+
***[cpj_path_get_basename_test]({{ site.baseurl }}{% link reference/cpj_path_get_basename_test.md %})**
11
13
Gets the basename of a file path.
12
14
13
-
***[cpj_path_change_basename_test]({{ site.baseurl }}{% link reference/cpj_path_change_basename_test.md %})**
15
+
***[cpj_path_change_basename_test]({{ site.baseurl }}{% link reference/cpj_path_change_basename_test.md %})**
14
16
Changes the basename of a file path.
15
17
16
-
***[cpj_path_get_dirname_test]({{ site.baseurl }}{% link reference/cpj_path_get_dirname_test.md %})**
18
+
***[cpj_path_get_dirname_test]({{ site.baseurl }}{% link reference/cpj_path_get_dirname_test.md %})**
17
19
Gets the dirname of a file path.
18
20
19
-
***[cpj_path_get_root]({{ site.baseurl }}{% link reference/cpj_path_get_root.md %})**
21
+
***[cpj_path_get_root]({{ site.baseurl }}{% link reference/cpj_path_get_root.md %})**
20
22
Determines the root of a path.
21
23
22
-
***[cpj_path_change_root_test]({{ site.baseurl }}{% link reference/cpj_path_change_root_test.md %})**
24
+
***[cpj_path_change_root_test]({{ site.baseurl }}{% link reference/cpj_path_change_root_test.md %})**
23
25
Changes the root of a path.
24
26
25
-
***[cpj_path_is_absolute]({{ site.baseurl }}{% link reference/cpj_path_is_absolute.md %})**
27
+
***[cpj_path_is_absolute]({{ site.baseurl }}{% link reference/cpj_path_is_absolute.md %})**
26
28
Determine whether the path is absolute or not.
27
29
28
-
***[cpj_path_is_relative]({{ site.baseurl }}{% link reference/cpj_path_is_relative.md %})**
30
+
***[cpj_path_is_relative]({{ site.baseurl }}{% link reference/cpj_path_is_relative.md %})**
29
31
Determine whether the path is relative or not.
30
32
31
-
***[cpj_path_join_test]({{ site.baseurl }}{% link reference/cpj_path_join_test.md %})**
33
+
***[cpj_path_join_test]({{ site.baseurl }}{% link reference/cpj_path_join_test.md %})**
32
34
Joins two paths together.
33
35
34
-
***[cpj_path_join_multiple_test]({{ site.baseurl }}{% link reference/cpj_path_join_multiple_test.md %})**
36
+
***[cpj_path_join_multiple_test]({{ site.baseurl }}{% link reference/cpj_path_join_multiple_test.md %})**
35
37
Joins multiple paths together.
36
38
37
-
***[cpj_path_normalize_test]({{ site.baseurl }}{% link reference/cpj_path_normalize_test.md %})**
39
+
***[cpj_path_normalize_test]({{ site.baseurl }}{% link reference/cpj_path_normalize_test.md %})**
38
40
Creates a normalized version of the path.
39
41
40
-
***[cpj_path_intersection]({{ site.baseurl }}{% link reference/cpj_path_intersection.md %})**
42
+
***[cpj_path_intersection]({{ site.baseurl }}{% link reference/cpj_path_intersection.md %})**
41
43
Finds common portions in two paths.
42
44
43
45
## Navigation
46
+
44
47
One might specify paths containing relative components ``../``. These functions help to resolve or create relative paths based on a base path.
45
48
46
49
### Functions
47
-
***[cpj_path_get_absolute_test]({{ site.baseurl }}{% link reference/cpj_path_get_absolute_test.md %})**
50
+
51
+
***[cpj_path_get_absolute_test]({{ site.baseurl }}{% link reference/cpj_path_get_absolute_test.md %})**
48
52
Generates an absolute path based on a base.
49
53
50
-
***[cpj_path_get_relative_test]({{ site.baseurl }}{% link reference/cpj_path_get_relative_test.md %})**
54
+
***[cpj_path_get_relative_test]({{ site.baseurl }}{% link reference/cpj_path_get_relative_test.md %})**
51
55
Generates a relative path based on a base.
52
56
53
57
## Extensions
58
+
54
59
Extensions are the portion of a path which come after a `.`. For instance, the file extension of the ``/var/log/test.txt`` would be ``.txt`` - which indicates that the content is text.
55
60
56
61
### Functions
57
-
***[cpj_path_get_extension_test]({{ site.baseurl }}{% link reference/cpj_path_get_extension_test.md %})**
58
-
Gets the extension of a file path.
59
62
60
-
***[cpj_path_has_extension_test]({{ site.baseurl }}{% link reference/cpj_path_has_extension_test.md %})**
61
-
Determines whether the file path has an extension.
63
+
***[cpj_path_get_extension]({{ site.baseurl }}{% link reference/cpj_path_get_extension.md %})**
64
+
Gets the extension of a file path.
62
65
63
-
***[cpj_path_change_extension_test]({{ site.baseurl }}{% link reference/cpj_path_change_extension_test.md %})**
66
+
***[cpj_path_change_extension_test]({{ site.baseurl }}{% link reference/cpj_path_change_extension_test.md %})**
64
67
Changes the extension of a file path.
65
68
66
69
## Segments
70
+
67
71
A segment represents a single component of a path. For instance, on linux a path might look like this ``/var/log/``, which consists of two segments ``var`` and ``log``.
68
72
69
73
### Functions
70
-
***[cpj_path_get_first_segment]({{ site.baseurl }}{% link reference/cpj_path_get_first_segment.md %})**
74
+
75
+
***[cpj_path_get_first_segment]({{ site.baseurl }}{% link reference/cpj_path_get_first_segment.md %})**
71
76
Gets the first segment of a path.
72
77
73
-
***[cpj_path_get_last_segment]({{ site.baseurl }}{% link reference/cpj_path_get_last_segment.md %})**
78
+
***[cpj_path_get_last_segment]({{ site.baseurl }}{% link reference/cpj_path_get_last_segment.md %})**
74
79
Gets the last segment of the path.
75
80
76
-
***[cpj_path_get_next_segment]({{ site.baseurl }}{% link reference/cpj_path_get_next_segment.md %})**
81
+
***[cpj_path_get_next_segment]({{ site.baseurl }}{% link reference/cpj_path_get_next_segment.md %})**
77
82
Advances to the next segment.
78
83
79
-
***[cpj_path_get_previous_segment]({{ site.baseurl }}{% link reference/cpj_path_get_previous_segment.md %})**
84
+
***[cpj_path_get_previous_segment]({{ site.baseurl }}{% link reference/cpj_path_get_previous_segment.md %})**
80
85
Moves to the previous segment.
81
86
82
-
***[cpj_path_get_segment_type]({{ site.baseurl }}{% link reference/cpj_path_get_segment_type.md %})**
87
+
***[cpj_path_get_segment_type]({{ site.baseurl }}{% link reference/cpj_path_get_segment_type.md %})**
83
88
Gets the type of the submitted path segment.
84
89
85
-
***[cpj_path_change_segment]({{ site.baseurl }}{% link reference/cpj_path_change_segment.md %})**
90
+
***[cpj_path_change_segment]({{ site.baseurl }}{% link reference/cpj_path_change_segment.md %})**
86
91
Changes the content of a segment.
87
92
88
93
## Style
94
+
89
95
The path style describes how paths are generated and parsed. **cpj** currently supports two path styles, ``CPJ_STYLE_WINDOWS`` and ``CPJ_STYLE_UNIX``.
90
96
91
97
### Functions
92
-
***[cpj_path_guess_style_test]({{ site.baseurl }}{% link reference/cpj_path_guess_style_test.md %})**
98
+
99
+
***[cpj_path_guess_style]({{ site.baseurl }}{% link reference/cpj_path_guess_style.md %})**
93
100
Guesses the path style.
94
101
95
-
***[cpj_path_set_style]({{ site.baseurl }}{% link reference/cpj_path_set_style.md %})**
102
+
***[cpj_path_set_style]({{ site.baseurl }}{% link reference/cpj_path_set_style.md %})**
96
103
Configures which path style is used.
97
104
98
-
***[cpj_path_get_style]({{ site.baseurl }}{% link reference/cpj_path_get_style.md %})**
99
-
Gets the path style configuration.
105
+
***[cpj_path_get_style]({{ site.baseurl }}{% link reference/cpj_path_get_style.md %})**
0 commit comments