/usr/include/giac/myostream.h is in libgiac-dev 1.2.3.57+dfsg1-2build3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | // -*- mode:C++ ; compile-command: "g++ -I.. -g -c myostream.h" -*-
/*
* Copyright (C) 2011 B. Parisse, 12 r. Conrad Kilian, 38950 St Martin le Vinoux
* Copyright (C) 2013 J-Y. Avenard, somewhere in the world
*/
#ifndef MYOSTREAM_H
#define MYOSTREAM_H
#include <ostream>
#include <iostream>
#ifndef NO_NAMESPACE_GIAC
namespace giac {
#endif // ndef NO_NAMESPACE_GIAC
class my_ostream: public std::ostream {
public:
template <typename T>
friend my_ostream & operator<<(my_ostream &, const T &);
// Additional overload to handle ostream specific io manipulators
friend my_ostream & operator<<(my_ostream &, std::ostream & (*)(std::ostream &));
//my_ostream do not own ostream* os... Caller must handle delete
my_ostream(std::ostream * os) : std::ostream(os->rdbuf()) { }
my_ostream(std::streambuf * sb) : std::ostream(sb) { }
virtual ~my_ostream() { }
};
template <typename T>
inline my_ostream & operator<<(my_ostream & out, const T & value){
static_cast<std::ostream &>(out) << value;
return out;
}
// overload for double
template <>
inline my_ostream & operator<<(my_ostream & out, const double & value){
char buf[50];
my_sprintf(buf, "%f", value);
return out << buf;
}
// overload for float
template <>
inline my_ostream & operator<<(my_ostream & out, const float & value){
char buf[50];
my_sprintf(buf, "%f", value);
return out << buf;
}
// overload for int
template <>
inline my_ostream & operator<<(my_ostream & out, const int & value){
char buf[50];
my_sprintf(buf, "%d", value);
return out << buf;
}
// overload for unsigned int
template <>
inline my_ostream & operator<<(my_ostream & out, const unsigned int & value){
char buf[50];
my_sprintf(buf, "%u", value);
return out << buf;
}
// overload for std::ostream specific io manipulators
inline my_ostream & operator<<(my_ostream & out, std::ostream & (*func)(std::ostream &)){
static_cast<std::ostream &>(out) << func;
return out;
}
#ifndef NO_NAMESPACE_GIAC
} // namespace giac
#endif // ndef NO_NAMESPACE_GIAC
#endif // MYOSTREAM_H
|