forked from boostorg/regex
Make cpp_regex_traits all inline.
This commit is contained in:
@ -122,7 +122,6 @@ explicit has_icu ;
|
||||
alias icu_options : : : : [ check-target-builds has_icu : $(ICU_OPTS) : ] ;
|
||||
|
||||
SOURCES =
|
||||
cpp_regex_traits.cpp
|
||||
icu.cpp
|
||||
posix_api.cpp
|
||||
regex.cpp
|
||||
|
@ -19,7 +19,7 @@
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#define BOOST_REGEX_CONFIG_HPP
|
||||
|
||||
#if !((__cplusplus >= 201103L) || (defined(_MSC_VER) && (_MSC_VER >= 1600)))
|
||||
#if !((__cplusplus >= 201103L) || (defined(_MSC_VER) && (_MSC_VER >= 1600)) || defined(BOOST_REGEX_CXX03))
|
||||
# define BOOST_REGEX_CXX03
|
||||
#endif
|
||||
|
||||
|
@ -75,7 +75,7 @@ template <class charT>
|
||||
struct c_regex_traits;
|
||||
|
||||
template<>
|
||||
struct BOOST_REGEX_DECL c_regex_traits<char>
|
||||
struct c_regex_traits<char>
|
||||
{
|
||||
c_regex_traits(){}
|
||||
typedef char char_type;
|
||||
@ -120,7 +120,7 @@ private:
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
template<>
|
||||
struct BOOST_REGEX_DECL c_regex_traits<wchar_t>
|
||||
struct c_regex_traits<wchar_t>
|
||||
{
|
||||
c_regex_traits(){}
|
||||
typedef wchar_t char_type;
|
||||
|
@ -29,13 +29,13 @@
|
||||
#include <boost/regex/pattern_except.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
|
||||
#include <boost/regex/v4/regex_traits_defaults.hpp>
|
||||
#include <boost/regex/v5/regex_traits_defaults.hpp>
|
||||
#endif
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
#include <boost/regex/pending/static_mutex.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_PRIMARY_TRANSFORM
|
||||
#include <boost/regex/v4/primary_transform.hpp>
|
||||
#include <boost/regex/v5/primary_transform.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_OBJECT_CACHE_HPP
|
||||
#include <boost/regex/pending/object_cache.hpp>
|
||||
@ -355,7 +355,7 @@ typename cpp_regex_traits_char_layer<charT>::string_type
|
||||
// specialized version for narrow characters:
|
||||
//
|
||||
template <>
|
||||
class BOOST_REGEX_DECL cpp_regex_traits_char_layer<char> : public cpp_regex_traits_base<char>
|
||||
class cpp_regex_traits_char_layer<char> : public cpp_regex_traits_base<char>
|
||||
{
|
||||
typedef std::string string_type;
|
||||
public:
|
||||
@ -1129,6 +1129,92 @@ static_mutex& cpp_regex_traits<charT>::get_mutex_inst()
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace BOOST_REGEX_DETAIL_NS {
|
||||
|
||||
inline void cpp_regex_traits_char_layer<char>::init()
|
||||
{
|
||||
// we need to start by initialising our syntax map so we know which
|
||||
// character is used for which purpose:
|
||||
std::memset(m_char_map, 0, sizeof(m_char_map));
|
||||
#ifndef BOOST_NO_STD_MESSAGES
|
||||
#ifndef __IBMCPP__
|
||||
std::messages<char>::catalog cat = static_cast<std::messages<char>::catalog>(-1);
|
||||
#else
|
||||
std::messages<char>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
|
||||
#endif
|
||||
std::string cat_name(cpp_regex_traits<char>::get_catalog_name());
|
||||
if ((!cat_name.empty()) && (m_pmessages != 0))
|
||||
{
|
||||
cat = this->m_pmessages->open(
|
||||
cat_name,
|
||||
this->m_locale);
|
||||
if ((int)cat < 0)
|
||||
{
|
||||
std::string m("Unable to open message catalog: ");
|
||||
std::runtime_error err(m + cat_name);
|
||||
boost::BOOST_REGEX_DETAIL_NS::raise_runtime_error(err);
|
||||
}
|
||||
}
|
||||
//
|
||||
// if we have a valid catalog then load our messages:
|
||||
//
|
||||
if ((int)cat >= 0)
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try {
|
||||
#endif
|
||||
for (regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
|
||||
{
|
||||
string_type mss = this->m_pmessages->get(cat, 0, i, get_default_syntax(i));
|
||||
for (string_type::size_type j = 0; j < mss.size(); ++j)
|
||||
{
|
||||
m_char_map[static_cast<unsigned char>(mss[j])] = i;
|
||||
}
|
||||
}
|
||||
this->m_pmessages->close(cat);
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->m_pmessages->close(cat);
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
for (regex_constants::syntax_type j = 1; j < regex_constants::syntax_max; ++j)
|
||||
{
|
||||
const char* ptr = get_default_syntax(j);
|
||||
while (ptr && *ptr)
|
||||
{
|
||||
m_char_map[static_cast<unsigned char>(*ptr)] = j;
|
||||
++ptr;
|
||||
}
|
||||
}
|
||||
#ifndef BOOST_NO_STD_MESSAGES
|
||||
}
|
||||
#endif
|
||||
//
|
||||
// finish off by calculating our escape types:
|
||||
//
|
||||
unsigned char i = 'A';
|
||||
do
|
||||
{
|
||||
if (m_char_map[i] == 0)
|
||||
{
|
||||
if (this->m_pctype->is(std::ctype_base::lower, i))
|
||||
m_char_map[i] = regex_constants::escape_type_class;
|
||||
else if (this->m_pctype->is(std::ctype_base::upper, i))
|
||||
m_char_map[i] = regex_constants::escape_type_not_class;
|
||||
}
|
||||
} while (0xFF != i++);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
} // boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
|
@ -200,123 +200,6 @@ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW*);
|
||||
} /* namespace */
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
/*
|
||||
* C++ high level wrapper goes here:
|
||||
*/
|
||||
#include <string>
|
||||
#include <vector>
|
||||
namespace boost{
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4103)
|
||||
#endif
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
class RegEx;
|
||||
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
class RegExData;
|
||||
struct pred1;
|
||||
struct pred2;
|
||||
struct pred3;
|
||||
struct pred4;
|
||||
|
||||
} /* namespace BOOST_REGEX_DETAIL_NS */
|
||||
|
||||
#if (defined(BOOST_MSVC) || defined(BOOST_BORLANDC)) && !defined(BOOST_DISABLE_WIN32)
|
||||
typedef bool (__cdecl *GrepCallback)(const RegEx& expression);
|
||||
typedef bool (__cdecl *GrepFileCallback)(const char* file, const RegEx& expression);
|
||||
typedef bool (__cdecl *FindFilesCallback)(const char* file);
|
||||
#else
|
||||
typedef bool (*GrepCallback)(const RegEx& expression);
|
||||
typedef bool (*GrepFileCallback)(const char* file, const RegEx& expression);
|
||||
typedef bool (*FindFilesCallback)(const char* file);
|
||||
#endif
|
||||
|
||||
class BOOST_REGEX_DECL RegEx
|
||||
{
|
||||
private:
|
||||
BOOST_REGEX_DETAIL_NS::RegExData* pdata;
|
||||
public:
|
||||
RegEx();
|
||||
RegEx(const RegEx& o);
|
||||
~RegEx();
|
||||
explicit RegEx(const char* c, bool icase = false);
|
||||
explicit RegEx(const std::string& s, bool icase = false);
|
||||
RegEx& operator=(const RegEx& o);
|
||||
RegEx& operator=(const char* p);
|
||||
RegEx& operator=(const std::string& s){ return this->operator=(s.c_str()); }
|
||||
unsigned int SetExpression(const char* p, bool icase = false);
|
||||
unsigned int SetExpression(const std::string& s, bool icase = false){ return SetExpression(s.c_str(), icase); }
|
||||
std::string Expression()const;
|
||||
unsigned int error_code()const;
|
||||
/*
|
||||
* now matching operators:
|
||||
*/
|
||||
bool Match(const char* p, match_flag_type flags = match_default);
|
||||
bool Match(const std::string& s, match_flag_type flags = match_default) { return Match(s.c_str(), flags); }
|
||||
bool Search(const char* p, match_flag_type flags = match_default);
|
||||
bool Search(const std::string& s, match_flag_type flags = match_default) { return Search(s.c_str(), flags); }
|
||||
unsigned int Grep(GrepCallback cb, const char* p, match_flag_type flags = match_default);
|
||||
unsigned int Grep(GrepCallback cb, const std::string& s, match_flag_type flags = match_default) { return Grep(cb, s.c_str(), flags); }
|
||||
unsigned int Grep(std::vector<std::string>& v, const char* p, match_flag_type flags = match_default);
|
||||
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); }
|
||||
unsigned int Grep(std::vector<std::size_t>& v, const char* p, match_flag_type flags = match_default);
|
||||
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); }
|
||||
#ifndef BOOST_REGEX_NO_FILEITER
|
||||
unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, match_flag_type flags = match_default);
|
||||
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); }
|
||||
unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, match_flag_type flags = match_default);
|
||||
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); }
|
||||
#endif
|
||||
|
||||
std::string Merge(const std::string& in, const std::string& fmt,
|
||||
bool copy = true, match_flag_type flags = match_default);
|
||||
std::string Merge(const char* in, const char* fmt,
|
||||
bool copy = true, match_flag_type flags = match_default);
|
||||
|
||||
std::size_t Split(std::vector<std::string>& v, std::string& s, match_flag_type flags = match_default, unsigned max_count = ~0);
|
||||
/*
|
||||
* now operators for returning what matched in more detail:
|
||||
*/
|
||||
std::size_t Position(int i = 0)const;
|
||||
std::size_t Length(int i = 0)const;
|
||||
bool Matched(int i = 0)const;
|
||||
std::size_t Marks()const;
|
||||
std::string What(int i = 0)const;
|
||||
std::string operator[](int i)const { return What(i); }
|
||||
|
||||
static const std::size_t npos;
|
||||
|
||||
friend struct BOOST_REGEX_DETAIL_NS::pred1;
|
||||
friend struct BOOST_REGEX_DETAIL_NS::pred2;
|
||||
friend struct BOOST_REGEX_DETAIL_NS::pred3;
|
||||
friend struct BOOST_REGEX_DETAIL_NS::pred4;
|
||||
};
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4103)
|
||||
#endif
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* include guard */
|
||||
|
||||
|
||||
|
@ -1,557 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE fileiter.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares various platform independent file and
|
||||
* directory iterators, plus binary file input in
|
||||
* the form of class map_file.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RE_FILEITER_HPP_INCLUDED
|
||||
#define BOOST_RE_FILEITER_HPP_INCLUDED
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#ifndef BOOST_REGEX_NO_FILEITER
|
||||
|
||||
#if (defined(__CYGWIN__) || defined(__CYGWIN32__)) && !defined(BOOST_REGEX_NO_W32)
|
||||
#error "Sorry, can't mix <windows.h> with STL code and gcc compiler: if you ran configure, try again with configure --disable-ms-windows"
|
||||
#define BOOST_REGEX_FI_WIN32_MAP
|
||||
#define BOOST_REGEX_FI_POSIX_DIR
|
||||
#elif (defined(__WIN32__) || defined(_WIN32) || defined(WIN32)) && !defined(BOOST_REGEX_NO_W32)
|
||||
#define BOOST_REGEX_FI_WIN32_MAP
|
||||
#define BOOST_REGEX_FI_WIN32_DIR
|
||||
#else
|
||||
#define BOOST_REGEX_FI_POSIX_MAP
|
||||
#define BOOST_REGEX_FI_POSIX_DIR
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_REGEX_FI_WIN32_MAP)||defined(BOOST_REGEX_FI_WIN32_DIR)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_REGEX_FI_WIN32_DIR)
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost{
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
typedef WIN32_FIND_DATAA _fi_find_data;
|
||||
#else
|
||||
typedef WIN32_FIND_DATAW _fi_find_data;
|
||||
#endif
|
||||
typedef HANDLE _fi_find_handle;
|
||||
|
||||
} // namespace BOOST_REGEX_DETAIL_NS
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#define _fi_invalid_handle INVALID_HANDLE_VALUE
|
||||
#define _fi_dir FILE_ATTRIBUTE_DIRECTORY
|
||||
|
||||
#elif defined(BOOST_REGEX_FI_POSIX_DIR)
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cctype>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <cassert>
|
||||
#include <dirent.h>
|
||||
|
||||
#if defined(__SUNPRO_CC)
|
||||
using std::list;
|
||||
#endif
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 256
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
struct _fi_find_data
|
||||
{
|
||||
unsigned dwFileAttributes;
|
||||
char cFileName[MAX_PATH];
|
||||
};
|
||||
|
||||
struct _fi_priv_data;
|
||||
|
||||
typedef _fi_priv_data* _fi_find_handle;
|
||||
#define _fi_invalid_handle 0
|
||||
#define _fi_dir 1
|
||||
|
||||
_fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindFileData);
|
||||
bool _fi_FindNextFile(_fi_find_handle hFindFile, _fi_find_data* lpFindFileData);
|
||||
bool _fi_FindClose(_fi_find_handle hFindFile);
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
} // namespace BOOST_REGEX_DETAIL_NS
|
||||
} // namespace boost
|
||||
|
||||
#ifdef FindFirstFile
|
||||
#undef FindFirstFile
|
||||
#endif
|
||||
#ifdef FindNextFile
|
||||
#undef FindNextFile
|
||||
#endif
|
||||
#ifdef FindClose
|
||||
#undef FindClose
|
||||
#endif
|
||||
|
||||
#define FindFirstFileA _fi_FindFirstFile
|
||||
#define FindNextFileA _fi_FindNextFile
|
||||
#define FindClose _fi_FindClose
|
||||
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_REGEX_FI_WIN32_MAP // win32 mapfile
|
||||
|
||||
class BOOST_REGEX_DECL mapfile
|
||||
{
|
||||
HANDLE hfile;
|
||||
HANDLE hmap;
|
||||
const char* _first;
|
||||
const char* _last;
|
||||
public:
|
||||
|
||||
typedef const char* iterator;
|
||||
|
||||
mapfile(){ hfile = hmap = 0; _first = _last = 0; }
|
||||
mapfile(const char* file){ hfile = hmap = 0; _first = _last = 0; open(file); }
|
||||
~mapfile(){ close(); }
|
||||
void open(const char* file);
|
||||
void close();
|
||||
const char* begin(){ return _first; }
|
||||
const char* end(){ return _last; }
|
||||
size_t size(){ return _last - _first; }
|
||||
bool valid(){ return (hfile != 0) && (hfile != INVALID_HANDLE_VALUE); }
|
||||
};
|
||||
|
||||
|
||||
#else
|
||||
|
||||
class BOOST_REGEX_DECL mapfile_iterator;
|
||||
|
||||
class BOOST_REGEX_DECL mapfile
|
||||
{
|
||||
typedef char* pointer;
|
||||
std::FILE* hfile;
|
||||
long int _size;
|
||||
pointer* _first;
|
||||
pointer* _last;
|
||||
mutable std::list<pointer*> condemed;
|
||||
enum sizes
|
||||
{
|
||||
buf_size = 4096
|
||||
};
|
||||
void lock(pointer* node)const;
|
||||
void unlock(pointer* node)const;
|
||||
public:
|
||||
|
||||
typedef mapfile_iterator iterator;
|
||||
|
||||
mapfile(){ hfile = 0; _size = 0; _first = _last = 0; }
|
||||
mapfile(const char* file){ hfile = 0; _size = 0; _first = _last = 0; open(file); }
|
||||
~mapfile(){ close(); }
|
||||
void open(const char* file);
|
||||
void close();
|
||||
iterator begin()const;
|
||||
iterator end()const;
|
||||
unsigned long size()const{ return _size; }
|
||||
bool valid()const{ return hfile != 0; }
|
||||
friend class mapfile_iterator;
|
||||
};
|
||||
|
||||
class BOOST_REGEX_DECL mapfile_iterator
|
||||
{
|
||||
typedef mapfile::pointer internal_pointer;
|
||||
internal_pointer* node;
|
||||
const mapfile* file;
|
||||
unsigned long offset;
|
||||
long position()const
|
||||
{
|
||||
return file ? ((node - file->_first) * mapfile::buf_size + offset) : 0;
|
||||
}
|
||||
void position(long pos)
|
||||
{
|
||||
if(file)
|
||||
{
|
||||
node = file->_first + (pos / mapfile::buf_size);
|
||||
offset = pos % mapfile::buf_size;
|
||||
}
|
||||
}
|
||||
public:
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef char value_type;
|
||||
typedef const char* pointer;
|
||||
typedef const char& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
|
||||
mapfile_iterator() { node = 0; file = 0; offset = 0; }
|
||||
mapfile_iterator(const mapfile* f, long arg_position)
|
||||
{
|
||||
BOOST_ASSERT(f);
|
||||
file = f;
|
||||
node = f->_first + arg_position / mapfile::buf_size;
|
||||
offset = arg_position % mapfile::buf_size;
|
||||
file->lock(node);
|
||||
}
|
||||
mapfile_iterator(const mapfile_iterator& i)
|
||||
{
|
||||
file = i.file;
|
||||
node = i.node;
|
||||
offset = i.offset;
|
||||
if(file)
|
||||
file->lock(node);
|
||||
}
|
||||
~mapfile_iterator()
|
||||
{
|
||||
if(file && node)
|
||||
file->unlock(node);
|
||||
}
|
||||
mapfile_iterator& operator = (const mapfile_iterator& i);
|
||||
char operator* ()const
|
||||
{
|
||||
BOOST_ASSERT(node >= file->_first);
|
||||
BOOST_ASSERT(node < file->_last);
|
||||
return file ? *(*node + sizeof(int) + offset) : char(0);
|
||||
}
|
||||
char operator[] (long off)const
|
||||
{
|
||||
mapfile_iterator tmp(*this);
|
||||
tmp += off;
|
||||
return *tmp;
|
||||
}
|
||||
mapfile_iterator& operator++ ();
|
||||
mapfile_iterator operator++ (int);
|
||||
mapfile_iterator& operator-- ();
|
||||
mapfile_iterator operator-- (int);
|
||||
|
||||
mapfile_iterator& operator += (long off)
|
||||
{
|
||||
position(position() + off);
|
||||
return *this;
|
||||
}
|
||||
mapfile_iterator& operator -= (long off)
|
||||
{
|
||||
position(position() - off);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
friend inline bool operator==(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return (i.file == j.file) && (i.node == j.node) && (i.offset == j.offset);
|
||||
}
|
||||
|
||||
friend inline bool operator!=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return !(i == j);
|
||||
}
|
||||
|
||||
friend inline bool operator<(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() < j.position();
|
||||
}
|
||||
friend inline bool operator>(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() > j.position();
|
||||
}
|
||||
friend inline bool operator<=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() <= j.position();
|
||||
}
|
||||
friend inline bool operator>=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() >= j.position();
|
||||
}
|
||||
|
||||
friend mapfile_iterator operator + (const mapfile_iterator& i, long off);
|
||||
friend mapfile_iterator operator + (long off, const mapfile_iterator& i)
|
||||
{
|
||||
mapfile_iterator tmp(i);
|
||||
return tmp += off;
|
||||
}
|
||||
friend mapfile_iterator operator - (const mapfile_iterator& i, long off);
|
||||
friend inline long operator - (const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() - j.position();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
friend bool operator==(const mapfile_iterator& i, const mapfile_iterator& j);
|
||||
friend bool operator!=(const mapfile_iterator& i, const mapfile_iterator& j);
|
||||
friend bool operator<(const mapfile_iterator& i, const mapfile_iterator& j);
|
||||
friend bool operator>(const mapfile_iterator& i, const mapfile_iterator& j);
|
||||
friend bool operator<=(const mapfile_iterator& i, const mapfile_iterator& j);
|
||||
friend bool operator>=(const mapfile_iterator& i, const mapfile_iterator& j);
|
||||
friend mapfile_iterator operator + (const mapfile_iterator& i, long off);
|
||||
friend mapfile_iterator operator + (long off, const mapfile_iterator& i);
|
||||
friend mapfile_iterator operator - (const mapfile_iterator& i, long off);
|
||||
friend long operator - (const mapfile_iterator& i, const mapfile_iterator& j);
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#if defined(BOOST_EMBTC)
|
||||
|
||||
inline bool operator==(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return (i.file == j.file) && (i.node == j.node) && (i.offset == j.offset);
|
||||
}
|
||||
|
||||
inline bool operator!=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return !(i == j);
|
||||
}
|
||||
|
||||
inline bool operator<(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() < j.position();
|
||||
}
|
||||
inline bool operator>(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() > j.position();
|
||||
}
|
||||
inline bool operator<=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() <= j.position();
|
||||
}
|
||||
inline bool operator>=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() >= j.position();
|
||||
}
|
||||
mapfile_iterator operator + (long off, const mapfile_iterator& i)
|
||||
{
|
||||
mapfile_iterator tmp(i);
|
||||
return tmp += off;
|
||||
}
|
||||
inline long operator - (const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() - j.position();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// _fi_sep determines the directory separator, either '\\' or '/'
|
||||
BOOST_REGEX_DECL extern const char* _fi_sep;
|
||||
|
||||
struct file_iterator_ref
|
||||
{
|
||||
_fi_find_handle hf;
|
||||
_fi_find_data _data;
|
||||
long count;
|
||||
};
|
||||
|
||||
|
||||
class BOOST_REGEX_DECL file_iterator
|
||||
{
|
||||
char* _root;
|
||||
char* _path;
|
||||
char* ptr;
|
||||
file_iterator_ref* ref;
|
||||
|
||||
public:
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef const char* value_type;
|
||||
typedef const char** pointer;
|
||||
typedef const char*& reference;
|
||||
typedef std::input_iterator_tag iterator_category;
|
||||
|
||||
file_iterator();
|
||||
file_iterator(const char* wild);
|
||||
~file_iterator();
|
||||
file_iterator(const file_iterator&);
|
||||
file_iterator& operator=(const file_iterator&);
|
||||
const char* root()const { return _root; }
|
||||
const char* path()const { return _path; }
|
||||
const char* name()const { return ptr; }
|
||||
_fi_find_data* data() { return &(ref->_data); }
|
||||
void next();
|
||||
file_iterator& operator++() { next(); return *this; }
|
||||
file_iterator operator++(int);
|
||||
const char* operator*() { return path(); }
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
friend inline bool operator == (const file_iterator& f1, const file_iterator& f2)
|
||||
{
|
||||
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
|
||||
}
|
||||
|
||||
friend inline bool operator != (const file_iterator& f1, const file_iterator& f2)
|
||||
{
|
||||
return !(f1 == f2);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
friend bool operator == (const file_iterator& f1, const file_iterator& f2);
|
||||
friend bool operator != (const file_iterator& f1, const file_iterator& f2);
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#if defined(BOOST_EMBTC)
|
||||
|
||||
inline bool operator == (const file_iterator& f1, const file_iterator& f2)
|
||||
{
|
||||
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
|
||||
}
|
||||
|
||||
inline bool operator != (const file_iterator& f1, const file_iterator& f2)
|
||||
{
|
||||
return !(f1 == f2);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// dwa 9/13/00 - suppress unused parameter warning
|
||||
inline bool operator < (const file_iterator&, const file_iterator&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
class BOOST_REGEX_DECL directory_iterator
|
||||
{
|
||||
char* _root;
|
||||
char* _path;
|
||||
char* ptr;
|
||||
file_iterator_ref* ref;
|
||||
|
||||
public:
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef const char* value_type;
|
||||
typedef const char** pointer;
|
||||
typedef const char*& reference;
|
||||
typedef std::input_iterator_tag iterator_category;
|
||||
|
||||
directory_iterator();
|
||||
directory_iterator(const char* wild);
|
||||
~directory_iterator();
|
||||
directory_iterator(const directory_iterator& other);
|
||||
directory_iterator& operator=(const directory_iterator& other);
|
||||
|
||||
const char* root()const { return _root; }
|
||||
const char* path()const { return _path; }
|
||||
const char* name()const { return ptr; }
|
||||
_fi_find_data* data() { return &(ref->_data); }
|
||||
void next();
|
||||
directory_iterator& operator++() { next(); return *this; }
|
||||
directory_iterator operator++(int);
|
||||
const char* operator*() { return path(); }
|
||||
|
||||
static const char* separator() { return _fi_sep; }
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
friend inline bool operator == (const directory_iterator& f1, const directory_iterator& f2)
|
||||
{
|
||||
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
|
||||
}
|
||||
|
||||
|
||||
friend inline bool operator != (const directory_iterator& f1, const directory_iterator& f2)
|
||||
{
|
||||
return !(f1 == f2);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
friend bool operator == (const directory_iterator& f1, const directory_iterator& f2);
|
||||
friend bool operator != (const directory_iterator& f1, const directory_iterator& f2);
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#if defined(BOOST_EMBTC)
|
||||
|
||||
inline bool operator == (const directory_iterator& f1, const directory_iterator& f2)
|
||||
{
|
||||
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
|
||||
}
|
||||
|
||||
|
||||
inline bool operator != (const directory_iterator& f1, const directory_iterator& f2)
|
||||
{
|
||||
return !(f1 == f2);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline bool operator < (const directory_iterator&, const directory_iterator&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace BOOST_REGEX_DETAIL_NS
|
||||
using boost::BOOST_REGEX_DETAIL_NS::directory_iterator;
|
||||
using boost::BOOST_REGEX_DETAIL_NS::file_iterator;
|
||||
using boost::BOOST_REGEX_DETAIL_NS::mapfile;
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REGEX_NO_FILEITER
|
||||
#endif // BOOST_RE_FILEITER_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -75,7 +75,7 @@ template <class charT>
|
||||
struct c_regex_traits;
|
||||
|
||||
template<>
|
||||
struct BOOST_REGEX_DECL c_regex_traits<char>
|
||||
struct c_regex_traits<char>
|
||||
{
|
||||
c_regex_traits(){}
|
||||
typedef char char_type;
|
||||
@ -120,7 +120,7 @@ private:
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
template<>
|
||||
struct BOOST_REGEX_DECL c_regex_traits<wchar_t>
|
||||
struct c_regex_traits<wchar_t>
|
||||
{
|
||||
c_regex_traits(){}
|
||||
typedef wchar_t char_type;
|
||||
|
@ -355,7 +355,7 @@ typename cpp_regex_traits_char_layer<charT>::string_type
|
||||
// specialized version for narrow characters:
|
||||
//
|
||||
template <>
|
||||
class BOOST_REGEX_DECL cpp_regex_traits_char_layer<char> : public cpp_regex_traits_base<char>
|
||||
class cpp_regex_traits_char_layer<char> : public cpp_regex_traits_base<char>
|
||||
{
|
||||
typedef std::string string_type;
|
||||
public:
|
||||
@ -1129,6 +1129,92 @@ static_mutex& cpp_regex_traits<charT>::get_mutex_inst()
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace BOOST_REGEX_DETAIL_NS {
|
||||
|
||||
inline void cpp_regex_traits_char_layer<char>::init()
|
||||
{
|
||||
// we need to start by initialising our syntax map so we know which
|
||||
// character is used for which purpose:
|
||||
std::memset(m_char_map, 0, sizeof(m_char_map));
|
||||
#ifndef BOOST_NO_STD_MESSAGES
|
||||
#ifndef __IBMCPP__
|
||||
std::messages<char>::catalog cat = static_cast<std::messages<char>::catalog>(-1);
|
||||
#else
|
||||
std::messages<char>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
|
||||
#endif
|
||||
std::string cat_name(cpp_regex_traits<char>::get_catalog_name());
|
||||
if ((!cat_name.empty()) && (m_pmessages != 0))
|
||||
{
|
||||
cat = this->m_pmessages->open(
|
||||
cat_name,
|
||||
this->m_locale);
|
||||
if ((int)cat < 0)
|
||||
{
|
||||
std::string m("Unable to open message catalog: ");
|
||||
std::runtime_error err(m + cat_name);
|
||||
boost::BOOST_REGEX_DETAIL_NS::raise_runtime_error(err);
|
||||
}
|
||||
}
|
||||
//
|
||||
// if we have a valid catalog then load our messages:
|
||||
//
|
||||
if ((int)cat >= 0)
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try {
|
||||
#endif
|
||||
for (regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
|
||||
{
|
||||
string_type mss = this->m_pmessages->get(cat, 0, i, get_default_syntax(i));
|
||||
for (string_type::size_type j = 0; j < mss.size(); ++j)
|
||||
{
|
||||
m_char_map[static_cast<unsigned char>(mss[j])] = i;
|
||||
}
|
||||
}
|
||||
this->m_pmessages->close(cat);
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->m_pmessages->close(cat);
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
for (regex_constants::syntax_type j = 1; j < regex_constants::syntax_max; ++j)
|
||||
{
|
||||
const char* ptr = get_default_syntax(j);
|
||||
while (ptr && *ptr)
|
||||
{
|
||||
m_char_map[static_cast<unsigned char>(*ptr)] = j;
|
||||
++ptr;
|
||||
}
|
||||
}
|
||||
#ifndef BOOST_NO_STD_MESSAGES
|
||||
}
|
||||
#endif
|
||||
//
|
||||
// finish off by calculating our escape types:
|
||||
//
|
||||
unsigned char i = 'A';
|
||||
do
|
||||
{
|
||||
if (m_char_map[i] == 0)
|
||||
{
|
||||
if (this->m_pctype->is(std::ctype_base::lower, i))
|
||||
m_char_map[i] = regex_constants::escape_type_class;
|
||||
else if (this->m_pctype->is(std::ctype_base::upper, i))
|
||||
m_char_map[i] = regex_constants::escape_type_not_class;
|
||||
}
|
||||
} while (0xFF != i++);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
} // boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
|
@ -1,557 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE fileiter.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares various platform independent file and
|
||||
* directory iterators, plus binary file input in
|
||||
* the form of class map_file.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RE_FILEITER_HPP_INCLUDED
|
||||
#define BOOST_RE_FILEITER_HPP_INCLUDED
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#ifndef BOOST_REGEX_NO_FILEITER
|
||||
|
||||
#if (defined(__CYGWIN__) || defined(__CYGWIN32__)) && !defined(BOOST_REGEX_NO_W32)
|
||||
#error "Sorry, can't mix <windows.h> with STL code and gcc compiler: if you ran configure, try again with configure --disable-ms-windows"
|
||||
#define BOOST_REGEX_FI_WIN32_MAP
|
||||
#define BOOST_REGEX_FI_POSIX_DIR
|
||||
#elif (defined(__WIN32__) || defined(_WIN32) || defined(WIN32)) && !defined(BOOST_REGEX_NO_W32)
|
||||
#define BOOST_REGEX_FI_WIN32_MAP
|
||||
#define BOOST_REGEX_FI_WIN32_DIR
|
||||
#else
|
||||
#define BOOST_REGEX_FI_POSIX_MAP
|
||||
#define BOOST_REGEX_FI_POSIX_DIR
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_REGEX_FI_WIN32_MAP)||defined(BOOST_REGEX_FI_WIN32_DIR)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_REGEX_FI_WIN32_DIR)
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost{
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
typedef WIN32_FIND_DATAA _fi_find_data;
|
||||
#else
|
||||
typedef WIN32_FIND_DATAW _fi_find_data;
|
||||
#endif
|
||||
typedef HANDLE _fi_find_handle;
|
||||
|
||||
} // namespace BOOST_REGEX_DETAIL_NS
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#define _fi_invalid_handle INVALID_HANDLE_VALUE
|
||||
#define _fi_dir FILE_ATTRIBUTE_DIRECTORY
|
||||
|
||||
#elif defined(BOOST_REGEX_FI_POSIX_DIR)
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cctype>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <cassert>
|
||||
#include <dirent.h>
|
||||
|
||||
#if defined(__SUNPRO_CC)
|
||||
using std::list;
|
||||
#endif
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 256
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
struct _fi_find_data
|
||||
{
|
||||
unsigned dwFileAttributes;
|
||||
char cFileName[MAX_PATH];
|
||||
};
|
||||
|
||||
struct _fi_priv_data;
|
||||
|
||||
typedef _fi_priv_data* _fi_find_handle;
|
||||
#define _fi_invalid_handle 0
|
||||
#define _fi_dir 1
|
||||
|
||||
_fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindFileData);
|
||||
bool _fi_FindNextFile(_fi_find_handle hFindFile, _fi_find_data* lpFindFileData);
|
||||
bool _fi_FindClose(_fi_find_handle hFindFile);
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
} // namespace BOOST_REGEX_DETAIL_NS
|
||||
} // namespace boost
|
||||
|
||||
#ifdef FindFirstFile
|
||||
#undef FindFirstFile
|
||||
#endif
|
||||
#ifdef FindNextFile
|
||||
#undef FindNextFile
|
||||
#endif
|
||||
#ifdef FindClose
|
||||
#undef FindClose
|
||||
#endif
|
||||
|
||||
#define FindFirstFileA _fi_FindFirstFile
|
||||
#define FindNextFileA _fi_FindNextFile
|
||||
#define FindClose _fi_FindClose
|
||||
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_REGEX_FI_WIN32_MAP // win32 mapfile
|
||||
|
||||
class BOOST_REGEX_DECL mapfile
|
||||
{
|
||||
HANDLE hfile;
|
||||
HANDLE hmap;
|
||||
const char* _first;
|
||||
const char* _last;
|
||||
public:
|
||||
|
||||
typedef const char* iterator;
|
||||
|
||||
mapfile(){ hfile = hmap = 0; _first = _last = 0; }
|
||||
mapfile(const char* file){ hfile = hmap = 0; _first = _last = 0; open(file); }
|
||||
~mapfile(){ close(); }
|
||||
void open(const char* file);
|
||||
void close();
|
||||
const char* begin(){ return _first; }
|
||||
const char* end(){ return _last; }
|
||||
size_t size(){ return _last - _first; }
|
||||
bool valid(){ return (hfile != 0) && (hfile != INVALID_HANDLE_VALUE); }
|
||||
};
|
||||
|
||||
|
||||
#else
|
||||
|
||||
class BOOST_REGEX_DECL mapfile_iterator;
|
||||
|
||||
class BOOST_REGEX_DECL mapfile
|
||||
{
|
||||
typedef char* pointer;
|
||||
std::FILE* hfile;
|
||||
long int _size;
|
||||
pointer* _first;
|
||||
pointer* _last;
|
||||
mutable std::list<pointer*> condemed;
|
||||
enum sizes
|
||||
{
|
||||
buf_size = 4096
|
||||
};
|
||||
void lock(pointer* node)const;
|
||||
void unlock(pointer* node)const;
|
||||
public:
|
||||
|
||||
typedef mapfile_iterator iterator;
|
||||
|
||||
mapfile(){ hfile = 0; _size = 0; _first = _last = 0; }
|
||||
mapfile(const char* file){ hfile = 0; _size = 0; _first = _last = 0; open(file); }
|
||||
~mapfile(){ close(); }
|
||||
void open(const char* file);
|
||||
void close();
|
||||
iterator begin()const;
|
||||
iterator end()const;
|
||||
unsigned long size()const{ return _size; }
|
||||
bool valid()const{ return hfile != 0; }
|
||||
friend class mapfile_iterator;
|
||||
};
|
||||
|
||||
class BOOST_REGEX_DECL mapfile_iterator
|
||||
{
|
||||
typedef mapfile::pointer internal_pointer;
|
||||
internal_pointer* node;
|
||||
const mapfile* file;
|
||||
unsigned long offset;
|
||||
long position()const
|
||||
{
|
||||
return file ? ((node - file->_first) * mapfile::buf_size + offset) : 0;
|
||||
}
|
||||
void position(long pos)
|
||||
{
|
||||
if(file)
|
||||
{
|
||||
node = file->_first + (pos / mapfile::buf_size);
|
||||
offset = pos % mapfile::buf_size;
|
||||
}
|
||||
}
|
||||
public:
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef char value_type;
|
||||
typedef const char* pointer;
|
||||
typedef const char& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
|
||||
mapfile_iterator() { node = 0; file = 0; offset = 0; }
|
||||
mapfile_iterator(const mapfile* f, long arg_position)
|
||||
{
|
||||
BOOST_ASSERT(f);
|
||||
file = f;
|
||||
node = f->_first + arg_position / mapfile::buf_size;
|
||||
offset = arg_position % mapfile::buf_size;
|
||||
file->lock(node);
|
||||
}
|
||||
mapfile_iterator(const mapfile_iterator& i)
|
||||
{
|
||||
file = i.file;
|
||||
node = i.node;
|
||||
offset = i.offset;
|
||||
if(file)
|
||||
file->lock(node);
|
||||
}
|
||||
~mapfile_iterator()
|
||||
{
|
||||
if(file && node)
|
||||
file->unlock(node);
|
||||
}
|
||||
mapfile_iterator& operator = (const mapfile_iterator& i);
|
||||
char operator* ()const
|
||||
{
|
||||
BOOST_ASSERT(node >= file->_first);
|
||||
BOOST_ASSERT(node < file->_last);
|
||||
return file ? *(*node + sizeof(int) + offset) : char(0);
|
||||
}
|
||||
char operator[] (long off)const
|
||||
{
|
||||
mapfile_iterator tmp(*this);
|
||||
tmp += off;
|
||||
return *tmp;
|
||||
}
|
||||
mapfile_iterator& operator++ ();
|
||||
mapfile_iterator operator++ (int);
|
||||
mapfile_iterator& operator-- ();
|
||||
mapfile_iterator operator-- (int);
|
||||
|
||||
mapfile_iterator& operator += (long off)
|
||||
{
|
||||
position(position() + off);
|
||||
return *this;
|
||||
}
|
||||
mapfile_iterator& operator -= (long off)
|
||||
{
|
||||
position(position() - off);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
friend inline bool operator==(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return (i.file == j.file) && (i.node == j.node) && (i.offset == j.offset);
|
||||
}
|
||||
|
||||
friend inline bool operator!=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return !(i == j);
|
||||
}
|
||||
|
||||
friend inline bool operator<(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() < j.position();
|
||||
}
|
||||
friend inline bool operator>(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() > j.position();
|
||||
}
|
||||
friend inline bool operator<=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() <= j.position();
|
||||
}
|
||||
friend inline bool operator>=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() >= j.position();
|
||||
}
|
||||
|
||||
friend mapfile_iterator operator + (const mapfile_iterator& i, long off);
|
||||
friend mapfile_iterator operator + (long off, const mapfile_iterator& i)
|
||||
{
|
||||
mapfile_iterator tmp(i);
|
||||
return tmp += off;
|
||||
}
|
||||
friend mapfile_iterator operator - (const mapfile_iterator& i, long off);
|
||||
friend inline long operator - (const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() - j.position();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
friend bool operator==(const mapfile_iterator& i, const mapfile_iterator& j);
|
||||
friend bool operator!=(const mapfile_iterator& i, const mapfile_iterator& j);
|
||||
friend bool operator<(const mapfile_iterator& i, const mapfile_iterator& j);
|
||||
friend bool operator>(const mapfile_iterator& i, const mapfile_iterator& j);
|
||||
friend bool operator<=(const mapfile_iterator& i, const mapfile_iterator& j);
|
||||
friend bool operator>=(const mapfile_iterator& i, const mapfile_iterator& j);
|
||||
friend mapfile_iterator operator + (const mapfile_iterator& i, long off);
|
||||
friend mapfile_iterator operator + (long off, const mapfile_iterator& i);
|
||||
friend mapfile_iterator operator - (const mapfile_iterator& i, long off);
|
||||
friend long operator - (const mapfile_iterator& i, const mapfile_iterator& j);
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#if defined(BOOST_EMBTC)
|
||||
|
||||
inline bool operator==(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return (i.file == j.file) && (i.node == j.node) && (i.offset == j.offset);
|
||||
}
|
||||
|
||||
inline bool operator!=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return !(i == j);
|
||||
}
|
||||
|
||||
inline bool operator<(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() < j.position();
|
||||
}
|
||||
inline bool operator>(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() > j.position();
|
||||
}
|
||||
inline bool operator<=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() <= j.position();
|
||||
}
|
||||
inline bool operator>=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() >= j.position();
|
||||
}
|
||||
mapfile_iterator operator + (long off, const mapfile_iterator& i)
|
||||
{
|
||||
mapfile_iterator tmp(i);
|
||||
return tmp += off;
|
||||
}
|
||||
inline long operator - (const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() - j.position();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// _fi_sep determines the directory separator, either '\\' or '/'
|
||||
BOOST_REGEX_DECL extern const char* _fi_sep;
|
||||
|
||||
struct file_iterator_ref
|
||||
{
|
||||
_fi_find_handle hf;
|
||||
_fi_find_data _data;
|
||||
long count;
|
||||
};
|
||||
|
||||
|
||||
class BOOST_REGEX_DECL file_iterator
|
||||
{
|
||||
char* _root;
|
||||
char* _path;
|
||||
char* ptr;
|
||||
file_iterator_ref* ref;
|
||||
|
||||
public:
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef const char* value_type;
|
||||
typedef const char** pointer;
|
||||
typedef const char*& reference;
|
||||
typedef std::input_iterator_tag iterator_category;
|
||||
|
||||
file_iterator();
|
||||
file_iterator(const char* wild);
|
||||
~file_iterator();
|
||||
file_iterator(const file_iterator&);
|
||||
file_iterator& operator=(const file_iterator&);
|
||||
const char* root()const { return _root; }
|
||||
const char* path()const { return _path; }
|
||||
const char* name()const { return ptr; }
|
||||
_fi_find_data* data() { return &(ref->_data); }
|
||||
void next();
|
||||
file_iterator& operator++() { next(); return *this; }
|
||||
file_iterator operator++(int);
|
||||
const char* operator*() { return path(); }
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
friend inline bool operator == (const file_iterator& f1, const file_iterator& f2)
|
||||
{
|
||||
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
|
||||
}
|
||||
|
||||
friend inline bool operator != (const file_iterator& f1, const file_iterator& f2)
|
||||
{
|
||||
return !(f1 == f2);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
friend bool operator == (const file_iterator& f1, const file_iterator& f2);
|
||||
friend bool operator != (const file_iterator& f1, const file_iterator& f2);
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#if defined(BOOST_EMBTC)
|
||||
|
||||
inline bool operator == (const file_iterator& f1, const file_iterator& f2)
|
||||
{
|
||||
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
|
||||
}
|
||||
|
||||
inline bool operator != (const file_iterator& f1, const file_iterator& f2)
|
||||
{
|
||||
return !(f1 == f2);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// dwa 9/13/00 - suppress unused parameter warning
|
||||
inline bool operator < (const file_iterator&, const file_iterator&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
class BOOST_REGEX_DECL directory_iterator
|
||||
{
|
||||
char* _root;
|
||||
char* _path;
|
||||
char* ptr;
|
||||
file_iterator_ref* ref;
|
||||
|
||||
public:
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef const char* value_type;
|
||||
typedef const char** pointer;
|
||||
typedef const char*& reference;
|
||||
typedef std::input_iterator_tag iterator_category;
|
||||
|
||||
directory_iterator();
|
||||
directory_iterator(const char* wild);
|
||||
~directory_iterator();
|
||||
directory_iterator(const directory_iterator& other);
|
||||
directory_iterator& operator=(const directory_iterator& other);
|
||||
|
||||
const char* root()const { return _root; }
|
||||
const char* path()const { return _path; }
|
||||
const char* name()const { return ptr; }
|
||||
_fi_find_data* data() { return &(ref->_data); }
|
||||
void next();
|
||||
directory_iterator& operator++() { next(); return *this; }
|
||||
directory_iterator operator++(int);
|
||||
const char* operator*() { return path(); }
|
||||
|
||||
static const char* separator() { return _fi_sep; }
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
friend inline bool operator == (const directory_iterator& f1, const directory_iterator& f2)
|
||||
{
|
||||
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
|
||||
}
|
||||
|
||||
|
||||
friend inline bool operator != (const directory_iterator& f1, const directory_iterator& f2)
|
||||
{
|
||||
return !(f1 == f2);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
friend bool operator == (const directory_iterator& f1, const directory_iterator& f2);
|
||||
friend bool operator != (const directory_iterator& f1, const directory_iterator& f2);
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#if defined(BOOST_EMBTC)
|
||||
|
||||
inline bool operator == (const directory_iterator& f1, const directory_iterator& f2)
|
||||
{
|
||||
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
|
||||
}
|
||||
|
||||
|
||||
inline bool operator != (const directory_iterator& f1, const directory_iterator& f2)
|
||||
{
|
||||
return !(f1 == f2);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline bool operator < (const directory_iterator&, const directory_iterator&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace BOOST_REGEX_DETAIL_NS
|
||||
using boost::BOOST_REGEX_DETAIL_NS::directory_iterator;
|
||||
using boost::BOOST_REGEX_DETAIL_NS::file_iterator;
|
||||
using boost::BOOST_REGEX_DETAIL_NS::mapfile;
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REGEX_NO_FILEITER
|
||||
#endif // BOOST_RE_FILEITER_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,116 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2004
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE cpp_regex_traits.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Implements cpp_regex_traits<char> (and associated helper classes).
|
||||
*/
|
||||
|
||||
#define BOOST_REGEX_SOURCE
|
||||
#include <boost/config.hpp>
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
#include <boost/regex/regex_traits.hpp>
|
||||
#include <boost/regex/pattern_except.hpp>
|
||||
|
||||
#ifdef BOOST_NO_STDC_NAMESPACE
|
||||
namespace std{
|
||||
using ::memset;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
void cpp_regex_traits_char_layer<char>::init()
|
||||
{
|
||||
// we need to start by initialising our syntax map so we know which
|
||||
// character is used for which purpose:
|
||||
std::memset(m_char_map, 0, sizeof(m_char_map));
|
||||
#ifndef BOOST_NO_STD_MESSAGES
|
||||
#ifndef __IBMCPP__
|
||||
std::messages<char>::catalog cat = static_cast<std::messages<char>::catalog>(-1);
|
||||
#else
|
||||
std::messages<char>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
|
||||
#endif
|
||||
std::string cat_name(cpp_regex_traits<char>::get_catalog_name());
|
||||
if((!cat_name.empty()) && (m_pmessages != 0))
|
||||
{
|
||||
cat = this->m_pmessages->open(
|
||||
cat_name,
|
||||
this->m_locale);
|
||||
if((int)cat < 0)
|
||||
{
|
||||
std::string m("Unable to open message catalog: ");
|
||||
std::runtime_error err(m + cat_name);
|
||||
boost::BOOST_REGEX_DETAIL_NS::raise_runtime_error(err);
|
||||
}
|
||||
}
|
||||
//
|
||||
// if we have a valid catalog then load our messages:
|
||||
//
|
||||
if((int)cat >= 0)
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try{
|
||||
#endif
|
||||
for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
|
||||
{
|
||||
string_type mss = this->m_pmessages->get(cat, 0, i, get_default_syntax(i));
|
||||
for(string_type::size_type j = 0; j < mss.size(); ++j)
|
||||
{
|
||||
m_char_map[static_cast<unsigned char>(mss[j])] = i;
|
||||
}
|
||||
}
|
||||
this->m_pmessages->close(cat);
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
this->m_pmessages->close(cat);
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
for(regex_constants::syntax_type j = 1; j < regex_constants::syntax_max; ++j)
|
||||
{
|
||||
const char* ptr = get_default_syntax(j);
|
||||
while(ptr && *ptr)
|
||||
{
|
||||
m_char_map[static_cast<unsigned char>(*ptr)] = j;
|
||||
++ptr;
|
||||
}
|
||||
}
|
||||
#ifndef BOOST_NO_STD_MESSAGES
|
||||
}
|
||||
#endif
|
||||
//
|
||||
// finish off by calculating our escape types:
|
||||
//
|
||||
unsigned char i = 'A';
|
||||
do
|
||||
{
|
||||
if(m_char_map[i] == 0)
|
||||
{
|
||||
if(this->m_pctype->is(std::ctype_base::lower, i))
|
||||
m_char_map[i] = regex_constants::escape_type_class;
|
||||
else if(this->m_pctype->is(std::ctype_base::upper, i))
|
||||
m_char_map[i] = regex_constants::escape_type_not_class;
|
||||
}
|
||||
}while(0xFF != i++);
|
||||
}
|
||||
|
||||
} // BOOST_REGEX_DETAIL_NS
|
||||
} // boost
|
||||
#endif
|
@ -60,6 +60,25 @@ test_overloads.cpp
|
||||
test_operators.cpp
|
||||
;
|
||||
|
||||
lib boost_regex_recursive :
|
||||
../src/icu.cpp
|
||||
../src/posix_api.cpp
|
||||
../src/regex.cpp
|
||||
../src/regex_debug.cpp
|
||||
../src/regex_raw_buffer.cpp
|
||||
../src/regex_traits_defaults.cpp
|
||||
../src/static_mutex.cpp
|
||||
../src/w32_regex_traits.cpp
|
||||
../src/wide_posix_api.cpp
|
||||
../build//icu_options
|
||||
:
|
||||
<define>BOOST_REGEX_RECURSIVE=1
|
||||
<define>BOOST_REGEX_CXX03=1
|
||||
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
|
||||
:
|
||||
;
|
||||
|
||||
|
||||
local regress-sources = regress/$(R_SOURCE) ;
|
||||
|
||||
test-suite regex
|
||||
@ -144,6 +163,15 @@ test-suite regex
|
||||
captures_test
|
||||
]
|
||||
|
||||
[ run regress/$(R_SOURCE) .//boost_regex_recursive
|
||||
../build//icu_options
|
||||
: # command line
|
||||
: # input files
|
||||
: # requirements
|
||||
<define>BOOST_REGEX_RECURSIVE=1
|
||||
<define>BOOST_REGEX_CXX03=1
|
||||
: regex_regress_recursive ]
|
||||
|
||||
[ run regress/$(R_SOURCE) ./noeh_test//boost_regex_noeh
|
||||
../build//icu_options
|
||||
: # command line
|
||||
|
@ -8,7 +8,6 @@ project
|
||||
;
|
||||
|
||||
EX_SOURCES =
|
||||
cpp_regex_traits.cpp
|
||||
icu.cpp
|
||||
posix_api.cpp
|
||||
regex.cpp
|
||||
|
@ -24,7 +24,6 @@ project
|
||||
|
||||
|
||||
lib boost_regex_noeh :
|
||||
../../src/cpp_regex_traits.cpp
|
||||
../../src/icu.cpp
|
||||
../../src/posix_api.cpp
|
||||
../../src/regex.cpp
|
||||
|
@ -10,7 +10,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <libs/regex/src/cpp_regex_traits.cpp>
|
||||
#include <libs/regex/src/icu.cpp>
|
||||
#include <libs/regex/src/posix_api.cpp>
|
||||
#include <libs/regex/src/regex.cpp>
|
||||
|
Reference in New Issue
Block a user