[poppler] 2 commits - poppler/CachedFile.h poppler/CurlPDFDocBuilder.h poppler/LocalPDFDocBuilder.h poppler/PDFDocBuilder.h poppler/PDFDocFactory.h poppler/StdinPDFDocBuilder.h utils/pdftohtml.cc utils/pdftops.cc utils/pdftotext.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Mon Apr 5 12:15:44 PDT 2010


 poppler/CachedFile.h         |   30 ++++++++++++++++++++++++++++++
 poppler/CurlPDFDocBuilder.h  |    2 ++
 poppler/LocalPDFDocBuilder.h |    2 ++
 poppler/PDFDocBuilder.h      |    9 +++++++++
 poppler/PDFDocFactory.h      |   12 ++++++++++++
 poppler/StdinPDFDocBuilder.h |    2 ++
 utils/pdftohtml.cc           |    1 +
 utils/pdftops.cc             |    1 +
 utils/pdftotext.cc           |    1 +
 9 files changed, 60 insertions(+)

New commits:
commit c152d30f879e6cde45de58bb9249035e127e84e7
Author: Hib Eris <hib at hiberis.nl>
Date:   Mon Apr 5 18:55:29 2010 +0200

    delete fileName in utils

diff --git a/utils/pdftohtml.cc b/utils/pdftohtml.cc
index 53d9ecb..74733e7 100644
--- a/utils/pdftohtml.cc
+++ b/utils/pdftohtml.cc
@@ -389,6 +389,7 @@ int main(int argc, char *argv[]) {
   // clean up
  error:
   if(doc) delete doc;
+  delete fileName;
   if(globalParams) delete globalParams;
 
   if(htmlFileName) delete htmlFileName;
diff --git a/utils/pdftops.cc b/utils/pdftops.cc
index 58ba731..0376e2f 100644
--- a/utils/pdftops.cc
+++ b/utils/pdftops.cc
@@ -378,6 +378,7 @@ int main(int argc, char *argv[]) {
   delete psFileName;
  err1:
   delete doc;
+  delete fileName;
  err0:
   delete globalParams;
 
diff --git a/utils/pdftotext.cc b/utils/pdftotext.cc
index cb530a9..cee40fa 100644
--- a/utils/pdftotext.cc
+++ b/utils/pdftotext.cc
@@ -334,6 +334,7 @@ int main(int argc, char *argv[]) {
   delete textFileName;
  err2:
   delete doc;
+  delete fileName;
   uMap->decRefCnt();
  err1:
   delete globalParams;
commit f091c83414ab32a4ecf1fa2bd15f13a3cf113a86
Author: Hib Eris <hib at hiberis.nl>
Date:   Mon Apr 5 20:12:01 2010 +0100

    add some docu

diff --git a/poppler/CachedFile.h b/poppler/CachedFile.h
index eefb2a3..897ff4a 100644
--- a/poppler/CachedFile.h
+++ b/poppler/CachedFile.h
@@ -30,6 +30,13 @@ class GooString;
 class CachedFileLoader;
 
 //------------------------------------------------------------------------
+// CachedFile
+//
+// CachedFile gives FILE-like access to a document at a specified URI.
+// In the constructor, you specify a CachedFileLoader that handles loading
+// the data from the document. The CachedFile requests no more data then it
+// needs from the CachedFileLoader.
+//------------------------------------------------------------------------
 
 class CachedFile {
 
@@ -79,14 +86,24 @@ private:
 };
 
 //------------------------------------------------------------------------
+// CachedFileWriter
+//
+// CachedFileWriter handles sequential writes to a CachedFile.
+// On construction, you specify the CachedFile and the chunks of it to which data
+// should be written.
+//------------------------------------------------------------------------
 
 class CachedFileWriter {
 
 public:
 
+  // Construct a CachedFile Writer.
+  // The caller is responsible for deleting the cachedFile and chunksA.
   CachedFileWriter(CachedFile *cachedFile, GooVector<int> *chunksA);
+
   ~CachedFileWriter();
 
+  // Writes size bytes from ptr to cachedFile, returns number of bytes written.
   size_t write(const char *ptr, size_t size);
 
 private:
@@ -99,13 +116,26 @@ private:
 };
 
 //------------------------------------------------------------------------
+// CachedFileLoader
+//
+// CachedFileLoader is an abstact class that specifies the interface for
+// loadng data from an URI into a CachedFile.
+//------------------------------------------------------------------------
 
 class CachedFileLoader {
 
 public:
 
   virtual ~CachedFileLoader() {};
+
+  // Initializes the file load.
+  // Returns the length of the file.
+  // The caller is responsible for deleting uri and cachedFile.
   virtual size_t init(GooString *uri, CachedFile *cachedFile) = 0;
+
+  // Loads speficified byte ranges and passes it to the writer to store them.
+  // Returns 0 on success, Anything but 0 on failure.
+  // The caller is responsible for deleting the writer.
   virtual int load(const GooVector<ByteRange> &ranges, CachedFileWriter *writer) = 0;
 
 };
diff --git a/poppler/CurlPDFDocBuilder.h b/poppler/CurlPDFDocBuilder.h
index 75f9f62..fb34862 100644
--- a/poppler/CurlPDFDocBuilder.h
+++ b/poppler/CurlPDFDocBuilder.h
@@ -16,6 +16,8 @@
 
 //------------------------------------------------------------------------
 // CurlPDFDocBuilder
+//
+// The CurlPDFDocBuilder implements a PDFDocBuilder for 'http(s)://'.
 //------------------------------------------------------------------------
 
 class CurlPDFDocBuilder : public PDFDocBuilder {
diff --git a/poppler/LocalPDFDocBuilder.h b/poppler/LocalPDFDocBuilder.h
index 5b90a1e..c2b1d90 100644
--- a/poppler/LocalPDFDocBuilder.h
+++ b/poppler/LocalPDFDocBuilder.h
@@ -16,6 +16,8 @@
 
 //------------------------------------------------------------------------
 // LocalPDFDocBuilder
+//
+// The LocalPDFDocBuilder implements a PDFDocBuilder for local files.
 //------------------------------------------------------------------------
 
 class LocalPDFDocBuilder : public PDFDocBuilder {
diff --git a/poppler/PDFDocBuilder.h b/poppler/PDFDocBuilder.h
index 43d7b0d..d6eccf5 100644
--- a/poppler/PDFDocBuilder.h
+++ b/poppler/PDFDocBuilder.h
@@ -17,6 +17,9 @@ class GooString;
 
 //------------------------------------------------------------------------
 // PDFDocBuilder
+//
+// PDFDocBuilder is an abstract class that specifies the interface for
+// constructing PDFDocs.
 //------------------------------------------------------------------------
 
 class PDFDocBuilder {
@@ -24,8 +27,14 @@ class PDFDocBuilder {
 public:
 
   virtual ~PDFDocBuilder() {};
+
+  // Builds a new PDFDoc. Returns a PDFDoc. You should check this PDFDoc
+  // with PDFDoc::isOk() for failures.
+  // The caller is responsible for deleting ownerPassword, userPassWord and guiData.
   virtual PDFDoc *buildPDFDoc(const GooString &uri, GooString *ownerPassword = NULL,
       GooString *userPassword = NULL, void *guiDataA = NULL) = 0;
+
+  // Returns gTrue if the builder supports building a PDFDoc from the URI.
   virtual GBool supports(const GooString &uri) = 0;
 
 };
diff --git a/poppler/PDFDocFactory.h b/poppler/PDFDocFactory.h
index 609c4c4..dbceaa5 100644
--- a/poppler/PDFDocFactory.h
+++ b/poppler/PDFDocFactory.h
@@ -20,6 +20,14 @@ class PDFDocBuilder;
 
 //------------------------------------------------------------------------
 // PDFDocFactory
+//
+// PDFDocFactory allows the construction of PDFDocs from different URIs.
+//
+// By default, it supports local files, 'file://' and 'fd:0' (stdin). When
+// compiled with libcurl, it also supports 'http://' and 'https://'.
+//
+// You can extend the supported URIs by giving a list of PDFDocBuilders to
+// the constructor, or by registering a new PDFDocBuilder afterwards.
 //------------------------------------------------------------------------
 
 class PDFDocFactory {
@@ -29,9 +37,13 @@ public:
   PDFDocFactory(GooList *pdfDocBuilders = NULL);
   ~PDFDocFactory();
 
+  // Create a PDFDoc. Returns a PDFDoc. You should check this PDFDoc
+  // with PDFDoc::isOk() for failures.
+  // The caller is responsible for deleting ownerPassword, userPassWord and guiData.
   PDFDoc *createPDFDoc(const GooString &uri, GooString *ownerPassword = NULL,
       GooString *userPassword = NULL, void *guiDataA = NULL);
 
+  // Extend supported URIs with the ones from the PDFDocBuilder.
   void registerPDFDocBuilder(PDFDocBuilder *pdfDocBuilder);
 
 private:
diff --git a/poppler/StdinPDFDocBuilder.h b/poppler/StdinPDFDocBuilder.h
index 2fe60e0..e9b2f47 100644
--- a/poppler/StdinPDFDocBuilder.h
+++ b/poppler/StdinPDFDocBuilder.h
@@ -16,6 +16,8 @@
 
 //------------------------------------------------------------------------
 // StdinPDFDocBuilder
+//
+// The StdinPDFDocBuilder implements a PDFDocBuilder that read from stdin.
 //------------------------------------------------------------------------
 
 class StdinPDFDocBuilder : public PDFDocBuilder {


More information about the poppler mailing list