1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
14#ifndef OSGDB_PARAMETEROUTPUT
15#define OSGDB_PARAMETEROUTPUT 1
17#include <osgDB/Output>
25 ParameterOutput(Output& fw):
27 _numItemsPerLine(fw.getNumIndicesPerLine()),
30 ParameterOutput(Output& fw,int numItemsPerLine):
32 _numItemsPerLine(numItemsPerLine),
37 _fw.indent() << "{"<<std::endl;
43 if (_column!=0) _fw << std::endl;
49 if (_column!=0) _fw << std::endl;
51 _fw.indent() << "}"<<std::endl;
56 void write(const T& t)
58 if (_column==0) _fw.indent();
63 if (_column==_numItemsPerLine)
75 template<class Iterator>
76 void write(Iterator first, Iterator last)
78 for(Iterator itr=first;
87 template<class Iterator>
88 void writeAsInts(Iterator first, Iterator last)
90 for(Iterator itr=first;
102 ParameterOutput& operator = (const ParameterOutput&) { return *this; }
105 int _numItemsPerLine;
110template<class Iterator>
111void writeArray(Output& fw, Iterator first, Iterator last,int noItemsPerLine=0)
113 if (noItemsPerLine==0) noItemsPerLine=fw.getNumIndicesPerLine();
115 fw.indent() << "{"<<std::endl;
120 for(Iterator itr=first;
124 if (column==0) fw.indent();
129 if (column==noItemsPerLine)
139 if (column!=0) fw << std::endl;
142 fw.indent()<<"}"<<std::endl;
147template<class Iterator>
148void writeArrayAsInts(Output& fw, Iterator first, Iterator last,int noItemsPerLine=0)
150 if (noItemsPerLine==0) noItemsPerLine=fw.getNumIndicesPerLine();
152 fw.indent() << "{"<<std::endl;
157 for(Iterator itr=first;
161 if (column==0) fw.indent();
166 if (column==noItemsPerLine)
176 if (column!=0) fw << std::endl;
179 fw.indent()<<"}"<<std::endl;
186#endif // __SG_OUTPUT_H