mirror of
https://github.com/boostorg/algorithm.git
synced 2025-07-06 09:16:33 +02:00
-predicate_facade moved to a separate header
-composition operators for classification predicates moved to the same namespace as predicate_facade [SVN r23382]
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
#include <algorithm>
|
||||
#include <locale>
|
||||
#include <boost/algorithm/string/detail/classification.hpp>
|
||||
#include <boost/algorithm/string/predicate_facade.hpp>
|
||||
|
||||
/*! \file
|
||||
Classification predicates are included in the library to give
|
||||
@ -215,6 +216,65 @@ namespace boost {
|
||||
{
|
||||
return detail::is_from_rangeF<CharT>(From,To);
|
||||
}
|
||||
|
||||
// predicate combinators ---------------------------------------------------//
|
||||
|
||||
//! predicate 'and' composition predicate
|
||||
/*!
|
||||
Construct the \c class_and predicate. This predicate can be used
|
||||
to logically combine two classification predicates. \c class_and holds,
|
||||
if both predicates return true.
|
||||
|
||||
\param Pred1 The first predicate
|
||||
\param Pred2 The second predicate
|
||||
\return An instance of the \c class_and predicate
|
||||
*/
|
||||
template<typename Pred1T, typename Pred2T>
|
||||
inline detail::pred_andF<Pred1T, Pred2T>
|
||||
operator&&(
|
||||
const predicate_facade<Pred1T>& Pred1,
|
||||
const predicate_facade<Pred2T>& Pred2 )
|
||||
{
|
||||
return detail::pred_andF<Pred1T,Pred2T>(
|
||||
static_cast<const Pred1T&>(Pred1),
|
||||
static_cast<const Pred2T&>(Pred2) );
|
||||
}
|
||||
|
||||
//! predicate 'or' composition predicate
|
||||
/*!
|
||||
Construct the \c class_or predicate. This predicate can be used
|
||||
to logically combine two classification predicates. \c class_or holds,
|
||||
if one of the predicates return true.
|
||||
|
||||
\param Pred1 The first predicate
|
||||
\param Pred2 The second predicate
|
||||
\return An instance of the \c class_or predicate
|
||||
*/
|
||||
template<typename Pred1T, typename Pred2T>
|
||||
inline detail::pred_orF<Pred1T, Pred2T>
|
||||
operator||(
|
||||
const predicate_facade<Pred1T>& Pred1,
|
||||
const predicate_facade<Pred2T>& Pred2 )
|
||||
{
|
||||
return detail::pred_orF<Pred1T,Pred2T>(
|
||||
static_cast<const Pred1T&>(Pred1),
|
||||
static_cast<const Pred2T&>(Pred2));
|
||||
}
|
||||
|
||||
//! predicate negation operator
|
||||
/*!
|
||||
Construct the \c class_not predicate. This predicate represents a negation.
|
||||
\c class_or holds, if of the predicates return false.
|
||||
|
||||
\param Pred The predicate to be negated
|
||||
\return An instance of the \c class_not predicate
|
||||
*/
|
||||
template<typename PredT>
|
||||
inline detail::pred_notF<PredT>
|
||||
operator!( const predicate_facade<PredT>& Pred )
|
||||
{
|
||||
return detail::pred_notF<PredT>(static_cast<const PredT&>(Pred));
|
||||
}
|
||||
|
||||
} // namespace algorithm
|
||||
|
||||
@ -236,69 +296,4 @@ namespace boost {
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
// predicate combinators ---------------------------------------------------//
|
||||
/*
|
||||
* These operators must be declared in the global namespace, otherwise
|
||||
* they are not resolved correctly. There will not a problem with a name-clash,
|
||||
* since they are define only for internal types
|
||||
*/
|
||||
|
||||
//! predicate 'and' composition predicate
|
||||
/*!
|
||||
Construct the \c class_and predicate. This predicate can be used
|
||||
to logically combine two classification predicates. \c class_and holds,
|
||||
if both predicates return true.
|
||||
|
||||
\param Pred1 The first predicate
|
||||
\param Pred2 The second predicate
|
||||
\return An instance of the \c class_and predicate
|
||||
*/
|
||||
template<typename Pred1T, typename Pred2T>
|
||||
inline boost::algorithm::detail::pred_andF<Pred1T, Pred2T>
|
||||
operator&&(
|
||||
const boost::algorithm::detail::predicate_facade<Pred1T>& Pred1,
|
||||
const boost::algorithm::detail::predicate_facade<Pred2T>& Pred2 )
|
||||
{
|
||||
return boost::algorithm::detail::pred_andF<Pred1T,Pred2T>(
|
||||
static_cast<const Pred1T&>(Pred1),
|
||||
static_cast<const Pred2T&>(Pred2) );
|
||||
}
|
||||
|
||||
//! predicate 'or' composition predicate
|
||||
/*!
|
||||
Construct the \c class_or predicate. This predicate can be used
|
||||
to logically combine two classification predicates. \c class_or holds,
|
||||
if one of the predicates return true.
|
||||
|
||||
\param Pred1 The first predicate
|
||||
\param Pred2 The second predicate
|
||||
\return An instance of the \c class_or predicate
|
||||
*/
|
||||
template<typename Pred1T, typename Pred2T>
|
||||
inline boost::algorithm::detail::pred_orF<Pred1T, Pred2T>
|
||||
operator||(
|
||||
const boost::algorithm::detail::predicate_facade<Pred1T>& Pred1,
|
||||
const boost::algorithm::detail::predicate_facade<Pred2T>& Pred2 )
|
||||
{
|
||||
return boost::algorithm::detail::pred_orF<Pred1T,Pred2T>(
|
||||
static_cast<const Pred1T&>(Pred1),
|
||||
static_cast<const Pred2T&>(Pred2));
|
||||
}
|
||||
|
||||
//! predicate negation operator
|
||||
/*!
|
||||
Construct the \c class_not predicate. This predicate represents a negation.
|
||||
\c class_or holds, if of the predicates return false.
|
||||
|
||||
\param Pred The predicate to be negated
|
||||
\return An instance of the \c class_not predicate
|
||||
*/
|
||||
template<typename PredT>
|
||||
inline boost::algorithm::detail::pred_notF<PredT>
|
||||
operator!( const boost::algorithm::detail::predicate_facade<PredT>& Pred )
|
||||
{
|
||||
return boost::algorithm::detail::pred_notF<PredT>(static_cast<const PredT&>(Pred));
|
||||
}
|
||||
|
||||
#endif // BOOST_STRING_PREDICATE_HPP
|
||||
|
Reference in New Issue
Block a user