Updated documentation.

On Mon, Apr 5, 2010 at 5:10 PM, Hib Eris <[email protected]> wrote:
> 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 52d94a5c3a412c10aa6be22460b8e6d565c8f077 Mon Sep 17 00:00:00 2001
From: Hib Eris <[email protected]>
Date: Mon, 5 Apr 2010 18:16:05 +0200
Subject: [PATCH] Code documentation

---
 poppler/CachedFile.h         |   30 ++++++++++++++++++++++++++++++
 poppler/CurlPDFDocBuilder.h  |    2 ++
 poppler/LocalPDFDocBuilder.h |    2 ++
 poppler/PDFDocBuilder.h      |    9 +++++++++
 poppler/PDFDocFactory.h      |   12 ++++++++++++
 poppler/StdinPDFDocBuilder.h |    2 ++
 6 files changed, 57 insertions(+), 0 deletions(-)

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 {
-- 
1.6.4.2

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

Reply via email to