Some documentation attached.

On Mon, Apr 5, 2010 at 3:06 PM, Hib Eris <[email protected]> wrote:
> Hi Albert and others,
>
> I have rewritten my patches taking your comments into account. I have
> attached the new patches.
>
> I am currently working on support for linearized pdf files. This will
> allow you to render any page from a pdf document without the need to
> download the complete pdf. Expect more patches soon.
>
> Cheers,
>
> Hib
>
From c5d7c19994084487b91aae947356102297673fc9 Mon Sep 17 00:00:00 2001
From: Hib Eris <[email protected]>
Date: Mon, 5 Apr 2010 17:00:49 +0200
Subject: [PATCH 01/42] Code documentation

---
 poppler/CachedFile.h         |   25 +++++++++++++++++++++++++
 poppler/CurlPDFDocBuilder.h  |    2 ++
 poppler/LocalPDFDocBuilder.h |    2 ++
 poppler/PDFDocBuilder.h      |    8 ++++++++
 poppler/PDFDocFactory.h      |   11 +++++++++++
 poppler/StdinPDFDocBuilder.h |    2 ++
 6 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/poppler/CachedFile.h b/poppler/CachedFile.h
index e004578..4628cfa 100644
--- a/poppler/CachedFile.h
+++ b/poppler/CachedFile.h
@@ -29,6 +29,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 {
 
@@ -77,6 +84,12 @@ 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 {
 
@@ -85,6 +98,7 @@ public:
   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:
@@ -97,13 +111,24 @@ 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.
   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.
   virtual int load(GooVector<ByteRange> *ranges, CachedFileWriter *writer) = 0;
 
 };
diff --git a/poppler/CurlPDFDocBuilder.h b/poppler/CurlPDFDocBuilder.h
index e84a4c7..df8307b 100644
--- a/poppler/CurlPDFDocBuilder.h
+++ b/poppler/CurlPDFDocBuilder.h
@@ -15,6 +15,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 439a131..c5ea9a3 100644
--- a/poppler/LocalPDFDocBuilder.h
+++ b/poppler/LocalPDFDocBuilder.h
@@ -15,6 +15,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 8a1350b..a9ea630 100644
--- a/poppler/PDFDocBuilder.h
+++ b/poppler/PDFDocBuilder.h
@@ -16,6 +16,9 @@ class GooString;
 
 //------------------------------------------------------------------------
 // PDFDocBuilder
+//
+// PDFDocBuilder is an abstract class that specifies the interface for
+// constructing PDFDocs.
 //------------------------------------------------------------------------
 
 class PDFDocBuilder {
@@ -23,8 +26,13 @@ class PDFDocBuilder {
 public:
 
   virtual ~PDFDocBuilder() {};
+
+  // Builds a new PDFDoc. Returns a PDFDoc. You should check this PDFDoc
+  // with PDFDoc::isOk() for failures.
   virtual PDFDoc *buildPDFDoc(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(GooString* uri) = 0;
 
 };
diff --git a/poppler/PDFDocFactory.h b/poppler/PDFDocFactory.h
index 00ee359..8a2d315 100644
--- a/poppler/PDFDocFactory.h
+++ b/poppler/PDFDocFactory.h
@@ -19,6 +19,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 {
@@ -28,9 +36,12 @@ public:
   PDFDocFactory(GooList *pdfDocBuilders = NULL);
   ~PDFDocFactory();
 
+  // Create a PDFDoc. Returns a PDFDoc. You should check this PDFDoc
+  // with PDFDoc::isOk() for failures.
   PDFDoc *createPDFDoc(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 fae32c0..5d160b7 100644
--- a/poppler/StdinPDFDocBuilder.h
+++ b/poppler/StdinPDFDocBuilder.h
@@ -15,6 +15,8 @@
 
 //------------------------------------------------------------------------
 // StdinPDFDocBuilder
+//
+// The StdinPDFDocBuilder implements a PDFDocBuilder that read from stdin.
 //------------------------------------------------------------------------
 
 class StdinPDFDocBuilder : public PDFDocBuilder {
-- 
1.6.4.2

_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to