libdap++ Updated for version 3.8.2

DapIndent.cc

Go to the documentation of this file.
00001 // DapIndent.cc
00002 
00003 // -*- mode: c++; c-basic-offset:4 -*-
00004 
00005 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
00006 // Access Protocol.
00007 
00008 // Copyright (c) 2002,2003 OPeNDAP, Inc.
00009 // Author: Patrick West <pwest@ucar.edu>
00010 //
00011 // This library is free software; you can redistribute it and/or
00012 // modify it under the terms of the GNU Lesser General Public
00013 // License as published by the Free Software Foundation; either
00014 // version 2.1 of the License, or (at your option) any later version.
00015 //
00016 // This library is distributed in the hope that it will be useful,
00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024 //
00025 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
00026 
00027 // (c) COPYRIGHT URI/MIT 1994-1999
00028 // Please read the full copyright statement in the file COPYRIGHT_URI.
00029 //
00030 // Authors:
00031 //      pwest       Patrick West <pwest@ucar.edu>
00032 
00033 // Methods for the class DapIndent - an indentation class to support
00034 // debugging and the dump methods.
00035 
00036 #include "DapIndent.h"
00037 
00038 namespace libdap {
00039 
00040 string DapIndent::_indent ;
00041 
00042 void
00043 DapIndent::Indent()
00044 {
00045     _indent += "    " ;
00046 }
00047 
00048 void
00049 DapIndent::UnIndent()
00050 {
00051     if (_indent.length() == 0)
00052         return ;
00053     if (_indent.length() == 4)
00054         _indent = "" ;
00055     else
00056         _indent = _indent.substr(0, _indent.length() - 4) ;
00057 }
00058 
00059 void
00060 DapIndent::Reset()
00061 {
00062     _indent = "" ;
00063 }
00064 
00065 const string &
00066 DapIndent::GetIndent()
00067 {
00068     return _indent ;
00069 }
00070 
00071 void
00072 DapIndent::SetIndent(const string &indent)
00073 {
00074     _indent = indent ;
00075 }
00076 
00077 ostream &
00078 DapIndent::LMarg(ostream &strm)
00079 {
00080     strm << _indent ;
00081     return strm ;
00082 }
00083 
00084 } // namespace libdap
00085