38 #ifndef OPENVDB_UTIL_FORMATS_HAS_BEEN_INCLUDED 39 #define OPENVDB_UTIL_FORMATS_HAS_BEEN_INCLUDED 44 #include <openvdb/version.h> 45 #include <openvdb/Platform.h> 64 const std::string& head =
"",
65 const std::string& tail =
"\n",
66 bool exact =
false,
int width = 8,
int precision = 3);
79 const std::string& head =
"",
80 const std::string& tail =
"\n",
81 bool exact =
true,
int width = 8,
int precision = 3);
88 template<
typename IntT>
92 static char sep() {
return ','; }
96 std::ostream&
put(std::ostream& os)
const 99 std::ostringstream ostr;
101 std::string s = ostr.str();
103 size_t padding = (s.size() % 3) ? 3 - (s.size() % 3) : 0;
104 s = std::string(padding,
' ') + s;
108 for (
size_t i = 0, N = s.size(); i < N; ) {
111 if (i >= padding && i % 3 == 0 && i < s.size()) {
117 os << s.substr(padding, s.size());
125 template<
typename IntT>
126 std::ostream& operator<<(std::ostream& os, const FormattedInt<IntT>& n) {
return n.put(os); }
129 template<
typename IntT>
136 #endif // OPENVDB_UTIL_FORMATS_HAS_BEEN_INCLUDED
OPENVDB_API int printBytes(std::ostream &os, uint64_t bytes, const std::string &head="", const std::string &tail="\, bool exact=false, int width=8, int precision=3)
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:136
Definition: Exceptions.h:40
FormattedInt< IntT > formattedInt(IntT n)
Definition: Formats.h:130
OPENVDB_API int printNumber(std::ostream &os, uint64_t number, const std::string &head="", const std::string &tail="\, bool exact=true, int width=8, int precision=3)
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:188