]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Deserializer.hh
improved new vorbisfile compatibility
[chaz/yoink] / src / Moof / Deserializer.hh
index 8a771e86594db802ec04761090ebb6165517bca1..cf99c2de3c966bc22d1ac8da7c95846c27ffaa7d 100644 (file)
 
 #include <boost/shared_ptr.hpp>
 
+#include <Moof/Exception.hh>
+
 
 namespace Mf {
 
 
 class Serializable;            // forward declaration
-typedef boost::shared_ptr<Serializable> SerializablePtr;
+typedef boost::shared_ptr<Serializable> SerializableP;
+
 
 class Deserializer
 {
+       class Impl;
+       boost::shared_ptr<Impl> impl_;
+
 public:
 
        /**
@@ -77,7 +83,7 @@ public:
         * deserializer.
         */
 
-       SerializablePtr deserialize();
+       SerializableP deserialize();
 
        /**
         * Used by serializable objects to parse themselves.  These methods should
@@ -110,15 +116,31 @@ public:
         * This exception is thrown upon deserialization errors.
         */
 
-       struct Exception : std::runtime_error
+       struct Exception : public Mf::Exception
        {
-               explicit Exception(const std::string& what_arg) :
-                       std::runtime_error(what_arg) {}
+               enum
+               {
+                       PARSING_FAILED  = 1024
+               };
+
+               explicit Exception(unsigned error) :
+                       Mf::Exception(error) {}
+
+               void raise()
+               {
+                       throw *this;
+               }
+
+               const char* what() const throw()
+               {
+                       switch (code)
+                       {
+                               case PARSING_FAILED:
+                                       return "parsing failed";
+                       }
+                       return Mf::Exception::what();
+               }
        };
-
-private:
-       class DeserializerImpl;
-       boost::shared_ptr<DeserializerImpl> impl_;
 };
 
 
This page took 0.018311 seconds and 4 git commands to generate.