added qse_str_to_ntime() and similar functions.

relocated cli error codes into the new enum type qse_cli_error_code_t
This commit is contained in:
2018-10-16 15:53:08 +00:00
parent 80ceed7bb2
commit 2915a591f0
3 changed files with 137 additions and 9 deletions

View File

@ -69,11 +69,15 @@ struct qse_opt_t
#define QSE_CLI_OPTNAME (1 << 0)
#define QSE_CLI_OPTVAL (1 << 1)
#define QSE_CLI_ERROR_INVALID_OPTNAME 1
#define QSE_CLI_ERROR_MISSING_OPTNAME 2
#define QSE_CLI_ERROR_REDUNDANT_OPTVAL 3
#define QSE_CLI_ERROR_MISSING_OPTVAL 4
#define QSE_CLI_ERROR_MEMORY 5
enum qse_cli_error_code_t
{
QSE_CLI_ERROR_INVALID_OPTNAME = 1,
QSE_CLI_ERROR_MISSING_OPTNAME = 2,
QSE_CLI_ERROR_REDUNDANT_OPTVAL = 3,
QSE_CLI_ERROR_MISSING_OPTVAL = 4,
QSE_CLI_ERROR_MEMORY = 5
};
typedef enum qse_cli_error_code_t qse_cli_error_code_t;
typedef struct qse_cli_opt_t qse_cli_opt_t;
typedef struct qse_cli_t qse_cli_t;
@ -89,10 +93,10 @@ struct qse_cli_opt_t
};
typedef int (*qse_cli_errcb_t) (
qse_cli_t* cli,
int code,
const qse_char_t* qname,
const qse_char_t* qval
qse_cli_t* cli,
qse_cli_error_code_t code,
const qse_char_t* qname,
const qse_char_t* qval
);
struct qse_cli_data_t

View File

@ -221,6 +221,28 @@ QSE_EXPORT void qse_subtime (
qse_ntime_t* z
);
/**
* The qse_strtontime() function converts a numeric text to the numeric time.
* seconds.nanoseconds
* 10.231
*/
QSE_EXPORT int qse_mbs_to_ntime (
const qse_mchar_t* text,
qse_ntime_t* ntime
);
QSE_EXPORT int qse_wcs_to_ntime (
const qse_wchar_t* text,
qse_ntime_t* ntime
);
#if defined(QSE_CHAR_IS_MCHAR)
# define qse_str_to_ntime(text,ntime) qse_mbs_to_ntime(text,ntime)
#else
# define qse_str_to_ntime(text,ntime) qse_wcs_to_ntime(text,ntime)
#endif
#if defined(__cplusplus)
}
#endif