Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::logic Namespace Reference

Namespaces

 detail
 INTERNAL ONLY.
 

Classes

class  indeterminate_name
 A locale facet specifying the name of the indeterminate value of a tribool. More...
 
class  tribool
 A 3-state boolean type. More...
 

Typedefs

typedef bool(* indeterminate_keyword_t )(tribool, detail::indeterminate_t)
 INTERNAL ONLY The type of the 'indeterminate' keyword. More...
 

Functions

bool indeterminate (tribool x, detail::indeterminate_t dummy=detail::indeterminate_t())
 Keyword and test function for the indeterminate tribool value. More...
 
tribool operator! (tribool x)
 Computes the logical negation of a tribool. More...
 
tribool operator&& (tribool x, tribool y)
 Computes the logical conjuction of two tribools. More...
 
tribool operator&& (tribool x, bool y)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
tribool operator&& (bool x, tribool y)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
tribool operator&& (indeterminate_keyword_t, tribool x)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
tribool operator&& (tribool x, indeterminate_keyword_t)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
tribool operator|| (tribool x, tribool y)
 Computes the logical disjunction of two tribools. More...
 
tribool operator|| (tribool x, bool y)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
tribool operator|| (bool x, tribool y)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
tribool operator|| (indeterminate_keyword_t, tribool x)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
tribool operator|| (tribool x, indeterminate_keyword_t)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
tribool operator== (tribool x, tribool y)
 Compare tribools for equality. More...
 
tribool operator== (tribool x, bool y)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
tribool operator== (bool x, tribool y)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
tribool operator== (indeterminate_keyword_t, tribool x)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
tribool operator== (tribool x, indeterminate_keyword_t)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
tribool operator!= (tribool x, tribool y)
 Compare tribools for inequality. More...
 
tribool operator!= (tribool x, bool y)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
tribool operator!= (bool x, tribool y)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
tribool operator!= (indeterminate_keyword_t, tribool x)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
tribool operator!= (tribool x, indeterminate_keyword_t)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<typename T >
std::basic_string< Tget_default_indeterminate_name ()
 Returns a string containing the default name for the indeterminate value of a tribool with the given character type T. More...
 
template<>
std::basic_string< char > get_default_indeterminate_name< char > ()
 Returns the character string "indeterminate". More...
 
template<>
std::basic_string< wchar_t > get_default_indeterminate_name< wchar_t > ()
 Returns the wide character string L"indeterminate". More...
 
template<typename CharT , typename Traits >
std::basic_ostream< CharT,
Traits > & 
operator<< (std::basic_ostream< CharT, Traits > &out, tribool x)
 Writes the value of a tribool to a stream. More...
 
template<typename CharT , typename Traits >
std::basic_ostream< CharT,
Traits > & 
operator<< (std::basic_ostream< CharT, Traits > &out, bool(*)(tribool, detail::indeterminate_t))
 Writes the indeterminate tribool value to a stream. More...
 
template<typename CharT , typename Traits >
std::basic_istream< CharT,
Traits > & 
operator>> (std::basic_istream< CharT, Traits > &in, tribool &x)
 Reads a tribool value from a stream. More...
 

Typedef Documentation

typedef bool(* boost::logic::indeterminate_keyword_t)(tribool, detail::indeterminate_t)

INTERNAL ONLY The type of the 'indeterminate' keyword.

This has the same type as the function 'indeterminate' so that we can recognize when the keyword is used.

Function Documentation

template<typename T >
std::basic_string<T> boost::logic::get_default_indeterminate_name ( )

Returns a string containing the default name for the indeterminate value of a tribool with the given character type T.

This routine is used by the input and output streaming operators for tribool when there is no locale support or the stream's locale does not contain the indeterminate_name facet.

template<>
std::basic_string<char> boost::logic::get_default_indeterminate_name< char > ( )
inline

Returns the character string "indeterminate".

template<>
std::basic_string<wchar_t> boost::logic::get_default_indeterminate_name< wchar_t > ( )
inline

Returns the wide character string L"indeterminate".

References boost::spirit::lex::lexertl::detail::L().

bool boost::logic::indeterminate ( tribool  x,
detail::indeterminate_t  dummy = detail::indeterminate_t() 
)
inline

Keyword and test function for the indeterminate tribool value.

The indeterminate function has a dual role. It's first role is as a unary function that tells whether the tribool value is in the "indeterminate" state. It's second role is as a keyword representing the indeterminate (just like "true" and "false" represent the true and false states). If you do not like the name "indeterminate", and would prefer to use a different name, see the macro BOOST_TRIBOOL_THIRD_STATE.

Returns
x.value == tribool::indeterminate_value
Exceptions
nothrow

References boost::logic::tribool::indeterminate_value, and boost::logic::tribool::value.

Referenced by operator!(), boost::numeric::interval_lib::compare::tribool::operator!=(), operator!=(), operator&&(), boost::numeric::interval_lib::compare::tribool::operator<(), operator<<(), boost::numeric::interval_lib::compare::tribool::operator<=(), boost::numeric::interval_lib::compare::tribool::operator==(), operator==(), boost::numeric::interval_lib::compare::tribool::operator>(), boost::numeric::interval_lib::compare::tribool::operator>=(), operator>>(), and operator||().

tribool boost::logic::operator!= ( tribool  x,
tribool  y 
)
inline

Compare tribools for inequality.

Returns
the result of comparing two tribool values for inequality, according to the following table:
!=
false
true
indeterminate
false
false
true
indeterminate
true
true
false
indeterminate
indeterminate
indeterminate
indeterminate
indeterminate
Exceptions
nothrow

References indeterminate(), and boost::polygon::y().

tribool boost::logic::operator!= ( tribool  x,
bool  y 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

tribool boost::logic::operator!= ( bool  x,
tribool  y 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References boost::polygon::y().

tribool boost::logic::operator!= ( indeterminate_keyword_t  ,
tribool  x 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References indeterminate(), and boost::flyweights::x.

tribool boost::logic::operator!= ( tribool  x,
indeterminate_keyword_t   
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References indeterminate().

template<typename CharT , typename Traits >
std::basic_ostream<CharT, Traits>& boost::logic::operator<< ( std::basic_ostream< CharT, Traits > &  out,
bool(*)(tribool, detail::indeterminate_t)   
)
inline

Writes the indeterminate tribool value to a stream.

This routine outputs either the integer value 2 (if (out.flags() & std::ios_base::boolalpha) == 0) or the name of the indeterminate value. The name of the indeterminate value comes from the indeterminate_name facet (if it is defined in the output stream's locale), or from the get_default_indeterminate_name function (if it is not defined in the locale or if the C++ standard library implementation does not support locales).

Returns
out

References indeterminate().

template<typename CharT , typename Traits >
std::basic_ostream<CharT, Traits>& boost::logic::operator<< ( std::basic_ostream< CharT, Traits > &  out,
tribool  x 
)
inline

Writes the value of a tribool to a stream.

When the value of x is either true or false, this routine is semantically equivalent to:

out << static_cast<bool>(x);

When x has an indeterminate value, it outputs either the integer value 2 (if (out.flags() & std::ios_base::boolalpha) == 0) or the name of the indeterminate value. The name of the indeterminate value comes from the indeterminate_name facet (if it is defined in the output stream's locale), or from the get_default_indeterminate_name function (if it is not defined in the locale or if the C++ standard library implementation does not support locales).

Returns
out

References BOOST_HAS_FACET, BOOST_USE_FACET, indeterminate(), boost::logic::indeterminate_name< CharT >::name(), boost::out, and boost::flyweights::x.

tribool boost::logic::operator== ( tribool  x,
tribool  y 
)
inline

Compare tribools for equality.

Returns
the result of comparing two tribool values, according to the following table:
==
false
true
indeterminate
false
true
false
indeterminate
true
false
true
indeterminate
indeterminate
indeterminate
indeterminate
indeterminate
Exceptions
nothrow

References indeterminate(), and boost::polygon::y().

tribool boost::logic::operator== ( tribool  x,
bool  y 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

tribool boost::logic::operator== ( bool  x,
tribool  y 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References boost::polygon::y().

tribool boost::logic::operator== ( indeterminate_keyword_t  ,
tribool  x 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References indeterminate(), and boost::flyweights::x.

tribool boost::logic::operator== ( tribool  x,
indeterminate_keyword_t   
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References indeterminate(), and boost::flyweights::x.

template<typename CharT , typename Traits >
std::basic_istream<CharT, Traits>& boost::logic::operator>> ( std::basic_istream< CharT, Traits > &  in,
tribool &  x 
)
inline

Reads a tribool value from a stream.

When (out.flags() & std::ios_base::boolalpha) == 0, this function reads a long value from the input stream in and converts that value to a tribool. If that value is 0, x becomes false; if it is 1, x becomes true; if it is 2, becomes indetermine; otherwise, the operation fails (and the fail bit is set on the input stream in).

When (out.flags() & std::ios_base::boolalpha) != 0, this function first determines the names of the false, true, and indeterminate values. The false and true names are extracted from the std::numpunct facet of the input stream's locale (if the C++ standard library implementation supports locales), or from the default_false_name and default_true_name functions (if there is no locale support). The indeterminate name is extracted from the appropriate indeterminate_name facet (if it is available in the input stream's locale), or from the get_default_indeterminate_name function (if the C++ standard library implementation does not support locales, or the indeterminate_name facet is not specified for this locale object). The input is then matched to each of these names, and the tribool x is assigned the value corresponding to the longest name that matched. If no name is matched or all names are empty, the operation fails (and the fail bit is set on the input stream in).

Returns
in

References BOOST_HAS_FACET, BOOST_USE_FACET, boost::multiprecision::backends::c, boost::asio::error::eof, boost::tuples::detail::eq(), boost::regex_constants::failbit, boost::flyweights::in, indeterminate(), boost::xpressive::matched, boost::iostreams::gzip::flags::name, and boost::program_options::value().