Merge branch 'genete_static_values'
[synfig.git] / synfig-core / src / synfig / loadcanvas.h
index 888e1d7..8cfc482 100644 (file)
@@ -1,6 +1,6 @@
 /* === S Y N F I G ========================================================= */
 /*!    \file loadcanvas.h
-**     \brief writeme
+**     \brief Implementation for the Synfig Canvas Loader (canvas file parser)
 **
 **     $Id$
 **
@@ -52,7 +52,8 @@ namespace xmlpp { class Node; class Element; };
 namespace synfig {
 
 /*!    \class CanvasParser
-**     \todo writeme
+**     \brief Class that handles xmlpp elements from a sif file and converts
+* them into Synfig objects
 */
 class CanvasParser
 {
@@ -61,22 +62,23 @@ class CanvasParser
        */
 
 private:
-
+       //! Maximun number of allowed warnings before fatal error is thrown
        int max_warnings_;
-
+       //! Total number of warning during canvas parsing
     int total_warnings_;
-
+       //! Total number of errors during canvas parsing
     int total_errors_;
-
+       //! True if errors doesn't stop canvas parsing
        bool allow_errors_;
-
+       //! File name to parse
        String filename;
-
+       //! Path of the file name to parse
        String path;
-
+       //! Error text when errors found
        String errors_text;
+       //! Warning text when warnings found
        String warnings_text;
-
+       //! Seems not to be used
        GUID guid_;
 
        /*
@@ -98,7 +100,7 @@ public:
 
 public:
 
-       //! \todo writeme
+       //! Sets allow errors variable
        CanvasParser &set_allow_errors(bool x) { allow_errors_=x; return *this; }
 
        //! Sets the maximum number of warnings before a fatal error is thrown
@@ -113,77 +115,113 @@ public:
        //! Returns the number of warnings in the last parse
        int warning_count()const { return total_warnings_; }
 
+       //! Sets the path of the file to parse
        void set_path(const synfig::String& x) { path=x; }
 
+       //! Gets the path of the file to parse
        const synfig::String& get_path()const { return path; }
 
+       //! Gets error text string
        const synfig::String& get_errors_text()const { return errors_text; }
+       //! Gets warning text string
        const synfig::String& get_warnings_text()const { return warnings_text; }
 
+       //! Register a canvas in the canvas map
+       /*! \param canvas The handle to the canvas to register
+        *  \param as The absolute path to the file that represents the canvas
+        * Apart of store the pair canvas and */
        static void register_canvas_in_map(Canvas::Handle canvas, String as);
 
 #ifdef _DEBUG
        static void show_canvas_map(String file, int line, String text);
 #endif // _DEBUG
 
-       //! \todo writeme
+       //! Parse a Cavnas form a file with absolute path.
        Canvas::Handle parse_from_file_as(const String &filename,const String &as,String &errors);
+       //! Parse a Canvas from a xmlpp root node
        Canvas::Handle parse_as(xmlpp::Element* node,String &errors);
 
+       //! Set of absolute file names of the canvases currently being parsed
        static std::set<String> loading_;
 
 private:
 
-       // Error/Warning handling functions
-
+       //! Error handling function
        void error(xmlpp::Node *node,const String &text);
+       //! Fatal Error handling function
        void fatal_error(xmlpp::Node *node,const String &text);
+       //! Warning handling function
        void warning(xmlpp::Node *node,const String &text);
+       //! Unexpected element error handling function
        void error_unexpected_element(xmlpp::Node *node,const String &got, const String &expected);
+       //! Unexpected element error handling function
        void error_unexpected_element(xmlpp::Node *node,const String &got);
 
-       // Parsing Functions
-
+       //! Canvas Parsing Function
        Canvas::Handle parse_canvas(xmlpp::Element *node,Canvas::Handle parent=0,bool inline_=false, String path=".");
+       //! Canvas definitions Parsing Function (exported value nodes and exported canvases)
        void parse_canvas_defs(xmlpp::Element *node,Canvas::Handle canvas);
+       //! Layer Parsing Function
        etl::handle<Layer> parse_layer(xmlpp::Element *node,Canvas::Handle canvas);
+       //! Generic Value Base Parsing Function
        ValueBase parse_value(xmlpp::Element *node,Canvas::Handle canvas);
+       //! Generic Value Node Parsing Function
        etl::handle<ValueNode> parse_value_node(xmlpp::Element *node,Canvas::Handle canvas);
 
-       // ValueBase Parsing Functions
-
+       //! Real Value Base Parsing Function
        Real parse_real(xmlpp::Element *node);
+       //! Time Value Base Parsing Function
        Time parse_time(xmlpp::Element *node,Canvas::Handle canvas);
+       //! Integer Value Base Parsing Function
        int parse_integer(xmlpp::Element *node);
+       //! Vector Value Base Parsing Function
        Vector parse_vector(xmlpp::Element *node);
+       //! Color Value Base Parsing Function
        Color parse_color(xmlpp::Element *node);
+       //! Angle Value Base Parsing Function
        Angle parse_angle(xmlpp::Element *node);
+       //! String Value Base Parsing Function
        String parse_string(xmlpp::Element *node);
+       //! Bool Value Base Parsing Function
        bool parse_bool(xmlpp::Element *node);
+       //! Segment Value Base Parsing Function
        Segment parse_segment(xmlpp::Element *node);
+       //! List Value Base Parsing Function
        ValueBase parse_list(xmlpp::Element *node,Canvas::Handle canvas);
+       //! Gradient Value Base Parsing Function
        Gradient parse_gradient(xmlpp::Element *node);
+       //! Bline Point Value Base Parsing Function
        BLinePoint parse_bline_point(xmlpp::Element *node);
 
+       //! Keyframe Parsing Function
        Keyframe parse_keyframe(xmlpp::Element *node,Canvas::Handle canvas);
 
-       // ValueNode Parsing Functions
-
+       //! ValueNode Animated Parsing Function
        etl::handle<ValueNode_Animated> parse_animated(xmlpp::Element *node,Canvas::Handle canvas);
-       etl::handle<ValueNode_Subtract> parse_subtract(xmlpp::Element *node,Canvas::Handle canvas);
+       //! Linkable ValueNode Parsing Function
        etl::handle<LinkableValueNode> parse_linkable_value_node(xmlpp::Element *node,Canvas::Handle canvas);
+       //! Dynamic List Parsnig Function
        etl::handle<ValueNode_DynamicList> parse_dynamic_list(xmlpp::Element *node,Canvas::Handle canvas);
 
+       //! Static option for ValueBase parsing fucntion
+       bool parse_static(xmlpp::Element *node);
+
 }; // END of CanvasParser
 
 /* === E X T E R N S ======================================================= */
 
-//!    Loads a canvas from \a filename
+//!    Loads a canvas from current xmlpp Element
 /*!    \return The Canvas's handle on success, an empty handle on failure */
 extern Canvas::Handle open_canvas(xmlpp::Element* node,String &errors,String &warnings);
+//!    Loads a canvas from \a filename
+/*!    \return The Canvas's handle on success, an empty handle on failure */
 extern Canvas::Handle open_canvas(const String &filename,String &errors,String &warnings);
+//!    Loads a canvas from \a filename and its absolute path
+/*!    \return The Canvas's handle on success, an empty handle on failure */
 extern Canvas::Handle open_canvas_as(const String &filename,const String &as,String &errors,String &warnings);
 
+//! Returns the Open Canvases Map.
+//! \see open_canvas_map_
 std::map<synfig::String, etl::loose_handle<Canvas> >& get_open_canvas_map();
 
 }; // END of namespace synfig