[poppler] 2 commits - qt4/src

Pino Toscano pino at kemper.freedesktop.org
Wed May 25 07:16:26 PDT 2011


 qt4/src/poppler-embeddedfile-private.h |   40 +++++++++++++++++++++++++++++++++
 qt4/src/poppler-embeddedfile.cc        |   24 ++++++++++++++-----
 qt4/src/poppler-private.h              |    3 +-
 qt4/src/poppler-qt4.h                  |    2 +
 4 files changed, 61 insertions(+), 8 deletions(-)

New commits:
commit a264e5385b2d0fee5126b3d0e57d42d34cafa45d
Author: Pino Toscano <pino at kde.org>
Date:   Wed May 25 16:12:02 2011 +0200

    [qt4] create EmbeddedFile by EmbeddedFileData only
    
    - create the private class and pass it to the EmbeddedFile ctor, reducing the amount of poppler code API exposed to the outside
    - turn the old private EmbeddedFile(EmbFile*) ctor in a death machine

diff --git a/qt4/src/poppler-embeddedfile-private.h b/qt4/src/poppler-embeddedfile-private.h
index 7cc1658..d64b0d1 100644
--- a/qt4/src/poppler-embeddedfile-private.h
+++ b/qt4/src/poppler-embeddedfile-private.h
@@ -29,6 +29,9 @@ namespace Poppler
 class EmbeddedFileData
 {
 public:
+	EmbeddedFileData(EmbFile *ef);
+	~EmbeddedFileData();
+
 	EmbFile *embfile;
 };
 
diff --git a/qt4/src/poppler-embeddedfile.cc b/qt4/src/poppler-embeddedfile.cc
index e44bccb..6166bbd 100644
--- a/qt4/src/poppler-embeddedfile.cc
+++ b/qt4/src/poppler-embeddedfile.cc
@@ -33,15 +33,30 @@
 namespace Poppler
 {
 
+EmbeddedFileData::EmbeddedFileData(EmbFile *ef)
+	: embfile(ef)
+{
+}
+
+EmbeddedFileData::~EmbeddedFileData()
+{
+	delete embfile;
+}
+
+
 EmbeddedFile::EmbeddedFile(EmbFile *embfile)
+	: m_embeddedFile(0)
+{
+	assert(!"You must not use this private constructor!");
+}
+
+EmbeddedFile::EmbeddedFile(EmbeddedFileData &dd)
+	: m_embeddedFile(&dd)
 {
-	m_embeddedFile = new EmbeddedFileData();
-	m_embeddedFile->embfile = embfile;
 }
 
 EmbeddedFile::~EmbeddedFile()
 {
-	delete m_embeddedFile->embfile;
 	delete m_embeddedFile;
 }
 
diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h
index a104bf8..ea36e7e 100644
--- a/qt4/src/poppler-private.h
+++ b/qt4/src/poppler-private.h
@@ -41,6 +41,7 @@
 #endif
 
 #include "poppler-qt4.h"
+#include "poppler-embeddedfile-private.h"
 
 class LinkDest;
 class FormWidget;
@@ -164,7 +165,7 @@ namespace Poppler {
 			// we have some embedded documents, build the list
 			for (int yalv = 0; yalv < numEmb; ++yalv) {
 				EmbFile *ef = doc->getCatalog()->embeddedFile(yalv);
-				m_embeddedFiles.append(new EmbeddedFile(ef));
+				m_embeddedFiles.append(new EmbeddedFile(*new EmbeddedFileData(ef)));
 			}
 		}
 	}
diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
index b43a3dd..8119a25 100644
--- a/qt4/src/poppler-qt4.h
+++ b/qt4/src/poppler-qt4.h
@@ -305,6 +305,7 @@ delete it;
        Container class for an embedded file with a PDF document
     */
     class POPPLER_QT4_EXPORT EmbeddedFile {
+	friend class DocumentData;
     public:
 	/// \cond PRIVATE
 	EmbeddedFile(EmbFile *embfile);
@@ -377,6 +378,7 @@ delete it;
 
     private:
 	Q_DISABLE_COPY(EmbeddedFile)
+	EmbeddedFile(EmbeddedFileData &dd);
 
 	EmbeddedFileData *m_embeddedFile;
     };
commit 232bfa1c59013637fd7e858e22194becb636ad21
Author: Pino Toscano <pino at kde.org>
Date:   Wed May 25 15:55:48 2011 +0200

    [Qt4] split EmbeddedFileData in an own file

diff --git a/qt4/src/poppler-embeddedfile-private.h b/qt4/src/poppler-embeddedfile-private.h
new file mode 100644
index 0000000..7cc1658
--- /dev/null
+++ b/qt4/src/poppler-embeddedfile-private.h
@@ -0,0 +1,37 @@
+/* poppler-embeddedfile-private.h: Qt4 interface to poppler
+ * Copyright (C) 2005, 2008, 2009, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2005, Brad Hards <bradh at frogmouth.net>
+ * Copyright (C) 2008, Pino Toscano <pino at kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef POPPLER_EMBEDDEDFILE_PRIVATE_H
+#define POPPLER_EMBEDDEDFILE_PRIVATE_H
+
+class EmbFile;
+
+namespace Poppler
+{
+
+class EmbeddedFileData
+{
+public:
+	EmbFile *embfile;
+};
+
+}
+
+#endif
diff --git a/qt4/src/poppler-embeddedfile.cc b/qt4/src/poppler-embeddedfile.cc
index d54cf1e..e44bccb 100644
--- a/qt4/src/poppler-embeddedfile.cc
+++ b/qt4/src/poppler-embeddedfile.cc
@@ -28,16 +28,11 @@
 #include "Catalog.h"
 
 #include "poppler-private.h"
+#include "poppler-embeddedfile-private.h"
 
 namespace Poppler
 {
 
-class EmbeddedFileData
-{
-public:
-	EmbFile *embfile;
-};
-
 EmbeddedFile::EmbeddedFile(EmbFile *embfile)
 {
 	m_embeddedFile = new EmbeddedFileData();


More information about the poppler mailing list