| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#ifndef H_ANDROID_SPLIT_RULE |
| 18 |
#define H_ANDROID_SPLIT_RULE |
| 19 |
|
| 20 |
#include "SplitDescription.h" |
| 21 |
|
| 22 |
#include <utils/RefBase.h> |
| 23 |
#include <utils/StrongPointer.h> |
| 24 |
#include <utils/String8.h> |
| 25 |
#include <utils/Vector.h> |
| 26 |
|
| 27 |
namespace split { |
| 28 |
|
| 29 |
struct Rule : public virtual android::RefBase { |
| 30 |
inline Rule(); |
| 31 |
Rule(const Rule& rhs); |
| 32 |
|
| 33 |
enum Operator { |
| 34 |
LESS_THAN = 1, |
| 35 |
GREATER_THAN, |
| 36 |
EQUALS, |
| 37 |
CONTAINS_ANY, |
| 38 |
CONTAINS_ALL, |
| 39 |
IS_TRUE, |
| 40 |
IS_FALSE, |
| 41 |
AND_SUBRULES, |
| 42 |
OR_SUBRULES, |
| 43 |
ALWAYS_TRUE, |
| 44 |
}; |
| 45 |
|
| 46 |
Operator op; |
| 47 |
|
| 48 |
enum Key { |
| 49 |
NONE = 0, |
| 50 |
SDK_VERSION, |
| 51 |
SCREEN_DENSITY, |
| 52 |
LANGUAGE, |
| 53 |
NATIVE_PLATFORM, |
| 54 |
TOUCH_SCREEN, |
| 55 |
SCREEN_SIZE, |
| 56 |
SCREEN_LAYOUT, |
| 57 |
}; |
| 58 |
|
| 59 |
Key key; |
| 60 |
bool negate; |
| 61 |
|
| 62 |
android::Vector<android::String8> stringArgs; |
| 63 |
android::Vector<int> longArgs; |
| 64 |
android::Vector<double> doubleArgs; |
| 65 |
android::Vector<android::sp<Rule> > subrules; |
| 66 |
|
| 67 |
android::String8 toJson(int indent=0) const; |
| 68 |
|
| 69 |
static android::sp<Rule> simplify(android::sp<Rule> rule); |
| 70 |
}; |
| 71 |
|
| 72 |
Rule::Rule() |
| 73 |
: op(ALWAYS_TRUE) |
| 74 |
, key(NONE) |
| 75 |
, negate(false) {} |
| 76 |
|
| 77 |
} |
| 78 |
|
| 79 |
#endif |