Re: [Podofo-users] [PATCH 13/13] PdfDictionary: Added support for range iteration

2018-06-10 Thread Matthew Brincke
Hello Francesco, hello all,
> On 22 February 2018 at 12:21 Francesco Pretto  wrote:
> 
> 
> Also added a convenience GetSize() method
> ---
>   src/base/PdfDictionary.cpp | 10 ++
>   src/base/PdfDictionary.h   | 16 +++-
>   2 files changed, 25 insertions(+), 1 deletion(-)
> 

your patch looks fine (except that it wouldn't apply without ignoring
white-space and some removals of that) and I've tested it OK in two
environments: a Debian sid chroot (with the Debian revision as a base,
GCC 7 compiler) and a sandbox with the current svn revision, but only
GCC 4.9.2). Therefore I've committed it as svn r1928:
https://sourceforge.net/p/podofo/code/1928/

I'm sorry for having taken my time (so much) with the testing (test
attached, committed version of patch also, first).

Best regards, mabriIndex: src/base/PdfDictionary.cpp
===
--- src/base/PdfDictionary.cpp	(revision 1927)
+++ src/base/PdfDictionary.cpp	(working copy)
@@ -357,4 +357,14 @@
 }
 }
 
+TCIKeyMap PdfDictionary::begin() const
+{
+return m_mapKeys.begin();
+}
+
+TCIKeyMap PdfDictionary::end() const
+{
+return m_mapKeys.end();
+}
+
 };
Index: src/base/PdfDictionary.h
===
--- src/base/PdfDictionary.h	(revision 1927)
+++ src/base/PdfDictionary.h	(working copy)
@@ -229,6 +229,11 @@
 void Write( PdfOutputDevice* pDevice, EPdfWriteMode eWriteMode, 
 const PdfEncrypt* pEncrypt, const PdfName & keyStop = PdfName::KeyNull ) const;
 
+/**
+*  \returns the size of the internal map
+*/
+inline size_t GetSize() const;
+
 /** Get access to the internal map of keys.
  *
  * \returns all keys of this dictionary
@@ -262,6 +267,10 @@
  */
 virtual void SetDirty( bool bDirty );
 
+ public:
+ TCIKeyMap begin() const;
+ TCIKeyMap end() const;
+
  private: 
 TKeyMap  m_mapKeys; 
 
@@ -272,6 +281,11 @@
 typedef	TVecDictionaries::iterator   TIVecDictionaries; 
 typedef	TVecDictionaries::const_iterator TCIVecDictionaries;
 
+size_t PdfDictionary::GetSize() const
+{
+return m_mapKeys.size();
+}
+
 // -
 // 
 // -
#include 
#include 

using namespace PoDoFo;

int main()
{
PdfError::EnableDebug(true);
PdfDictionary testDict;
testDict.AddKey(PdfName("Name"), PdfString("Test"));
testDict.AddKey(PdfName("F"), PdfString("test.txt"));
testDict.AddKey(PdfName("UF"), PdfString("Test.txt"));
for (const auto& testElem: testDict)
{
std::string objString;
PdfError::DebugMessage("Current element name: %s value: %s\n",
testElem.first.GetName().c_str(),
(testElem.second->ToString(objString), objString.c_str()));
}
PdfError::DebugMessage("Size of dictionary: %zu\n", testDict.GetSize());
return 0;
}

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users


[Podofo-users] [PATCH 13/13] PdfDictionary: Added support for range iteration

2018-02-22 Thread Francesco Pretto

Also added a convenience GetSize() method
---
 src/base/PdfDictionary.cpp | 10 ++
 src/base/PdfDictionary.h   | 16 +++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/base/PdfDictionary.cpp b/src/base/PdfDictionary.cpp
index 65ed73a..d2e3da5 100644
--- a/src/base/PdfDictionary.cpp
+++ b/src/base/PdfDictionary.cpp
@@ -364,6 +364,16 @@ void PdfDictionary::SetDirty( bool bDirty )
 ++it;
 }
 }
+}
+
+TCIKeyMap PdfDictionary::begin() const
+{
+return m_mapKeys.begin();
+}
+
+TCIKeyMap PdfDictionary::end() const
+{
+return m_mapKeys.end();
 }
 
 };

diff --git a/src/base/PdfDictionary.h b/src/base/PdfDictionary.h
index 67043af..7a25f5a 100644
--- a/src/base/PdfDictionary.h
+++ b/src/base/PdfDictionary.h
@@ -238,6 +238,11 @@ class PODOFO_API PdfDictionary : public PdfDataType {
  */
 void Write( PdfOutputDevice* pDevice, EPdfWriteMode eWriteMode,
 const PdfEncrypt* pEncrypt, const PdfName & keyStop = 
PdfName::KeyNull ) const;
+
+/**
+*  \returns the size of the internal map
+*/
+inline size_t GetSize() const;
 
 /** Get access to the internal map of keys.

  *
@@ -270,7 +275,11 @@ class PODOFO_API PdfDictionary : public PdfDataType {
  *
  *  \see IsDirty
  */
-virtual void SetDirty( bool bDirty );
+virtual void SetDirty( bool bDirty );
+
+ public:
+ TCIKeyMap begin() const;
+ TCIKeyMap end() const;
 
  private:

 TKeyMap  m_mapKeys;
@@ -281,6 +290,11 @@ class PODOFO_API PdfDictionary : public PdfDataType {
 typedef std::vector  TVecDictionaries;
 typedefTVecDictionaries::iterator   TIVecDictionaries;
 typedefTVecDictionaries::const_iterator TCIVecDictionaries;
+
+size_t PdfDictionary::GetSize() const
+{
+return m_mapKeys.size();
+}
 
 // -

 //
--
2.16.1.windows.1


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users