9 #ifndef __NODAMUSHI_SVD_SVD_PRINTER_IMPLE_HPP__ 10 #define __NODAMUSHI_SVD_SVD_PRINTER_IMPLE_HPP__ 18 # include <type_traits> 26 std::ostream& o,
const_string name, T
const& v,
int indent)
30 o <<
"</" << name <<
">";
61 std::ios_base::fmtflags f( o.flags() );
62 o <<
"0x"<< std::hex << std::uppercase << v;
67 o <<
"</" << name <<
">";
74 static std::ostream&
print(std::ostream& o, vtype v)
76 std::ios_base::fmtflags f( o.flags() );
77 o <<
"0x"<< std::hex <<std::uppercase << v;
88 static constexpr
bool is_hex = is_hex_t::value;
90 using type_a =
typename std::conditional<
94 using type_e =
typename std::conditional<
111 template<
typename T,
bool required,
char... name>
118 o << std::string(indent,
' ');
132 template<
typename T,
bool required,
char... name>
142 template<
typename T,
bool required,
char... name>
152 template<
typename T,
bool required,
char... name>
155 const value<std::vector<T>,
false,required,name...>& v,
161 if(first) first =
false;
168 template<
typename T,
bool required,
char... name>
176 for(const ::nodamushi::box<T>& t:*v){
177 if(first) first =
false;
185 template<
typename T,
typename PTR,
bool required,
char... name>
194 if(first) first =
false;
218 (std::is_integral<T>::value
219 || std::is_floating_point<T>::value
220 || std::is_enum<T>::value);
222 static void print(std::ostream& o,T
const& v)
232 return c ==
'"' || c ==
'\'' || c ==
'<' || c ==
'>' || c ==
'&';
235 static void print(std::ostream& o,
const char* itr,
const char*
const end)
240 bool e = itr == end || (c=*itr) ==
'\0';
241 if(e || svd_escape_charactor(c)){
242 if(p != itr) o.write(p,itr-p);
245 case '"': o <<
""";
246 case '\'':o <<
"'";
247 case '<': o <<
"<";
248 case '>': o <<
">";
249 case '&': o <<
"&";
256 static void print(std::ostream& o,
const char * v)
264 static void print(std::ostream& o,
const bool& v)
266 o << (v?
"true":
"false");
273 static void print(std::ostream& o,std::string
const& v)
279 # if __cplusplus >= 201703 280 template<>
struct print_with_svd_escape<
std::string_view>
282 static void print(std::ostream& o,std::string_view
const& v)
292 static void print(std::ostream& o,T
const& v)
300 static void print(std::ostream& o,T
const& v)
304 std::string str = s.str();
314 #endif // __NODAMUSHI_SVD_SVD_PRINTER_IMPLE_HPP__ boxvec. vector<pointer<X>>
static std::ostream & print(std::ostream &o, const_string name, vtype v, int indent)
std::ostream & print_const_string(std::ostream &o)
static std::ostream & print(std::ostream &o, vtype v)
typename _hex_printer_selector< T >::type_a select_printer_attr
static void print(std::ostream &o, T const &v)
static void print(std::ostream &o, T const &v)
std::string get_indent(int s)
typename u::template contains<::nodamushi::svd::hex > is_hex_t
typename std::conditional< is_hex, _hex_printer_elem< vtype >, svd_printer< T > >::type type_e
box.std::unique_ptr wrapper
const char * const_string
static std::ostream & print(std::ostream &o, const value< std::vector<::nodamushi::box< T >>, false, required, name... > &v, int indent)
static std::ostream & print(std::ostream &o, const value< T, true, required, name... > &v, int indent)
static std::ostream & print(std::ostream &o, const value<::nodamushi::boxvec< T, PTR >, false, required, name... > &v, int indent)
static void print(std::ostream &o, const bool &v)
static void print(std::ostream &o, const char *itr, const char *const end)
This class reperesents SVD(xml) element / attribute.
static void print(std::ostream &o, const char *v)
static std::ostream & print(std::ostream &o, const_string name, const T &v, int indent)
static std::ostream & print(std::ostream &o, const value<::nodamushi::box< T >, false, required, name... > &v, int indent)
#define NODAMUSHI_LOCAL_CONST_STRING(CHARS, varname)
typename std::conditional< is_hex, _hex_printer_attr< vtype >, details::print_with_svd_escape< T > >::type type_a
static std::ostream & print(std::ostream &o, const_string name, const T &v, int indent)
static constexpr bool simple_type
static constexpr bool is_hex
static void print(std::ostream &o, T const &v)
static void print(std::ostream &o, std::string const &v)
static std::ostream & print(std::ostream &o, const value< T, false, required, name... > &v, int indent)
static std::ostream & print(std::ostream &o, const value< std::vector< T >, false, required, name... > &v, int indent)
typename _hex_printer_selector< T >::type_e select_printer_elem
static constexpr bool svd_escape_charactor(char c)