Changeset 8 for trunk/src/Document.h

Show
Ignore:
Timestamp:
04/10/06 12:49:58 (3 years ago)
Author:
jordi
Message:

I've changed the way the loadFile() function handles the error. Now all Poppler error are defined under the DocumentError? enumeration. When an error happens we can call the Document::getErrorMessage() static method to get the error message from the error code.

Also I've added the Document domain to the GError.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/Document.h

    r6 r8  
    1919#define __DOCUMENT_H__ 
    2020 
     21/// This is the definition of the GQuark used for Document's errors. 
     22#define EPDFVIEW_DOCUMENT_ERROR     ePDFView::Document::getErrorQuark () 
     23 
    2124namespace ePDFView  
    2225{ 
     26    /// 
     27    /// @brief Defines the possible errors loading a document. 
     28    /// 
     29    /// This enumeration matches the definitions at ErrorCodes.h of Poppler. 
     30    /// 
     31    typedef enum 
     32    { 
     33        /// No error. 
     34        DocumentErrorNone = 0, 
     35        /// Couldn't open the PDF file. 
     36        DocumentErrorOpenFile = 1, 
     37        /// Coudln't read the page catalog. 
     38        DocumentErrorBadCatalog = 2, 
     39        /// PDF file is damaged and couldn't be repaired. 
     40        DocumentErrorDamaged = 3, 
     41        /// The file is encrypted and the password was incorrect  
     42        /// or not supplied. 
     43        DocumentErrorEncrypted = 4, 
     44        /// Nonexistent or invalid highlight file. 
     45        DocumentErrorHighlightFile = 5, 
     46        /// Invalid printer. 
     47        DocumentErrorBadPrinter = 6, 
     48        /// Error during printing. 
     49        DocumentErrorPrinting = 7, 
     50        /// PDF File doesn't allow that operation. 
     51        DocumentErrorPermission = 8, 
     52        /// Invalid page number. 
     53        DocumentErrorBadPageNumber = 9, 
     54        /// File I/O Error. 
     55        DocumentErrorFileIO = 10 
     56    } DocumentError; 
     57         
    2358    /// 
    2459    /// @brief Defines the document's page mode. 
     
    71106            DocumentIndex &getDocumentIndex (void); 
    72107 
     108            static GQuark getErrorQuark (void); 
     109            static gchar *getErrorMessage (DocumentError errorCode); 
     110 
    73111        protected: 
    74112            PDFDoc *m_Document; 
     113 
     114            static GQuark errorQuark; 
    75115    }; 
    76116}