OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkPDFTypes_DEFINED | 10 #ifndef SkPDFTypes_DEFINED |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 public: | 58 public: |
59 SK_DECLARE_INST_COUNT(SkPDFObjRef) | 59 SK_DECLARE_INST_COUNT(SkPDFObjRef) |
60 | 60 |
61 /** Create a reference to an existing SkPDFObject. | 61 /** Create a reference to an existing SkPDFObject. |
62 * @param obj The object to reference. | 62 * @param obj The object to reference. |
63 */ | 63 */ |
64 explicit SkPDFObjRef(SkPDFObject* obj); | 64 explicit SkPDFObjRef(SkPDFObject* obj); |
65 virtual ~SkPDFObjRef(); | 65 virtual ~SkPDFObjRef(); |
66 | 66 |
67 // The SkPDFObject interface. | 67 // The SkPDFObject interface. |
68 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRID
E; | 68 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) override; |
69 virtual void addResources(SkPDFCatalog*) const SK_OVERRIDE; | 69 virtual void addResources(SkPDFCatalog*) const override; |
70 | 70 |
71 private: | 71 private: |
72 SkAutoTUnref<SkPDFObject> fObj; | 72 SkAutoTUnref<SkPDFObject> fObj; |
73 | 73 |
74 typedef SkPDFObject INHERITED; | 74 typedef SkPDFObject INHERITED; |
75 }; | 75 }; |
76 | 76 |
77 /** \class SkPDFInt | 77 /** \class SkPDFInt |
78 | 78 |
79 An integer object in a PDF. | 79 An integer object in a PDF. |
80 */ | 80 */ |
81 class SkPDFInt : public SkPDFObject { | 81 class SkPDFInt : public SkPDFObject { |
82 public: | 82 public: |
83 SK_DECLARE_INST_COUNT(SkPDFInt) | 83 SK_DECLARE_INST_COUNT(SkPDFInt) |
84 | 84 |
85 /** Create a PDF integer (usually for indirect reference purposes). | 85 /** Create a PDF integer (usually for indirect reference purposes). |
86 * @param value An integer value between 2^31 - 1 and -2^31. | 86 * @param value An integer value between 2^31 - 1 and -2^31. |
87 */ | 87 */ |
88 explicit SkPDFInt(int32_t value); | 88 explicit SkPDFInt(int32_t value); |
89 virtual ~SkPDFInt(); | 89 virtual ~SkPDFInt(); |
90 | 90 |
91 // The SkPDFObject interface. | 91 // The SkPDFObject interface. |
92 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRID
E; | 92 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) override; |
93 | 93 |
94 private: | 94 private: |
95 int32_t fValue; | 95 int32_t fValue; |
96 | 96 |
97 typedef SkPDFObject INHERITED; | 97 typedef SkPDFObject INHERITED; |
98 }; | 98 }; |
99 | 99 |
100 /** \class SkPDFBool | 100 /** \class SkPDFBool |
101 | 101 |
102 An boolean value in a PDF. | 102 An boolean value in a PDF. |
103 */ | 103 */ |
104 class SkPDFBool : public SkPDFObject { | 104 class SkPDFBool : public SkPDFObject { |
105 public: | 105 public: |
106 SK_DECLARE_INST_COUNT(SkPDFBool) | 106 SK_DECLARE_INST_COUNT(SkPDFBool) |
107 | 107 |
108 /** Create a PDF boolean. | 108 /** Create a PDF boolean. |
109 * @param value true or false. | 109 * @param value true or false. |
110 */ | 110 */ |
111 explicit SkPDFBool(bool value); | 111 explicit SkPDFBool(bool value); |
112 virtual ~SkPDFBool(); | 112 virtual ~SkPDFBool(); |
113 | 113 |
114 // The SkPDFObject interface. | 114 // The SkPDFObject interface. |
115 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRID
E; | 115 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) override; |
116 | 116 |
117 private: | 117 private: |
118 bool fValue; | 118 bool fValue; |
119 | 119 |
120 typedef SkPDFObject INHERITED; | 120 typedef SkPDFObject INHERITED; |
121 }; | 121 }; |
122 | 122 |
123 /** \class SkPDFScalar | 123 /** \class SkPDFScalar |
124 | 124 |
125 A real number object in a PDF. | 125 A real number object in a PDF. |
126 */ | 126 */ |
127 class SkPDFScalar : public SkPDFObject { | 127 class SkPDFScalar : public SkPDFObject { |
128 public: | 128 public: |
129 SK_DECLARE_INST_COUNT(SkPDFScalar) | 129 SK_DECLARE_INST_COUNT(SkPDFScalar) |
130 | 130 |
131 /** Create a PDF real number. | 131 /** Create a PDF real number. |
132 * @param value A real value. | 132 * @param value A real value. |
133 */ | 133 */ |
134 explicit SkPDFScalar(SkScalar value); | 134 explicit SkPDFScalar(SkScalar value); |
135 virtual ~SkPDFScalar(); | 135 virtual ~SkPDFScalar(); |
136 | 136 |
137 static void Append(SkScalar value, SkWStream* stream); | 137 static void Append(SkScalar value, SkWStream* stream); |
138 | 138 |
139 // The SkPDFObject interface. | 139 // The SkPDFObject interface. |
140 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRID
E; | 140 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) override; |
141 | 141 |
142 private: | 142 private: |
143 SkScalar fValue; | 143 SkScalar fValue; |
144 | 144 |
145 typedef SkPDFObject INHERITED; | 145 typedef SkPDFObject INHERITED; |
146 }; | 146 }; |
147 | 147 |
148 /** \class SkPDFString | 148 /** \class SkPDFString |
149 | 149 |
150 A string object in a PDF. | 150 A string object in a PDF. |
(...skipping 11 matching lines...) Expand all Loading... |
162 /** Create a PDF string. Maximum length (in bytes) is 65,535. | 162 /** Create a PDF string. Maximum length (in bytes) is 65,535. |
163 * @param value A string value. | 163 * @param value A string value. |
164 * @param len The length of value. | 164 * @param len The length of value. |
165 * @param wideChars Indicates if the top byte in value is significant and | 165 * @param wideChars Indicates if the top byte in value is significant and |
166 * should be encoded (true) or not (false). | 166 * should be encoded (true) or not (false). |
167 */ | 167 */ |
168 SkPDFString(const uint16_t* value, size_t len, bool wideChars); | 168 SkPDFString(const uint16_t* value, size_t len, bool wideChars); |
169 virtual ~SkPDFString(); | 169 virtual ~SkPDFString(); |
170 | 170 |
171 // The SkPDFObject interface. | 171 // The SkPDFObject interface. |
172 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRID
E; | 172 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) override; |
173 | 173 |
174 static SkString FormatString(const char* input, size_t len); | 174 static SkString FormatString(const char* input, size_t len); |
175 static SkString FormatString(const uint16_t* input, size_t len, | 175 static SkString FormatString(const uint16_t* input, size_t len, |
176 bool wideChars); | 176 bool wideChars); |
177 private: | 177 private: |
178 static const size_t kMaxLen = 65535; | 178 static const size_t kMaxLen = 65535; |
179 | 179 |
180 const SkString fValue; | 180 const SkString fValue; |
181 | 181 |
182 static SkString DoFormatString(const void* input, size_t len, | 182 static SkString DoFormatString(const void* input, size_t len, |
(...skipping 13 matching lines...) Expand all Loading... |
196 /** Create a PDF name object. Maximum length is 127 bytes. | 196 /** Create a PDF name object. Maximum length is 127 bytes. |
197 * @param value The name. | 197 * @param value The name. |
198 */ | 198 */ |
199 explicit SkPDFName(const char name[]); | 199 explicit SkPDFName(const char name[]); |
200 explicit SkPDFName(const SkString& name); | 200 explicit SkPDFName(const SkString& name); |
201 virtual ~SkPDFName(); | 201 virtual ~SkPDFName(); |
202 | 202 |
203 bool operator==(const SkPDFName& b) const; | 203 bool operator==(const SkPDFName& b) const; |
204 | 204 |
205 // The SkPDFObject interface. | 205 // The SkPDFObject interface. |
206 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRID
E; | 206 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) override; |
207 | 207 |
208 private: | 208 private: |
209 static const size_t kMaxLen = 127; | 209 static const size_t kMaxLen = 127; |
210 | 210 |
211 const SkString fValue; | 211 const SkString fValue; |
212 | 212 |
213 static SkString FormatName(const SkString& input); | 213 static SkString FormatName(const SkString& input); |
214 | 214 |
215 typedef SkPDFObject INHERITED; | 215 typedef SkPDFObject INHERITED; |
216 }; | 216 }; |
217 | 217 |
218 /** \class SkPDFArray | 218 /** \class SkPDFArray |
219 | 219 |
220 An array object in a PDF. | 220 An array object in a PDF. |
221 */ | 221 */ |
222 class SkPDFArray : public SkPDFObject { | 222 class SkPDFArray : public SkPDFObject { |
223 public: | 223 public: |
224 SK_DECLARE_INST_COUNT(SkPDFArray) | 224 SK_DECLARE_INST_COUNT(SkPDFArray) |
225 | 225 |
226 /** Create a PDF array. Maximum length is 8191. | 226 /** Create a PDF array. Maximum length is 8191. |
227 */ | 227 */ |
228 SkPDFArray(); | 228 SkPDFArray(); |
229 virtual ~SkPDFArray(); | 229 virtual ~SkPDFArray(); |
230 | 230 |
231 // The SkPDFObject interface. | 231 // The SkPDFObject interface. |
232 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRID
E; | 232 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) override; |
233 virtual void addResources(SkPDFCatalog*) const SK_OVERRIDE; | 233 virtual void addResources(SkPDFCatalog*) const override; |
234 | 234 |
235 /** The size of the array. | 235 /** The size of the array. |
236 */ | 236 */ |
237 int size() { return fValue.count(); } | 237 int size() { return fValue.count(); } |
238 | 238 |
239 /** Preallocate space for the given number of entries. | 239 /** Preallocate space for the given number of entries. |
240 * @param length The number of array slots to preallocate. | 240 * @param length The number of array slots to preallocate. |
241 */ | 241 */ |
242 void reserve(int length); | 242 void reserve(int length); |
243 | 243 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 SkPDFDict(); | 294 SkPDFDict(); |
295 | 295 |
296 /** Create a PDF dictionary with a Type entry. | 296 /** Create a PDF dictionary with a Type entry. |
297 * @param type The value of the Type entry. | 297 * @param type The value of the Type entry. |
298 */ | 298 */ |
299 explicit SkPDFDict(const char type[]); | 299 explicit SkPDFDict(const char type[]); |
300 | 300 |
301 virtual ~SkPDFDict(); | 301 virtual ~SkPDFDict(); |
302 | 302 |
303 // The SkPDFObject interface. | 303 // The SkPDFObject interface. |
304 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRID
E; | 304 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) override; |
305 virtual void addResources(SkPDFCatalog*) const SK_OVERRIDE; | 305 virtual void addResources(SkPDFCatalog*) const override; |
306 | 306 |
307 /** The size of the dictionary. | 307 /** The size of the dictionary. |
308 */ | 308 */ |
309 int size() const; | 309 int size() const; |
310 | 310 |
311 /** Add the value to the dictionary with the given key. Refs value. | 311 /** Add the value to the dictionary with the given key. Refs value. |
312 * @param key The key for this dictionary entry. | 312 * @param key The key for this dictionary entry. |
313 * @param value The value for this dictionary entry. | 313 * @param value The value for this dictionary entry. |
314 * @return The value argument is returned. | 314 * @return The value argument is returned. |
315 */ | 315 */ |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 static const int kMaxLen = 4095; | 381 static const int kMaxLen = 4095; |
382 | 382 |
383 SkTDArray<struct Rec> fValue; | 383 SkTDArray<struct Rec> fValue; |
384 | 384 |
385 SkPDFObject* append(SkPDFName* key, SkPDFObject* value); | 385 SkPDFObject* append(SkPDFName* key, SkPDFObject* value); |
386 | 386 |
387 typedef SkPDFObject INHERITED; | 387 typedef SkPDFObject INHERITED; |
388 }; | 388 }; |
389 | 389 |
390 #endif | 390 #endif |
OLD | NEW |