]> git.saurik.com Git - android/aapt.git/blame - Bundle.h
Argh fix another build breakage!
[android/aapt.git] / Bundle.h
CommitLineData
a534180c
TAOSP
1//
2// Copyright 2006 The Android Open Source Project
3//
4// State bundle. Used to pass around stuff like command-line args.
5//
6#ifndef __BUNDLE_H
7#define __BUNDLE_H
8
9#include <stdlib.h>
10#include <utils.h> // android
11#include <utils/String8.h>
12#include <utils/Vector.h>
13
14/*
15 * Things we can do.
16 */
17typedef enum Command {
18 kCommandUnknown = 0,
19 kCommandVersion,
20 kCommandList,
21 kCommandDump,
22 kCommandAdd,
23 kCommandRemove,
24 kCommandPackage,
25} Command;
26
27/*
28 * Bundle of goodies, including everything specified on the command line.
29 */
30class Bundle {
31public:
32 Bundle(void)
33 : mCmd(kCommandUnknown), mVerbose(false), mAndroidList(false),
34 mForce(false), mGrayscaleTolerance(0), mMakePackageDirs(false),
35 mUpdate(false), mExtending(false),
36 mRequireLocalization(false), mPseudolocalize(false),
37 mCompressionMethod(0), mOutputAPKFile(NULL),
38 mAssetSourceDir(NULL),
39 mAndroidManifestFile(NULL), mPublicOutputFile(NULL),
40 mRClassDir(NULL), mResourceIntermediatesDir(NULL),
53288885
DH
41 mMinSdkVersion(NULL), mTargetSdkVersion(NULL), mMaxSdkVersion(NULL),
42 mVersionCode(NULL), mVersionName(NULL),
a534180c
TAOSP
43 mArgc(0), mArgv(NULL)
44 {}
45 ~Bundle(void) {}
46
47 /*
48 * Set the command value. Returns "false" if it was previously set.
49 */
50 Command getCommand(void) const { return mCmd; }
51 void setCommand(Command cmd) { mCmd = cmd; }
52
53 /*
54 * Command modifiers. Not all modifiers are appropriate for all
55 * commands.
56 */
57 bool getVerbose(void) const { return mVerbose; }
58 void setVerbose(bool val) { mVerbose = val; }
59 bool getAndroidList(void) const { return mAndroidList; }
60 void setAndroidList(bool val) { mAndroidList = val; }
61 bool getForce(void) const { return mForce; }
62 void setForce(bool val) { mForce = val; }
63 void setGrayscaleTolerance(int val) { mGrayscaleTolerance = val; }
64 int getGrayscaleTolerance() { return mGrayscaleTolerance; }
65 bool getMakePackageDirs(void) const { return mMakePackageDirs; }
66 void setMakePackageDirs(bool val) { mMakePackageDirs = val; }
67 bool getUpdate(void) const { return mUpdate; }
68 void setUpdate(bool val) { mUpdate = val; }
69 bool getExtending(void) const { return mExtending; }
70 void setExtending(bool val) { mExtending = val; }
71 bool getRequireLocalization(void) const { return mRequireLocalization; }
72 void setRequireLocalization(bool val) { mRequireLocalization = val; }
73 bool getPseudolocalize(void) const { return mPseudolocalize; }
74 void setPseudolocalize(bool val) { mPseudolocalize = val; }
75 int getCompressionMethod(void) const { return mCompressionMethod; }
76 void setCompressionMethod(int val) { mCompressionMethod = val; }
77 const char* getOutputAPKFile() const { return mOutputAPKFile; }
78 void setOutputAPKFile(const char* val) { mOutputAPKFile = val; }
79
80 /*
81 * Input options.
82 */
83 const char* getAssetSourceDir() const { return mAssetSourceDir; }
84 void setAssetSourceDir(const char* dir) { mAssetSourceDir = dir; }
85 const android::Vector<const char*>& getResourceSourceDirs() const { return mResourceSourceDirs; }
86 void addResourceSourceDir(const char* dir) { mResourceSourceDirs.insertAt(dir,0); }
87 const char* getAndroidManifestFile() const { return mAndroidManifestFile; }
88 void setAndroidManifestFile(const char* file) { mAndroidManifestFile = file; }
89 const char* getPublicOutputFile() const { return mPublicOutputFile; }
90 void setPublicOutputFile(const char* file) { mPublicOutputFile = file; }
91 const char* getRClassDir() const { return mRClassDir; }
92 void setRClassDir(const char* dir) { mRClassDir = dir; }
93 const char* getConfigurations() const { return mConfigurations.size() > 0 ? mConfigurations.string() : NULL; }
94 void addConfigurations(const char* val) { if (mConfigurations.size() > 0) { mConfigurations.append(","); mConfigurations.append(val); } else { mConfigurations = val; } }
95 const char* getResourceIntermediatesDir() const { return mResourceIntermediatesDir; }
96 void setResourceIntermediatesDir(const char* dir) { mResourceIntermediatesDir = dir; }
97 const android::Vector<const char*>& getPackageIncludes() const { return mPackageIncludes; }
98 void addPackageInclude(const char* file) { mPackageIncludes.add(file); }
99 const android::Vector<const char*>& getJarFiles() const { return mJarFiles; }
100 void addJarFile(const char* file) { mJarFiles.add(file); }
101 const android::Vector<const char*>& getNoCompressExtensions() const { return mNoCompressExtensions; }
102 void addNoCompressExtension(const char* ext) { mNoCompressExtensions.add(ext); }
103
7e486e33
DH
104 const char* getMinSdkVersion() const { return mMinSdkVersion; }
105 void setMinSdkVersion(const char* val) { mMinSdkVersion = val; }
106 const char* getTargetSdkVersion() const { return mTargetSdkVersion; }
107 void setTargetSdkVersion(const char* val) { mTargetSdkVersion = val; }
108 const char* getMaxSdkVersion() const { return mMaxSdkVersion; }
109 void setMaxSdkVersion(const char* val) { mMaxSdkVersion = val; }
110 const char* getVersionCode() const { return mVersionCode; }
111 void setVersionCode(const char* val) { mVersionCode = val; }
112 const char* getVersionName() const { return mVersionName; }
113 void setVersionName(const char* val) { mVersionName = val; }
114
a534180c
TAOSP
115 /*
116 * Set and get the file specification.
117 *
118 * Note this does NOT make a copy of argv.
119 */
120 void setFileSpec(char* const argv[], int argc) {
121 mArgc = argc;
122 mArgv = argv;
123 }
124 int getFileSpecCount(void) const { return mArgc; }
125 const char* getFileSpecEntry(int idx) const { return mArgv[idx]; }
126 void eatArgs(int n) {
127 if (n > mArgc) n = mArgc;
128 mArgv += n;
129 mArgc -= n;
130 }
131
132#if 0
133 /*
134 * Package count. Nothing to do with anything else here; this is
135 * just a convenient place to stuff it so we don't have to pass it
136 * around everywhere.
137 */
138 int getPackageCount(void) const { return mPackageCount; }
139 void setPackageCount(int val) { mPackageCount = val; }
140#endif
141
142private:
143 /* commands & modifiers */
144 Command mCmd;
145 bool mVerbose;
146 bool mAndroidList;
147 bool mForce;
148 int mGrayscaleTolerance;
149 bool mMakePackageDirs;
150 bool mUpdate;
151 bool mExtending;
152 bool mRequireLocalization;
153 bool mPseudolocalize;
154 int mCompressionMethod;
155 const char* mOutputAPKFile;
156 const char* mAssetSourceDir;
157 const char* mAndroidManifestFile;
158 const char* mPublicOutputFile;
159 const char* mRClassDir;
160 const char* mResourceIntermediatesDir;
161 android::String8 mConfigurations;
162 android::Vector<const char*> mPackageIncludes;
163 android::Vector<const char*> mJarFiles;
164 android::Vector<const char*> mNoCompressExtensions;
165 android::Vector<const char*> mResourceSourceDirs;
166
7e486e33
DH
167 const char* mMinSdkVersion;
168 const char* mTargetSdkVersion;
169 const char* mMaxSdkVersion;
170 const char* mVersionCode;
171 const char* mVersionName;
172
a534180c
TAOSP
173 /* file specification */
174 int mArgc;
175 char* const* mArgv;
176
177#if 0
178 /* misc stuff */
179 int mPackageCount;
180#endif
181};
182
183#endif // __BUNDLE_H