summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/OutputUtil.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2002-01-31 14:32:05 +0000
committerMatthew Newhook <matthew@zeroc.com>2002-01-31 14:32:05 +0000
commit68ec8c36af4f3abe5a10d4f24c924eeb5e8234e1 (patch)
tree542c8bc5a76b4ebdeaad6a05b6c5c1b1faaca64d /cpp/src/Slice/OutputUtil.cpp
parentbug fix (diff)
downloadice-68ec8c36af4f3abe5a10d4f24c924eeb5e8234e1.tar.bz2
ice-68ec8c36af4f3abe5a10d4f24c924eeb5e8234e1.tar.xz
ice-68ec8c36af4f3abe5a10d4f24c924eeb5e8234e1.zip
Move Slice/OutputUtil to IceUtil. Integrate IceXML/Output.cpp with
OutputUtil. Various Makefile fixes.
Diffstat (limited to 'cpp/src/Slice/OutputUtil.cpp')
-rw-r--r--cpp/src/Slice/OutputUtil.cpp221
1 files changed, 0 insertions, 221 deletions
diff --git a/cpp/src/Slice/OutputUtil.cpp b/cpp/src/Slice/OutputUtil.cpp
deleted file mode 100644
index 21b819ec338..00000000000
--- a/cpp/src/Slice/OutputUtil.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#include <Slice/OutputUtil.h>
-
-using namespace std;
-using namespace Slice;
-
-namespace Slice
-{
-
-NextLine nl;
-StartBlock sb;
-EndBlock eb;
-Separator sp;
-
-}
-
-// ----------------------------------------------------------------------
-// Output
-// ----------------------------------------------------------------------
-
-Slice::Output::Output()
- : _pos(0),
- _indent(0),
- _separator(true),
- _blockStart("{"),
- _blockEnd("}"),
- _useTab(true),
- _indentSize(4)
-{
-}
-
-Slice::Output::Output(const char* s)
- : _pos(0),
- _indent(0),
- _separator(true),
- _blockStart("{"),
- _blockEnd("}"),
- _useTab(true),
- _indentSize(4)
-{
- open(s);
-}
-
-void
-Slice::Output::open(const char* s)
-{
- _out.open(s);
-}
-
-void
-Slice::Output::print(const char* s)
-{
- for (unsigned int i = 0; i < strlen(s); ++i)
- {
- if (s[i] == '\n')
- {
- _pos = 0;
- }
- else
- {
- ++_pos;
- }
- }
-
- _out << s;
-}
-
-void
-Slice::Output::inc()
-{
- _indent += _indentSize;
-}
-
-void
-Slice::Output::dec()
-{
- assert(_indent >= _indentSize);
- _indent -= _indentSize;
-}
-
-void
-Slice::Output::useCurrentPosAsIndent()
-{
- _indentSave.push(_indent);
- _indent = _pos;
-}
-
-void
-Slice::Output::zeroIndent()
-{
- _indentSave.push(_indent);
- _indent = 0;
-}
-
-void
-Slice::Output::restoreIndent()
-{
- assert(!_indentSave.empty());
- _indent = _indentSave.top();
- _indentSave.pop();
-}
-
-void
-Slice::Output::setBeginBlock(const char *bb)
-{
- _blockStart = bb;
-}
-
-void
-Slice::Output::setEndBlock(const char *eb)
-{
- _blockEnd = eb;
-}
-
-void
-Slice::Output::setIndent(int indentSize)
-{
- _indentSize = indentSize;
-}
-
-void
-Slice::Output::setUseTab(bool useTab)
-{
- _useTab = useTab;
-}
-
-void
-Slice::Output::nl()
-{
- _out << '\n';
- _pos = 0;
- _separator = true;
-
- int indent = _indent;
-
- if (_useTab)
- {
- while (indent >= 8)
- {
- indent -= 8;
- _out << '\t';
- _pos += 8;
- }
- }
- else
- {
- while (indent >= _indentSize)
- {
- indent -= _indentSize;
- _out << " ";
- _pos += _indentSize;
- }
- }
-
- while (indent > 0)
- {
- --indent;
- _out << ' ';
- ++_pos;
- }
-
- _out.flush();
-}
-
-void
-Slice::Output::sb()
-{
- if (_blockStart.length())
- {
- nl();
- _out << _blockStart;
- }
- ++_pos;
- inc();
- _separator = false;
-}
-
-void
-Slice::Output::eb()
-{
- dec();
- if (_blockEnd.length())
- {
- nl();
- _out << _blockEnd;
- }
- --_pos;
-}
-
-void
-Slice::Output::sp()
-{
- if (_separator)
- {
- _out << '\n';
- }
-}
-
-bool
-Slice::Output::operator!() const
-{
- return !_out;
-}
-
-Output&
-Slice::operator<<(Output& out, ios_base& (*val)(ios_base&))
-{
- ostringstream s;
- s << val;
- out.print(s.str().c_str());
- return out;
-}