VCCC  2024.05
VisualCamp Common C++ library
iomanip.hpp
Go to the documentation of this file.
1 //
2 // Created by YongGyu Lee on 2023/03/31.
3 //
4 
5 #ifndef VCCC_LOG_IOMANIP_HPP
6 #define VCCC_LOG_IOMANIP_HPP
7 
8 #include <string>
9 
11 
12 namespace vccc {
13 
16 
27 class Separator : public StreamManipulator {
28  public:
29  explicit Separator(std::string sep) : sep_(std::move(sep)) {}
30 
31  template<typename CharT, typename String, typename Stream>
33  stream.separator(sep_);
34  return stream;
35  }
36 
37  private:
38  std::string sep_;
39 };
40 
42 class Quoted : public StreamManipulator {
43  public:
44  Quoted() : value_(true) {}
45 
46  explicit Quoted(bool value) : value_(value) {}
47 
48 
49  template<typename CharT, typename String, typename Stream>
51  stream.quote_string(value_);
52  return stream;
53  }
54 
55  private:
56  bool value_;
57 };
58 
63  public:
64  ExpandAggregate() : value_(true) {}
65 
66  explicit ExpandAggregate(bool value) : value_(value) {}
67 
68  template<typename CharT, typename String, typename Stream>
70  stream.expand_aggregate(value_);
71  return stream;
72  }
73 
74  private:
75  bool value_;
76 };
77 
82  public:
83  ExpandArray() : value_(true) {}
84 
85  explicit ExpandArray(bool value) : value_(value) {}
86 
87  template<typename CharT, typename String, typename Stream>
89  stream.expand_array(value_);
90  return stream;
91  }
92 
93  private:
94  bool value_;
95 };
96 
98 
99 } // namespace vccc
100 
101 #endif // VCCC_LOG_IOMANIP_HPP
stream wrapper that supports extended operator overloading
Definition: stream_wrapper.hpp:186
Manipulator for expanding aggregate types.
Definition: iomanip.hpp:62
ExpandAggregate(bool value)
Definition: iomanip.hpp:66
BasicStreamWrapper< CharT, String, Stream > & operator()(BasicStreamWrapper< CharT, String, Stream > &stream) const
Definition: iomanip.hpp:69
ExpandAggregate()
Definition: iomanip.hpp:64
Expand array instead of printing its value.
Definition: iomanip.hpp:81
ExpandArray(bool value)
Definition: iomanip.hpp:85
ExpandArray()
Definition: iomanip.hpp:83
BasicStreamWrapper< CharT, String, Stream > & operator()(BasicStreamWrapper< CharT, String, Stream > &stream) const
Definition: iomanip.hpp:88
Manipulator for adding quotation to strings(only to string and string_view)
Definition: iomanip.hpp:42
Quoted()
Definition: iomanip.hpp:44
Quoted(bool value)
Definition: iomanip.hpp:46
BasicStreamWrapper< CharT, String, Stream > & operator()(BasicStreamWrapper< CharT, String, Stream > &stream) const
Definition: iomanip.hpp:50
Set separator to vccc::BasicStreamWrapper.
Definition: iomanip.hpp:27
Separator(std::string sep)
Definition: iomanip.hpp:29
BasicStreamWrapper< CharT, String, Stream > & operator()(BasicStreamWrapper< CharT, String, Stream > &stream) const
Definition: iomanip.hpp:32
Manipulator for vccc::StreamWrapper.
Definition: stream_wrapper.hpp:84
VCCC_NODISCARD bool quote_string() const noexcept
Definition: stream_wrapper.hpp:131
VCCC_NODISCARD bool expand_aggregate() const noexcept
Definition: stream_wrapper.hpp:139
const string_type & separator() const
Get current separator.
Definition: stream_wrapper.hpp:118
VCCC_NODISCARD bool expand_array()
Definition: stream_wrapper.hpp:147
Definition: matrix.hpp:495
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35