libtenum
|
00001 00008 #ifndef TENUM_DETAIL_STREAM_HPP_ 00009 #define TENUM_DETAIL_STREAM_HPP_ 00010 00011 #ifndef IN_TENUM_HPP_ 00012 # error "This header should not be included directly. Please use tenum.hpp." 00013 #endif 00014 00015 #include <tenum/detail/helper.hpp> 00016 00017 #define TENUM_STREAM_OPERATORS_DECLARATION(type_m) \ 00018 template< typename OutputStream > \ 00019 static inline OutputStream& operator<<(OutputStream& ostream, TENUM_TYPE(type_m) const enum_in); \ 00020 template< typename InputStream > \ 00021 static inline InputStream& operator>>(InputStream& istream, TENUM_TYPE(type_m)& enum_out); 00022 00032 #define TENUM_STREAM_OPERATORS_DEFINITION(type_m) \ 00033 template< typename OutputStream > \ 00034 static inline OutputStream& operator<<(OutputStream& ostream, TENUM_TYPE(type_m) const enum_in) { \ 00035 ostream << ::tenum::enum_helper< TENUM_TYPE(type_m) >::serialize(enum_in); \ 00036 return ostream; \ 00037 } \ 00038 \ 00039 template< typename InputStream > \ 00040 static inline InputStream& operator>>(InputStream& istream, TENUM_TYPE(type_m)& enum_out) { \ 00041 ::std::string enum_string; \ 00042 istream >> enum_string; \ 00043 enum_out = ::tenum::enum_helper< TENUM_TYPE(type_m) >::deserialize(enum_string); \ 00044 return istream; \ 00045 } 00046 00047 #endif /* TENUM_DETAIL_STREAM_HPP_ */