NGL  6.5
The NCCA Graphics Library
ostream.cc
Go to the documentation of this file.
1 /*
2  Formatting library for C++ - std::ostream support
3 
4  Copyright (c) 2012 - 2016, Victor Zverovich
5  All rights reserved.
6 
7  For the license information refer to format.h.
8  */
9 
10 #include "fmt/ostream.h"
11 
12 namespace fmt {
13 
14 namespace internal {
15 FMT_FUNC void write(std::ostream &os, Writer &w) {
16  const char *data = w.data();
17  typedef internal::MakeUnsigned<std::streamsize>::Type UnsignedStreamSize;
18  UnsignedStreamSize size = w.size();
19  UnsignedStreamSize max_size =
20  internal::to_unsigned((std::numeric_limits<std::streamsize>::max)());
21  do {
22  UnsignedStreamSize n = size <= max_size ? size : max_size;
23  os.write(data, static_cast<std::streamsize>(n));
24  data += n;
25  size -= n;
26  } while (size != 0);
27 }
28 }
29 
30 FMT_FUNC void print(std::ostream &os, CStringRef format_str, ArgList args) {
32  w.write(format_str, args);
33  internal::write(os, w);
34 }
35 } // namespace fmt
FMT_FUNC void write(std::ostream &os, Writer &w)
Definition: ostream.cc:15
const Char * data() const FMT_NOEXCEPT
Definition: format.h:2468
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1382
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1893
void write(BasicCStringRef< Char > format, ArgList args)
Definition: format.h:2515
#define FMT_FUNC
Definition: format.h:3832
MakeUnsigned< Int >::Type to_unsigned(Int value)
Definition: format.h:564
FMT_FUNC void print(std::FILE *f, CStringRef format_str, ArgList args)
Definition: format.cc:486
GLsizeiptr size
Definition: glew.h:1684
GLsizei n
Definition: glew.h:4052
Definition: format.cc:82
std::size_t size() const
Definition: format.h:2462