Commit d58ec90310c93653ab42bcb7373a38e3f8d43362

Authored by m-holger
1 parent 76189c44

Un-inline QPDFValue::getDescription

libqpdf/QPDFValue.cc
@@ -9,3 +9,20 @@ QPDFValue::do_create(QPDFValue* object) @@ -9,3 +9,20 @@ QPDFValue::do_create(QPDFValue* object)
9 obj->value = std::shared_ptr<QPDFValue>(object); 9 obj->value = std::shared_ptr<QPDFValue>(object);
10 return obj; 10 return obj;
11 } 11 }
  12 +
  13 +std::string
  14 +QPDFValue::getDescription()
  15 +{
  16 + auto description = object_description ? *object_description : "";
  17 + if (auto pos = description.find("$OG"); pos != std::string::npos) {
  18 + description.replace(pos, 3, og.unparse(' '));
  19 + }
  20 + if (auto pos = description.find("$PO"); pos != std::string::npos) {
  21 + qpdf_offset_t shift = (type_code == ::ot_dictionary) ? 2
  22 + : (type_code == ::ot_array) ? 1
  23 + : 0;
  24 +
  25 + description.replace(pos, 3, std::to_string(parsed_offset + shift));
  26 + }
  27 + return description;
  28 +}
libqpdf/qpdf/QPDFValue.hh
@@ -44,22 +44,7 @@ class QPDFValue @@ -44,22 +44,7 @@ class QPDFValue
44 qpdf = a_qpdf; 44 qpdf = a_qpdf;
45 og = a_og; 45 og = a_og;
46 } 46 }
47 - std::string  
48 - getDescription()  
49 - {  
50 - auto description = object_description ? *object_description : "";  
51 - if (auto pos = description.find("$OG"); pos != std::string::npos) {  
52 - description.replace(pos, 3, og.unparse(' '));  
53 - }  
54 - if (auto pos = description.find("$PO"); pos != std::string::npos) {  
55 - qpdf_offset_t shift = (type_code == ::ot_dictionary) ? 2  
56 - : (type_code == ::ot_array) ? 1  
57 - : 0;  
58 -  
59 - description.replace(pos, 3, std::to_string(parsed_offset + shift));  
60 - }  
61 - return description;  
62 - } 47 + std::string getDescription();
63 bool 48 bool
64 hasDescription() 49 hasDescription()
65 { 50 {