Commit 14b541b8a514f80c49acec30b287b8eca945f2ec

Authored by m-holger
1 parent a19264f0

Refactor `QPDFObjectHandle`: replace `getName` and `getKey` with `Name` and oper…

…ator[] for improved consistency and clarity, and remove unused test coverage entry.
libqpdf/QPDFObjectHandle.cc
@@ -766,14 +766,14 @@ QPDFObjectHandle::isScalar() const @@ -766,14 +766,14 @@ QPDFObjectHandle::isScalar() const
766 bool 766 bool
767 QPDFObjectHandle::isNameAndEquals(std::string const& name) const 767 QPDFObjectHandle::isNameAndEquals(std::string const& name) const
768 { 768 {
769 - return isName() && (getName() == name); 769 + return Name(*this) == name;
770 } 770 }
771 771
772 bool 772 bool
773 QPDFObjectHandle::isDictionaryOfType(std::string const& type, std::string const& subtype) const 773 QPDFObjectHandle::isDictionaryOfType(std::string const& type, std::string const& subtype) const
774 { 774 {
775 - return isDictionary() && (type.empty() || getKey("/Type").isNameAndEquals(type)) &&  
776 - (subtype.empty() || getKey("/Subtype").isNameAndEquals(subtype)); 775 + return isDictionary() && (type.empty() || Name((*this)["/Type"]) == type) &&
  776 + (subtype.empty() || Name((*this)["/Subtype"]) == subtype);
777 } 777 }
778 778
779 bool 779 bool
@@ -987,7 +987,6 @@ QPDFObjectHandle::getName() const @@ -987,7 +987,6 @@ QPDFObjectHandle::getName() const
987 return obj->getStringValue(); 987 return obj->getStringValue();
988 } else { 988 } else {
989 typeWarning("name", "returning dummy name"); 989 typeWarning("name", "returning dummy name");
990 - QTC::TC("qpdf", "QPDFObjectHandle name returning dummy name");  
991 return "/QPDFFakeName"; 990 return "/QPDFFakeName";
992 } 991 }
993 } 992 }
qpdf/qpdf.testcov
@@ -275,7 +275,6 @@ QPDFParser eof in parse 0 @@ -275,7 +275,6 @@ QPDFParser eof in parse 0
275 QPDFParser eof in parseRemainder 0 275 QPDFParser eof in parseRemainder 0
276 QPDFObjectHandle boolean returning false 0 276 QPDFObjectHandle boolean returning false 0
277 QPDFObjectHandle real returning 0.0 0 277 QPDFObjectHandle real returning 0.0 0
278 -QPDFObjectHandle name returning dummy name 0  
279 QPDFObjectHandle string returning empty string 0 278 QPDFObjectHandle string returning empty string 0
280 QPDFObjectHandle string returning empty utf8 0 279 QPDFObjectHandle string returning empty utf8 0
281 QPDFObjectHandle operator returning fake value 0 280 QPDFObjectHandle operator returning fake value 0