mirror of
https://github.com/boostorg/regex.git
synced 2025-07-17 22:32:09 +02:00
Change detail namespace.
Big search and replace to change name of internal namepace so it's mangled with the Boost version number - the aim is to reduce the chances of mixing different header and library versions.
This commit is contained in:
@ -68,7 +68,7 @@ inline std::string to_string(const char* i, const char* j)
|
||||
}
|
||||
|
||||
}
|
||||
namespace re_detail{
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
class RegExData
|
||||
{
|
||||
@ -141,12 +141,12 @@ void RegExData::clean()
|
||||
|
||||
RegEx::RegEx()
|
||||
{
|
||||
pdata = new re_detail::RegExData();
|
||||
pdata = new BOOST_REGEX_DETAIL_NS::RegExData();
|
||||
}
|
||||
|
||||
RegEx::RegEx(const RegEx& o)
|
||||
{
|
||||
pdata = new re_detail::RegExData(*(o.pdata));
|
||||
pdata = new BOOST_REGEX_DETAIL_NS::RegExData(*(o.pdata));
|
||||
}
|
||||
|
||||
RegEx::~RegEx()
|
||||
@ -156,13 +156,13 @@ RegEx::~RegEx()
|
||||
|
||||
RegEx::RegEx(const char* c, bool icase)
|
||||
{
|
||||
pdata = new re_detail::RegExData();
|
||||
pdata = new BOOST_REGEX_DETAIL_NS::RegExData();
|
||||
SetExpression(c, icase);
|
||||
}
|
||||
|
||||
RegEx::RegEx(const std::string& s, bool icase)
|
||||
{
|
||||
pdata = new re_detail::RegExData();
|
||||
pdata = new BOOST_REGEX_DETAIL_NS::RegExData();
|
||||
SetExpression(s.c_str(), icase);
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ std::string RegEx::Expression()const
|
||||
//
|
||||
bool RegEx::Match(const char* p, match_flag_type flags)
|
||||
{
|
||||
pdata->t = re_detail::RegExData::type_pc;
|
||||
pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pc;
|
||||
pdata->pbase = p;
|
||||
const char* end = p;
|
||||
while(*end)++end;
|
||||
@ -215,7 +215,7 @@ bool RegEx::Match(const char* p, match_flag_type flags)
|
||||
|
||||
bool RegEx::Search(const char* p, match_flag_type flags)
|
||||
{
|
||||
pdata->t = re_detail::RegExData::type_pc;
|
||||
pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pc;
|
||||
pdata->pbase = p;
|
||||
const char* end = p;
|
||||
while(*end)++end;
|
||||
@ -227,7 +227,7 @@ bool RegEx::Search(const char* p, match_flag_type flags)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
namespace re_detail{
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
struct pred1
|
||||
{
|
||||
GrepCallback cb;
|
||||
@ -242,17 +242,17 @@ struct pred1
|
||||
}
|
||||
unsigned int RegEx::Grep(GrepCallback cb, const char* p, match_flag_type flags)
|
||||
{
|
||||
pdata->t = re_detail::RegExData::type_pc;
|
||||
pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pc;
|
||||
pdata->pbase = p;
|
||||
const char* end = p;
|
||||
while(*end)++end;
|
||||
|
||||
unsigned int result = regex_grep(re_detail::pred1(cb, this), p, end, pdata->e, flags);
|
||||
unsigned int result = regex_grep(BOOST_REGEX_DETAIL_NS::pred1(cb, this), p, end, pdata->e, flags);
|
||||
if(result)
|
||||
pdata->update();
|
||||
return result;
|
||||
}
|
||||
namespace re_detail{
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
struct pred2
|
||||
{
|
||||
std::vector<std::string>& v;
|
||||
@ -271,17 +271,17 @@ private:
|
||||
|
||||
unsigned int RegEx::Grep(std::vector<std::string>& v, const char* p, match_flag_type flags)
|
||||
{
|
||||
pdata->t = re_detail::RegExData::type_pc;
|
||||
pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pc;
|
||||
pdata->pbase = p;
|
||||
const char* end = p;
|
||||
while(*end)++end;
|
||||
|
||||
unsigned int result = regex_grep(re_detail::pred2(v, this), p, end, pdata->e, flags);
|
||||
unsigned int result = regex_grep(BOOST_REGEX_DETAIL_NS::pred2(v, this), p, end, pdata->e, flags);
|
||||
if(result)
|
||||
pdata->update();
|
||||
return result;
|
||||
}
|
||||
namespace re_detail{
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
struct pred3
|
||||
{
|
||||
std::vector<std::size_t>& v;
|
||||
@ -300,18 +300,18 @@ private:
|
||||
}
|
||||
unsigned int RegEx::Grep(std::vector<std::size_t>& v, const char* p, match_flag_type flags)
|
||||
{
|
||||
pdata->t = re_detail::RegExData::type_pc;
|
||||
pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pc;
|
||||
pdata->pbase = p;
|
||||
const char* end = p;
|
||||
while(*end)++end;
|
||||
|
||||
unsigned int result = regex_grep(re_detail::pred3(v, p, this), p, end, pdata->e, flags);
|
||||
unsigned int result = regex_grep(BOOST_REGEX_DETAIL_NS::pred3(v, p, this), p, end, pdata->e, flags);
|
||||
if(result)
|
||||
pdata->update();
|
||||
return result;
|
||||
}
|
||||
#ifndef BOOST_REGEX_NO_FILEITER
|
||||
namespace re_detail{
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
struct pred4
|
||||
{
|
||||
GrepFileCallback cb;
|
||||
@ -338,17 +338,17 @@ void BuildFileList(std::list<std::string>* pl, const char* files, bool recurse)
|
||||
{
|
||||
// go through sub directories:
|
||||
char buf[MAX_PATH];
|
||||
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(buf, MAX_PATH, start.root()));
|
||||
BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(buf, MAX_PATH, start.root()));
|
||||
if(*buf == 0)
|
||||
{
|
||||
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(buf, MAX_PATH, "."));
|
||||
re_detail::overflow_error_if_not_zero(re_detail::strcat_s(buf, MAX_PATH, directory_iterator::separator()));
|
||||
re_detail::overflow_error_if_not_zero(re_detail::strcat_s(buf, MAX_PATH, "*"));
|
||||
BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(buf, MAX_PATH, "."));
|
||||
BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcat_s(buf, MAX_PATH, directory_iterator::separator()));
|
||||
BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcat_s(buf, MAX_PATH, "*"));
|
||||
}
|
||||
else
|
||||
{
|
||||
re_detail::overflow_error_if_not_zero(re_detail::strcat_s(buf, MAX_PATH, directory_iterator::separator()));
|
||||
re_detail::overflow_error_if_not_zero(re_detail::strcat_s(buf, MAX_PATH, "*"));
|
||||
BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcat_s(buf, MAX_PATH, directory_iterator::separator()));
|
||||
BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcat_s(buf, MAX_PATH, "*"));
|
||||
}
|
||||
directory_iterator dstart(buf);
|
||||
directory_iterator dend;
|
||||
@ -403,9 +403,9 @@ unsigned int RegEx::GrepFiles(GrepFileCallback cb, const char* files, bool recur
|
||||
while(start != end)
|
||||
{
|
||||
mapfile map((*start).c_str());
|
||||
pdata->t = re_detail::RegExData::type_pf;
|
||||
pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pf;
|
||||
pdata->fbase = map.begin();
|
||||
re_detail::pred4 pred(cb, this, (*start).c_str());
|
||||
BOOST_REGEX_DETAIL_NS::pred4 pred(cb, this, (*start).c_str());
|
||||
int r = regex_grep(pred, map.begin(), map.end(), pdata->e, flags);
|
||||
result += r;
|
||||
++start;
|
||||
@ -430,7 +430,7 @@ unsigned int RegEx::FindFiles(FindFilesCallback cb, const char* files, bool recu
|
||||
while(start != end)
|
||||
{
|
||||
mapfile map((*start).c_str());
|
||||
pdata->t = re_detail::RegExData::type_pf;
|
||||
pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pf;
|
||||
pdata->fbase = map.begin();
|
||||
|
||||
if(regex_search(map.begin(), map.end(), pdata->fm, pdata->e, flags))
|
||||
@ -456,7 +456,7 @@ std::string RegEx::Merge(const std::string& in, const std::string& fmt,
|
||||
bool copy, match_flag_type flags)
|
||||
{
|
||||
std::string result;
|
||||
re_detail::string_out_iterator<std::string> i(result);
|
||||
BOOST_REGEX_DETAIL_NS::string_out_iterator<std::string> i(result);
|
||||
if(!copy) flags |= format_no_copy;
|
||||
regex_replace(i, in.begin(), in.end(), pdata->e, fmt.c_str(), flags);
|
||||
return result;
|
||||
@ -467,7 +467,7 @@ std::string RegEx::Merge(const char* in, const char* fmt,
|
||||
{
|
||||
std::string result;
|
||||
if(!copy) flags |= format_no_copy;
|
||||
re_detail::string_out_iterator<std::string> i(result);
|
||||
BOOST_REGEX_DETAIL_NS::string_out_iterator<std::string> i(result);
|
||||
regex_replace(i, in, in + std::strlen(in), pdata->e, fmt, flags);
|
||||
return result;
|
||||
}
|
||||
@ -489,13 +489,13 @@ std::size_t RegEx::Position(int i)const
|
||||
{
|
||||
switch(pdata->t)
|
||||
{
|
||||
case re_detail::RegExData::type_pc:
|
||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pc:
|
||||
return pdata->m[i].matched ? pdata->m[i].first - pdata->pbase : RegEx::npos;
|
||||
#ifndef BOOST_REGEX_NO_FILEITER
|
||||
case re_detail::RegExData::type_pf:
|
||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pf:
|
||||
return pdata->fm[i].matched ? pdata->fm[i].first - pdata->fbase : RegEx::npos;
|
||||
#endif
|
||||
case re_detail::RegExData::type_copy:
|
||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_copy:
|
||||
{
|
||||
std::map<int, std::ptrdiff_t, std::less<int> >::iterator pos = pdata->positions.find(i);
|
||||
if(pos == pdata->positions.end())
|
||||
@ -516,13 +516,13 @@ std::size_t RegEx::Length(int i)const
|
||||
{
|
||||
switch(pdata->t)
|
||||
{
|
||||
case re_detail::RegExData::type_pc:
|
||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pc:
|
||||
return pdata->m[i].matched ? pdata->m[i].second - pdata->m[i].first : RegEx::npos;
|
||||
#ifndef BOOST_REGEX_NO_FILEITER
|
||||
case re_detail::RegExData::type_pf:
|
||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pf:
|
||||
return pdata->fm[i].matched ? pdata->fm[i].second - pdata->fm[i].first : RegEx::npos;
|
||||
#endif
|
||||
case re_detail::RegExData::type_copy:
|
||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_copy:
|
||||
{
|
||||
std::map<int, std::string, std::less<int> >::iterator pos = pdata->strings.find(i);
|
||||
if(pos == pdata->strings.end())
|
||||
@ -537,13 +537,13 @@ bool RegEx::Matched(int i)const
|
||||
{
|
||||
switch(pdata->t)
|
||||
{
|
||||
case re_detail::RegExData::type_pc:
|
||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pc:
|
||||
return pdata->m[i].matched;
|
||||
#ifndef BOOST_REGEX_NO_FILEITER
|
||||
case re_detail::RegExData::type_pf:
|
||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pf:
|
||||
return pdata->fm[i].matched;
|
||||
#endif
|
||||
case re_detail::RegExData::type_copy:
|
||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_copy:
|
||||
{
|
||||
std::map<int, std::string, std::less<int> >::iterator pos = pdata->strings.find(i);
|
||||
if(pos == pdata->strings.end())
|
||||
@ -560,15 +560,15 @@ std::string RegEx::What(int i)const
|
||||
std::string result;
|
||||
switch(pdata->t)
|
||||
{
|
||||
case re_detail::RegExData::type_pc:
|
||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pc:
|
||||
if(pdata->m[i].matched)
|
||||
result.assign(pdata->m[i].first, pdata->m[i].second);
|
||||
break;
|
||||
case re_detail::RegExData::type_pf:
|
||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pf:
|
||||
if(pdata->m[i].matched)
|
||||
result.assign(to_string(pdata->m[i].first, pdata->m[i].second));
|
||||
break;
|
||||
case re_detail::RegExData::type_copy:
|
||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_copy:
|
||||
{
|
||||
std::map<int, std::string, std::less<int> >::iterator pos = pdata->strings.find(i);
|
||||
if(pos != pdata->strings.end())
|
||||
|
Reference in New Issue
Block a user