1 /*
2  * Copyright (C) 2014 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 __OUTPUT_SET_H
18 #define __OUTPUT_SET_H
19 
20 #include <set>
21 #include <utils/Errors.h>
22 #include <utils/String8.h>
23 #include <utils/StrongPointer.h>
24 
25 class AaptFile;
26 
27 class OutputEntry {
28 public:
OutputEntry()29     OutputEntry() {}
OutputEntry(const android::String8 & path,const android::sp<const AaptFile> & file)30     OutputEntry(const android::String8& path, const android::sp<const AaptFile>& file)
31         : mPath(path), mFile(file) {}
32 
getFile()33     inline const android::sp<const AaptFile>& getFile() const {
34         return mFile;
35     }
36 
getPath()37     inline const android::String8& getPath() const {
38         return mPath;
39     }
40 
41     bool operator<(const OutputEntry& o) const { return getPath() < o.mPath; }
42     bool operator==(const OutputEntry& o) const { return getPath() == o.mPath; }
43 
44 private:
45     android::String8 mPath;
46     android::sp<const AaptFile> mFile;
47 };
48 
49 class OutputSet : public virtual android::RefBase {
50 public:
51     virtual const std::set<OutputEntry>& getEntries() const = 0;
52 
~OutputSet()53     virtual ~OutputSet() {}
54 };
55 
56 #endif // __OUTPUT_SET_H
57