imgtools/imglib/boostlibrary/boost/regex/v4/cregex.hpp
author lorewang
Wed, 17 Nov 2010 11:21:28 +0800
changeset 684 2defe8c85348
parent 600 6d08f4a05d93
permissions -rw-r--r--
elf2e32 treatment of ARM$$INIT_ARRAY$$Base can break GCCE builds
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
600
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     1
/*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     2
 *
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     3
 * Copyright (c) 1998-2002
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     4
 * John Maddock
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     5
 *
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     6
 * Use, modification and distribution are subject to the
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     7
 * Boost Software License, Version 1.0. (See accompanying file
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     8
 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     9
 *
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    10
 */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    11
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    12
 /*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    13
  *   LOCATION:    see http://www.boost.org for most recent version.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    14
  *   FILE         cregex.cpp
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    15
  *   VERSION      see <boost/version.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    16
  *   DESCRIPTION: Declares POSIX API functions
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    17
  *                + boost::RegEx high level wrapper.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    18
  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    19
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    20
#ifndef BOOST_RE_CREGEX_HPP_INCLUDED
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    21
#define BOOST_RE_CREGEX_HPP_INCLUDED
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    22
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    23
#ifndef BOOST_REGEX_CONFIG_HPP
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    24
#include <boost/regex/config.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    25
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    26
#include <boost/regex/v4/match_flags.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    27
#include <boost/regex/v4/error_type.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    28
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    29
#ifdef __cplusplus
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    30
#include <cstddef>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    31
#else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    32
#include <stddef.h>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    33
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    34
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    35
#ifdef BOOST_MSVC
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    36
#pragma warning(push)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    37
#pragma warning(disable: 4103)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    38
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    39
#ifdef BOOST_HAS_ABI_HEADERS
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    40
#  include BOOST_ABI_PREFIX
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    41
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    42
#ifdef BOOST_MSVC
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    43
#pragma warning(pop)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    44
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    45
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    46
/* include these defs only for POSIX compatablity */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    47
#ifdef __cplusplus
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    48
namespace boost{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    49
extern "C" {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    50
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    51
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    52
#if defined(__cplusplus) && !defined(BOOST_NO_STDC_NAMESPACE)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    53
typedef std::ptrdiff_t regoff_t;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    54
typedef std::size_t regsize_t;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    55
#else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    56
typedef ptrdiff_t regoff_t;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    57
typedef size_t regsize_t;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    58
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    59
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    60
typedef struct
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    61
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    62
   unsigned int re_magic;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    63
#ifdef __cplusplus
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    64
   std::size_t  re_nsub;      /* number of parenthesized subexpressions */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    65
#else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    66
   size_t re_nsub; 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    67
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    68
   const char*  re_endp;       /* end pointer for REG_PEND */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    69
   void* guts;                /* none of your business :-) */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    70
   match_flag_type eflags;        /* none of your business :-) */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    71
} regex_tA;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    72
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    73
#ifndef BOOST_NO_WREGEX
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    74
typedef struct
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    75
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    76
   unsigned int re_magic;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    77
#ifdef __cplusplus
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    78
   std::size_t  re_nsub;         /* number of parenthesized subexpressions */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    79
#else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    80
   size_t re_nsub;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    81
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    82
   const wchar_t* re_endp;       /* end pointer for REG_PEND */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    83
   void* guts;                   /* none of your business :-) */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    84
   match_flag_type eflags;           /* none of your business :-) */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    85
} regex_tW;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    86
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    87
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    88
typedef struct
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    89
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    90
   regoff_t rm_so;      /* start of match */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    91
   regoff_t rm_eo;      /* end of match */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    92
} regmatch_t;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    93
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    94
/* regcomp() flags */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    95
typedef enum{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    96
   REG_BASIC = 0000,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    97
   REG_EXTENDED = 0001,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    98
   REG_ICASE = 0002,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    99
   REG_NOSUB = 0004,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   100
   REG_NEWLINE = 0010,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   101
   REG_NOSPEC = 0020,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   102
   REG_PEND = 0040,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   103
   REG_DUMP = 0200,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   104
   REG_NOCOLLATE = 0400,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   105
   REG_ESCAPE_IN_LISTS = 01000,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   106
   REG_NEWLINE_ALT = 02000,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   107
   REG_PERLEX = 04000,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   108
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   109
   REG_PERL = REG_EXTENDED | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS | REG_PERLEX,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   110
   REG_AWK = REG_EXTENDED | REG_ESCAPE_IN_LISTS,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   111
   REG_GREP = REG_BASIC | REG_NEWLINE_ALT,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   112
   REG_EGREP = REG_EXTENDED | REG_NEWLINE_ALT,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   113
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   114
   REG_ASSERT = 15,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   115
   REG_INVARG = 16,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   116
   REG_ATOI = 255,   /* convert name to number (!) */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   117
   REG_ITOA = 0400   /* convert number to name (!) */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   118
} reg_comp_flags;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   119
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   120
/* regexec() flags */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   121
typedef enum{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   122
   REG_NOTBOL =    00001,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   123
   REG_NOTEOL =    00002,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   124
   REG_STARTEND =  00004
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   125
} reg_exec_flags;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   126
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   127
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   128
// POSIX error codes:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   129
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   130
typedef unsigned reg_error_t;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   131
typedef reg_error_t reg_errcode_t;  // backwards compatibility
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   132
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   133
static const reg_error_t REG_NOERROR = 0;   /* Success.  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   134
static const reg_error_t REG_NOMATCH = 1;   /* Didn't find a match (for regexec).  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   135
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   136
  /* POSIX regcomp return error codes.  (In the order listed in the
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   137
     standard.)  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   138
static const reg_error_t REG_BADPAT = 2;    /* Invalid pattern.  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   139
static const reg_error_t REG_ECOLLATE = 3;  /* Undefined collating element.  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   140
static const reg_error_t REG_ECTYPE = 4;    /* Invalid character class name.  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   141
static const reg_error_t REG_EESCAPE = 5;   /* Trailing backslash.  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   142
static const reg_error_t REG_ESUBREG = 6;   /* Invalid back reference.  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   143
static const reg_error_t REG_EBRACK = 7;    /* Unmatched left bracket.  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   144
static const reg_error_t REG_EPAREN = 8;    /* Parenthesis imbalance.  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   145
static const reg_error_t REG_EBRACE = 9;    /* Unmatched \{.  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   146
static const reg_error_t REG_BADBR = 10;    /* Invalid contents of \{\}.  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   147
static const reg_error_t REG_ERANGE = 11;   /* Invalid range end.  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   148
static const reg_error_t REG_ESPACE = 12;   /* Ran out of memory.  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   149
static const reg_error_t REG_BADRPT = 13;   /* No preceding re for repetition op.  */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   150
static const reg_error_t REG_EEND = 14;     /* unexpected end of expression */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   151
static const reg_error_t REG_ESIZE = 15;    /* expression too big */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   152
static const reg_error_t REG_ERPAREN = 8;   /* = REG_EPAREN : unmatched right parenthesis */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   153
static const reg_error_t REG_EMPTY = 17;    /* empty expression */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   154
static const reg_error_t REG_E_MEMORY = 15; /* = REG_ESIZE : out of memory */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   155
static const reg_error_t REG_ECOMPLEXITY = 18; /* complexity too high */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   156
static const reg_error_t REG_ESTACK = 19;   /* out of stack space */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   157
static const reg_error_t REG_E_UNKNOWN = 20; /* unknown error */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   158
static const reg_error_t REG_ENOSYS = 20;   /* = REG_E_UNKNOWN : Reserved. */
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   159
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   160
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA*, const char*, int);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   161
BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int, const regex_tA*, char*, regsize_t);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   162
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA*, const char*, regsize_t, regmatch_t*, int);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   163
BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeA(regex_tA*);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   164
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   165
#ifndef BOOST_NO_WREGEX
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   166
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW*, const wchar_t*, int);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   167
BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int, const regex_tW*, wchar_t*, regsize_t);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   168
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW*, const wchar_t*, regsize_t, regmatch_t*, int);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   169
BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW*);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   170
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   171
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   172
#ifdef UNICODE
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   173
#define regcomp regcompW
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   174
#define regerror regerrorW
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   175
#define regexec regexecW
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   176
#define regfree regfreeW
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   177
#define regex_t regex_tW
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   178
#else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   179
#define regcomp regcompA
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   180
#define regerror regerrorA
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   181
#define regexec regexecA
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   182
#define regfree regfreeA
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   183
#define regex_t regex_tA
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   184
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   185
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   186
#ifdef BOOST_MSVC
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   187
#pragma warning(push)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   188
#pragma warning(disable: 4103)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   189
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   190
#ifdef BOOST_HAS_ABI_HEADERS
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   191
#  include BOOST_ABI_SUFFIX
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   192
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   193
#ifdef BOOST_MSVC
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   194
#pragma warning(pop)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   195
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   196
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   197
#ifdef __cplusplus
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   198
} // extern "C"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   199
} // namespace
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   200
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   201
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   202
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   203
// C++ high level wrapper goes here:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   204
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   205
#if defined(__cplusplus)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   206
#include <string>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   207
#include <vector>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   208
namespace boost{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   209
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   210
#ifdef BOOST_MSVC
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   211
#pragma warning(push)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   212
#pragma warning(disable: 4103)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   213
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   214
#ifdef BOOST_HAS_ABI_HEADERS
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   215
#  include BOOST_ABI_PREFIX
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   216
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   217
#ifdef BOOST_MSVC
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   218
#pragma warning(pop)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   219
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   220
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   221
class RegEx;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   222
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   223
namespace re_detail{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   224
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   225
class RegExData;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   226
struct pred1;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   227
struct pred2;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   228
struct pred3;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   229
struct pred4;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   230
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   231
}  // namespace re_detail
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   232
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   233
#if (defined(BOOST_MSVC) || defined(__BORLANDC__)) && !defined(BOOST_DISABLE_WIN32)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   234
typedef bool (__cdecl *GrepCallback)(const RegEx& expression);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   235
typedef bool (__cdecl *GrepFileCallback)(const char* file, const RegEx& expression);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   236
typedef bool (__cdecl *FindFilesCallback)(const char* file);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   237
#else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   238
typedef bool (*GrepCallback)(const RegEx& expression);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   239
typedef bool (*GrepFileCallback)(const char* file, const RegEx& expression);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   240
typedef bool (*FindFilesCallback)(const char* file);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   241
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   242
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   243
class BOOST_REGEX_DECL RegEx
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   244
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   245
private:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   246
   re_detail::RegExData* pdata;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   247
public:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   248
   RegEx();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   249
   RegEx(const RegEx& o);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   250
   ~RegEx();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   251
   explicit RegEx(const char* c, bool icase = false);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   252
   explicit RegEx(const std::string& s, bool icase = false);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   253
   RegEx& operator=(const RegEx& o);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   254
   RegEx& operator=(const char* p);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   255
   RegEx& operator=(const std::string& s){ return this->operator=(s.c_str()); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   256
   unsigned int SetExpression(const char* p, bool icase = false);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   257
   unsigned int SetExpression(const std::string& s, bool icase = false){ return SetExpression(s.c_str(), icase); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   258
   std::string Expression()const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   259
   unsigned int error_code()const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   260
   //
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   261
   // now matching operators:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   262
   //
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   263
   bool Match(const char* p, match_flag_type flags = match_default);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   264
   bool Match(const std::string& s, match_flag_type flags = match_default) { return Match(s.c_str(), flags); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   265
   bool Search(const char* p, match_flag_type flags = match_default);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   266
   bool Search(const std::string& s, match_flag_type flags = match_default) { return Search(s.c_str(), flags); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   267
   unsigned int Grep(GrepCallback cb, const char* p, match_flag_type flags = match_default);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   268
   unsigned int Grep(GrepCallback cb, const std::string& s, match_flag_type flags = match_default) { return Grep(cb, s.c_str(), flags); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   269
   unsigned int Grep(std::vector<std::string>& v, const char* p, match_flag_type flags = match_default);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   270
   unsigned int Grep(std::vector<std::string>& v, const std::string& s, match_flag_type flags = match_default) { return Grep(v, s.c_str(), flags); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   271
   unsigned int Grep(std::vector<std::size_t>& v, const char* p, match_flag_type flags = match_default);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   272
   unsigned int Grep(std::vector<std::size_t>& v, const std::string& s, match_flag_type flags = match_default) { return Grep(v, s.c_str(), flags); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   273
#ifndef BOOST_REGEX_NO_FILEITER
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   274
   unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, match_flag_type flags = match_default);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   275
   unsigned int GrepFiles(GrepFileCallback cb, const std::string& files, bool recurse = false, match_flag_type flags = match_default) { return GrepFiles(cb, files.c_str(), recurse, flags); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   276
   unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, match_flag_type flags = match_default);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   277
   unsigned int FindFiles(FindFilesCallback cb, const std::string& files, bool recurse = false, match_flag_type flags = match_default) { return FindFiles(cb, files.c_str(), recurse, flags); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   278
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   279
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   280
   std::string Merge(const std::string& in, const std::string& fmt,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   281
                       bool copy = true, match_flag_type flags = match_default);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   282
   std::string Merge(const char* in, const char* fmt,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   283
                       bool copy = true, match_flag_type flags = match_default);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   284
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   285
   std::size_t Split(std::vector<std::string>& v, std::string& s, match_flag_type flags = match_default, unsigned max_count = ~0);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   286
   //
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   287
   // now operators for returning what matched in more detail:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   288
   //
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   289
   std::size_t Position(int i = 0)const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   290
   std::size_t Length(int i = 0)const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   291
   bool Matched(int i = 0)const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   292
   std::size_t Marks()const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   293
   std::string What(int i = 0)const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   294
   std::string operator[](int i)const { return What(i); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   295
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   296
   static const std::size_t npos;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   297
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   298
   friend struct re_detail::pred1;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   299
   friend struct re_detail::pred2;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   300
   friend struct re_detail::pred3;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   301
   friend struct re_detail::pred4;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   302
};
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   303
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   304
#ifdef BOOST_MSVC
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   305
#pragma warning(push)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   306
#pragma warning(disable: 4103)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   307
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   308
#ifdef BOOST_HAS_ABI_HEADERS
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   309
#  include BOOST_ABI_SUFFIX
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   310
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   311
#ifdef BOOST_MSVC
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   312
#pragma warning(pop)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   313
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   314
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   315
} // namespace boost
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   316
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   317
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   318
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   319
#endif // include guard
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   320
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   321
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   322
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   323
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   324
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   325
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   326
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   327
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   328
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   329