Skip to content

Commit

Permalink
Add getter for supported URIs
Browse files Browse the repository at this point in the history
  • Loading branch information
attah committed Jan 4, 2025
1 parent b150bcd commit b985827
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/ippprinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ List<std::string> IppPrinter::icons() const
return _printerAttrs.getList<std::string>("printer-icons");
}

List<std::string> IppPrinter::urisSupported() const
{
return _printerAttrs.getList<std::string>("printer-uri-supported");
}

std::string IppPrinter::strings() const
{
return _printerAttrs.get<std::string>("printer-strings-uri");
Expand Down
1 change: 1 addition & 0 deletions lib/ippprinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class IppPrinter
List<Firmware> firmware() const;
List<std::string> settableAttributes() const;
List<std::string> icons() const;
List<std::string> urisSupported() const;
std::string strings() const;
List<std::string> documentFormats() const;
List<std::string> additionalDocumentFormats() const;
Expand Down
4 changes: 4 additions & 0 deletions tests/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2274,6 +2274,8 @@ TEST(attribute_getters)
{"printer-firmware-name", IppAttr(IppTag::NameWithoutLanguage, IppOneSetOf {"Firmware 1", "Firmware 2"})},
{"printer-firmware-string-version", IppAttr(IppTag::TextWithoutLanguage, IppOneSetOf {"1.0", "2.0"})},
{"printer-settable-attributes-supported", IppAttr(IppTag::Keyword, IppOneSetOf {"printer-name", "printer-location"})},
{"printer-icons", IppAttr(IppTag::Uri, IppOneSetOf {"http://myprinter/iconM.png", "http://myprinter/iconL.png"})},
{"printer-uri-supported", IppAttr(IppTag::Uri, "ipp://myprinter/ipp/print")},
{"document-format-supported", IppAttr(IppTag::Keyword, IppOneSetOf {"application/octet-stream",
"image/urf",
"image/pwg-raster",
Expand All @@ -2298,6 +2300,8 @@ TEST(attribute_getters)
ASSERT(ip.supplies().size() == 3);
ASSERT(ip.firmware() == (List<IppPrinter::Firmware> {{"Firmware 1", "1.0"}, {"Firmware 2", "2.0"}}));
ASSERT(ip.settableAttributes() == (List<std::string> {"printer-name", "printer-location"}));
ASSERT(ip.icons() == (List<std::string> {"http://myprinter/iconM.png", "http://myprinter/iconL.png"}));
ASSERT(ip.urisSupported() == (List<std::string> {"ipp://myprinter/ipp/print"}));
ASSERT(ip.documentFormats() == (List<std::string> {"application/octet-stream",
"image/urf",
"image/pwg-raster",
Expand Down
1 change: 1 addition & 0 deletions utils/ippclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ int main(int argc, char** argv)
print_if_set("Firmware:", printer.firmware());
print_if_set("Settable attributes:", join_string(printer.settableAttributes(), "\n"));
print_if_set("Icons:", join_string(printer.icons(), "\n"));
print_if_set("Printer URIs supported:", join_string(printer.urisSupported(), "\n"));
print_if_set("Strings:", printer.strings());
print_if_set("Document formats (native):", join_string(printer.documentFormats(), "\n"));
print_if_set("Document formats (guessed):", join_string(printer.additionalDocumentFormats(), "\n"));
Expand Down

0 comments on commit b985827

Please sign in to comment.