/* G-Cows - scripting language for creation of web sites Copyright (C) 2002, 2003, 2004, 2005, 2006 Andrea Sozzi This file is part of G-Cows. G-Cows is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. G-Cows 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef SRC_NEST_H #define SRC_NEST_H #include #include "common.H" typedef std::vector Starting_conditions; typedef Starting_conditions::iterator Conditions_iter; /* Handle identification of nested cows-tags; every time flex finds out a new open tag the current `start condition' is saved within `conditions' via the `save_condition' function. When the tag is closed, the previous start condition is restored. */ class Nested_tags { public: Nested_tags (int state) : has_tags (false) { conditions.push_back (state); } void save_condition (int state) { conditions.push_back (state); } int restore_condition (); void reset_conditions (); void set_file_has_tags () { has_tags = true; } void unset_file_has_tags () { has_tags = false; } bool file_has_tags () { return has_tags; } protected: Starting_conditions conditions; bool has_tags; }; #endif // ! SRC_NEST_H