/// This file is part of the X3DToolKit library /// Copyright (C) 2002-2004 Yannick Le Goc (legoc@imag.fr) /// http://artis.imag.fr/Members/Yannick.Legoc/X3D/ /// This library is free software; you can redistribute it and/or /// modify it under the terms of the GNU Lesser General Public /// License as published by the Free Software Foundation; either /// version 2.1 of the License, or (at your option) any later version. /// This library is distributed in the hope that it will be useful, /// but WITHOUT ANY WARRANTY; without even the implied warranty of /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU /// Lesser General Public License for more details. /// You should have received a copy of the GNU Lesser General Public /// License along with this library; if not, write to the Free Software /// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #ifndef X3DTK_X3D_SCENESAVERGLOBALVARIABLES_H #define X3DTK_X3D_SCENESAVERGLOBALVARIABLES_H #include "X3D_SceneGraphTypes.h" #include "StateVariables.h" #include namespace X3DTK { namespace X3D { /*! \brief Class declared in providing the StateVariables * of the X3D::SceneSaver processor. * * \ingroup X3D */ class SceneSaverStateVariables : public StateVariables { public: /// Constructor. SceneSaverStateVariables(); /// Destructor. virtual ~SceneSaverStateVariables(); /// Init traversal. void init(); /// Initializes the visited nodes. void initNodes(); /// Finish traversal. void finish(); /// Adds the node N. void addNode(SFNode N); /// Finds the node N. bool findNode(SFNode N); /// New line. void newLine(); /// Pushes line. void pushCurrentLine(); /// Writes the string. SFString &getCurrentLine(); /// Writes the string. SFString &getOpeningLine(); /// Pops the line stack. void popLine(); /// Adds a tabulation. void addTab(); /// Removes a tabulation. void removeTab(); /// Gets the tabulation. inline SFString getTab() const {return _tab;}; /// Adds the name to the list. void addName(const SFString &name); /// Generates a new name. SFString generateName(); /// Gets the SFString of the output. inline const MFString &getOutput() const {return _output;}; /// Returns TRUE if the current visited node has a child. bool hasChild(); /// Sets the hasUSE variable. void pushHasUSE(bool value); /// Returns the hasUSE variable. inline bool getHasUSE() const {return _hasUSEStack.front();}; /// Pops the hasUSE stack. void popHasUSE(); private: int _lineNumber; MFString _output; SFString _tab; std::list _lineStack; std::list _hasUSEStack; MFNode _visitedNodes; MFString _names; unsigned int _nameID; }; } } #endif