Skip to content

Commit f772a5e

Browse files
committed
Add WITH-ALL-VALUES-FROM predicate (Issue #20)
1 parent 8dc3233 commit f772a5e

4 files changed

Lines changed: 15 additions & 1 deletion

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ libcups v3.0b1 (Month DD, YYYY)
2222
- Added a roll to the default color ippeveprinter printer.
2323
- Added new DNS-SD API (Issue #19)
2424
- Added new PWG media sizes.
25+
- Added new `EXPECT-ALL-VALUES-FROM` predicate for ipptool files (Issue #20)
2526
- Added, modernized, and promoted the localization interfaces to public API
2627
(Issue #24)
2728
- Added public JSON API (Issue #31)

doc/ipptoolfile.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,10 @@ <h3 id="ipptoolfile-5.description.expect-predicates">Expect Predicates</h3>
394394
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>WITH-ALL-VALUES &quot;/</strong><em>regular expression</em><strong>/&quot;</strong><br>
395395
Requires that all values of the <strong>EXPECT</strong> attribute match the regular expression, which must conform to the POSIX regular expression syntax.
396396
Comparisons are case-sensitive.
397+
</p>
398+
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>WITH-ALL-VALUES-FROM </strong><em>attribute-name</em><br>
399+
Requires that all value(s) of the <strong>EXPECT</strong> attribute matches the value(s) in the specified attribute.
400+
For example, &quot;EXPECT-ALL media-col-database/media-source WITH-ALL-VALUES-FROM media-source-supported&quot; requires that all the &quot;media-source&quot; values are listed as a value of the &quot;media-source-supported&quot; attribute.
397401
</p>
398402
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>WITH-DISTINCT-VALUES</strong><br>
399403
Requires that all values of the <strong>EXPECT</strong> attribute are unique.

man/ipptoolfile.5

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ Requires that all values of the \fBEXPECT\fR attribute match the boolean value g
368368
Requires that all values of the \fBEXPECT\fR attribute match the regular expression, which must conform to the POSIX regular expression syntax.
369369
Comparisons are case-sensitive.
370370
.TP 5
371+
\fBWITH\-ALL\-VALUES\-FROM \fIattribute-name\fR
372+
Requires that all value(s) of the \fBEXPECT\fR attribute matches the value(s) in the specified attribute.
373+
For example, "EXPECT-ALL media\-col\-database/media\-source WITH\-ALL\-VALUES\-FROM media\-source\-supported" requires that all the "media\-source" values are listed as a value of the "media\-source\-supported" attribute.
374+
.TP 5
371375
\fBWITH\-DISTINCT\-VALUES\fR
372376
Requires that all values of the \fBEXPECT\fR attribute are unique.
373377
Comparisons are case-sensitive.

tools/ipptool.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5126,6 +5126,7 @@ token_cb(ipp_file_t *f, /* I - IPP file data */
51265126
_cups_strcasecmp(token, "REPEAT-NO-MATCH") &&
51275127
_cups_strcasecmp(token, "SAME-COUNT-AS") &&
51285128
_cups_strcasecmp(token, "WITH-ALL-VALUES") &&
5129+
_cups_strcasecmp(token, "WITH-ALL-VALUES-FROM") &&
51295130
_cups_strcasecmp(token, "WITH-ALL-HOSTNAMES") &&
51305131
_cups_strcasecmp(token, "WITH-ALL-RESOURCES") &&
51315132
_cups_strcasecmp(token, "WITH-ALL-SCHEMES") &&
@@ -6073,7 +6074,8 @@ token_cb(ipp_file_t *f, /* I - IPP file data */
60736074
return (false);
60746075
}
60756076
}
6076-
else if (!_cups_strcasecmp(token, "WITH-VALUE-FROM"))
6077+
else if (!_cups_strcasecmp(token, "WITH-ALL-VALUES-FROM") ||
6078+
!_cups_strcasecmp(token, "WITH-VALUE-FROM"))
60776079
{
60786080
if (!ippFileReadToken(f, temp, sizeof(temp)))
60796081
{
@@ -6091,6 +6093,9 @@ token_cb(ipp_file_t *f, /* I - IPP file data */
60916093

60926094
data->last_expect->with_value_from = strdup(value);
60936095
data->last_expect->with_flags = IPPTOOL_WITH_LITERAL;
6096+
6097+
if (!_cups_strncasecmp(token, "WITH-ALL-", 9))
6098+
data->last_expect->with_flags |= IPPTOOL_WITH_ALL;
60946099
}
60956100
else
60966101
{

0 commit comments

Comments
 (0)