NSVD Reader  0.0.1
svd_printer.hpp
Go to the documentation of this file.
1 
5 /*
6  * These codes are licensed under CC0.
7  * http://creativecommons.org/publicdomain/zero/1.0/
8  */
9 #ifndef __NODAMUSHI_SVD_SVD_PRINTER_HPP__
10 #define __NODAMUSHI_SVD_SVD_PRINTER_HPP__
11 
12 # include <ostream>
13 # include <type_traits>
14 # include <vector>
15 # include <memory>
16 
17 
18 # include "nodamushi/svd/value.hpp"
19 
20 namespace nodamushi{
21 namespace svd{
22 
26 template<typename T>struct svd_printer
27 {
28  static std::ostream& print(std::ostream& o, const_string name, const T& v,int indent);
29 };
30 
31 
32 template<bool attr>struct svd_value_printer;
33 
34 template<typename T,bool attribute,bool required,char... name>
35 std::ostream& print_svd_value(
36  std::ostream& o,
38  int indent,bool endline=false)
39 {
40  if(v){
42  if(endline)o << std::endl;
43  }
44  return o;
45 }
46 
47 template<size_t INDENT_BASE=2,char INDENT=' '>
48 std::string get_indent(int s)
49 {
50  return std::string(s * INDENT_BASE,INDENT);
51 }
52 
53 }} // end namespace sanken::svd
54 
56 
57 #endif // __NODAMUSHI_SVD_SVD_PRINTER_HPP__
std::string get_indent(int s)
Definition: svd_printer.hpp:48
const char * const_string
Definition: string_type.hpp:43
std::ostream & print_svd_value(std::ostream &o, const value< T, attribute, required, name... > &v, int indent, bool endline=false)
Definition: svd_printer.hpp:35
This class reperesents SVD(xml) element / attribute.
Definition: value.hpp:53
static std::ostream & print(std::ostream &o, const_string name, const T &v, int indent)
Definition: imple.hpp:25
svd printer imple
value class, empty_value_access_error class