Classes | Namespaces | Macros | Typedefs | Functions
ztd.h File Reference
#include <cstring>
#include <functional>
#include <sstream>
#include <string>
#include <zorba/config.h>
#include "type_traits.h"
Include dependency graph for ztd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  zorba::internal::ztd::has_insertion_operator_impl::any_t
 This dummy class is used to make the matching of the dummy operator<<() worse than the global operator<<(), if any. More...
 
struct  zorba::internal::ztd::destroy_delete< T >
 A deleter class that can be used with unique_ptr. More...
 
class  zorba::internal::ztd::explicit_bool
 Helper class for implementing a solution to the "explicit bool conversion" problem. More...
 
struct  zorba::internal::ztd::has_insertion_operator< T >
 
class  zorba::internal::ztd::has_insertion_operator_impl::has_insertion_operator< T >
 The implementation class that can be used to determine whether a given type T has a global std::ostream& operator<<(std::ostream&,T const&) defined for it. More...
 
class  zorba::internal::ztd::is_c_string< T >
 
struct  zorba::internal::ztd::less< T >
 
struct  zorba::internal::ztd::less< char const * >
 
class  zorba::internal::ztd::sfinae_base
 

Namespaces

namespace  zorba
 Copyright 2006-2011 The FLWOR Foundation.
 
namespace  zorba::internal
 
namespace  zorba::internal::ztd
 
namespace  zorba::internal::ztd::has_insertion_operator_impl
 

Macros

#define ZORBA_DECL_HAS_MEM_FN(FN_NAME)
 
#define ZORBA_HAS_C_STR(T)   ::zorba::internal::ztd::has_c_str<T,char const* (T::*)() const>::value
 
#define ZORBA_IS_STRING(T)   ZORBA_HAS_C_STR(T)
 

Typedefs

typedef char zorba::internal::ztd::has_insertion_operator_impl::no
 
typedef char zorba::internal::ztd::has_insertion_operator_impl::yes [2]
 

Functions

template<class StringType >
StringType::const_pointer zorba::internal::ztd::c_str (StringType const &s)
 
char const * zorba::internal::ztd::c_str (char const *s)
 
yes & zorba::internal::ztd::has_insertion_operator_impl::defined (std::ostream &)
 This function is matched only when there is a global operator<<() declared for type T because operator<<()'s return type is std::ostream&. More...
 
no zorba::internal::ztd::has_insertion_operator_impl::defined (no)
 This function is matched only when the dummy operator<<() is matched. More...
 
no zorba::internal::ztd::has_insertion_operator_impl::operator<< (std::ostream const &, any_t const &)
 This dummy operator is matched only when there is no global operator<<() otherwise declared for type T. More...
 
template<typename T >
std::enable_if
<!ZORBA_TR1_NS::is_array< T >
::value
&&!ZORBA_TR1_NS::is_pointer< T >
::value
&&has_insertion_operator<T >
::value, std::string >::type 
zorba::internal::ztd::to_string (T const &t)
 
template<class T >
std::enable_if
<!has_insertion_operator<T >
::value &&ZORBA_HAS_C_STR(T),
std::string >::type 
zorba::internal::ztd::to_string (T const &t)
 
template<class T >
std::enable_if
<!has_insertion_operator<T >
::value &&!ZORBA_HAS_C_STR(T)&&has_str
< T, std::string(T::*)() const >
::value &&!has_toString< T,
std::string(T::*)() const >
::value, std::string >::type 
zorba::internal::ztd::to_string (T const &t)
 
template<class T >
std::enable_if
<!has_insertion_operator<T >
::value &&!ZORBA_HAS_C_STR(T)&&!has_str
< T, std::string(T::*)() const >
::value &&has_toString< T,
std::string(T::*)() const >
::value, std::string >::type 
zorba::internal::ztd::to_string (T const &t)
 
template<typename T >
std::enable_if
< ZORBA_TR1_NS::is_pointer< T >
::value &&!is_c_string< T >
::value, std::string >::type 
zorba::internal::ztd::to_string (T p)
 
std::string zorba::internal::ztd::to_string (char const *s)
 
std::string zorba::internal::ztd::to_string (unsigned char const *s)
 
 zorba::internal::ztd::ZORBA_DECL_HAS_MEM_FN (c_str)
 
 zorba::internal::ztd::ZORBA_DECL_HAS_MEM_FN (str)
 
 zorba::internal::ztd::ZORBA_DECL_HAS_MEM_FN (toString)
 

Macro Definition Documentation

#define ZORBA_DECL_HAS_MEM_FN (   FN_NAME)
Value:
template<typename T,typename S> \
class has_##FN_NAME : public ::zorba::internal::ztd::sfinae_base { \
template<typename SignatureType,SignatureType> struct type_check; \
template<class U> static yes& test(type_check<S,&U::FN_NAME>*); \
template<class U> static no& test(...); \
public: \
static bool const value = sizeof( test<T>(0) ) == sizeof( yes ); \
}

Definition at line 73 of file ztd.h.

#define ZORBA_HAS_C_STR (   T)    ::zorba::internal::ztd::has_c_str<T,char const* (T::*)() const>::value

Definition at line 261 of file ztd.h.

#define ZORBA_IS_STRING (   T)    ZORBA_HAS_C_STR(T)

Definition at line 264 of file ztd.h.