blob: fd242a109006b41a0e745b5c074e0e815b459399 [file] [log] [blame]
Adam Lesinski6f6ceb72014-11-14 14:48:12 -08001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef AAPT_RESOURCE_VALUES_H
18#define AAPT_RESOURCE_VALUES_H
19
Adam Lesinskice5e56e2016-10-21 17:56:45 -070020#include <array>
Adam Lesinskic744ae82017-05-17 19:28:38 -070021#include <limits>
Adam Lesinskice5e56e2016-10-21 17:56:45 -070022#include <ostream>
23#include <vector>
24
25#include "androidfw/ResourceTypes.h"
Adam Lesinskid5083f62017-01-16 15:07:21 -080026#include "androidfw/StringPiece.h"
Adam Lesinskice5e56e2016-10-21 17:56:45 -070027
Adam Lesinskia5870652015-11-20 15:32:30 -080028#include "Diagnostics.h"
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080029#include "Resource.h"
30#include "StringPool.h"
Adam Lesinski355f2852016-02-13 20:26:45 -080031#include "io/File.h"
Adam Lesinskia5870652015-11-20 15:32:30 -080032#include "util/Maybe.h"
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080033
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080034namespace aapt {
35
Adam Lesinskid3ffa8442017-09-28 13:34:35 -070036class ValueVisitor;
37class ConstValueVisitor;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080038
Adam Lesinski75421622017-01-06 15:20:04 -080039// A resource value. This is an all-encompassing representation
40// of Item and Map and their subclasses. The way to do
41// type specific operations is to check the Value's type() and
42// cast it to the appropriate subclass. This isn't super clean,
43// but it is the simplest strategy.
Adam Lesinski5924d8c2017-05-30 15:15:58 -070044class Value {
45 public:
Adam Lesinskicacb28f2016-10-19 12:18:14 -070046 virtual ~Value() = default;
Adam Lesinski1ab598f2015-08-14 14:26:04 -070047
Adam Lesinski75421622017-01-06 15:20:04 -080048 // Whether this value is weak and can be overridden without warning or error. Default is false.
Adam Lesinskid3ffa8442017-09-28 13:34:35 -070049 bool IsWeak() const {
50 return weak_;
51 }
Adam Lesinski393b5f02015-12-17 13:03:11 -080052
Adam Lesinskid3ffa8442017-09-28 13:34:35 -070053 void SetWeak(bool val) {
54 weak_ = val;
55 }
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080056
Adam Lesinskid3ffa8442017-09-28 13:34:35 -070057 // Whether the value is marked as translatable. This does not persist when flattened to binary.
Adam Lesinskicacb28f2016-10-19 12:18:14 -070058 // It is only used during compilation phase.
Adam Lesinskid3ffa8442017-09-28 13:34:35 -070059 void SetTranslatable(bool val) {
60 translatable_ = val;
61 }
Adam Lesinski458b8772016-04-25 14:20:21 -070062
Adam Lesinskicacb28f2016-10-19 12:18:14 -070063 // Default true.
Adam Lesinskid3ffa8442017-09-28 13:34:35 -070064 bool IsTranslatable() const {
65 return translatable_;
66 }
Adam Lesinski458b8772016-04-25 14:20:21 -070067
Adam Lesinski75421622017-01-06 15:20:04 -080068 // Returns the source where this value was defined.
Adam Lesinskid3ffa8442017-09-28 13:34:35 -070069 const Source& GetSource() const {
70 return source_;
71 }
Adam Lesinskie78fd612015-10-22 12:48:43 -070072
Adam Lesinskid3ffa8442017-09-28 13:34:35 -070073 void SetSource(const Source& source) {
74 source_ = source;
75 }
Adam Lesinskie78fd612015-10-22 12:48:43 -070076
Adam Lesinskid3ffa8442017-09-28 13:34:35 -070077 void SetSource(Source&& source) {
78 source_ = std::move(source);
79 }
Adam Lesinskie78fd612015-10-22 12:48:43 -070080
Adam Lesinski75421622017-01-06 15:20:04 -080081 // Returns the comment that was associated with this resource.
Adam Lesinskid3ffa8442017-09-28 13:34:35 -070082 const std::string& GetComment() const {
83 return comment_;
84 }
Adam Lesinskie78fd612015-10-22 12:48:43 -070085
Adam Lesinskid3ffa8442017-09-28 13:34:35 -070086 void SetComment(const android::StringPiece& str) {
87 comment_ = str.to_string();
88 }
Adam Lesinskie78fd612015-10-22 12:48:43 -070089
Adam Lesinskid3ffa8442017-09-28 13:34:35 -070090 void SetComment(std::string&& str) {
91 comment_ = std::move(str);
92 }
Adam Lesinskie78fd612015-10-22 12:48:43 -070093
Adam Lesinskice5e56e2016-10-21 17:56:45 -070094 virtual bool Equals(const Value* value) const = 0;
Adam Lesinski458b8772016-04-25 14:20:21 -070095
Adam Lesinski75421622017-01-06 15:20:04 -080096 // Calls the appropriate overload of ValueVisitor.
Adam Lesinskid3ffa8442017-09-28 13:34:35 -070097 virtual void Accept(ValueVisitor* visitor) = 0;
98
99 // Calls the appropriate overload of ConstValueVisitor.
100 virtual void Accept(ConstValueVisitor* visitor) const = 0;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800101
Adam Lesinski75421622017-01-06 15:20:04 -0800102 // Clone the value. `new_pool` is the new StringPool that
103 // any resources with strings should use when copying their string.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700104 virtual Value* Clone(StringPool* new_pool) const = 0;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800105
Adam Lesinski75421622017-01-06 15:20:04 -0800106 // Human readable printout of this value.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700107 virtual void Print(std::ostream* out) const = 0;
Adam Lesinskie78fd612015-10-22 12:48:43 -0700108
Adam Lesinski5924d8c2017-05-30 15:15:58 -0700109 friend std::ostream& operator<<(std::ostream& out, const Value& value);
110
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700111 protected:
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700112 Source source_;
113 std::string comment_;
114 bool weak_ = false;
Adam Lesinski75421622017-01-06 15:20:04 -0800115 bool translatable_ = true;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800116};
117
Adam Lesinski75421622017-01-06 15:20:04 -0800118// Inherit from this to get visitor accepting implementations for free.
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800119template <typename Derived>
120struct BaseValue : public Value {
Adam Lesinskid3ffa8442017-09-28 13:34:35 -0700121 void Accept(ValueVisitor* visitor) override;
122 void Accept(ConstValueVisitor* visitor) const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800123};
124
Adam Lesinski75421622017-01-06 15:20:04 -0800125// A resource item with a single value. This maps to android::ResTable_entry.
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800126struct Item : public Value {
Adam Lesinski75421622017-01-06 15:20:04 -0800127 // Clone the Item.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700128 virtual Item* Clone(StringPool* new_pool) const override = 0;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800129
Adam Lesinski75421622017-01-06 15:20:04 -0800130 // Fills in an android::Res_value structure with this Item's binary representation.
131 // Returns false if an error occurred.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700132 virtual bool Flatten(android::Res_value* out_value) const = 0;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800133};
134
Adam Lesinski75421622017-01-06 15:20:04 -0800135// Inherit from this to get visitor accepting implementations for free.
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800136template <typename Derived>
137struct BaseItem : public Item {
Adam Lesinskid3ffa8442017-09-28 13:34:35 -0700138 void Accept(ValueVisitor* visitor) override;
139 void Accept(ConstValueVisitor* visitor) const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800140};
141
Adam Lesinski75421622017-01-06 15:20:04 -0800142// A reference to another resource. This maps to android::Res_value::TYPE_REFERENCE.
143// A reference can be symbolic (with the name set to a valid resource name) or be
144// numeric (the id is set to a valid resource ID).
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800145struct Reference : public BaseItem<Reference> {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700146 enum class Type {
147 kResource,
148 kAttribute,
149 };
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800150
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700151 Maybe<ResourceName> name;
152 Maybe<ResourceId> id;
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700153 Reference::Type reference_type;
154 bool private_reference = false;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800155
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700156 Reference();
157 explicit Reference(const ResourceNameRef& n, Type type = Type::kResource);
158 explicit Reference(const ResourceId& i, Type type = Type::kResource);
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700159 Reference(const ResourceNameRef& n, const ResourceId& i);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800160
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700161 bool Equals(const Value* value) const override;
162 bool Flatten(android::Res_value* out_value) const override;
163 Reference* Clone(StringPool* new_pool) const override;
164 void Print(std::ostream* out) const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800165};
166
Adam Lesinski8197cc462016-08-19 12:16:49 -0700167bool operator<(const Reference&, const Reference&);
168bool operator==(const Reference&, const Reference&);
169
Adam Lesinski75421622017-01-06 15:20:04 -0800170// An ID resource. Has no real value, just a place holder.
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800171struct Id : public BaseItem<Id> {
Adam Lesinskid3ffa8442017-09-28 13:34:35 -0700172 Id() {
173 weak_ = true;
174 }
175
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700176 bool Equals(const Value* value) const override;
177 bool Flatten(android::Res_value* out) const override;
178 Id* Clone(StringPool* new_pool) const override;
179 void Print(std::ostream* out) const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800180};
181
Adam Lesinski75421622017-01-06 15:20:04 -0800182// A raw, unprocessed string. This may contain quotations, escape sequences, and whitespace.
183// This shall *NOT* end up in the final resource table.
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800184struct RawString : public BaseItem<RawString> {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700185 StringPool::Ref value;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800186
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700187 explicit RawString(const StringPool::Ref& ref);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800188
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700189 bool Equals(const Value* value) const override;
190 bool Flatten(android::Res_value* out_value) const override;
191 RawString* Clone(StringPool* new_pool) const override;
192 void Print(std::ostream* out) const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800193};
194
Adam Lesinski75421622017-01-06 15:20:04 -0800195// Identifies a range of characters in a string that are untranslatable.
196// These should not be pseudolocalized. The start and end indices are measured in bytes.
197struct UntranslatableSection {
198 // Start offset inclusive.
199 size_t start;
200
201 // End offset exclusive.
202 size_t end;
203};
204
205inline bool operator==(const UntranslatableSection& a, const UntranslatableSection& b) {
206 return a.start == b.start && a.end == b.end;
207}
208
209inline bool operator!=(const UntranslatableSection& a, const UntranslatableSection& b) {
210 return a.start != b.start || a.end != b.end;
211}
212
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800213struct String : public BaseItem<String> {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700214 StringPool::Ref value;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800215
Adam Lesinski75421622017-01-06 15:20:04 -0800216 // Sections of the string to NOT translate. Mainly used
217 // for pseudolocalization. This data is NOT persisted
218 // in any format.
219 std::vector<UntranslatableSection> untranslatable_sections;
220
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700221 explicit String(const StringPool::Ref& ref);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800222
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700223 bool Equals(const Value* value) const override;
224 bool Flatten(android::Res_value* out_value) const override;
225 String* Clone(StringPool* new_pool) const override;
226 void Print(std::ostream* out) const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800227};
228
229struct StyledString : public BaseItem<StyledString> {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700230 StringPool::StyleRef value;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800231
Adam Lesinski75421622017-01-06 15:20:04 -0800232 // Sections of the string to NOT translate. Mainly used
233 // for pseudolocalization. This data is NOT persisted
234 // in any format.
235 std::vector<UntranslatableSection> untranslatable_sections;
236
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700237 explicit StyledString(const StringPool::StyleRef& ref);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800238
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700239 bool Equals(const Value* value) const override;
240 bool Flatten(android::Res_value* out_value) const override;
241 StyledString* Clone(StringPool* new_pool) const override;
242 void Print(std::ostream* out) const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800243};
244
245struct FileReference : public BaseItem<FileReference> {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700246 StringPool::Ref path;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800247
Adam Lesinski75421622017-01-06 15:20:04 -0800248 // A handle to the file object from which this file can be read.
249 // This field is NOT persisted in any format. It is transient.
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700250 io::IFile* file = nullptr;
Adam Lesinski355f2852016-02-13 20:26:45 -0800251
Adam Lesinski00451162017-10-03 07:44:08 -0700252 // FileType of the file pointed to by `file`. This is used to know how to inflate the file,
253 // or if to inflate at all (just copy).
254 ResourceFile::Type type = ResourceFile::Type::kUnknown;
255
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700256 FileReference() = default;
257 explicit FileReference(const StringPool::Ref& path);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800258
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700259 bool Equals(const Value* value) const override;
260 bool Flatten(android::Res_value* out_value) const override;
261 FileReference* Clone(StringPool* new_pool) const override;
262 void Print(std::ostream* out) const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800263};
264
Adam Lesinski75421622017-01-06 15:20:04 -0800265// Represents any other android::Res_value.
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800266struct BinaryPrimitive : public BaseItem<BinaryPrimitive> {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700267 android::Res_value value;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800268
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700269 BinaryPrimitive() = default;
270 explicit BinaryPrimitive(const android::Res_value& val);
271 BinaryPrimitive(uint8_t dataType, uint32_t data);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800272
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700273 bool Equals(const Value* value) const override;
274 bool Flatten(android::Res_value* out_value) const override;
275 BinaryPrimitive* Clone(StringPool* new_pool) const override;
276 void Print(std::ostream* out) const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800277};
278
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800279struct Attribute : public BaseValue<Attribute> {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700280 struct Symbol {
281 Reference symbol;
282 uint32_t value;
Adam Lesinski5924d8c2017-05-30 15:15:58 -0700283
284 friend std::ostream& operator<<(std::ostream& out, const Symbol& symbol);
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700285 };
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800286
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700287 uint32_t type_mask;
288 int32_t min_int;
289 int32_t max_int;
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700290 std::vector<Symbol> symbols;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800291
Adam Lesinskic744ae82017-05-17 19:28:38 -0700292 Attribute();
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700293 explicit Attribute(bool w, uint32_t t = 0u);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800294
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700295 bool Equals(const Value* value) const override;
296 Attribute* Clone(StringPool* new_pool) const override;
297 void PrintMask(std::ostream* out) const;
298 void Print(std::ostream* out) const override;
Adam Lesinski3124e7c2017-06-13 16:03:55 -0700299 bool Matches(const Item& item, DiagMessage* out_msg = nullptr) const;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800300};
301
302struct Style : public BaseValue<Style> {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700303 struct Entry {
304 Reference key;
305 std::unique_ptr<Item> value;
Adam Lesinski5924d8c2017-05-30 15:15:58 -0700306
307 friend std::ostream& operator<<(std::ostream& out, const Entry& entry);
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700308 };
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800309
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700310 Maybe<Reference> parent;
Adam Lesinskibdaa0922015-05-08 20:16:23 -0700311
Adam Lesinski75421622017-01-06 15:20:04 -0800312 // If set to true, the parent was auto inferred from the style's name.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700313 bool parent_inferred = false;
Adam Lesinskibdaa0922015-05-08 20:16:23 -0700314
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700315 std::vector<Entry> entries;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800316
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700317 bool Equals(const Value* value) const override;
318 Style* Clone(StringPool* new_pool) const override;
319 void Print(std::ostream* out) const override;
Adam Lesinski5924d8c2017-05-30 15:15:58 -0700320
321 // Merges `style` into this Style. All identical attributes of `style` take precedence, including
322 // the parent, if there is one.
323 void MergeWith(Style* style, StringPool* pool);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800324};
325
326struct Array : public BaseValue<Array> {
Adam Lesinski4ffea042017-08-10 15:37:28 -0700327 std::vector<std::unique_ptr<Item>> elements;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800328
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700329 bool Equals(const Value* value) const override;
330 Array* Clone(StringPool* new_pool) const override;
331 void Print(std::ostream* out) const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800332};
333
334struct Plural : public BaseValue<Plural> {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700335 enum { Zero = 0, One, Two, Few, Many, Other, Count };
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800336
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700337 std::array<std::unique_ptr<Item>, Count> values;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800338
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700339 bool Equals(const Value* value) const override;
340 Plural* Clone(StringPool* new_pool) const override;
341 void Print(std::ostream* out) const override;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800342};
343
344struct Styleable : public BaseValue<Styleable> {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700345 std::vector<Reference> entries;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800346
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700347 bool Equals(const Value* value) const override;
348 Styleable* Clone(StringPool* newPool) const override;
349 void Print(std::ostream* out) const override;
350 void MergeWith(Styleable* styleable);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800351};
352
Adam Lesinski5924d8c2017-05-30 15:15:58 -0700353template <typename T>
354typename std::enable_if<std::is_base_of<Value, T>::value, std::ostream&>::type operator<<(
355 std::ostream& out, const std::unique_ptr<T>& value) {
356 if (value == nullptr) {
357 out << "NULL";
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700358 } else {
Adam Lesinski5924d8c2017-05-30 15:15:58 -0700359 value->Print(&out);
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700360 }
Adam Lesinski5924d8c2017-05-30 15:15:58 -0700361 return out;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800362}
363
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700364} // namespace aapt
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800365
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700366#endif // AAPT_RESOURCE_VALUES_H