Maiden post here.

I probably wasted my time, it turns out, because there's a lot of changes between the latest published podofobrowser (0.5) and what's in svn. Anyway, since neither compile with the latest published podofo, here is a patch (I hope we love mime) which makes the few changes necessary: In brief, replace PdfDocument with PdfMemDocument; and include <algorithm> in a couple of places where it seems necessary. This, as I said, compiles with podofo 0.7 and, better still, seems to work.

Even if this patch isn't useful, I guess I could convince myself that I didn't entirely waste my time because I did gain some slight experience working with the code.

Cheers.
diff -r -u podofobrowser-0.5/src/backgroundloader.cpp 
podofobrowser-0.7/src/backgroundloader.cpp
--- podofobrowser-0.5/src/backgroundloader.cpp  2007-06-09 20:36:20.000000000 
+0930
+++ podofobrowser-0.7/src/backgroundloader.cpp  2010-02-09 03:51:31.000000000 
+1030
@@ -5,7 +5,7 @@
 
 #include <iostream>
 
-BackgroundLoader::BackgroundLoader(PdfDocument* doc)
+BackgroundLoader::BackgroundLoader(PdfMemDocument* doc)
     : m_timer(),
       m_lastObjectIdx(-1),
       m_pDoc(doc)
diff -r -u podofobrowser-0.5/src/backgroundloader.h 
podofobrowser-0.7/src/backgroundloader.h
--- podofobrowser-0.5/src/backgroundloader.h    2007-02-15 06:09:18.000000000 
+1030
+++ podofobrowser-0.7/src/backgroundloader.h    2010-02-09 03:51:45.000000000 
+1030
@@ -4,7 +4,7 @@
 #include <QtCore>
 
 namespace PoDoFo {
-    class PdfDocument;
+    class PdfMemDocument;
     class PdfObject;
 }
 
@@ -13,7 +13,7 @@
     Q_OBJECT
 
 public:
-    BackgroundLoader(PoDoFo::PdfDocument* doc);
+    BackgroundLoader(PoDoFo::PdfMemDocument* doc);
 
     virtual ~BackgroundLoader();
 
@@ -34,7 +34,7 @@
     // an invalid iterator could be _BAD_.
     int m_lastObjectIdx;
     // Document
-    PoDoFo::PdfDocument* m_pDoc;
+    PoDoFo::PdfMemDocument* m_pDoc;
 };
 
 #endif
diff -r -u podofobrowser-0.5/src/pdfobjectmodel.cpp 
podofobrowser-0.7/src/pdfobjectmodel.cpp
--- podofobrowser-0.5/src/pdfobjectmodel.cpp    2007-06-11 05:54:04.000000000 
+0930
+++ podofobrowser-0.7/src/pdfobjectmodel.cpp    2010-02-09 03:54:43.000000000 
+1030
@@ -9,6 +9,7 @@
 #include <cassert>
 #include <exception>
 #include <stdexcept>
+#include <algorithm>
 
 using namespace PoDoFo;
 
@@ -28,7 +29,7 @@
 {
 public:
     PdfObjectModelTree(
-            PdfDocument * doc,
+            PdfMemDocument * doc,
             const std::vector<PdfObject*>& roots,
             bool followReferences);
 
@@ -37,7 +38,7 @@
     PdfObjectModelNode* GetRoot(int n) const { return m_roots[n]; }
     const std::vector<PdfObjectModelNode*> & GetRoots() const { return 
m_roots; }
 
-    PdfDocument* GetDocument() const { return m_pDoc; }
+    PdfMemDocument* GetDocument() const { return m_pDoc; }
 
     bool FollowReferences() const { return m_bFollowReferences; }
 
@@ -52,7 +53,7 @@
     // Called from each node's dtor
     void NodeDeleted(PdfObjectModelNode* node);
 
-    PdfDocument* m_pDoc;
+    PdfMemDocument* m_pDoc;
     const bool m_bFollowReferences;
     typedef std::multimap<const PdfObject*,PdfObjectModelNode*> NodeAliasMap;
     NodeAliasMap m_nodeAliases;
@@ -234,7 +235,7 @@
     const PdfReference m_ref;
 };
 
-PdfObjectModelTree::PdfObjectModelTree(PdfDocument * doc, const 
std::vector<PdfObject*>& roots, bool followReferences)
+PdfObjectModelTree::PdfObjectModelTree(PdfMemDocument * doc, const 
std::vector<PdfObject*>& roots, bool followReferences)
     : m_pDoc(doc),
       m_bFollowReferences(followReferences),
       m_nodeAliases(),
@@ -471,7 +472,7 @@
     // Try to parse as a PdfVariant. Failure will throw an exception.
     PdfVariant variant;
     PdfTokenizer tokenizer (data.data(), data.size());
-    tokenizer.GetNextVariant(variant);
+    tokenizer.GetNextVariant(variant, NULL);
 
     SetData(variant);
     return true;
@@ -486,7 +487,7 @@
 }; // end anonymous namespace
 
 
-PdfObjectModel::PdfObjectModel(PdfDocument* doc, QObject* parent, bool 
catalogRooted)
+PdfObjectModel::PdfObjectModel(PdfMemDocument* doc, QObject* parent, bool 
catalogRooted)
     : QAbstractTableModel(parent), m_bDocChanged(false), m_pTree(0)
 {
     if (catalogRooted)
@@ -500,7 +501,7 @@
     delete static_cast<PdfObjectModelTree*>(m_pTree);
 }
 
-void PdfObjectModel::setupModelData_CatalogRooted(PdfDocument * doc)
+void PdfObjectModel::setupModelData_CatalogRooted(PdfMemDocument * doc)
 {
     // Find the document catalog dictionary, which we'll use as the root
     // of the tree
@@ -529,7 +530,7 @@
     m_pTree = new PdfObjectModelTree(doc, rootObjects, true);
 }
 
-void PdfObjectModel::setupModelData_IndirectRooted(PdfDocument * doc)
+void PdfObjectModel::setupModelData_IndirectRooted(PdfMemDocument * doc)
 {
     const PdfVecObjects& docObjs ( doc->GetObjects() );
     std::vector<PdfObject*> rootObjects(docObjs.begin(), docObjs.end());
diff -r -u podofobrowser-0.5/src/pdfobjectmodel.h 
podofobrowser-0.7/src/pdfobjectmodel.h
--- podofobrowser-0.5/src/pdfobjectmodel.h      2007-04-28 12:37:20.000000000 
+0930
+++ podofobrowser-0.7/src/pdfobjectmodel.h      2010-02-09 03:52:19.000000000 
+1030
@@ -9,7 +9,7 @@
 #include <podofo/podofo.h>
 
 namespace PoDoFo {
-    class PdfDocument;
+    class PdfMemDocument;
     class PdfObject;
     class PdfName;
 };
@@ -51,7 +51,7 @@
         Column_Type = 2
     };
 
-    PdfObjectModel(PoDoFo::PdfDocument* doc, QObject* parent = 0, bool 
catalogRooted = true);
+    PdfObjectModel(PoDoFo::PdfMemDocument* doc, QObject* parent = 0, bool 
catalogRooted = true);
     virtual ~PdfObjectModel();
 
     virtual QVariant data(const QModelIndex& index, int role) const;
@@ -114,8 +114,8 @@
     // have any changes been made to the document tree through the model?
     bool m_bDocChanged;
 
-    void setupModelData_CatalogRooted(PoDoFo::PdfDocument* doc);
-    void setupModelData_IndirectRooted(PoDoFo::PdfDocument* doc);
+    void setupModelData_CatalogRooted(PoDoFo::PdfMemDocument* doc);
+    void setupModelData_IndirectRooted(PoDoFo::PdfMemDocument* doc);
 
     // PdfObjectModelTree instance for the model
     void * m_pTree;
diff -r -u podofobrowser-0.5/src/podofobrowser.cpp 
podofobrowser-0.7/src/podofobrowser.cpp
--- podofobrowser-0.5/src/podofobrowser.cpp     2007-06-09 20:36:20.000000000 
+0930
+++ podofobrowser-0.7/src/podofobrowser.cpp     2010-02-09 03:55:21.000000000 
+1030
@@ -46,6 +46,7 @@
 
 #include <cassert>
 #include <iostream>
+#include <algorithm>
 
 using namespace PoDoFo;
 
@@ -124,7 +125,7 @@
     delete oldModel;
 }
 
-void PoDoFoBrowser::DocChange(PdfDocument* newDoc)
+void PoDoFoBrowser::DocChange(PdfMemDocument* newDoc)
 {
     delete m_pBackgroundLoader;
     m_pBackgroundLoader = NULL;
@@ -223,8 +224,8 @@
 
     this->clear();
 
-    PdfDocument* oldDoc = m_pDocument;
-    m_pDocument = new PdfDocument();
+    PdfMemDocument* oldDoc = m_pDocument;
+    m_pDocument = new PdfMemDocument();
 
     ModelChange( new PdfObjectModel(m_pDocument, listObjects, 
actionCatalogView->isChecked()) );
     DocChange(m_pDocument);
@@ -240,9 +241,9 @@
 
     QApplication::setOverrideCursor( Qt::WaitCursor );
 
-    PdfDocument* oldDoc = m_pDocument;
+    PdfMemDocument* oldDoc = m_pDocument;
     try {
-        m_pDocument = new PdfDocument( filename.toLocal8Bit().data() );
+        m_pDocument = new PdfMemDocument( filename.toLocal8Bit().data() );
         delete oldDoc;
     } catch( PdfError & e ) {
         QApplication::restoreOverrideCursor();
diff -r -u podofobrowser-0.5/src/podofobrowser.h 
podofobrowser-0.7/src/podofobrowser.h
--- podofobrowser-0.5/src/podofobrowser.h       2007-04-28 12:37:20.000000000 
+0930
+++ podofobrowser-0.7/src/podofobrowser.h       2010-02-09 03:52:38.000000000 
+1030
@@ -83,7 +83,7 @@
 
  private:
     void ModelChange(PdfObjectModel* newModel);
-    void DocChange(PoDoFo::PdfDocument* doc);
+    void DocChange(PoDoFo::PdfMemDocument* doc);
     void UpdateMenus();
 
     // Find the object m_gotoReference
@@ -110,7 +110,7 @@
 
     QString               m_filename;
 
-    PoDoFo::PdfDocument*  m_pDocument;
+    PoDoFo::PdfMemDocument*  m_pDocument;
     BackgroundLoader*     m_pBackgroundLoader;
     QProgressBar*         m_pDelayedLoadProgress;
 
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to