added qse_globmbs() and qse_globwcs()
This commit is contained in:
@ -35,12 +35,17 @@
|
||||
* in a path name.
|
||||
*/
|
||||
|
||||
typedef int (*qse_glob_cbimpl_t) (
|
||||
const qse_cstr_t* path,
|
||||
void* cbctx
|
||||
typedef int (*qse_glob_mbscbimpl_t) (
|
||||
const qse_mcstr_t* path,
|
||||
void* cbctx
|
||||
);
|
||||
|
||||
enum qse_glob_flags_t
|
||||
typedef int (*qse_glob_wcscbimpl_t) (
|
||||
const qse_wcstr_t* path,
|
||||
void* cbctx
|
||||
);
|
||||
|
||||
enum qse_glob_flag_t
|
||||
{
|
||||
/** Don't use the backslash as an escape charcter.
|
||||
* This option is on in Win32/OS2/DOS. */
|
||||
@ -58,30 +63,58 @@ enum qse_glob_flags_t
|
||||
|
||||
/** Exclude special entries from matching.
|
||||
* Special entries include . and .. */
|
||||
QSE_GLOB_SKIPSPCDIR = (1 << 4)
|
||||
QSE_GLOB_SKIPSPCDIR = (1 << 4),
|
||||
|
||||
|
||||
/**
|
||||
* bitsise-ORed of all valid enumerators
|
||||
*/
|
||||
QSE_GLOB_ALL = (QSE_GLOB_NOESCAPE | QSE_GLOB_PERIOD |
|
||||
QSE_GLOB_IGNORECASE | QSE_GLOB_TOLERANT |
|
||||
QSE_GLOB_SKIPSPCDIR)
|
||||
};
|
||||
typedef enum qse_glob_flag_t qse_glob_flag_t;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The qse_glob() function finds path names matchin the \a pattern.
|
||||
* The qse_globmbs() function finds path names matchin the \a pattern.
|
||||
* It calls the call-back function \a cbimpl for each path name found.
|
||||
*
|
||||
* \return -1 on failure, 0 on no match, 1 if matches are found.
|
||||
*/
|
||||
QSE_EXPORT int qse_glob (
|
||||
const qse_char_t* pattern,
|
||||
qse_glob_cbimpl_t cbimpl,
|
||||
void* cbctx,
|
||||
int flags,
|
||||
qse_mmgr_t* mmgr,
|
||||
qse_cmgr_t* cmgr
|
||||
QSE_EXPORT int qse_globmbs (
|
||||
const qse_mchar_t* pattern,
|
||||
qse_glob_mbscbimpl_t cbimpl,
|
||||
void* cbctx,
|
||||
int flags,
|
||||
qse_mmgr_t* mmgr,
|
||||
qse_cmgr_t* cmgr
|
||||
);
|
||||
|
||||
QSE_EXPORT int qse_globwcs (
|
||||
const qse_wchar_t* pattern,
|
||||
qse_glob_wcscbimpl_t cbimpl,
|
||||
void* cbctx,
|
||||
int flags,
|
||||
qse_mmgr_t* mmgr,
|
||||
qse_cmgr_t* cmgr
|
||||
);
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
typedef qse_glob_mbscbimpl_t qse_glob_cbimpl_t;
|
||||
# define qse_glob(pattern,cbimpl,cbctx,flags,mmgr,cmgr) qse_globmbs(pattern,cbimpl,cbctx,flags,mmgr,cmgr)
|
||||
|
||||
#else
|
||||
typedef qse_glob_wcscbimpl_t qse_glob_cbimpl_t;
|
||||
# define qse_glob(pattern,cbimpl,cbctx,flags,mmgr,cmgr) qse_globwcs(pattern,cbimpl,cbctx,flags,mmgr,cmgr)
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -50,22 +50,21 @@ enum qse_canonpath_flag_t
|
||||
# define QSE_ISPATHMBSEP(c) ((c) == QSE_MT('/') || (c) == QSE_MT('\\'))
|
||||
# define QSE_ISPATHWCSEP(c) ((c) == QSE_WT('/') || (c) == QSE_WT('\\'))
|
||||
|
||||
# define QSE_ISPATHMBDRIVE(s) \
|
||||
(((s[0] >= QSE_MT('A') && s[0] <= QSE_MT('Z')) || \
|
||||
(s[0] >= QSE_MT('a') && s[0] <= QSE_MT('z'))) && \
|
||||
s[1] == QSE_MT(':'))
|
||||
# define QSE_ISPATHWCDRIVE(s) \
|
||||
(((s[0] >= QSE_WT('A') && s[0] <= QSE_WT('Z')) || \
|
||||
(s[0] >= QSE_WT('a') && s[0] <= QSE_WT('z'))) && \
|
||||
s[1] == QSE_WT(':'))
|
||||
|
||||
#else
|
||||
# define QSE_ISPATHMBSEP(c) ((c) == QSE_MT('/'))
|
||||
# define QSE_ISPATHWCSEP(c) ((c) == QSE_WT('/'))
|
||||
|
||||
/* QSE_ISPATHMBDRIVE() and QSE_ISPATHWCDRIVE() are not defined for this platform */
|
||||
#endif
|
||||
|
||||
#define QSE_ISPATHMBDRIVE(s) \
|
||||
(((s[0] >= QSE_MT('A') && s[0] <= QSE_MT('Z')) || \
|
||||
(s[0] >= QSE_MT('a') && s[0] <= QSE_MT('z'))) && \
|
||||
s[1] == QSE_MT(':'))
|
||||
#define QSE_ISPATHWCDRIVE(s) \
|
||||
(((s[0] >= QSE_WT('A') && s[0] <= QSE_WT('Z')) || \
|
||||
(s[0] >= QSE_WT('a') && s[0] <= QSE_WT('z'))) && \
|
||||
s[1] == QSE_WT(':'))
|
||||
|
||||
#define QSE_ISPATHMBSEPORNIL(c) (QSE_ISPATHMBSEP(c) || (c) == QSE_MT('\0'))
|
||||
#define QSE_ISPATHWCSEPORNIL(c) (QSE_ISPATHWCSEP(c) || (c) == QSE_WT('\0'))
|
||||
|
||||
|
@ -3259,12 +3259,12 @@ QSE_EXPORT qse_size_t qse_wcs_fmt (
|
||||
);
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
# define qse_str_setmmgr(str,mmgr) qse_mbs_wetmmgr(str,mmgr)
|
||||
# define qse_str_getmmgr(str) qse_mbs_getmmgr(str)
|
||||
# define qse_str_open(mmgr,ext,capa) qse_mbs_open(mmgr,ext,capa)
|
||||
# define qse_str_close(str) qse_mbs_close(str)
|
||||
# define qse_str_init(str,mmgr,capa) qse_mbs_init(str,mmgr,capa)
|
||||
# define qse_str_fini(str) qse_mbs_fini(str)
|
||||
# define qse_str_setmmgr(str,mmgr) qse_mbs_setmmgr(str,mmgr)
|
||||
# define qse_str_getmmgr(str) qse_mbs_getmmgr(str)
|
||||
# define qse_str_yield(str,buf,ncapa) qse_mbs_yield(str,buf,ncapa)
|
||||
# define qse_str_yieldptr(str,ncapa) qse_mbs_yieldptr(str,ncapa)
|
||||
# define qse_str_getsizer(str) qse_mbs_getsizer(str)
|
||||
@ -3291,12 +3291,12 @@ QSE_EXPORT qse_size_t qse_wcs_fmt (
|
||||
# define qse_str_fmt qse_mbs_fmt
|
||||
# define qse_str_vfmt qse_mbs_vfmt
|
||||
#else
|
||||
# define qse_str_setmmgr(str,mmgr) qse_wcs_wetmmgr(str,mmgr)
|
||||
# define qse_str_getmmgr(str) qse_wcs_getmmgr(str)
|
||||
# define qse_str_open(mmgr,ext,capa) qse_wcs_open(mmgr,ext,capa)
|
||||
# define qse_str_close(str) qse_wcs_close(str)
|
||||
# define qse_str_init(str,mmgr,capa) qse_wcs_init(str,mmgr,capa)
|
||||
# define qse_str_fini(str) qse_wcs_fini(str)
|
||||
# define qse_str_setmmgr(str,mmgr) qse_wcs_setmmgr(str,mmgr)
|
||||
# define qse_str_getmmgr(str) qse_wcs_getmmgr(str)
|
||||
# define qse_str_yield(str,buf,ncapa) qse_wcs_yield(str,buf,ncapa)
|
||||
# define qse_str_yieldptr(str,ncapa) qse_wcs_yieldptr(str,ncapa)
|
||||
# define qse_str_getsizer(str) qse_wcs_getsizer(str)
|
||||
@ -3324,7 +3324,6 @@ QSE_EXPORT qse_size_t qse_wcs_fmt (
|
||||
# define qse_str_vfmt qse_wcs_vfmt
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user