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 "ostream.h"
11 
12 namespace fmt {
13 
14 namespace {
15 // Write the content of w to os.
16 void write(std::ostream &os, Writer &w) {
17  const char *data = w.data();
18  typedef internal::MakeUnsigned<std::streamsize>::Type UnsignedStreamSize;
19  UnsignedStreamSize size = w.size();
20  UnsignedStreamSize max_size =
21  internal::to_unsigned((std::numeric_limits<std::streamsize>::max)());
22  do {
23  UnsignedStreamSize n = size <= max_size ? size : max_size;
24  os.write(data, static_cast<std::streamsize>(n));
25  data += n;
26  size -= n;
27  } while (size != 0);
28 }
29 }
30 
31 FMT_FUNC void print(std::ostream &os, CStringRef format_str, ArgList args) {
32  MemoryWriter w;
33  w.write(format_str, args);
34  write(os, w);
35 }
36 
37 FMT_FUNC int fprintf(std::ostream &os, CStringRef format, ArgList args) {
38  MemoryWriter w;
39  printf(w, format, args);
40  write(os, w);
41  return static_cast<int>(w.size());
42 }
43 } // namespace fmt
FMT_API void print(std::FILE *f, CStringRef format_str, ArgList args)
Definition: format.cc:873
void write(BasicCStringRef< Char > format, ArgList args)
Definition: format.h:2918
std::string format(CStringRef format_str, ArgList args)
Definition: format.h:3686
bool write(ros_opcua_srvs::Write::Request &req, ros_opcua_srvs::Write::Response &res)
#define FMT_FUNC
Definition: format.h:4498
BasicWriter< char > Writer
Definition: format.h:426
MakeUnsigned< Int >::Type to_unsigned(Int value)
Definition: format.h:635
std::size_t size() const
Definition: format.h:2857
FMT_API int fprintf(std::FILE *f, CStringRef format, ArgList args)
Definition: format.cc:891
Definition: format.cc:81
void printf(BasicWriter< Char > &w, BasicCStringRef< Char > format, ArgList args)
Definition: format.h:3723


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Tue Jan 19 2021 03:12:07