Skip to content

Commit 6ffcc5e

Browse files
committed
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.
1 parent 297e873 commit 6ffcc5e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+609
-598
lines changed

include/boost/regex/config.hpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#if defined(__BORLANDC__)
2626
# include <boost/regex/config/borland.hpp>
2727
#endif
28+
#include <boost/version.hpp>
2829

2930
/*****************************************************************************
3031
*
@@ -69,6 +70,13 @@
6970
#define UNICODE
7071
#endif
7172

73+
74+
/*
75+
* Define a macro for the namespace that details are placed in, this includes the Boost
76+
* version number to avoid mismatched header and library versions:
77+
*/
78+
#define BOOST_REGEX_DETAIL_NS BOOST_JOIN(re_detail_, BOOST_VERSION)
79+
7280
/*
7381
* Fix for gcc prior to 3.4: std::ctype<wchar_t> doesn't allow
7482
* masks to be combined, for example:
@@ -334,7 +342,7 @@ if(0 == (x))\
334342
#if defined(__cplusplus) && defined(BOOST_REGEX_HAS_MS_STACK_GUARD)
335343

336344
namespace boost{
337-
namespace re_detail{
345+
namespace BOOST_REGEX_DETAIL_NS{
338346

339347
BOOST_REGEX_DECL void BOOST_REGEX_CALL reset_stack_guard_page();
340348

@@ -387,7 +395,7 @@ BOOST_REGEX_DECL void BOOST_REGEX_CALL reset_stack_guard_page();
387395
****************************************************************************/
388396

389397
#if defined(__cplusplus) && defined(BOOST_REGEX_NON_RECURSIVE)
390-
namespace boost{ namespace re_detail{
398+
namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
391399

392400
BOOST_REGEX_DECL void* BOOST_REGEX_CALL get_mem_block();
393401
BOOST_REGEX_DECL void BOOST_REGEX_CALL put_mem_block(void*);

include/boost/regex/icu.hpp

Lines changed: 83 additions & 83 deletions
Large diffs are not rendered by default.

include/boost/regex/mfc.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ OutputIterator regex_replace(OutputIterator out,
144144
return ::boost::regex_replace(out, first, last, e, fmt.GetString(), flags);
145145
}
146146

147-
namespace re_detail{
147+
namespace BOOST_REGEX_DETAIL_NS{
148148

149149
template <class B, bool b>
150150
class mfc_string_out_iterator
@@ -176,7 +176,7 @@ ATL::CSimpleStringT<B, b> regex_replace(const ATL::CSimpleStringT<B, b>& s,
176176
match_flag_type flags = match_default)
177177
{
178178
ATL::CSimpleStringT<B, b> result(s.GetManager());
179-
re_detail::mfc_string_out_iterator<B, b> i(result);
179+
BOOST_REGEX_DETAIL_NS::mfc_string_out_iterator<B, b> i(result);
180180
regex_replace(i, s.GetString(), s.GetString() + s.GetLength(), e, fmt.GetString(), flags);
181181
return result;
182182
}

include/boost/regex/pattern_except.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class BOOST_REGEX_DECL regex_error : public std::runtime_error
6363
typedef regex_error bad_pattern;
6464
typedef regex_error bad_expression;
6565

66-
namespace re_detail{
66+
namespace BOOST_REGEX_DETAIL_NS{
6767

6868
BOOST_REGEX_DECL void BOOST_REGEX_CALL raise_runtime_error(const std::runtime_error& ex);
6969

@@ -72,7 +72,7 @@ void raise_error(const traits& t, regex_constants::error_type code)
7272
{
7373
(void)t; // warning suppression
7474
std::runtime_error e(t.error_string(code));
75-
::boost::re_detail::raise_runtime_error(e);
75+
::boost::BOOST_REGEX_DETAIL_NS::raise_runtime_error(e);
7676
}
7777

7878
}

include/boost/regex/v4/basic_regex.hpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace boost{
4242
#endif
4343
#endif
4444

45-
namespace re_detail{
45+
namespace BOOST_REGEX_DETAIL_NS{
4646

4747
//
4848
// forward declaration, we will need this one later:
@@ -176,11 +176,11 @@ struct regex_data : public named_subexpressions
176176
const charT* m_expression; // the original expression
177177
std::ptrdiff_t m_expression_len; // the length of the original expression
178178
size_type m_mark_count; // the number of marked sub-expressions
179-
re_detail::re_syntax_base* m_first_state; // the first state of the machine
179+
BOOST_REGEX_DETAIL_NS::re_syntax_base* m_first_state; // the first state of the machine
180180
unsigned m_restart_type; // search optimisation type
181181
unsigned char m_startmap[1 << CHAR_BIT]; // which characters can start a match
182182
unsigned int m_can_be_null; // whether we can match a null string
183-
re_detail::raw_storage m_data; // the buffer in which our states are constructed
183+
BOOST_REGEX_DETAIL_NS::raw_storage m_data; // the buffer in which our states are constructed
184184
typename traits::char_class_type m_word_mask; // mask used to determine if a character is a word character
185185
std::vector<
186186
std::pair<
@@ -266,7 +266,7 @@ class basic_regex_implementation
266266
{
267267
return this->m_mark_count - 1;
268268
}
269-
const re_detail::re_syntax_base* get_first_state()const
269+
const BOOST_REGEX_DETAIL_NS::re_syntax_base* get_first_state()const
270270
{
271271
return this->m_first_state;
272272
}
@@ -293,7 +293,7 @@ class basic_regex_implementation
293293
}
294294
};
295295

296-
} // namespace re_detail
296+
} // namespace BOOST_REGEX_DETAIL_NS
297297
//
298298
// class basic_regex:
299299
// represents the compiled
@@ -597,7 +597,7 @@ class basic_regex : public regbase
597597
//
598598
// private access methods:
599599
//
600-
const re_detail::re_syntax_base* get_first_state()const
600+
const BOOST_REGEX_DETAIL_NS::re_syntax_base* get_first_state()const
601601
{
602602
BOOST_ASSERT(0 != m_pimpl.get());
603603
return m_pimpl->get_first_state();
@@ -622,18 +622,18 @@ class basic_regex : public regbase
622622
BOOST_ASSERT(0 != m_pimpl.get());
623623
return m_pimpl->can_be_null();
624624
}
625-
const re_detail::regex_data<charT, traits>& get_data()const
625+
const BOOST_REGEX_DETAIL_NS::regex_data<charT, traits>& get_data()const
626626
{
627627
BOOST_ASSERT(0 != m_pimpl.get());
628628
return m_pimpl->get_data();
629629
}
630-
boost::shared_ptr<re_detail::named_subexpressions > get_named_subs()const
630+
boost::shared_ptr<BOOST_REGEX_DETAIL_NS::named_subexpressions > get_named_subs()const
631631
{
632632
return m_pimpl;
633633
}
634634

635635
private:
636-
shared_ptr<re_detail::basic_regex_implementation<charT, traits> > m_pimpl;
636+
shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits> > m_pimpl;
637637
};
638638

639639
//
@@ -647,14 +647,14 @@ basic_regex<charT, traits>& basic_regex<charT, traits>::do_assign(const charT* p
647647
const charT* p2,
648648
flag_type f)
649649
{
650-
shared_ptr<re_detail::basic_regex_implementation<charT, traits> > temp;
650+
shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits> > temp;
651651
if(!m_pimpl.get())
652652
{
653-
temp = shared_ptr<re_detail::basic_regex_implementation<charT, traits> >(new re_detail::basic_regex_implementation<charT, traits>());
653+
temp = shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits> >(new BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits>());
654654
}
655655
else
656656
{
657-
temp = shared_ptr<re_detail::basic_regex_implementation<charT, traits> >(new re_detail::basic_regex_implementation<charT, traits>(m_pimpl->m_ptraits));
657+
temp = shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits> >(new BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits>(m_pimpl->m_ptraits));
658658
}
659659
temp->assign(p1, p2, f);
660660
temp.swap(m_pimpl);
@@ -664,7 +664,7 @@ basic_regex<charT, traits>& basic_regex<charT, traits>::do_assign(const charT* p
664664
template <class charT, class traits>
665665
typename basic_regex<charT, traits>::locale_type BOOST_REGEX_CALL basic_regex<charT, traits>::imbue(locale_type l)
666666
{
667-
shared_ptr<re_detail::basic_regex_implementation<charT, traits> > temp(new re_detail::basic_regex_implementation<charT, traits>());
667+
shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits> > temp(new BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits>());
668668
locale_type result = temp->imbue(l);
669669
temp.swap(m_pimpl);
670670
return result;

include/boost/regex/v4/basic_regex_creator.hpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
namespace boost{
4040

41-
namespace re_detail{
41+
namespace BOOST_REGEX_DETAIL_NS{
4242

4343
template <class charT>
4444
struct digraph : public std::pair<charT, charT>
@@ -371,9 +371,9 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
371371
//
372372
// fill in the basics:
373373
//
374-
result->csingles = static_cast<unsigned int>(::boost::re_detail::distance(char_set.singles_begin(), char_set.singles_end()));
375-
result->cranges = static_cast<unsigned int>(::boost::re_detail::distance(char_set.ranges_begin(), char_set.ranges_end())) / 2;
376-
result->cequivalents = static_cast<unsigned int>(::boost::re_detail::distance(char_set.equivalents_begin(), char_set.equivalents_end()));
374+
result->csingles = static_cast<unsigned int>(::boost::BOOST_REGEX_DETAIL_NS::distance(char_set.singles_begin(), char_set.singles_end()));
375+
result->cranges = static_cast<unsigned int>(::boost::BOOST_REGEX_DETAIL_NS::distance(char_set.ranges_begin(), char_set.ranges_end())) / 2;
376+
result->cequivalents = static_cast<unsigned int>(::boost::BOOST_REGEX_DETAIL_NS::distance(char_set.equivalents_begin(), char_set.equivalents_end()));
377377
result->cclasses = char_set.classes();
378378
result->cnclasses = char_set.negated_classes();
379379
if(flags() & regbase::icase)
@@ -463,10 +463,10 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
463463
return 0;
464464
}
465465
charT* p = static_cast<charT*>(this->m_pdata->m_data.extend(sizeof(charT) * (s1.size() + s2.size() + 2) ) );
466-
re_detail::copy(s1.begin(), s1.end(), p);
466+
BOOST_REGEX_DETAIL_NS::copy(s1.begin(), s1.end(), p);
467467
p[s1.size()] = charT(0);
468468
p += s1.size() + 1;
469-
re_detail::copy(s2.begin(), s2.end(), p);
469+
BOOST_REGEX_DETAIL_NS::copy(s2.begin(), s2.end(), p);
470470
p[s2.size()] = charT(0);
471471
}
472472
//
@@ -487,7 +487,7 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
487487
if(s.empty())
488488
return 0; // invalid or unsupported equivalence class
489489
charT* p = static_cast<charT*>(this->m_pdata->m_data.extend(sizeof(charT) * (s.size()+1) ) );
490-
re_detail::copy(s.begin(), s.end(), p);
490+
BOOST_REGEX_DETAIL_NS::copy(s.begin(), s.end(), p);
491491
p[s.size()] = charT(0);
492492
++first;
493493
}
@@ -664,7 +664,7 @@ void basic_regex_creator<charT, traits>::finalize(const charT* p1, const charT*
664664
m_pdata->m_expression_len = len;
665665
charT* ps = static_cast<charT*>(m_pdata->m_data.extend(sizeof(charT) * (1 + (p2 - p1))));
666666
m_pdata->m_expression = ps;
667-
re_detail::copy(p1, p2, ps);
667+
BOOST_REGEX_DETAIL_NS::copy(p1, p2, ps);
668668
ps[p2 - p1] = 0;
669669
// fill in our other data...
670670
// successful parsing implies a zero status:
@@ -1456,15 +1456,15 @@ syntax_element_type basic_regex_creator<charT, traits>::get_repeat_type(re_synta
14561456
{
14571457
switch(state->next.p->type)
14581458
{
1459-
case re_detail::syntax_element_wild:
1460-
return re_detail::syntax_element_dot_rep;
1461-
case re_detail::syntax_element_literal:
1462-
return re_detail::syntax_element_char_rep;
1463-
case re_detail::syntax_element_set:
1464-
return re_detail::syntax_element_short_set_rep;
1465-
case re_detail::syntax_element_long_set:
1466-
if(static_cast<re_detail::re_set_long<m_type>*>(state->next.p)->singleton)
1467-
return re_detail::syntax_element_long_set_rep;
1459+
case BOOST_REGEX_DETAIL_NS::syntax_element_wild:
1460+
return BOOST_REGEX_DETAIL_NS::syntax_element_dot_rep;
1461+
case BOOST_REGEX_DETAIL_NS::syntax_element_literal:
1462+
return BOOST_REGEX_DETAIL_NS::syntax_element_char_rep;
1463+
case BOOST_REGEX_DETAIL_NS::syntax_element_set:
1464+
return BOOST_REGEX_DETAIL_NS::syntax_element_short_set_rep;
1465+
case BOOST_REGEX_DETAIL_NS::syntax_element_long_set:
1466+
if(static_cast<BOOST_REGEX_DETAIL_NS::re_set_long<m_type>*>(state->next.p)->singleton)
1467+
return BOOST_REGEX_DETAIL_NS::syntax_element_long_set_rep;
14681468
break;
14691469
default:
14701470
break;
@@ -1529,7 +1529,7 @@ void basic_regex_creator<charT, traits>::probe_leading_repeat(re_syntax_base* st
15291529
}
15301530

15311531

1532-
} // namespace re_detail
1532+
} // namespace BOOST_REGEX_DETAIL_NS
15331533

15341534
} // namespace boost
15351535

include/boost/regex/v4/basic_regex_parser.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#endif
3232

3333
namespace boost{
34-
namespace re_detail{
34+
namespace BOOST_REGEX_DETAIL_NS{
3535

3636
#ifdef BOOST_MSVC
3737
#pragma warning(push)
@@ -165,7 +165,7 @@ void basic_regex_parser<charT, traits>::parse(const charT* p1, const charT* p2,
165165
// have had an unexpected ')' :
166166
if(!result)
167167
{
168-
fail(regex_constants::error_paren, ::boost::re_detail::distance(m_base, m_position), "Found a closing ) with no corresponding openening parenthesis.");
168+
fail(regex_constants::error_paren, ::boost::BOOST_REGEX_DETAIL_NS::distance(m_base, m_position), "Found a closing ) with no corresponding openening parenthesis.");
169169
return;
170170
}
171171
// if an error has been set then give up now:
@@ -489,7 +489,7 @@ bool basic_regex_parser<charT, traits>::parse_open_paren()
489489
//
490490
if(m_position == m_end)
491491
{
492-
this->fail(regex_constants::error_paren, ::boost::re_detail::distance(m_base, m_end));
492+
this->fail(regex_constants::error_paren, ::boost::BOOST_REGEX_DETAIL_NS::distance(m_base, m_end));
493493
return false;
494494
}
495495
BOOST_ASSERT(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_mark);
@@ -924,9 +924,9 @@ bool basic_regex_parser<charT, traits>::parse_match_any()
924924
static_cast<re_dot*>(
925925
this->append_state(syntax_element_wild, sizeof(re_dot))
926926
)->mask = static_cast<unsigned char>(this->flags() & regbase::no_mod_s
927-
? re_detail::force_not_newline
927+
? BOOST_REGEX_DETAIL_NS::force_not_newline
928928
: this->flags() & regbase::mod_s ?
929-
re_detail::force_newline : re_detail::dont_care);
929+
BOOST_REGEX_DETAIL_NS::force_newline : BOOST_REGEX_DETAIL_NS::dont_care);
930930
return true;
931931
}
932932

@@ -963,7 +963,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
963963
}
964964
if(0 == this->m_last_state)
965965
{
966-
fail(regex_constants::error_badrepeat, ::boost::re_detail::distance(m_base, m_position), "Nothing to repeat.");
966+
fail(regex_constants::error_badrepeat, ::boost::BOOST_REGEX_DETAIL_NS::distance(m_base, m_position), "Nothing to repeat.");
967967
return false;
968968
}
969969
if(this->m_last_state->type == syntax_element_endmark)
@@ -1235,7 +1235,7 @@ bool basic_regex_parser<charT, traits>::parse_alt()
12351235
//
12361236
// we need to append a trailing jump:
12371237
//
1238-
re_syntax_base* pj = this->append_state(re_detail::syntax_element_jump, sizeof(re_jump));
1238+
re_syntax_base* pj = this->append_state(BOOST_REGEX_DETAIL_NS::syntax_element_jump, sizeof(re_jump));
12391239
std::ptrdiff_t jump_offset = this->getoffset(pj);
12401240
//
12411241
// now insert the alternative:
@@ -1784,7 +1784,7 @@ charT basic_regex_parser<charT, traits>::unescape_character()
17841784
{
17851785
// an octal escape sequence, the first character must be a zero
17861786
// followed by up to 3 octal digits:
1787-
std::ptrdiff_t len = (std::min)(::boost::re_detail::distance(m_position, m_end), static_cast<std::ptrdiff_t>(4));
1787+
std::ptrdiff_t len = (std::min)(::boost::BOOST_REGEX_DETAIL_NS::distance(m_position, m_end), static_cast<std::ptrdiff_t>(4));
17881788
const charT* bp = m_position;
17891789
int val = this->m_traits.toi(bp, bp + 1, 8);
17901790
if(val != 0)
@@ -2521,7 +2521,7 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
25212521
// Rewind to start of (? sequence:
25222522
--m_position;
25232523
while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
2524-
this->fail(regex_constants::error_paren, ::boost::re_detail::distance(m_base, m_end));
2524+
this->fail(regex_constants::error_paren, ::boost::BOOST_REGEX_DETAIL_NS::distance(m_base, m_end));
25252525
return false;
25262526
}
25272527
BOOST_ASSERT(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_mark);
@@ -2862,7 +2862,7 @@ bool basic_regex_parser<charT, traits>::unwind_alts(std::ptrdiff_t last_paren_st
28622862
#pragma warning(pop)
28632863
#endif
28642864

2865-
} // namespace re_detail
2865+
} // namespace BOOST_REGEX_DETAIL_NS
28662866
} // namespace boost
28672867

28682868
#ifdef BOOST_MSVC

0 commit comments

Comments
 (0)