Source code: gnu/javax/print/ipp/IppValueTag.java
1 /* IppValueTag.java --
2 Copyright (C) 2006 Free Software Foundation, Inc.
3
4 This file is part of GNU Classpath.
5
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
20
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
25
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
37
38
39 package gnu.javax.print.ipp;
40
41 /**
42 * IPP Value Tags as described in RFC 2910 section 3.5.2.
43 * <p>
44 * Attributes are always of a special type syntax (e.g. boolean or
45 * interger attribute). These value types are specified by the tag
46 * constants provided in this class. Beside the syntax types some
47 * out of band values for reporting requested attributes as
48 * unsupported, unknown etc. back to the client.
49 * </p>
50 *
51 * @author Wolfgang Baer (WBaer@gmx.de)
52 */
53 public final class IppValueTag
54 {
55
56 /** Out of band value for unsupported attributes. */
57 public static final byte UNSUPPORTED = 0x10;
58
59 // 0x11 reserved for 'default' for definition in a future
60 // IETF standards track document
61
62 /** Out of band value for unknown attributes. */
63 public static final byte UNKNOWN = 0x12;
64
65 /** Out of band value for attribute without a value. */
66 public static final byte NO_VALUE = 0x13;
67
68 // 0x14-0x1F reserved for "out-of-band" values in future IETF
69 // standards track documents.
70
71 // 0x20 reserved for definition in a future IETF
72 // standards track document
73
74 /** Indicates a value of syntax type integer. */
75 public static final byte INTEGER = 0x21;
76
77 /** Indicates a value of syntax type boolean. */
78 public static final byte BOOLEAN = 0x22;
79
80 /** Indicates a value of syntax type enum (enumeration). */
81 public static final byte ENUM = 0x23;
82
83 // 0x24-0x2F reserved for integer types for definition in
84 // future IETF standards track documents
85
86 /** Indicates a value of syntax type octect string. */
87 public static final byte OCTECTSTRING_UNSPECIFIED = 0x30;
88
89 /** Indicates a value of syntax type datetime. */
90 public static final byte DATETIME = 0x31;
91
92 /** Indicates a value of syntax type resolution. */
93 public static final byte RESOLUTION = 0x32;
94
95 /** Indicates a value of syntax type range of integers. */
96 public static final byte RANGEOFINTEGER = 0x33;
97
98 // 0x34 reserved for definition in a future IETF
99 // standards track document
100
101 /** Indicates a value of syntax type text with language. */
102 public static final byte TEXT_WITH_LANGUAGE = 0x35;
103
104 /** Indicates a value of syntax type name with language. */
105 public static final byte NAME_WITH_LANGUAGE = 0x36;
106
107 // 0x37-0x3F reserved for octetString type definitions in
108 // future IETF standards track documents
109
110 // 0x40 reserved for definition in a future IETF
111 // standards track document
112
113 /** Indicates a value of syntax type text without language. */
114 public static final byte TEXT_WITHOUT_LANGUAGE = 0x41;
115
116 /** Indicates a value of syntax type name without language. */
117 public static final byte NAME_WITHOUT_LANGUAGE = 0x42;
118
119 // 0x43 reserved for definition in a future IETF
120 // standards track document
121
122 /** Indicates a value of syntax type keyword. */
123 public static final byte KEYWORD = 0x44;
124
125 /** Indicates a value of syntax type URI. */
126 public static final byte URI = 0x45;
127
128 /** Indicates a value of syntax type URI scheme. */
129 public static final byte URI_SCHEME = 0x46;
130
131 /** Indicates a value of syntax type charset. */
132 public static final byte CHARSET = 0x47;
133
134 /** Indicates a value of syntax type language. */
135 public static final byte NATURAL_LANGUAGE =0x48;
136
137 /** Indicates a value of syntax type mime media. */
138 public static final byte MIME_MEDIA_TYPE = 0x49;
139
140 // 0x4A-0x5F reserved for character string type definitions
141 // in future IETF standards track documents
142
143
144 private IppValueTag()
145 {
146 // not to be instantiated;
147 }
148
149 /**
150 * Tests if given value corresponds to a
151 * value tag value.
152 *
153 * @param value the value to test for
154 * @return <code>true</code> if, <code>false</code> otherwise.
155 */
156 public static boolean isValueTag(byte value)
157 {
158 if(value == 0x10 || value == 0x12 || value == 0x13
159 || value == 0x21 || value == 0x22 || value == 0x23
160 || value == 0x30 || value == 0x31 || value == 0x32
161 || value == 0x33 || value == 0x35 || value == 0x36
162 || value == 0x41 || value == 0x42 || value == 0x44
163 || value == 0x45 || value == 0x46 || value == 0x47
164 || value == 0x48 || value == 0x49 )
165 return true;
166
167 return false;
168 }
169
170 }