CUBRID Engine  latest
printer.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 /*
20  * printer.cpp - printing classes
21  */
22 
23 #include "printer.hpp"
24 
25 void print_output::operator+= (const char ch)
26 {
27  m_sb.operator+= (ch);
28  (void) flush ();
29 }
30 
32  output_file (fp)
33 {
34 }
35 
37 {
38  static file_print_output s_std_output (stdout);
39  return s_std_output;
40 }
41 
43 {
44  int res = (int) fwrite (m_sb.get_buffer (), 1, m_sb.len (), output_file);
45  m_sb.clear ();
46  return res;
47 }
48 
49 
51 {
52 }
53 
55 {
56  return (int) m_sb.len ();
57 }
string_buffer m_sb
Definition: printer.hpp:37
file_print_output(FILE *fp)
Definition: printer.cpp:31
virtual int flush(void)=0
FILE * output_file
Definition: unloaddb.c:48
static file_print_output & std_output(void)
Definition: printer.cpp:36
FILE * output_file
Definition: printer.hpp:75
int flush(void)
Definition: printer.cpp:42
void operator+=(const char ch)
Definition: printer.cpp:25
const char * get_buffer() const
size_t len() const
int flush(void)
Definition: printer.cpp:54