2 * Copyright (C) 2014 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #include <utils/String8.h>
21 #include <utils/String16.h>
23 #include "ConfigDescription.h"
24 #include "SourcePos.h"
27 * A resource symbol, not attached to any configuration or context.
31 inline Symbol(const android::String16& p, const android::String16& t, const android::String16& n, uint32_t i);
32 inline android::String8 toString() const;
33 inline bool operator<(const Symbol& rhs) const;
35 android::String16 package;
36 android::String16 type;
37 android::String16 name;
43 * A specific defintion of a symbol, defined with a configuration and a definition site.
45 struct SymbolDefinition {
46 inline SymbolDefinition();
47 inline SymbolDefinition(const Symbol& s, const ConfigDescription& c, const SourcePos& src);
48 inline bool operator<(const SymbolDefinition& rhs) const;
51 ConfigDescription config;
62 Symbol::Symbol(const android::String16& p, const android::String16& t, const android::String16& n, uint32_t i)
69 android::String8 Symbol::toString() const {
70 return android::String8::format("%s:%s/%s (0x%08x)",
71 android::String8(package).string(),
72 android::String8(type).string(),
73 android::String8(name).string(),
77 bool Symbol::operator<(const Symbol& rhs) const {
78 return (package < rhs.package) || (type < rhs.type) || (name < rhs.name) || (id < rhs.id);
81 SymbolDefinition::SymbolDefinition() {
84 SymbolDefinition::SymbolDefinition(const Symbol& s, const ConfigDescription& c, const SourcePos& src)
90 bool SymbolDefinition::operator<(const SymbolDefinition& rhs) const {
91 return (symbol < rhs.symbol) || (config < rhs.config) || (source < rhs.source);
94 #endif // AAPT_SYMBOL_H