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 string DapIndent::_indent ; 00039 00040 void 00041 DapIndent::Indent() 00042 { 00043 _indent += " " ; 00044 } 00045 00046 void 00047 DapIndent::UnIndent() 00048 { 00049 if (_indent.length() == 0) 00050 return ; 00051 if (_indent.length() == 4) 00052 _indent = "" ; 00053 else 00054 _indent = _indent.substr(0, _indent.length() - 4) ; 00055 } 00056 00057 void 00058 DapIndent::Reset() 00059 { 00060 _indent = "" ; 00061 } 00062 00063 const string & 00064 DapIndent::GetIndent() 00065 { 00066 return _indent ; 00067 } 00068 00069 void 00070 DapIndent::SetIndent(const string &indent) 00071 { 00072 _indent = indent ; 00073 } 00074 00075 ostream & 00076 DapIndent::LMarg(ostream &strm) 00077 { 00078 strm << _indent ; 00079 return strm ; 00080 } 00081