VCCC  2024.05
VisualCamp Common C++ library
BasicStreamWrapper< CharT, String, Stream > Class Template Reference

#include <vccc/__log/stream_wrapper.hpp>

+ Inheritance diagram for BasicStreamWrapper< CharT, String, Stream >:

Detailed Description

template<typename CharT, typename String = std::basic_string<CharT>, typename Stream = std::basic_stringstream<CharT>>
class vccc::BasicStreamWrapper< CharT, String, Stream >

Support writing of

  • container types*
  • tuple-like types*
  • container whose element is pair is treated as key-pair container
  • std::chrono types
  • integer sequences*
  • (of course) custom operator overloaded types (std::ostream& operator << (std::ostream&, T))
  • aggregate type*

Note: Types marked with (*) are default-separated with a single space

Template Parameters
CharT
String
Stream

Public Types

using base = StreamWrapperBase< String, Stream >
 
using char_type = CharT
 
using stream_type = typename base::stream_type
 
using string_type = typename base::string_type
 
using traits_type = typename base::traits_type
 
- Public Types inherited from StreamWrapperBase< std::basic_string< CharT >, std::basic_stringstream< CharT > >
using stream_type = std::basic_stringstream< CharT >
 
using string_type = std::basic_string< CharT >
 
using traits_type = typename stream_type::traits_type
 

Public Member Functions

 BasicStreamWrapper ()=default
 
 BasicStreamWrapper (string_type str)
 
 BasicStreamWrapper (stream_type &&stream)
 
BasicStreamWrapperoperator<< (std::ostream &(*pf)(std::ostream &))
 
BasicStreamWrapperoperator<< (std::ios_base &(&io_manip)(std::ios_base &))
 
template<typename T , std::enable_if_t< std::is_base_of< StreamManipulator, remove_cvref_t< T >> ::value, int > = 0>
BasicStreamWrapperoperator<< (const T &manipulator)
 
template<typename T , std::enable_if_t< !std::is_base_of< StreamManipulator, remove_cvref_t< T >> ::value, int > = 0>
BasicStreamWrapperoperator<< (const T &value)
 
stream_typestream ()
 Return internal stream. More...
 
const stream_typestream () const
 
string_type str () const
 Equals to stream().str() More...
 
void str (string_type s)
 Equals to stream().str(string_type) More...
 
- Public Member Functions inherited from StreamWrapperBase< std::basic_string< CharT >, std::basic_stringstream< CharT > >
const string_typeseparator () const
 Get current separator. More...
 
string_type separator (string_type new_separator)
 Set current separator. More...
 
VCCC_NODISCARD bool quote_string () const noexcept
 
void quote_string (bool new_value) noexcept
 
VCCC_NODISCARD bool expand_aggregate () const noexcept
 
void expand_aggregate (bool new_value) noexcept
 
VCCC_NODISCARD bool expand_array ()
 
void expand_array (bool new_value)
 

Additional Inherited Members

- Static Public Member Functions inherited from StreamWrapperBase< std::basic_string< CharT >, std::basic_stringstream< CharT > >
static string_typeglobal_separator ()
 Get global separator. More...
 
- Public Attributes inherited from StreamWrapperBase< std::basic_string< CharT >, std::basic_stringstream< CharT > >
string_type separator_
 
bool first_
 
bool quote_string_
 
bool expand_aggregate_
 
bool expand_array_
 
- Protected Attributes inherited from StreamWrapperBase< std::basic_string< CharT >, std::basic_stringstream< CharT > >
struct {
   string_type   separator_ = global_separator()
 
   bool   first_ = true
 
   bool   quote_string_ = GlobalStreamWrapperSettings::quote_string()
 
   bool   expand_aggregate_ = GlobalStreamWrapperSettings::expand_aggregate()
 
   bool   expand_array_ = GlobalStreamWrapperSettings::expand_array()
 
}; 
 

Member Typedef Documentation

◆ base

using base = StreamWrapperBase<String, Stream>

◆ char_type

using char_type = CharT

◆ stream_type

using stream_type = typename base::stream_type

◆ string_type

using string_type = typename base::string_type

◆ traits_type

using traits_type = typename base::traits_type

Constructor & Destructor Documentation

◆ BasicStreamWrapper() [1/3]

BasicStreamWrapper ( )
default

◆ BasicStreamWrapper() [2/3]

BasicStreamWrapper ( string_type  str)
inlineexplicit

◆ BasicStreamWrapper() [3/3]

BasicStreamWrapper ( stream_type &&  stream)
inlineexplicit

Member Function Documentation

◆ operator<<() [1/4]

BasicStreamWrapper& operator<< ( const T &  manipulator)
inline

◆ operator<<() [2/4]

BasicStreamWrapper& operator<< ( const T &  value)
inline

◆ operator<<() [3/4]

BasicStreamWrapper& operator<< ( std::ios_base &(&)(std::ios_base &)  io_manip)
inline

◆ operator<<() [4/4]

BasicStreamWrapper& operator<< ( std::ostream &(*)(std::ostream &)  pf)
inline

◆ str() [1/2]

string_type str ( ) const
inline
Returns
stream().str()

◆ str() [2/2]

void str ( string_type  s)
inline
Parameters
sNew string

◆ stream() [1/2]

stream_type& stream ( )
inline
Returns
Internal stream object

◆ stream() [2/2]

const stream_type& stream ( ) const
inline

The documentation for this class was generated from the following file: