improved sed error handling

This commit is contained in:
2009-08-26 21:03:51 +00:00
parent 1f29eb2521
commit cefda5ffc6
8 changed files with 176 additions and 153 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: Sed.hpp 258 2009-08-19 14:04:15Z hyunghwan.chung $
* $Id: Sed.hpp 269 2009-08-26 03:03:51Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -36,8 +36,10 @@ QSE_BEGIN_NAMESPACE(QSE)
class Sed: public Mmgr
{
public:
/// Type sed_t type redefines a stream editor type
/// The sed_t type redefines a stream editor type
typedef qse_sed_t sed_t;
/// The loc_t type redefines the location type
typedef qse_sed_loc_t loc_t;
/// The errnum_t type redefines an error number type
typedef qse_sed_errnum_t errnum_t;
/// The errstr_t type redefines an error formattering string getter type
@ -138,11 +140,12 @@ public:
const char_t* getErrorMessage() const;
/**
* The getErrorLine() function gets the number of the line where
* the last error occurred. It returns 0 if the stream editor has
* not been initialized with the open() function.
* The getErrorLocation() function gets the location where
* the last error occurred. The line and the column of the ::loc_t
* structure retruend are 0 if the stream editor has not been
* initialized with the open() function.
*/
size_t getErrorLine () const;
loc_t getErrorLocation () const;
/**
* The getErrorNumber() function gets the number of the last
@ -155,9 +158,10 @@ public:
* The setError() function sets information on an error occurred.
*/
void setError (
errnum_t err, ///< an error number
const cstr_t* args = QSE_NULL, ///< strings for formatting an error message
size_t lin = 0 ///< a line number
errnum_t num, ///< error number
const cstr_t* args = QSE_NULL, ///< string array for formatting
/// an error message
const loc_t* loc = QSE_NULL ///< error location
);
/**

View File

@ -1,5 +1,5 @@
/*
* $Id: sed.h 268 2009-08-25 13:07:54Z hyunghwan.chung $
* $Id: sed.h 269 2009-08-26 03:03:51Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -304,11 +304,11 @@ qse_sed_errnum_t qse_sed_geterrnum (
);
/**
* The qse_sed_geterrlin() function gets the number of the line where
* the last error has occurred.
* @return the line number of the last error
* The qse_sed_geterrloc() function gets the location where the last error
* has occurred.
* @return error location
*/
qse_size_t qse_sed_geterrlin (
const qse_sed_loc_t* qse_sed_geterrloc (
qse_sed_t* sed /**< stream editor */
);
@ -321,15 +321,15 @@ const qse_char_t* qse_sed_geterrmsg (
);
/**
* The qse_sed_geterror() function gets an error number, an error line, and
* an error message. The information is set to the memory area pointed to by
* each parameter.
* The qse_sed_geterror() function gets an error number, an error location,
* and an error message. The information is set to the memory area pointed
* to by each parameter.
*/
void qse_sed_geterror (
qse_sed_t* sed, /**< stream editor */
qse_sed_errnum_t* errnum, /**< pointer to an error number holder */
qse_size_t* errlin, /**< pointer to an error line holder */
const qse_char_t** errmsg /**< pointer to an error message */
qse_sed_errnum_t* errnum, /**< error number */
const qse_char_t** errmsg, /**< error message */
qse_sed_loc_t* errloc /**< error location */
);
/**
@ -347,22 +347,23 @@ void qse_sed_seterrnum (
* message for a given error number.
*/
void qse_sed_seterrmsg (
qse_sed_t* sed, /**< stream editor */
qse_sed_errnum_t errnum, /**< error number */
const qse_char_t* errmsg, /**< error message */
qse_size_t errlin /**< error line */
qse_sed_t* sed, /**< stream editor */
qse_sed_errnum_t errnum, /**< error number */
const qse_char_t* errmsg, /**< error message */
const qse_sed_loc_t* errloc /**< error location */
);
/**
* The qse_sed_seterror() function sets an error number, an error line, and
* The qse_sed_seterror() function sets an error number, an error location, and
* an error message. An error string is composed of a formatting string
* and an array of formatting parameters.
*/
void qse_sed_seterror (
qse_sed_t* sed, /**< stream editor */
qse_sed_errnum_t errnum, /**< error number */
const qse_cstr_t* errarg, /**< argument array for formatting error message */
qse_size_t errlin /**< error line */
qse_sed_t* sed, /**< stream editor */
qse_sed_errnum_t errnum, /**< error number */
const qse_cstr_t* errarg, /**< array of arguments for formatting
* an error message */
const qse_sed_loc_t* errloc /**< error location */
);
/**