enhanced qse_sed_t

- changed qse_sed_t to support arbitrary numbers of commands
- added qse_set_getmaxdepth() and qse_sed_setmaxdepth()
- added relevant wrapper functions to QSE::Sed
This commit is contained in:
2009-05-30 23:29:06 +00:00
parent 7875def835
commit d851798b3c
5 changed files with 315 additions and 165 deletions

View File

@ -48,6 +48,8 @@ public:
typedef qse_sed_io_arg_t io_arg_t;
/// The option_t type redefines an option type
typedef qse_sed_option_t option_t;
/// The depth_t type redefines an depth IDs
typedef qse_sed_depth_t depth_t;
/**
* The Sed() function creates an uninitialized stream editor.
@ -115,6 +117,19 @@ public:
int opt ///< option code
) throw ();
/**
* The getMaxDepth() function gets the maximum processing depth.
*/
size_t getMaxDepth (depth_t id) const throw ();
/**
* The setMaxDepth() function gets the maximum processing depth.
*/
void setMaxDepth (
int ids, ///< 0 or a number OR'ed of depth_t values
size_t depth ///< 0 maximum depth
) throw ();
/**
* The getErrorMessage() function gets the description of the last
* error occurred. It returns an empty string if the stream editor

View File

@ -35,10 +35,6 @@
* qse_sed_close (sed);
* @endcode
*
* @todo
* - allow flexible numbers of commands
* - allow configurable recursion depth for a regular expression
*
* @example sed01.c
* This example shows how to embed a basic stream editor.
*/
@ -123,6 +119,18 @@ enum qse_sed_option_t
};
typedef enum qse_sed_option_t qse_sed_option_t;
/**
* The qse_sed_depth_t type defines IDs for qse_sed_getmaxdepth() and
* qse_sed_setmaxdepth().
*/
enum qse_sed_depth_t
{
QSE_SED_DEPTH_REX_BUILD = (1 << 0),
QSE_SED_DEPTH_REX_MATCH = (1 << 1)
};
typedef enum qse_sed_depth_t qse_sed_depth_t;
/**
* The qse_sed_io_cmd_t type defines IO command codes. The code indicates
* the action to take in an IO handler.
@ -219,6 +227,23 @@ void qse_sed_setoption (
int opt /**< 0 or a number OR'ed of qse_sed_option_t values */
);
/**
* The qse_sed_getmaxdepth() gets the maximum processing depth.
*/
qse_size_t qse_sed_getmaxdepth (
qse_sed_t* sed, /**< a stream editor */
qse_sed_depth_t id /**< one of qse_sed_depth_t values */
);
/**
* The qse_sed_setmaxdepth() sets the maximum processing depth.
*/
void qse_sed_setmaxdepth (
qse_sed_t* sed, /**< a stream editor */
int ids, /**< 0 or a number OR'ed of qse_sed_depth_t values */
qse_size_t depth /**< maximum depth level */
);
/**
* The qse_sed_geterrstr() gets an error string getter.
*/