parse.H

00001 /*
00002  * This file is part of the "Archon" framework.
00003  * (http://files3d.sourceforge.net)
00004  *
00005  * Copyright © 2002 by Kristian Spangsege and Brian Kristiansen.
00006  *
00007  * Permission to use, copy, modify, and distribute this software and
00008  * its documentation under the terms of the GNU General Public License is
00009  * hereby granted. No representations are made about the suitability of
00010  * this software for any purpose. It is provided "as is" without express
00011  * or implied warranty. See the GNU General Public License
00012  * (http://www.gnu.org/copyleft/gpl.html) for more details.
00013  *
00014  * The characters in this file are ISO8859-1 encoded.
00015  *
00016  * The documentation in this file is in "Doxygen" style
00017  * (http://www.doxygen.org).
00018  */
00019 
00020 #ifndef ARCHON_X3D_PARSE_H
00021 #define ARCHON_X3D_PARSE_H
00022 
00023 #include <string>
00024 
00025 #include <archon/util/ref.H>
00026 #include <archon/util/logger.H>
00027 
00028 #include <archon/x3d/server/core.H>
00029 #include <archon/x3d/server/group.H>
00030 #include <archon/x3d/server/scene.H>
00031 
00032 namespace Archon
00033 {
00034   namespace X3D
00035   {
00036     using namespace std;
00037     using namespace Utilities;
00038 
00039     struct CustomFieldNode; // Defined in "custom_field.H"
00040     struct CustomFieldBase; // Defined in "custom_field.H"
00041 
00042     struct ProgressTracker
00043     {
00044       virtual void set(Ref<Scene>) = 0;
00045       virtual void progress(long chars_loaded) = 0;
00046       virtual void scene(const string &uri) = 0;
00047       virtual void image(const string &uri) = 0;
00048       virtual ~ProgressTracker() {}
00049     };
00050 
00051     struct Parser
00052     {
00053     protected:
00054       virtual void warning(string message) { logger->log(message); }
00055 
00056       Parser(Ref<ExecutionContext> context, Ref<GroupingNode> rootGroup, string sourceName, Logger *logger):
00057         context(context), rootGroup(rootGroup), sourceName(sourceName), logger(logger) {}
00058 
00059       virtual ~Parser() {}
00060 
00061       Ref<ExecutionContext> context;
00062 
00068       Ref<GroupingNode> rootGroup;
00069 
00073       string sourceName;
00074 
00075       Logger *logger;
00076 
00077       bool validateIdentifier(string);
00078       void addNamedNode(string, Ref<NodeBase>);
00079 
00080       Ref<NodeBase> lookupNode(string name) { return context->lookupNode(name); }
00081 
00082       void addRootGroupChild(Ref<ChildNode>, Time stamp);
00083 
00084       void addRoute(string sourceNodeName, string sourceFieldName,
00085                     string targetNodeName, string targetFieldName);
00086 
00087       int getNextCustomFieldIndex(Ref<CustomFieldNode>);
00088       void addScriptField(Ref<CustomFieldNode>, Ref<CustomFieldBase>);
00089     };
00090   }
00091 }
00092 
00093 #endif // ARCHON_X3D_PARSE_H

Generated on Sun Jul 30 22:55:50 2006 for Archon by  doxygen 1.4.4