libdap
Updated for version 3.17.0
|
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 "config.h" 00037 00038 #include "DapIndent.h" 00039 00040 namespace libdap { 00041 00042 string DapIndent::_indent ; 00043 00044 void 00045 DapIndent::Indent() 00046 { 00047 _indent += " " ; 00048 } 00049 00050 void 00051 DapIndent::UnIndent() 00052 { 00053 if (_indent.length() == 0) 00054 return ; 00055 if (_indent.length() == 4) 00056 _indent = "" ; 00057 else 00058 _indent = _indent.substr(0, _indent.length() - 4) ; 00059 } 00060 00061 void 00062 DapIndent::Reset() 00063 { 00064 _indent = "" ; 00065 } 00066 00067 const string & 00068 DapIndent::GetIndent() 00069 { 00070 return _indent ; 00071 } 00072 00073 void 00074 DapIndent::SetIndent(const string &indent) 00075 { 00076 _indent = indent ; 00077 } 00078 00079 ostream & 00080 DapIndent::LMarg(ostream &strm) 00081 { 00082 strm << _indent ; 00083 return strm ; 00084 } 00085 00086 } // namespace libdap 00087