summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/PSS/PSDL_Stream.h
blob: 43e79f5b342997d5c93ad100f52e5a73b9d865aa (plain)
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
80
81
82
83
84
85
86
87
88
89
90
/* -*- C++ -*- */
// $Id$
//
// ==================================================================
//
// = LIBRARY
//    PSS
//
// = FILENAME
//    PSDL_Stream
//
// = DESCRIPTION
//    This class is to help write the generated code to files.
//
// = AUTHOR
//    Priyanka Gontla <gontla_p@ociweb.com>
//
// ==================================================================

#ifndef TAO_PSDL_STREAM_H
#define TAO_PSDL_STREAM_H

#include /**/ "ace/pre.h"

#include "PSDL_Scope.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

class TAO_PSDL_Stream
{
 public:

  TAO_PSDL_Stream (void);

  ~TAO_PSDL_Stream (void);

  /// Open the file name to be able to write to it.
  int open (const char *fname);

  /// Return the underlying lowlevel file pointer.
  FILE *file (void);

  /// increment the indentation level and by default actually indent the output
  /// accordingly
  int incr_indent (unsigned short flag=1);

  /// decrease the indentation level and by default actually indent the output
  /// accordingly
  int decr_indent (unsigned short flag=1);

  /// reset indentation level to 0
  int reset (void);

  /// indent starting next line
  int indent (void);

  /// put a newline and indent on the next line
  int nl (void);

  /// "printf" style variable argument print
  int print (const char *format, ...);

  // =overloaded operators

  // output the char string and return a reference to ourselves
  TAO_PSDL_Stream &operator<< (const char *str);

  TAO_PSDL_Stream &operator<< (ACE_CString str);

  TAO_PSDL_Stream &operator<< (const unsigned long num);
  // output the integer and return a reference to ourselves

  TAO_PSDL_Stream &operator<< (const long num);
  // output the integer and return a reference to ourselves

private:

  // the underlying low-level I/O handle
  FILE *fp_;

  // indnetation level
  int indent_level_;
};


#include /**/ "ace/post.h"

#endif /* TAO_PSDL_STREAM_H */