Various utility functions.
More...
Various utility functions.
◆ async_main()
Run the passed in function as the main asynchronous function.
This starts the libuv event loop and sets up the asynchronous and exception effect handlers.
- Parameters
-
entry | The main asynchronous entry point. |
- Returns
- A possible error code or 0 on success.
◆ nodec_ends_with()
bool nodec_ends_with |
( |
const char * |
s, |
|
|
const char * |
postfix |
|
) |
| |
Does a string end with a postfix?
- Parameters
-
s | The string to analyze, can be NULL, in which case false is returned. |
postfix | The postfix to compare, can be NULL, in which case false is returned. |
- Returns
- True if the string ends with
postfix
.
◆ nodec_ends_withi()
bool nodec_ends_withi |
( |
const char * |
s, |
|
|
const char * |
postfix |
|
) |
| |
Does a string end with a postfix? Uses case-insensitive comparison.
- Parameters
-
s | The string to analyze, can be NULL, in which case false is returned. |
postfix | The postfix to compare, can be NULL, in which case false is returned. |
- Returns
- True if the string ends with
postfix
.
◆ nodec_inet_date()
const char* nodec_inet_date |
( |
time_t |
now | ) |
|
Format a time as a RFC1123 internet date.
Caches previous results to increase efficiency.
- Parameters
-
- Returns
- The current time in RFC1123 format, for example
Thu, 01 Jan 1972 00:00:00 GMT
.
◆ nodec_inet_date_now()
const char* nodec_inet_date_now |
( |
| ) |
|
Get the current time as a RFC1123 internet date.
Caches previous results to increase efficiency.
- Returns
- The current time in RFC1123 format, for example
Thu, 01 Jan 1972 00:00:00 GMT
.
◆ nodec_parse_inet_date()
bool nodec_parse_inet_date |
( |
const char * |
date, |
|
|
time_t * |
t |
|
) |
| |
Parse a RFC1123 internet date.
- Parameters
-
| date | A RFC1123 formatted internet date, for example Thu, 01 Jan 1972 00:00:00 GMT . Can be NULL which is treated as an invalid date. |
[out] | t | Set to the time according to date . If the date was not valid, the UNIX epoch is used. |
- Returns
- True if successful.
◆ nodec_starts_with()
bool nodec_starts_with |
( |
const char * |
s, |
|
|
const char * |
prefix |
|
) |
| |
Does a string start with a prefix?
- Parameters
-
s | The string to analyze, can be NULL, in which case false is returned. |
prefix | The prefix to compare, can be NULL, in which case false is returned. |
- Returns
- True if the string starts with
prefix
.
◆ nodec_starts_withi()
bool nodec_starts_withi |
( |
const char * |
s, |
|
|
const char * |
prefix |
|
) |
| |
Does a string start with a prefix? Uses case-insensitive comparison.
- Parameters
-
s | The string to analyze, can be NULL, in which case false is returned. |
prefix | The prefix to compare, can be NULL, in which case false is returned. |
- Returns
- True if the string starts with
prefix
.
◆ nodec_throw()
void nodec_throw |
( |
int |
err | ) |
|
Throw an error, either an errno
or uv_errno_t
.
- Parameters
-
◆ nodec_throw_msg()
void nodec_throw_msg |
( |
int |
err, |
|
|
const char * |
msg |
|
) |
| |
Throw an error, either an errno
or uv_errno_t
.
- Parameters
-
err | error code. |
msg | custom message. |