15 #include <vsg/io/Logger.h>
16 #include <vsg/io/Options.h>
17 #include <vsg/io/Output.h>
32 std::ostream& indent()
34 _output.
write(_indentationString, std::min(_indentation, _maximumIndentation));
45 void _write(
size_t num,
const T* value)
49 _output <<
' ' << *value;
53 for (
size_t numInRow = 1; num > 0; --num, ++value, ++numInRow)
55 _output <<
' ' << *value;
57 if (numInRow == _maximumNumbersPerLine && num > 1)
68 void _write_real(
size_t num,
const T* value)
72 if (std::isfinite(*value))
73 _output <<
' ' << *value;
75 _output <<
' ' << 0.0;
79 for (
size_t numInRow = 1; num > 0; --num, ++value, ++numInRow)
81 if (std::isfinite(*value))
82 _output <<
' ' << *value;
84 _output <<
' ' << 0.0;
86 if (numInRow == _maximumNumbersPerLine && num > 1)
96 template<
typename R,
typename T>
97 void _write_withcast(
size_t num,
const T* value)
101 _output << ' ' << static_cast<R>(*value);
105 for (
size_t numInRow = 1; num > 0; --num, ++value, ++numInRow)
107 _output << ' ' << static_cast<R>(*value);
109 if (numInRow == _maximumNumbersPerLine && num > 1)
120 void write(
size_t num,
const int8_t* value)
override { _write_withcast<int16_t>(num, value); }
121 void write(
size_t num,
const uint8_t* value)
override { _write_withcast<uint16_t>(num, value); }
123 void write(
size_t num,
const int16_t* value)
override { _write(num, value); }
124 void write(
size_t num,
const uint16_t* value)
override { _write(num, value); }
125 void write(
size_t num,
const int32_t* value)
override { _write(num, value); }
126 void write(
size_t num,
const uint32_t* value)
override { _write(num, value); }
127 void write(
size_t num,
const int64_t* value)
override { _write(num, value); }
128 void write(
size_t num,
const uint64_t* value)
override { _write(num, value); }
129 void write(
size_t num,
const float* value)
override
131 _output.precision(float_precision);
132 _write_real(num, value);
134 void write(
size_t num,
const double* value)
override
136 _output.precision(double_precision);
137 _write_real(num, value);
140 void _write(
const std::string& str)
153 void _write(
const std::wstring& str);
155 void write(
size_t num,
const std::string* value)
override;
156 void write(
size_t num,
const std::wstring* value)
override;
157 void write(
size_t num,
const Path* value)
override;
162 int float_precision = 6;
163 int double_precision = 12;
166 std::ostream& _output;
167 std::size_t _indentationStep = 2;
168 std::size_t _indentation = 0;
169 std::size_t _maximumIndentation = 0;
170 std::size_t _maximumNumbersPerLine = 12;
172 const char* _indentationString =
" ";
Definition: AsciiOutput.h:28
void write(const vsg::Object *object) override
write object
void writeEndOfLine() override
write end of line as an
Definition: AsciiOutput.h:42
void writePropertyName(const char *propertyName) override
write property name if appropriate for format
void write(size_t num, const int8_t *value) override
write contiguous array of value(s)
Definition: AsciiOutput.h:120