• Main Page
  • Related Pages
  • Classes
  • Files
  • File List

src/SceneFileLoader.hh

00001 /*
00002  * Copyright Anders Boberg 2007.
00003  * Copyright Staffan Gimåker 2007-2008, 2010.
00004  *
00005  * ---
00006  *
00007  * This file is part of peekabot.
00008  *
00009  * peekabot is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 3 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * peekabot is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00021  */
00022 
00023 #ifndef PEEKABOT_SCENE_FILE_LOADER_HH_INCLUDED
00024 #define PEEKABOT_SCENE_FILE_LOADER_HH_INCLUDED
00025 
00026 
00027 #include "ScopedHandler.hh"
00028 #include "HandlerInformer.hh"
00029 #include "Types.hh"
00030 
00031 #include <string>
00032 #include <vector>
00033 #include <set>
00034 #include <boost/filesystem/path.hpp>
00035 
00036 
00037 namespace peekabot
00038 {
00039     class Config;
00040     class ScopedHandler;
00041     class SceneObject;
00042     class Path;
00043 
00044     class SceneFileLoader
00045     {
00046     public:
00047         static std::vector<SceneObject *> load_scene(
00048             const Config &config, const Path &path);
00049 
00050         static bool register_creator(
00051             const std::string &name,
00052             ScopedHandler::ElementStartFunctor);
00053 
00054         static const ScopedHandler::StartFunctorMap & get_start_handlers();
00055 
00056     private:
00057         static void start_of_document(
00058             ScopedHandler *handler, const std::string &top_level_tag);
00059 
00060         static void end_of_document(ScopedHandler *handler);
00061 
00062         static void failure_handler(ScopedHandler *handler);
00063 
00064         static const ScopedHandler::ElementStartFunctor &get_creator(
00065             const std::string & name) throw(std::runtime_error);
00066 
00067         static void scene_start_handler(
00068             const std::string & name,
00069             XMLHandler::AttributeMap & attributes,
00070             ScopedHandler *handler);
00071 
00072         static void color_start_handler(
00073             const std::string & name,
00074             XMLHandler::AttributeMap & attributes,
00075             ScopedHandler *handler);
00076 
00077         static void color_end_handler(
00078             const std::string & name,
00079             ScopedHandler* handler);
00080 
00081         static void layer_start_handler(
00082             const std::string & name,
00083             XMLHandler::AttributeMap & attributes,
00084             ScopedHandler *handler);
00085 
00086         static void layer_end_handler(
00087             const std::string & name,
00088             ScopedHandler* handler);
00089 
00090         static void external_start_handler(
00091             const std::string & name,
00092             XMLHandler::AttributeMap & attributes,
00093             ScopedHandler *handler) throw();
00094 
00095 
00096         static void include_start_handler(
00097             const std::string &name,
00098             XMLHandler::AttributeMap &attributes,
00099             ScopedHandler *handler);
00100 
00101         static void inject_start_handler(
00102             const std::string &name,
00103             XMLHandler::AttributeMap &attributes,
00104             ScopedHandler *handler);
00105 
00106         static void inject_end_handler(
00107             const std::string &name,
00108             ScopedHandler *handler);
00109 
00110     private:
00111         static HandlerInformer ms_scene_informer;
00112         static HandlerInformer ms_color_informer;
00113         static HandlerInformer ms_layer_informer;
00114         static HandlerInformer ms_external_informer;
00115         static HandlerInformer ms_include_informer;
00116 
00117         static std::set<boost::filesystem::path> ms_included_scenes;
00118     };
00119 }
00120 
00121 
00122 #endif // PEEKABOT_SCENE_FILE_LOADER_HH_INCLUDED

Generated on Sun Jan 30 2011 for peekabot by  doxygen 1.7.1