< prev index next >

src/hotspot/share/utilities/ostream.hpp

Print this page

165 
166    void dec_cr() { dec(); cr(); }
167    void inc_cr() { inc(); cr(); }
168 };
169 
170 // standard output
171 // ANSI C++ name collision
172 extern outputStream* tty;           // tty output
173 
174 // outputStream indentation. When used, indentation is automatically applied
175 // when printing on the stream using the following APIs:
176 // print(), print_cr(), print_raw(), print_raw_cr()
177 class StreamIndentor {
178  private:
179   outputStream* const _stream;
180   const int           _indentation;
181   const bool          _old_autoindent;
182   NONCOPYABLE(StreamIndentor);
183 
184  public:
185   StreamIndentor(outputStream* os, int indentation) :
186     _stream(os),
187     _indentation(indentation),
188     _old_autoindent(_stream->set_autoindent(true)) {
189 
190     _stream->inc(_indentation);
191   }
192 
193   ~StreamIndentor() {
194     _stream->dec(_indentation);
195     _stream->set_autoindent(_old_autoindent);
196   }
197 };
198 
199 // advisory locking for the shared tty stream:
200 class ttyLocker: StackObj {
201   friend class ttyUnlocker;
202  private:
203   intx _holder;
204 
205  public:

165 
166    void dec_cr() { dec(); cr(); }
167    void inc_cr() { inc(); cr(); }
168 };
169 
170 // standard output
171 // ANSI C++ name collision
172 extern outputStream* tty;           // tty output
173 
174 // outputStream indentation. When used, indentation is automatically applied
175 // when printing on the stream using the following APIs:
176 // print(), print_cr(), print_raw(), print_raw_cr()
177 class StreamIndentor {
178  private:
179   outputStream* const _stream;
180   const int           _indentation;
181   const bool          _old_autoindent;
182   NONCOPYABLE(StreamIndentor);
183 
184  public:
185   StreamIndentor(outputStream* os, int indentation = 2) :
186     _stream(os),
187     _indentation(indentation),
188     _old_autoindent(_stream->set_autoindent(true)) {
189 
190     _stream->inc(_indentation);
191   }
192 
193   ~StreamIndentor() {
194     _stream->dec(_indentation);
195     _stream->set_autoindent(_old_autoindent);
196   }
197 };
198 
199 // advisory locking for the shared tty stream:
200 class ttyLocker: StackObj {
201   friend class ttyUnlocker;
202  private:
203   intx _holder;
204 
205  public:
< prev index next >