Commit 6c61be00e8366d467e7e4c82a6d91a4d074a1181

Authored by Jay Berkenbilt
1 parent 5d65e73c

Rename QPDFObject -> QPDFValueProxy

This is in preparation for restoring a QPDFObject.hh to ease the
transition on qpdf_object_type_e.

This commit was created by
* Renaming QPDFObject.cc and QPDFObject.hh
* Replacing QPDFObject\b with QPDFValueProxy (where \b is word
  boundary)
* Running format-code
* Manually resorting files in libqpdf/CMakeLists.txt
* Manually refilling the comment in QPDF.hh near class Resolver
cSpell.json
@@ -300,6 +300,7 @@ @@ -300,6 +300,7 @@
300 "nodefaultlib", 300 "nodefaultlib",
301 "noout", 301 "noout",
302 "notfound", 302 "notfound",
  303 + "nowarn",
303 "npages", 304 "npages",
304 "nproc", 305 "nproc",
305 "nrounds", 306 "nrounds",
@@ -423,6 +424,7 @@ @@ -423,6 +424,7 @@
423 "qpdftypes", 424 "qpdftypes",
424 "qpdfusage", 425 "qpdfusage",
425 "qpdfvalue", 426 "qpdfvalue",
  427 + "qpdfvalueproxy",
426 "qpdfwriter", 428 "qpdfwriter",
427 "qpdfx", 429 "qpdfx",
428 "qpdfxrefentry", 430 "qpdfxrefentry",
include/qpdf/QPDF.hh
@@ -842,11 +842,11 @@ class QPDF @@ -842,11 +842,11 @@ class QPDF
842 } 842 }
843 }; 843 };
844 844
845 - // Resolver class is restricted to QPDFObject so that only it can  
846 - // resolve indirect references. 845 + // Resolver class is restricted to QPDFValueProxy so that only it
  846 + // can resolve indirect references.
847 class Resolver 847 class Resolver
848 { 848 {
849 - friend class QPDFObject; 849 + friend class QPDFValueProxy;
850 850
851 private: 851 private:
852 static void 852 static void
@@ -952,7 +952,7 @@ class QPDF @@ -952,7 +952,7 @@ class QPDF
952 { 952 {
953 } 953 }
954 ObjCache( 954 ObjCache(
955 - std::shared_ptr<QPDFObject> object, 955 + std::shared_ptr<QPDFValueProxy> object,
956 qpdf_offset_t end_before_space, 956 qpdf_offset_t end_before_space,
957 qpdf_offset_t end_after_space) : 957 qpdf_offset_t end_after_space) :
958 object(object), 958 object(object),
@@ -961,7 +961,7 @@ class QPDF @@ -961,7 +961,7 @@ class QPDF
961 { 961 {
962 } 962 }
963 963
964 - std::shared_ptr<QPDFObject> object; 964 + std::shared_ptr<QPDFValueProxy> object;
965 qpdf_offset_t end_before_space; 965 qpdf_offset_t end_before_space;
966 qpdf_offset_t end_after_space; 966 qpdf_offset_t end_after_space;
967 }; 967 };
@@ -1186,12 +1186,12 @@ class QPDF @@ -1186,12 +1186,12 @@ class QPDF
1186 QPDFObjectHandle reserveObjectIfNotExists(QPDFObjGen const& og); 1186 QPDFObjectHandle reserveObjectIfNotExists(QPDFObjGen const& og);
1187 QPDFObjectHandle reserveStream(QPDFObjGen const& og); 1187 QPDFObjectHandle reserveStream(QPDFObjGen const& og);
1188 QPDFObjectHandle 1188 QPDFObjectHandle
1189 - newIndirect(QPDFObjGen const&, std::shared_ptr<QPDFObject> const&); 1189 + newIndirect(QPDFObjGen const&, std::shared_ptr<QPDFValueProxy> const&);
1190 bool isCached(QPDFObjGen const& og); 1190 bool isCached(QPDFObjGen const& og);
1191 bool isUnresolved(QPDFObjGen const& og); 1191 bool isUnresolved(QPDFObjGen const& og);
1192 void updateCache( 1192 void updateCache(
1193 QPDFObjGen const& og, 1193 QPDFObjGen const& og,
1194 - std::shared_ptr<QPDFObject> const& object, 1194 + std::shared_ptr<QPDFValueProxy> const& object,
1195 qpdf_offset_t end_before_space, 1195 qpdf_offset_t end_before_space,
1196 qpdf_offset_t end_after_space); 1196 qpdf_offset_t end_after_space);
1197 1197
include/qpdf/QPDFObjectHandle.hh
@@ -54,7 +54,7 @@ class QPDF_Real; @@ -54,7 +54,7 @@ class QPDF_Real;
54 class QPDF_Reserved; 54 class QPDF_Reserved;
55 class QPDF_Stream; 55 class QPDF_Stream;
56 class QPDF_String; 56 class QPDF_String;
57 -class QPDFObject; 57 +class QPDFValueProxy;
58 class QPDFTokenizer; 58 class QPDFTokenizer;
59 class QPDFExc; 59 class QPDFExc;
60 class Pl_QPDFTokenizer; 60 class Pl_QPDFTokenizer;
@@ -1453,7 +1453,7 @@ class QPDFObjectHandle @@ -1453,7 +1453,7 @@ class QPDFObjectHandle
1453 1453
1454 private: 1454 private:
1455 static QPDFObjectHandle 1455 static QPDFObjectHandle
1456 - newIndirect(std::shared_ptr<QPDFObject> const& obj) 1456 + newIndirect(std::shared_ptr<QPDFValueProxy> const& obj)
1457 { 1457 {
1458 return QPDFObjectHandle(obj); 1458 return QPDFObjectHandle(obj);
1459 } 1459 }
@@ -1478,7 +1478,7 @@ class QPDFObjectHandle @@ -1478,7 +1478,7 @@ class QPDFObjectHandle
1478 friend class QPDF; 1478 friend class QPDF;
1479 1479
1480 private: 1480 private:
1481 - static std::shared_ptr<QPDFObject> 1481 + static std::shared_ptr<QPDFValueProxy>
1482 getObject(QPDFObjectHandle& o) 1482 getObject(QPDFObjectHandle& o)
1483 { 1483 {
1484 if (!o.dereference()) { 1484 if (!o.dereference()) {
@@ -1560,7 +1560,7 @@ class QPDFObjectHandle @@ -1560,7 +1560,7 @@ class QPDFObjectHandle
1560 bool isImage(bool exclude_imagemask = true); 1560 bool isImage(bool exclude_imagemask = true);
1561 1561
1562 private: 1562 private:
1563 - QPDFObjectHandle(std::shared_ptr<QPDFObject> const& obj) : 1563 + QPDFObjectHandle(std::shared_ptr<QPDFValueProxy> const& obj) :
1564 obj(obj) 1564 obj(obj)
1565 { 1565 {
1566 } 1566 }
@@ -1613,7 +1613,7 @@ class QPDFObjectHandle @@ -1613,7 +1613,7 @@ class QPDFObjectHandle
1613 // Moving members of QPDFObjectHandle into a smart pointer incurs 1613 // Moving members of QPDFObjectHandle into a smart pointer incurs
1614 // a substantial performance penalty since QPDFObjectHandle 1614 // a substantial performance penalty since QPDFObjectHandle
1615 // objects are copied around so frequently. 1615 // objects are copied around so frequently.
1616 - std::shared_ptr<QPDFObject> obj; 1616 + std::shared_ptr<QPDFValueProxy> obj;
1617 }; 1617 };
1618 1618
1619 #ifndef QPDF_NO_QPDF_STRING 1619 #ifndef QPDF_NO_QPDF_STRING
libqpdf/CMakeLists.txt
@@ -72,7 +72,6 @@ set(libqpdf_SOURCES @@ -72,7 +72,6 @@ set(libqpdf_SOURCES
72 QPDFMatrix.cc 72 QPDFMatrix.cc
73 QPDFNameTreeObjectHelper.cc 73 QPDFNameTreeObjectHelper.cc
74 QPDFNumberTreeObjectHelper.cc 74 QPDFNumberTreeObjectHelper.cc
75 - QPDFObject.cc  
76 QPDFObjectHandle.cc 75 QPDFObjectHandle.cc
77 QPDFObjGen.cc 76 QPDFObjGen.cc
78 QPDFOutlineDocumentHelper.cc 77 QPDFOutlineDocumentHelper.cc
@@ -86,6 +85,7 @@ set(libqpdf_SOURCES @@ -86,6 +85,7 @@ set(libqpdf_SOURCES
86 QPDFTokenizer.cc 85 QPDFTokenizer.cc
87 QPDFUsage.cc 86 QPDFUsage.cc
88 QPDFValue.cc 87 QPDFValue.cc
  88 + QPDFValueProxy.cc
89 QPDFWriter.cc 89 QPDFWriter.cc
90 QPDFXRefEntry.cc 90 QPDFXRefEntry.cc
91 QPDF_Array.cc 91 QPDF_Array.cc
libqpdf/QPDF.cc
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 #include <qpdf/Pl_OStream.hh> 21 #include <qpdf/Pl_OStream.hh>
22 #include <qpdf/QPDFExc.hh> 22 #include <qpdf/QPDFExc.hh>
23 #include <qpdf/QPDFLogger.hh> 23 #include <qpdf/QPDFLogger.hh>
24 -#include <qpdf/QPDFObject.hh> 24 +#include <qpdf/QPDFValueProxy.hh>
25 #include <qpdf/QPDF_Array.hh> 25 #include <qpdf/QPDF_Array.hh>
26 #include <qpdf/QPDF_Dictionary.hh> 26 #include <qpdf/QPDF_Dictionary.hh>
27 #include <qpdf/QPDF_Null.hh> 27 #include <qpdf/QPDF_Null.hh>
@@ -2114,7 +2114,8 @@ QPDF::resolveObjectsInStream(int obj_stream_number) @@ -2114,7 +2114,8 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
2114 } 2114 }
2115 2115
2116 QPDFObjectHandle 2116 QPDFObjectHandle
2117 -QPDF::newIndirect(QPDFObjGen const& og, std::shared_ptr<QPDFObject> const& obj) 2117 +QPDF::newIndirect(
  2118 + QPDFObjGen const& og, std::shared_ptr<QPDFValueProxy> const& obj)
2118 { 2119 {
2119 obj->setObjGen(this, og); 2120 obj->setObjGen(this, og);
2120 if (!obj->hasDescription()) { 2121 if (!obj->hasDescription()) {
@@ -2126,7 +2127,7 @@ QPDF::newIndirect(QPDFObjGen const&amp; og, std::shared_ptr&lt;QPDFObject&gt; const&amp; obj) @@ -2126,7 +2127,7 @@ QPDF::newIndirect(QPDFObjGen const&amp; og, std::shared_ptr&lt;QPDFObject&gt; const&amp; obj)
2126 void 2127 void
2127 QPDF::updateCache( 2128 QPDF::updateCache(
2128 QPDFObjGen const& og, 2129 QPDFObjGen const& og,
2129 - std::shared_ptr<QPDFObject> const& object, 2130 + std::shared_ptr<QPDFValueProxy> const& object,
2130 qpdf_offset_t end_before_space, 2131 qpdf_offset_t end_before_space,
2131 qpdf_offset_t end_after_space) 2132 qpdf_offset_t end_after_space)
2132 { 2133 {
libqpdf/QPDFObjectHandle.cc
@@ -7,9 +7,9 @@ @@ -7,9 +7,9 @@
7 #include <qpdf/QPDFExc.hh> 7 #include <qpdf/QPDFExc.hh>
8 #include <qpdf/QPDFLogger.hh> 8 #include <qpdf/QPDFLogger.hh>
9 #include <qpdf/QPDFMatrix.hh> 9 #include <qpdf/QPDFMatrix.hh>
10 -#include <qpdf/QPDFObject.hh>  
11 #include <qpdf/QPDFPageObjectHelper.hh> 10 #include <qpdf/QPDFPageObjectHelper.hh>
12 #include <qpdf/QPDFParser.hh> 11 #include <qpdf/QPDFParser.hh>
  12 +#include <qpdf/QPDFValueProxy.hh>
13 #include <qpdf/QPDF_Array.hh> 13 #include <qpdf/QPDF_Array.hh>
14 #include <qpdf/QPDF_Bool.hh> 14 #include <qpdf/QPDF_Bool.hh>
15 #include <qpdf/QPDF_Dictionary.hh> 15 #include <qpdf/QPDF_Dictionary.hh>
@@ -2257,7 +2257,7 @@ QPDFObjectHandle::copyObject( @@ -2257,7 +2257,7 @@ QPDFObjectHandle::copyObject(
2257 " reserved object handle direct"); 2257 " reserved object handle direct");
2258 } 2258 }
2259 2259
2260 - std::shared_ptr<QPDFObject> new_obj; 2260 + std::shared_ptr<QPDFValueProxy> new_obj;
2261 2261
2262 if (isBool() || isInteger() || isName() || isNull() || isReal() || 2262 if (isBool() || isInteger() || isName() || isNull() || isReal() ||
2263 isString()) { 2263 isString()) {
libqpdf/QPDFValue.cc
1 #include <qpdf/QPDFValue.hh> 1 #include <qpdf/QPDFValue.hh>
2 2
3 -#include <qpdf/QPDFObject.hh> 3 +#include <qpdf/QPDFValueProxy.hh>
4 4
5 -std::shared_ptr<QPDFObject> 5 +std::shared_ptr<QPDFValueProxy>
6 QPDFValue::do_create(QPDFValue* object) 6 QPDFValue::do_create(QPDFValue* object)
7 { 7 {
8 - std::shared_ptr<QPDFObject> obj(new QPDFObject()); 8 + std::shared_ptr<QPDFValueProxy> obj(new QPDFValueProxy());
9 obj->value = std::shared_ptr<QPDFValue>(object); 9 obj->value = std::shared_ptr<QPDFValue>(object);
10 return obj; 10 return obj;
11 } 11 }
libqpdf/QPDFObject.cc renamed to libqpdf/QPDFValueProxy.cc
1 -#include <qpdf/QPDFObject.hh> 1 +#include <qpdf/QPDFValueProxy.hh>
2 2
3 #include <qpdf/QPDF.hh> 3 #include <qpdf/QPDF.hh>
4 4
5 void 5 void
6 -QPDFObject::doResolve() 6 +QPDFValueProxy::doResolve()
7 { 7 {
8 auto og = value->og; 8 auto og = value->og;
9 QPDF::Resolver::resolve(value->qpdf, og); 9 QPDF::Resolver::resolve(value->qpdf, og);
libqpdf/QPDF_Array.cc
@@ -16,19 +16,19 @@ QPDF_Array::QPDF_Array(SparseOHArray const&amp; items) : @@ -16,19 +16,19 @@ QPDF_Array::QPDF_Array(SparseOHArray const&amp; items) :
16 { 16 {
17 } 17 }
18 18
19 -std::shared_ptr<QPDFObject> 19 +std::shared_ptr<QPDFValueProxy>
20 QPDF_Array::create(std::vector<QPDFObjectHandle> const& items) 20 QPDF_Array::create(std::vector<QPDFObjectHandle> const& items)
21 { 21 {
22 return do_create(new QPDF_Array(items)); 22 return do_create(new QPDF_Array(items));
23 } 23 }
24 24
25 -std::shared_ptr<QPDFObject> 25 +std::shared_ptr<QPDFValueProxy>
26 QPDF_Array::create(SparseOHArray const& items) 26 QPDF_Array::create(SparseOHArray const& items)
27 { 27 {
28 return do_create(new QPDF_Array(items)); 28 return do_create(new QPDF_Array(items));
29 } 29 }
30 30
31 -std::shared_ptr<QPDFObject> 31 +std::shared_ptr<QPDFValueProxy>
32 QPDF_Array::shallowCopy() 32 QPDF_Array::shallowCopy()
33 { 33 {
34 return create(elements); 34 return create(elements);
libqpdf/QPDF_Bool.cc
@@ -6,13 +6,13 @@ QPDF_Bool::QPDF_Bool(bool val) : @@ -6,13 +6,13 @@ QPDF_Bool::QPDF_Bool(bool val) :
6 { 6 {
7 } 7 }
8 8
9 -std::shared_ptr<QPDFObject> 9 +std::shared_ptr<QPDFValueProxy>
10 QPDF_Bool::create(bool value) 10 QPDF_Bool::create(bool value)
11 { 11 {
12 return do_create(new QPDF_Bool(value)); 12 return do_create(new QPDF_Bool(value));
13 } 13 }
14 14
15 -std::shared_ptr<QPDFObject> 15 +std::shared_ptr<QPDFValueProxy>
16 QPDF_Bool::shallowCopy() 16 QPDF_Bool::shallowCopy()
17 { 17 {
18 return create(val); 18 return create(val);
libqpdf/QPDF_Dictionary.cc
@@ -9,13 +9,13 @@ QPDF_Dictionary::QPDF_Dictionary( @@ -9,13 +9,13 @@ QPDF_Dictionary::QPDF_Dictionary(
9 { 9 {
10 } 10 }
11 11
12 -std::shared_ptr<QPDFObject> 12 +std::shared_ptr<QPDFValueProxy>
13 QPDF_Dictionary::create(std::map<std::string, QPDFObjectHandle> const& items) 13 QPDF_Dictionary::create(std::map<std::string, QPDFObjectHandle> const& items)
14 { 14 {
15 return do_create(new QPDF_Dictionary(items)); 15 return do_create(new QPDF_Dictionary(items));
16 } 16 }
17 17
18 -std::shared_ptr<QPDFObject> 18 +std::shared_ptr<QPDFValueProxy>
19 QPDF_Dictionary::shallowCopy() 19 QPDF_Dictionary::shallowCopy()
20 { 20 {
21 return create(items); 21 return create(items);
libqpdf/QPDF_InlineImage.cc
@@ -6,13 +6,13 @@ QPDF_InlineImage::QPDF_InlineImage(std::string const&amp; val) : @@ -6,13 +6,13 @@ QPDF_InlineImage::QPDF_InlineImage(std::string const&amp; val) :
6 { 6 {
7 } 7 }
8 8
9 -std::shared_ptr<QPDFObject> 9 +std::shared_ptr<QPDFValueProxy>
10 QPDF_InlineImage::create(std::string const& val) 10 QPDF_InlineImage::create(std::string const& val)
11 { 11 {
12 return do_create(new QPDF_InlineImage(val)); 12 return do_create(new QPDF_InlineImage(val));
13 } 13 }
14 14
15 -std::shared_ptr<QPDFObject> 15 +std::shared_ptr<QPDFValueProxy>
16 QPDF_InlineImage::shallowCopy() 16 QPDF_InlineImage::shallowCopy()
17 { 17 {
18 return create(val); 18 return create(val);
libqpdf/QPDF_Integer.cc
@@ -8,13 +8,13 @@ QPDF_Integer::QPDF_Integer(long long val) : @@ -8,13 +8,13 @@ QPDF_Integer::QPDF_Integer(long long val) :
8 { 8 {
9 } 9 }
10 10
11 -std::shared_ptr<QPDFObject> 11 +std::shared_ptr<QPDFValueProxy>
12 QPDF_Integer::create(long long value) 12 QPDF_Integer::create(long long value)
13 { 13 {
14 return do_create(new QPDF_Integer(value)); 14 return do_create(new QPDF_Integer(value));
15 } 15 }
16 16
17 -std::shared_ptr<QPDFObject> 17 +std::shared_ptr<QPDFValueProxy>
18 QPDF_Integer::shallowCopy() 18 QPDF_Integer::shallowCopy()
19 { 19 {
20 return create(val); 20 return create(val);
libqpdf/QPDF_Name.cc
@@ -10,13 +10,13 @@ QPDF_Name::QPDF_Name(std::string const&amp; name) : @@ -10,13 +10,13 @@ QPDF_Name::QPDF_Name(std::string const&amp; name) :
10 { 10 {
11 } 11 }
12 12
13 -std::shared_ptr<QPDFObject> 13 +std::shared_ptr<QPDFValueProxy>
14 QPDF_Name::create(std::string const& name) 14 QPDF_Name::create(std::string const& name)
15 { 15 {
16 return do_create(new QPDF_Name(name)); 16 return do_create(new QPDF_Name(name));
17 } 17 }
18 18
19 -std::shared_ptr<QPDFObject> 19 +std::shared_ptr<QPDFValueProxy>
20 QPDF_Name::shallowCopy() 20 QPDF_Name::shallowCopy()
21 { 21 {
22 return create(name); 22 return create(name);
libqpdf/QPDF_Null.cc
@@ -5,13 +5,13 @@ QPDF_Null::QPDF_Null() : @@ -5,13 +5,13 @@ QPDF_Null::QPDF_Null() :
5 { 5 {
6 } 6 }
7 7
8 -std::shared_ptr<QPDFObject> 8 +std::shared_ptr<QPDFValueProxy>
9 QPDF_Null::create() 9 QPDF_Null::create()
10 { 10 {
11 return do_create(new QPDF_Null()); 11 return do_create(new QPDF_Null());
12 } 12 }
13 13
14 -std::shared_ptr<QPDFObject> 14 +std::shared_ptr<QPDFValueProxy>
15 QPDF_Null::shallowCopy() 15 QPDF_Null::shallowCopy()
16 { 16 {
17 return create(); 17 return create();
libqpdf/QPDF_Operator.cc
@@ -6,13 +6,13 @@ QPDF_Operator::QPDF_Operator(std::string const&amp; val) : @@ -6,13 +6,13 @@ QPDF_Operator::QPDF_Operator(std::string const&amp; val) :
6 { 6 {
7 } 7 }
8 8
9 -std::shared_ptr<QPDFObject> 9 +std::shared_ptr<QPDFValueProxy>
10 QPDF_Operator::create(std::string const& val) 10 QPDF_Operator::create(std::string const& val)
11 { 11 {
12 return do_create(new QPDF_Operator(val)); 12 return do_create(new QPDF_Operator(val));
13 } 13 }
14 14
15 -std::shared_ptr<QPDFObject> 15 +std::shared_ptr<QPDFValueProxy>
16 QPDF_Operator::shallowCopy() 16 QPDF_Operator::shallowCopy()
17 { 17 {
18 return create(val); 18 return create(val);
libqpdf/QPDF_Real.cc
@@ -15,20 +15,20 @@ QPDF_Real::QPDF_Real( @@ -15,20 +15,20 @@ QPDF_Real::QPDF_Real(
15 { 15 {
16 } 16 }
17 17
18 -std::shared_ptr<QPDFObject> 18 +std::shared_ptr<QPDFValueProxy>
19 QPDF_Real::create(std::string const& val) 19 QPDF_Real::create(std::string const& val)
20 { 20 {
21 return do_create(new QPDF_Real(val)); 21 return do_create(new QPDF_Real(val));
22 } 22 }
23 23
24 -std::shared_ptr<QPDFObject> 24 +std::shared_ptr<QPDFValueProxy>
25 QPDF_Real::create(double value, int decimal_places, bool trim_trailing_zeroes) 25 QPDF_Real::create(double value, int decimal_places, bool trim_trailing_zeroes)
26 { 26 {
27 return do_create( 27 return do_create(
28 new QPDF_Real(value, decimal_places, trim_trailing_zeroes)); 28 new QPDF_Real(value, decimal_places, trim_trailing_zeroes));
29 } 29 }
30 30
31 -std::shared_ptr<QPDFObject> 31 +std::shared_ptr<QPDFValueProxy>
32 QPDF_Real::shallowCopy() 32 QPDF_Real::shallowCopy()
33 { 33 {
34 return create(val); 34 return create(val);
libqpdf/QPDF_Reserved.cc
@@ -7,13 +7,13 @@ QPDF_Reserved::QPDF_Reserved() : @@ -7,13 +7,13 @@ QPDF_Reserved::QPDF_Reserved() :
7 { 7 {
8 } 8 }
9 9
10 -std::shared_ptr<QPDFObject> 10 +std::shared_ptr<QPDFValueProxy>
11 QPDF_Reserved::create() 11 QPDF_Reserved::create()
12 { 12 {
13 return do_create(new QPDF_Reserved()); 13 return do_create(new QPDF_Reserved());
14 } 14 }
15 15
16 -std::shared_ptr<QPDFObject> 16 +std::shared_ptr<QPDFValueProxy>
17 QPDF_Reserved::shallowCopy() 17 QPDF_Reserved::shallowCopy()
18 { 18 {
19 return create(); 19 return create();
libqpdf/QPDF_Stream.cc
@@ -130,7 +130,7 @@ QPDF_Stream::QPDF_Stream( @@ -130,7 +130,7 @@ QPDF_Stream::QPDF_Stream(
130 qpdf, qpdf->getFilename() + ", stream object " + og.unparse(' ')); 130 qpdf, qpdf->getFilename() + ", stream object " + og.unparse(' '));
131 } 131 }
132 132
133 -std::shared_ptr<QPDFObject> 133 +std::shared_ptr<QPDFValueProxy>
134 QPDF_Stream::create( 134 QPDF_Stream::create(
135 QPDF* qpdf, 135 QPDF* qpdf,
136 QPDFObjGen const& og, 136 QPDFObjGen const& og,
@@ -141,7 +141,7 @@ QPDF_Stream::create( @@ -141,7 +141,7 @@ QPDF_Stream::create(
141 return do_create(new QPDF_Stream(qpdf, og, stream_dict, offset, length)); 141 return do_create(new QPDF_Stream(qpdf, og, stream_dict, offset, length));
142 } 142 }
143 143
144 -std::shared_ptr<QPDFObject> 144 +std::shared_ptr<QPDFValueProxy>
145 QPDF_Stream::shallowCopy() 145 QPDF_Stream::shallowCopy()
146 { 146 {
147 throw std::logic_error("stream objects cannot be cloned"); 147 throw std::logic_error("stream objects cannot be cloned");
libqpdf/QPDF_String.cc
@@ -26,13 +26,13 @@ QPDF_String::QPDF_String(std::string const&amp; val) : @@ -26,13 +26,13 @@ QPDF_String::QPDF_String(std::string const&amp; val) :
26 { 26 {
27 } 27 }
28 28
29 -std::shared_ptr<QPDFObject> 29 +std::shared_ptr<QPDFValueProxy>
30 QPDF_String::create(std::string const& val) 30 QPDF_String::create(std::string const& val)
31 { 31 {
32 return do_create(new QPDF_String(val)); 32 return do_create(new QPDF_String(val));
33 } 33 }
34 34
35 -std::shared_ptr<QPDFObject> 35 +std::shared_ptr<QPDFValueProxy>
36 QPDF_String::create_utf16(std::string const& utf8_val) 36 QPDF_String::create_utf16(std::string const& utf8_val)
37 { 37 {
38 std::string result; 38 std::string result;
@@ -42,7 +42,7 @@ QPDF_String::create_utf16(std::string const&amp; utf8_val) @@ -42,7 +42,7 @@ QPDF_String::create_utf16(std::string const&amp; utf8_val)
42 return do_create(new QPDF_String(result)); 42 return do_create(new QPDF_String(result));
43 } 43 }
44 44
45 -std::shared_ptr<QPDFObject> 45 +std::shared_ptr<QPDFValueProxy>
46 QPDF_String::shallowCopy() 46 QPDF_String::shallowCopy()
47 { 47 {
48 return create(val); 48 return create(val);
libqpdf/QPDF_Unresolved.cc
@@ -7,13 +7,13 @@ QPDF_Unresolved::QPDF_Unresolved(QPDF* qpdf, QPDFObjGen const&amp; og) : @@ -7,13 +7,13 @@ QPDF_Unresolved::QPDF_Unresolved(QPDF* qpdf, QPDFObjGen const&amp; og) :
7 { 7 {
8 } 8 }
9 9
10 -std::shared_ptr<QPDFObject> 10 +std::shared_ptr<QPDFValueProxy>
11 QPDF_Unresolved::create(QPDF* qpdf, QPDFObjGen const& og) 11 QPDF_Unresolved::create(QPDF* qpdf, QPDFObjGen const& og)
12 { 12 {
13 return do_create(new QPDF_Unresolved(qpdf, og)); 13 return do_create(new QPDF_Unresolved(qpdf, og));
14 } 14 }
15 15
16 -std::shared_ptr<QPDFObject> 16 +std::shared_ptr<QPDFValueProxy>
17 QPDF_Unresolved::shallowCopy() 17 QPDF_Unresolved::shallowCopy()
18 { 18 {
19 throw std::logic_error( 19 throw std::logic_error(
libqpdf/qpdf/QPDFValue.hh
@@ -11,16 +11,16 @@ @@ -11,16 +11,16 @@
11 11
12 class QPDF; 12 class QPDF;
13 class QPDFObjectHandle; 13 class QPDFObjectHandle;
14 -class QPDFObject; 14 +class QPDFValueProxy;
15 15
16 class QPDFValue 16 class QPDFValue
17 { 17 {
18 - friend class QPDFObject; 18 + friend class QPDFValueProxy;
19 19
20 public: 20 public:
21 virtual ~QPDFValue() = default; 21 virtual ~QPDFValue() = default;
22 22
23 - virtual std::shared_ptr<QPDFObject> shallowCopy() = 0; 23 + virtual std::shared_ptr<QPDFValueProxy> shallowCopy() = 0;
24 virtual std::string unparse() = 0; 24 virtual std::string unparse() = 0;
25 virtual JSON getJSON(int json_version) = 0; 25 virtual JSON getJSON(int json_version) = 0;
26 virtual void 26 virtual void
@@ -87,7 +87,7 @@ class QPDFValue @@ -87,7 +87,7 @@ class QPDFValue
87 { 87 {
88 } 88 }
89 89
90 - static std::shared_ptr<QPDFObject> do_create(QPDFValue*); 90 + static std::shared_ptr<QPDFValueProxy> do_create(QPDFValue*);
91 91
92 private: 92 private:
93 QPDFValue(QPDFValue const&) = delete; 93 QPDFValue(QPDFValue const&) = delete;
libqpdf/qpdf/QPDFObject.hh renamed to libqpdf/qpdf/QPDFValueProxy.hh
1 -#ifndef QPDFOBJECT_HH  
2 -#define QPDFOBJECT_HH 1 +#ifndef QPDFVALUEPROXY_HH
  2 +#define QPDFVALUEPROXY_HH
3 3
4 #include <qpdf/Constants.h> 4 #include <qpdf/Constants.h>
5 #include <qpdf/DLL.h> 5 #include <qpdf/DLL.h>
@@ -12,14 +12,14 @@ @@ -12,14 +12,14 @@
12 class QPDF; 12 class QPDF;
13 class QPDFObjectHandle; 13 class QPDFObjectHandle;
14 14
15 -class QPDFObject 15 +class QPDFValueProxy
16 { 16 {
17 friend class QPDFValue; 17 friend class QPDFValue;
18 18
19 public: 19 public:
20 - QPDFObject() = default; 20 + QPDFValueProxy() = default;
21 21
22 - std::shared_ptr<QPDFObject> 22 + std::shared_ptr<QPDFValueProxy>
23 shallowCopy() 23 shallowCopy()
24 { 24 {
25 return value->shallowCopy(); 25 return value->shallowCopy();
@@ -87,12 +87,12 @@ class QPDFObject @@ -87,12 +87,12 @@ class QPDFObject
87 return value->getParsedOffset(); 87 return value->getParsedOffset();
88 } 88 }
89 void 89 void
90 - assign(std::shared_ptr<QPDFObject> o) 90 + assign(std::shared_ptr<QPDFValueProxy> o)
91 { 91 {
92 value = o->value; 92 value = o->value;
93 } 93 }
94 void 94 void
95 - swapWith(std::shared_ptr<QPDFObject> o) 95 + swapWith(std::shared_ptr<QPDFValueProxy> o)
96 { 96 {
97 auto v = value; 97 auto v = value;
98 value = o->value; 98 value = o->value;
@@ -138,9 +138,9 @@ class QPDFObject @@ -138,9 +138,9 @@ class QPDFObject
138 } 138 }
139 139
140 private: 140 private:
141 - QPDFObject(QPDFObject const&) = delete;  
142 - QPDFObject& operator=(QPDFObject const&) = delete; 141 + QPDFValueProxy(QPDFValueProxy const&) = delete;
  142 + QPDFValueProxy& operator=(QPDFValueProxy const&) = delete;
143 std::shared_ptr<QPDFValue> value; 143 std::shared_ptr<QPDFValue> value;
144 }; 144 };
145 145
146 -#endif // QPDFOBJECT_HH 146 +#endif // QPDFVALUEPROXY_HH
libqpdf/qpdf/QPDF_Array.hh
@@ -11,10 +11,10 @@ class QPDF_Array: public QPDFValue @@ -11,10 +11,10 @@ class QPDF_Array: public QPDFValue
11 { 11 {
12 public: 12 public:
13 virtual ~QPDF_Array() = default; 13 virtual ~QPDF_Array() = default;
14 - static std::shared_ptr<QPDFObject> 14 + static std::shared_ptr<QPDFValueProxy>
15 create(std::vector<QPDFObjectHandle> const& items); 15 create(std::vector<QPDFObjectHandle> const& items);
16 - static std::shared_ptr<QPDFObject> create(SparseOHArray const& items);  
17 - virtual std::shared_ptr<QPDFObject> shallowCopy(); 16 + static std::shared_ptr<QPDFValueProxy> create(SparseOHArray const& items);
  17 + virtual std::shared_ptr<QPDFValueProxy> shallowCopy();
18 virtual std::string unparse(); 18 virtual std::string unparse();
19 virtual JSON getJSON(int json_version); 19 virtual JSON getJSON(int json_version);
20 20
libqpdf/qpdf/QPDF_Bool.hh
@@ -7,8 +7,8 @@ class QPDF_Bool: public QPDFValue @@ -7,8 +7,8 @@ class QPDF_Bool: public QPDFValue
7 { 7 {
8 public: 8 public:
9 virtual ~QPDF_Bool() = default; 9 virtual ~QPDF_Bool() = default;
10 - static std::shared_ptr<QPDFObject> create(bool val);  
11 - virtual std::shared_ptr<QPDFObject> shallowCopy(); 10 + static std::shared_ptr<QPDFValueProxy> create(bool val);
  11 + virtual std::shared_ptr<QPDFValueProxy> shallowCopy();
12 virtual std::string unparse(); 12 virtual std::string unparse();
13 virtual JSON getJSON(int json_version); 13 virtual JSON getJSON(int json_version);
14 bool getVal() const; 14 bool getVal() const;
libqpdf/qpdf/QPDF_Dictionary.hh
@@ -12,9 +12,9 @@ class QPDF_Dictionary: public QPDFValue @@ -12,9 +12,9 @@ class QPDF_Dictionary: public QPDFValue
12 { 12 {
13 public: 13 public:
14 virtual ~QPDF_Dictionary() = default; 14 virtual ~QPDF_Dictionary() = default;
15 - static std::shared_ptr<QPDFObject> 15 + static std::shared_ptr<QPDFValueProxy>
16 create(std::map<std::string, QPDFObjectHandle> const& items); 16 create(std::map<std::string, QPDFObjectHandle> const& items);
17 - virtual std::shared_ptr<QPDFObject> shallowCopy(); 17 + virtual std::shared_ptr<QPDFValueProxy> shallowCopy();
18 virtual std::string unparse(); 18 virtual std::string unparse();
19 virtual JSON getJSON(int json_version); 19 virtual JSON getJSON(int json_version);
20 20
libqpdf/qpdf/QPDF_InlineImage.hh
@@ -7,8 +7,8 @@ class QPDF_InlineImage: public QPDFValue @@ -7,8 +7,8 @@ class QPDF_InlineImage: public QPDFValue
7 { 7 {
8 public: 8 public:
9 virtual ~QPDF_InlineImage() = default; 9 virtual ~QPDF_InlineImage() = default;
10 - static std::shared_ptr<QPDFObject> create(std::string const& val);  
11 - virtual std::shared_ptr<QPDFObject> shallowCopy(); 10 + static std::shared_ptr<QPDFValueProxy> create(std::string const& val);
  11 + virtual std::shared_ptr<QPDFValueProxy> shallowCopy();
12 virtual std::string unparse(); 12 virtual std::string unparse();
13 virtual JSON getJSON(int json_version); 13 virtual JSON getJSON(int json_version);
14 std::string getVal() const; 14 std::string getVal() const;
libqpdf/qpdf/QPDF_Integer.hh
@@ -7,8 +7,8 @@ class QPDF_Integer: public QPDFValue @@ -7,8 +7,8 @@ class QPDF_Integer: public QPDFValue
7 { 7 {
8 public: 8 public:
9 virtual ~QPDF_Integer() = default; 9 virtual ~QPDF_Integer() = default;
10 - static std::shared_ptr<QPDFObject> create(long long value);  
11 - virtual std::shared_ptr<QPDFObject> shallowCopy(); 10 + static std::shared_ptr<QPDFValueProxy> create(long long value);
  11 + virtual std::shared_ptr<QPDFValueProxy> shallowCopy();
12 virtual std::string unparse(); 12 virtual std::string unparse();
13 virtual JSON getJSON(int json_version); 13 virtual JSON getJSON(int json_version);
14 long long getVal() const; 14 long long getVal() const;
libqpdf/qpdf/QPDF_Name.hh
@@ -7,8 +7,8 @@ class QPDF_Name: public QPDFValue @@ -7,8 +7,8 @@ class QPDF_Name: public QPDFValue
7 { 7 {
8 public: 8 public:
9 virtual ~QPDF_Name() = default; 9 virtual ~QPDF_Name() = default;
10 - static std::shared_ptr<QPDFObject> create(std::string const& name);  
11 - virtual std::shared_ptr<QPDFObject> shallowCopy(); 10 + static std::shared_ptr<QPDFValueProxy> create(std::string const& name);
  11 + virtual std::shared_ptr<QPDFValueProxy> shallowCopy();
12 virtual std::string unparse(); 12 virtual std::string unparse();
13 virtual JSON getJSON(int json_version); 13 virtual JSON getJSON(int json_version);
14 std::string getName() const; 14 std::string getName() const;
libqpdf/qpdf/QPDF_Null.hh
@@ -7,8 +7,8 @@ class QPDF_Null: public QPDFValue @@ -7,8 +7,8 @@ class QPDF_Null: public QPDFValue
7 { 7 {
8 public: 8 public:
9 virtual ~QPDF_Null() = default; 9 virtual ~QPDF_Null() = default;
10 - static std::shared_ptr<QPDFObject> create();  
11 - virtual std::shared_ptr<QPDFObject> shallowCopy(); 10 + static std::shared_ptr<QPDFValueProxy> create();
  11 + virtual std::shared_ptr<QPDFValueProxy> shallowCopy();
12 virtual std::string unparse(); 12 virtual std::string unparse();
13 virtual JSON getJSON(int json_version); 13 virtual JSON getJSON(int json_version);
14 14
libqpdf/qpdf/QPDF_Operator.hh
@@ -7,8 +7,8 @@ class QPDF_Operator: public QPDFValue @@ -7,8 +7,8 @@ class QPDF_Operator: public QPDFValue
7 { 7 {
8 public: 8 public:
9 virtual ~QPDF_Operator() = default; 9 virtual ~QPDF_Operator() = default;
10 - static std::shared_ptr<QPDFObject> create(std::string const& val);  
11 - virtual std::shared_ptr<QPDFObject> shallowCopy(); 10 + static std::shared_ptr<QPDFValueProxy> create(std::string const& val);
  11 + virtual std::shared_ptr<QPDFValueProxy> shallowCopy();
12 virtual std::string unparse(); 12 virtual std::string unparse();
13 virtual JSON getJSON(int json_version); 13 virtual JSON getJSON(int json_version);
14 std::string getVal() const; 14 std::string getVal() const;
libqpdf/qpdf/QPDF_Real.hh
@@ -7,10 +7,10 @@ class QPDF_Real: public QPDFValue @@ -7,10 +7,10 @@ class QPDF_Real: public QPDFValue
7 { 7 {
8 public: 8 public:
9 virtual ~QPDF_Real() = default; 9 virtual ~QPDF_Real() = default;
10 - static std::shared_ptr<QPDFObject> create(std::string const& val);  
11 - static std::shared_ptr<QPDFObject> 10 + static std::shared_ptr<QPDFValueProxy> create(std::string const& val);
  11 + static std::shared_ptr<QPDFValueProxy>
12 create(double value, int decimal_places, bool trim_trailing_zeroes); 12 create(double value, int decimal_places, bool trim_trailing_zeroes);
13 - virtual std::shared_ptr<QPDFObject> shallowCopy(); 13 + virtual std::shared_ptr<QPDFValueProxy> shallowCopy();
14 virtual std::string unparse(); 14 virtual std::string unparse();
15 virtual JSON getJSON(int json_version); 15 virtual JSON getJSON(int json_version);
16 std::string getVal(); 16 std::string getVal();
libqpdf/qpdf/QPDF_Reserved.hh
@@ -7,8 +7,8 @@ class QPDF_Reserved: public QPDFValue @@ -7,8 +7,8 @@ class QPDF_Reserved: public QPDFValue
7 { 7 {
8 public: 8 public:
9 virtual ~QPDF_Reserved() = default; 9 virtual ~QPDF_Reserved() = default;
10 - static std::shared_ptr<QPDFObject> create();  
11 - virtual std::shared_ptr<QPDFObject> shallowCopy(); 10 + static std::shared_ptr<QPDFValueProxy> create();
  11 + virtual std::shared_ptr<QPDFValueProxy> shallowCopy();
12 virtual std::string unparse(); 12 virtual std::string unparse();
13 virtual JSON getJSON(int json_version); 13 virtual JSON getJSON(int json_version);
14 14
libqpdf/qpdf/QPDF_Stream.hh
@@ -17,13 +17,13 @@ class QPDF_Stream: public QPDFValue @@ -17,13 +17,13 @@ class QPDF_Stream: public QPDFValue
17 { 17 {
18 public: 18 public:
19 virtual ~QPDF_Stream() = default; 19 virtual ~QPDF_Stream() = default;
20 - static std::shared_ptr<QPDFObject> create( 20 + static std::shared_ptr<QPDFValueProxy> create(
21 QPDF*, 21 QPDF*,
22 QPDFObjGen const& og, 22 QPDFObjGen const& og,
23 QPDFObjectHandle stream_dict, 23 QPDFObjectHandle stream_dict,
24 qpdf_offset_t offset, 24 qpdf_offset_t offset,
25 size_t length); 25 size_t length);
26 - virtual std::shared_ptr<QPDFObject> shallowCopy(); 26 + virtual std::shared_ptr<QPDFValueProxy> shallowCopy();
27 virtual std::string unparse(); 27 virtual std::string unparse();
28 virtual JSON getJSON(int json_version); 28 virtual JSON getJSON(int json_version);
29 virtual void setDescription(QPDF*, std::string const&); 29 virtual void setDescription(QPDF*, std::string const&);
libqpdf/qpdf/QPDF_String.hh
@@ -11,10 +11,10 @@ class QPDF_String: public QPDFValue @@ -11,10 +11,10 @@ class QPDF_String: public QPDFValue
11 11
12 public: 12 public:
13 virtual ~QPDF_String() = default; 13 virtual ~QPDF_String() = default;
14 - static std::shared_ptr<QPDFObject> create(std::string const& val);  
15 - static std::shared_ptr<QPDFObject> 14 + static std::shared_ptr<QPDFValueProxy> create(std::string const& val);
  15 + static std::shared_ptr<QPDFValueProxy>
16 create_utf16(std::string const& utf8_val); 16 create_utf16(std::string const& utf8_val);
17 - virtual std::shared_ptr<QPDFObject> shallowCopy(); 17 + virtual std::shared_ptr<QPDFValueProxy> shallowCopy();
18 virtual std::string unparse(); 18 virtual std::string unparse();
19 std::string unparse(bool force_binary); 19 std::string unparse(bool force_binary);
20 virtual JSON getJSON(int json_version); 20 virtual JSON getJSON(int json_version);
libqpdf/qpdf/QPDF_Unresolved.hh
@@ -7,8 +7,9 @@ class QPDF_Unresolved: public QPDFValue @@ -7,8 +7,9 @@ class QPDF_Unresolved: public QPDFValue
7 { 7 {
8 public: 8 public:
9 virtual ~QPDF_Unresolved() = default; 9 virtual ~QPDF_Unresolved() = default;
10 - static std::shared_ptr<QPDFObject> create(QPDF* qpdf, QPDFObjGen const& og);  
11 - virtual std::shared_ptr<QPDFObject> shallowCopy(); 10 + static std::shared_ptr<QPDFValueProxy>
  11 + create(QPDF* qpdf, QPDFObjGen const& og);
  12 + virtual std::shared_ptr<QPDFValueProxy> shallowCopy();
12 virtual std::string unparse(); 13 virtual std::string unparse();
13 virtual JSON getJSON(int json_version); 14 virtual JSON getJSON(int json_version);
14 15