3535
3636int str_length (const char *str);
3737
38- /*
39- Function: str_timestamp
40- Copies a time stamp in the format year-month-day_hour-minute-second to the string.
41-
42- Parameters:
43- buffer - Pointer to a buffer that shall receive the time stamp string.
44- buffer_size - Size of the buffer.
45-
46- Remarks:
47- - Guarantees that buffer string will contain zero-termination.
48- */
4938void str_timestamp (char *buffer, int buffer_size);
5039void str_timestamp_format (char *buffer, int buffer_size, const char *format)
5140 GNUC_ATTRIBUTE((format(strftime, 3 , 0 )));
5241void str_timestamp_ex (time_t time, char *buffer, int buffer_size, const char *format)
5342 GNUC_ATTRIBUTE((format(strftime, 4 , 0 )));
5443
55- /*
56- Function: str_format
57- Performs printf formatting into a buffer.
58-
59- Parameters:
60- buffer - Pointer to the buffer to receive the formatted string.
61- buffer_size - Size of the buffer.
62- format - printf formatting string.
63- ... - Parameters for the formatting.
64-
65- Remarks:
66- - See the C manual for syntax for the printf formatting string.
67- - The strings are treated as zero-termineted strings.
68- - Guarantees that dst string will contain zero-termination.
69- */
7044void str_format (char *buffer, int buffer_size, const char *format, ...)
7145 GNUC_ATTRIBUTE((format(printf, 3 , 4 )));
7246
73- /* *
74- * Appends a string to another.
75- *
76- * @ingroup Strings
77- *
78- * @param dst Pointer to a buffer that contains a string.
79- * @param src String to append.
80- * @param dst_size Size of the buffer of the dst string.
81- *
82- * @remark The strings are treated as zero-terminated strings.
83- * @remark Guarantees that dst string will contain zero-termination.
84- */
8547void str_append (char *dst, const char *src, int dst_size);
8648
87- /* *
88- * Appends a string to a fixed-size array of chars.
89- *
90- * @ingroup Strings
91- *
92- * @param dst Array that shall receive the string.
93- * @param src String to append.
94- *
95- * @remark The strings are treated as zero-terminated strings.
96- * @remark Guarantees that dst string will contain zero-termination.
97- */
9849template <int N>
9950void str_append (char (&dst)[N], const char *src)
10051{
10152 str_append (dst, src, N);
10253}
10354
104- /* *
105- * Copies a string to another.
106- *
107- * @ingroup Strings
108- *
109- * @param dst Pointer to a buffer that shall receive the string.
110- * @param src String to be copied.
111- * @param dst_size Size of the buffer dst.
112- *
113- * @return Length of written string, even if it has been truncated
114- *
115- * @remark The strings are treated as zero-terminated strings.
116- * @remark Guarantees that dst string will contain zero-termination.
117- */
11855void str_copy (char *dst, const char *src, int dst_size);
11956
120- /* *
121- * Copies a string to a fixed-size array of chars.
122- *
123- * @ingroup Strings
124- *
125- * @param dst Array that shall receive the string.
126- * @param src String to be copied.
127- *
128- * @remark The strings are treated as zero-terminated strings.
129- * @remark Guarantees that dst string will contain zero-termination.
130- */
13157template <int N>
13258void str_copy (char (&dst)[N], const char *src)
13359{
13460 str_copy (dst, src, N);
13561}
13662
137- /* *
138- * Truncates a string to a given length.
139- *
140- * @ingroup Strings
141- *
142- * @param dst Pointer to a buffer that shall receive the string.
143- * @param dst_size Size of the buffer dst.
144- * @param src String to be truncated.
145- * @param truncation_len Maximum length of the returned string (not
146- * counting the zero termination).
147- *
148- * @remark The strings are treated as zero-terminated strings.
149- * @remark Guarantees that dst string will contain zero-termination.
150- */
15163void str_truncate (char *dst, int dst_size, const char *src, int truncation_len);
15264
153- /*
154- Function: dbg_msg
155-
156- Prints a debug message.
157-
158- Parameters:
159- sys - A string that describes what system the message belongs to
160- fmt - A printf styled format string.
161-
162- See Also:
163- <dbg_assert>
164- */
16565void dbg_msg (const char *sys, const char *fmt, ...)
16666 GNUC_ATTRIBUTE((format(printf, 2 , 3 )));
16767
16868void dbg_break ();
16969void dbg_assert_imp (const char *filename, int line, bool test, const char *msg);
17070
171- /* Group: Debug */
172- /*
173-
174- Function: dbg_assert
175- Breaks into the debugger based on a test.
176-
177- Parameters:
178- test - Result of the test.
179- msg - Message that should be printed if the test fails.
180-
181- See Also:
182- <dbg_break>
183- */
18471void dbg_assert (int test, const char *msg);
18572#define dbg_assert (test, msg ) dbg_assert_imp(__FILE__, __LINE__, test, msg)
18673
187- /* *
188- * @ingroup Debug
189- *
190- * Breaks into the debugger based on a test.
191- *
192- * @param test Result of the test.
193- * @param msg Message that should be printed if the test fails.
194- *
195- * @remark Also works in release mode.
196- *
197- * @see dbg_break
198- */
19974#define dbg_assert (test, msg ) dbg_assert_imp(__FILE__, __LINE__, test, msg)
20075void dbg_assert_imp (const char *filename, int line, bool test, const char *msg);
20176
@@ -205,18 +80,6 @@ std::wstring windows_utf8_to_wide(const char *str);
20580
20681int fs_file_time (const char *name, time_t *created, time_t *modified);
20782
208- /* *
209- * Checks if a file exists.
210- *
211- * @ingroup Filesystem
212- *
213- * @param path the path to check.
214- *
215- * @return 1 if a file with the given path exists,
216- * 0 on failure or if the file does not exist.
217- *
218- * @remark The strings are treated as zero-terminated strings.
219- */
22083int fs_is_file (const char *path);
22184
22285bool str_isnum (char c);
0 commit comments