@@ -33,54 +33,52 @@ namespace Rcpp {
33
33
Rstreambuf (){}
34
34
35
35
protected:
36
- virtual std::streamsize xsputn (const char *s, std::streamsize n );
36
+ virtual std::streamsize xsputn (const char *s, std::streamsize n);
37
37
38
- virtual int overflow (int c = traits_type::eof() );
38
+ virtual int overflow (int c = traits_type::eof());
39
39
40
- virtual int sync () ;
40
+ virtual int sync ();
41
41
};
42
42
43
43
template <bool OUTPUT>
44
44
class Rostream : public std ::ostream {
45
- typedef Rstreambuf<OUTPUT> Buffer ;
46
- Buffer buf ;
45
+ typedef Rstreambuf<OUTPUT> Buffer;
46
+ Buffer buf;
47
47
public:
48
- Rostream () :
49
- std::ostream ( &buf )
50
- {}
48
+ Rostream () : std::ostream( &buf ) {}
51
49
};
52
50
// #nocov start
53
- template <> inline std::streamsize Rstreambuf<true >::xsputn(const char *s, std::streamsize num ) {
54
- Rprintf ( " %.*s" , num, s ) ;
55
- return num ;
51
+ template <> inline std::streamsize Rstreambuf<true >::xsputn(const char *s, std::streamsize num) {
52
+ Rprintf (" %.*s" , num, s) ;
53
+ return num;
56
54
}
57
- template <> inline std::streamsize Rstreambuf<false >::xsputn(const char *s, std::streamsize num ) {
58
- REprintf ( " %.*s" , num, s ) ;
59
- return num ;
55
+ template <> inline std::streamsize Rstreambuf<false >::xsputn(const char *s, std::streamsize num) {
56
+ REprintf (" %.*s" , num, s) ;
57
+ return num;
60
58
}
61
59
62
- template <> inline int Rstreambuf<true >::overflow(int c ) {
60
+ template <> inline int Rstreambuf<true >::overflow(int c) {
63
61
if (c != traits_type::eof ()) {
64
62
char_type ch = traits_type::to_char_type (c);
65
63
return xsputn (&ch, 1 ) == 1 ? c : traits_type::eof ();
66
64
}
67
65
return c;
68
66
}
69
- template <> inline int Rstreambuf<false >::overflow(int c ) {
67
+ template <> inline int Rstreambuf<false >::overflow(int c) {
70
68
if (c != traits_type::eof ()) {
71
69
char_type ch = traits_type::to_char_type (c);
72
70
return xsputn (&ch, 1 ) == 1 ? c : traits_type::eof ();
73
71
}
74
72
return c;
75
73
}
76
74
77
- template <> inline int Rstreambuf<true >::sync(){
78
- ::R_FlushConsole () ;
79
- return 0 ;
75
+ template <> inline int Rstreambuf<true >::sync() {
76
+ ::R_FlushConsole ();
77
+ return 0 ;
80
78
}
81
- template <> inline int Rstreambuf<false >::sync(){
82
- ::R_FlushConsole () ;
83
- return 0 ;
79
+ template <> inline int Rstreambuf<false >::sync() {
80
+ ::R_FlushConsole ();
81
+ return 0 ;
84
82
} // #nocov end
85
83
static Rostream<true > Rcout;
86
84
static Rostream<false > Rcerr;
0 commit comments