19066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#include "Type.h"
29066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
39066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectNamespace NAMES;
49066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
59066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* VOID_TYPE;
69066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* BOOLEAN_TYPE;
79066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* BYTE_TYPE;
89066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* CHAR_TYPE;
99066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* INT_TYPE;
109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* LONG_TYPE;
119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* FLOAT_TYPE;
129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* DOUBLE_TYPE;
139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* STRING_TYPE;
14fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe OnoratoType* OBJECT_TYPE;
159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* CHAR_SEQUENCE_TYPE;
169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* TEXT_UTILS_TYPE;
179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* REMOTE_EXCEPTION_TYPE;
189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* RUNTIME_EXCEPTION_TYPE;
199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* IBINDER_TYPE;
209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* IINTERFACE_TYPE;
219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* BINDER_NATIVE_TYPE;
229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* BINDER_PROXY_TYPE;
239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* PARCEL_TYPE;
249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* PARCELABLE_INTERFACE_TYPE;
25fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe OnoratoType* CONTEXT_TYPE;
269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* MAP_TYPE;
279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* LIST_TYPE;
289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType* CLASSLOADER_TYPE;
29fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe OnoratoType* RPC_DATA_TYPE;
30fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe OnoratoType* RPC_ERROR_TYPE;
31e24dbeafe64278408b3342fcb77756bc7d091791Joe OnoratoType* EVENT_FAKE_TYPE;
329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectExpression* NULL_VALUE;
349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectExpression* THIS_VALUE;
359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectExpression* SUPER_VALUE;
369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectExpression* TRUE_VALUE;
379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectExpression* FALSE_VALUE;
389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectregister_base_types()
419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
4205ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    VOID_TYPE = new BasicType("void",
4305ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato            "XXX", "XXX", "XXX", "XXX", "XXX",
4405ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato            "XXX", "XXX", "XXX", "XXX", "XXX");
459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(VOID_TYPE);
469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    BOOLEAN_TYPE = new BooleanType();
489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(BOOLEAN_TYPE);
499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5005ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    BYTE_TYPE = new BasicType("byte",
5105ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato            "writeByte", "readByte", "writeByteArray", "createByteArray", "readByteArray",
5205ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato            "putByte", "getByte", "putByteArray", "createByteArray", "getByteArray");
539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(BYTE_TYPE);
549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    CHAR_TYPE = new CharType();
569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(CHAR_TYPE);
579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5805ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    INT_TYPE = new BasicType("int",
5905ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato            "writeInt", "readInt", "writeIntArray", "createIntArray", "readIntArray",
6005ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato            "putInteger", "getInteger", "putIntegerArray", "createIntegerArray", "getIntegerArray");
619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(INT_TYPE);
629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6305ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    LONG_TYPE = new BasicType("long",
6405ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato            "writeLong", "readLong", "writeLongArray", "createLongArray", "readLongArray",
6505ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato            "putLong", "getLong", "putLongArray", "createLongArray", "getLongArray");
669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(LONG_TYPE);
679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6805ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    FLOAT_TYPE = new BasicType("float",
6905ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato            "writeFloat", "readFloat", "writeFloatArray", "createFloatArray", "readFloatArray",
7005ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato            "putFloat", "getFloat", "putFloatArray", "createFloatArray", "getFloatArray");
719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(FLOAT_TYPE);
729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7305ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    DOUBLE_TYPE = new BasicType("double",
7405ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato            "writeDouble", "readDouble", "writeDoubleArray", "createDoubleArray", "readDoubleArray",
7505ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato            "putDouble", "getDouble", "putDoubleArray", "createDoubleArray", "getDoubleArray");
769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(DOUBLE_TYPE);
779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    STRING_TYPE = new StringType();
799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(STRING_TYPE);
809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
817db766c3fec2795b08d237f29b972f474983684bJoe Onorato    OBJECT_TYPE = new Type("java.lang", "Object", Type::BUILT_IN, false, false, false);
82fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato    NAMES.Add(OBJECT_TYPE);
83fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato
849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    CHAR_SEQUENCE_TYPE = new CharSequenceType();
859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(CHAR_SEQUENCE_TYPE);
869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    MAP_TYPE = new MapType();
889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(MAP_TYPE);
899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    LIST_TYPE = new ListType();
919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(LIST_TYPE);
929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
937db766c3fec2795b08d237f29b972f474983684bJoe Onorato    TEXT_UTILS_TYPE = new Type("android.text", "TextUtils", Type::BUILT_IN, false, false, false);
949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(TEXT_UTILS_TYPE);
959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    REMOTE_EXCEPTION_TYPE = new RemoteExceptionType();
979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(REMOTE_EXCEPTION_TYPE);
989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    RUNTIME_EXCEPTION_TYPE = new RuntimeExceptionType();
1009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(RUNTIME_EXCEPTION_TYPE);
1019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    IBINDER_TYPE = new IBinderType();
1039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(IBINDER_TYPE);
1049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    IINTERFACE_TYPE = new IInterfaceType();
1069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(IINTERFACE_TYPE);
1079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    BINDER_NATIVE_TYPE = new BinderType();
1099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(BINDER_NATIVE_TYPE);
1109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    BINDER_PROXY_TYPE = new BinderProxyType();
1129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(BINDER_PROXY_TYPE);
1139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    PARCEL_TYPE = new ParcelType();
1159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(PARCEL_TYPE);
1169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    PARCELABLE_INTERFACE_TYPE = new ParcelableInterfaceType();
1189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(PARCELABLE_INTERFACE_TYPE);
1199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1207db766c3fec2795b08d237f29b972f474983684bJoe Onorato    CONTEXT_TYPE = new Type("android.content", "Context", Type::BUILT_IN, false, false, false);
121fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato    NAMES.Add(CONTEXT_TYPE);
122fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato
1231eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato    RPC_DATA_TYPE = new RpcDataType();
124fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato    NAMES.Add(RPC_DATA_TYPE);
125fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato
12617a452f00c188173f48d0d490d98750cbb4529caMike Lockwood    RPC_ERROR_TYPE = new UserDataType("android.support.place.rpc", "RpcError",
127fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato                                    true, __FILE__, __LINE__);
128fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato    NAMES.Add(RPC_ERROR_TYPE);
129fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato
130e24dbeafe64278408b3342fcb77756bc7d091791Joe Onorato    EVENT_FAKE_TYPE = new Type("event", Type::BUILT_IN, false, false, false);
131e24dbeafe64278408b3342fcb77756bc7d091791Joe Onorato    NAMES.Add(EVENT_FAKE_TYPE);
132fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato
1339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    CLASSLOADER_TYPE = new ClassLoaderType();
1349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.Add(CLASSLOADER_TYPE);
1359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NULL_VALUE = new LiteralExpression("null");
1379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    THIS_VALUE = new LiteralExpression("this");
1389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    SUPER_VALUE = new LiteralExpression("super");
1399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    TRUE_VALUE = new LiteralExpression("true");
1409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    FALSE_VALUE = new LiteralExpression("false");
1419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.AddGenericType("java.util", "List", 1);
1439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    NAMES.AddGenericType("java.util", "Map", 2);
1449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
1459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic Type*
1479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectmake_generic_type(const string& package, const string& name,
1489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                    const vector<Type*>& args)
1499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
1509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (package == "java.util" && name == "List") {
1519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        return new GenericListType("java.util", "List", args);
1529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
1539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return NULL;
1549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    //return new GenericType(package, name, args);
1559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
1569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
1589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1597db766c3fec2795b08d237f29b972f474983684bJoe OnoratoType::Type(const string& name, int kind, bool canWriteToParcel, bool canWriteToRpcData,
1607db766c3fec2795b08d237f29b972f474983684bJoe Onorato        bool canBeOut)
1619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    :m_package(),
1629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     m_name(name),
1639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     m_declFile(""),
1649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     m_declLine(-1),
1659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     m_kind(kind),
1669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     m_canWriteToParcel(canWriteToParcel),
1677db766c3fec2795b08d237f29b972f474983684bJoe Onorato     m_canWriteToRpcData(canWriteToRpcData),
1689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     m_canBeOut(canBeOut)
1699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
1709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    m_qualifiedName = name;
1719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
1729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType::Type(const string& package, const string& name,
1747db766c3fec2795b08d237f29b972f474983684bJoe Onorato            int kind, bool canWriteToParcel, bool canWriteToRpcData,
1757db766c3fec2795b08d237f29b972f474983684bJoe Onorato            bool canBeOut, const string& declFile, int declLine)
1769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    :m_package(package),
1779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     m_name(name),
1789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     m_declFile(declFile),
1799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     m_declLine(declLine),
1809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     m_kind(kind),
1819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     m_canWriteToParcel(canWriteToParcel),
1827db766c3fec2795b08d237f29b972f474983684bJoe Onorato     m_canWriteToRpcData(canWriteToRpcData),
1839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     m_canBeOut(canBeOut)
1849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
1859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (package.length() > 0) {
1869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        m_qualifiedName = package;
1879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        m_qualifiedName += '.';
1889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
1899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    m_qualifiedName += name;
1909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
1919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType::~Type()
1939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
1949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
1959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectbool
1979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType::CanBeArray() const
1989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
1999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return false;
2009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
2019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstring
2039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType::ImportType() const
2049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
2059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return m_qualifiedName;
2069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
2079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstring
2099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType::CreatorName() const
2109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
2119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return "";
2129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
2139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstring
21579824179b8ceb77d4ddb392a7c104e873d61ccc8Joe OnoratoType::RpcCreatorName() const
21679824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato{
21779824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato    return "";
21879824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato}
21979824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato
22079824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onoratostring
2219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType::InstantiableName() const
2229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
2239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return QualifiedName();
2249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
2259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
2289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
2299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
2309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d qualifiedName=%sn",
2319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            __FILE__, __LINE__, m_qualifiedName.c_str());
2329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new LiteralExpression("/* WriteToParcel error "
2339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                + m_qualifiedName + " */"));
2349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
2359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
237b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
2389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
2399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d qualifiedName=%s\n",
2409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            __FILE__, __LINE__, m_qualifiedName.c_str());
2419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new LiteralExpression("/* CreateFromParcel error "
2429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                + m_qualifiedName + " */"));
2439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
2449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
246b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesType::ReadFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
2479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
2489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d qualifiedName=%s\n",
2499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            __FILE__, __LINE__, m_qualifiedName.c_str());
2509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new LiteralExpression("/* ReadFromParcel error "
2519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                + m_qualifiedName + " */"));
2529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
2539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
2559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType::WriteArrayToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
2569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
2579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d qualifiedName=%s\n",
2589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            __FILE__, __LINE__, m_qualifiedName.c_str());
2599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new LiteralExpression("/* WriteArrayToParcel error "
2609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                + m_qualifiedName + " */"));
2619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
2629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
2649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType::CreateArrayFromParcel(StatementBlock* addTo, Variable* v,
265b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                            Variable* parcel, Variable**)
2669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
2679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d qualifiedName=%s\n",
2689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            __FILE__, __LINE__, m_qualifiedName.c_str());
2699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new LiteralExpression("/* CreateArrayFromParcel error "
2709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                + m_qualifiedName + " */"));
2719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
2729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
274b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesType::ReadArrayFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
2759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
2769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d qualifiedName=%s\n",
2779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            __FILE__, __LINE__, m_qualifiedName.c_str());
2789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new LiteralExpression("/* ReadArrayFromParcel error "
2799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                + m_qualifiedName + " */"));
2809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
2819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
283fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe OnoratoType::WriteToRpcData(StatementBlock* addTo, Expression* k, Variable* v,
284fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato        Variable* data, int flags)
285fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato{
28605ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    fprintf(stderr, "aidl:internal error %s:%d qualifiedName=%s\n",
287fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato            __FILE__, __LINE__, m_qualifiedName.c_str());
288fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato    addTo->Add(new LiteralExpression("/* WriteToRpcData error "
289fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato                + m_qualifiedName + " */"));
290fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato}
291fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato
292fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onoratovoid
293fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe OnoratoType::CreateFromRpcData(StatementBlock* addTo, Expression* k, Variable* v, Variable* data,
294fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato        Variable** cl)
295fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato{
29605ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    fprintf(stderr, "aidl:internal error %s:%d qualifiedName=%s\n",
297fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato            __FILE__, __LINE__, m_qualifiedName.c_str());
298fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato    addTo->Add(new LiteralExpression("/* ReadFromRpcData error "
299fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato                + m_qualifiedName + " */"));
300fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato}
301fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato
302fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onoratovoid
3039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType::SetQualifiedName(const string& qualified)
3049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
3059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    m_qualifiedName = qualified;
3069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectExpression*
3099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectType::BuildWriteToParcelFlags(int flags)
3109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
3119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (flags == 0) {
3129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        return new LiteralExpression("0");
3139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
3149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if ((flags&PARCELABLE_WRITE_RETURN_VALUE) != 0) {
3159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        return new FieldVariable(PARCELABLE_INTERFACE_TYPE,
3169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                "PARCELABLE_WRITE_RETURN_VALUE");
3179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
3189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return new LiteralExpression("0");
3199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
3229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
32305ffbe7c020c59ee4fa7e13e04641c954d591951Joe OnoratoBasicType::BasicType(const string& name, const string& marshallParcel,
32405ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato          const string& unmarshallParcel, const string& writeArrayParcel,
32505ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato          const string& createArrayParcel, const string& readArrayParcel,
32605ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato          const string& marshallRpc, const string& unmarshallRpc,
32705ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato          const string& writeArrayRpc, const string& createArrayRpc, const string& readArrayRpc)
3287db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type(name, BUILT_IN, true, true, false),
32905ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato     m_marshallParcel(marshallParcel),
33005ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato     m_unmarshallParcel(unmarshallParcel),
33105ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato     m_writeArrayParcel(writeArrayParcel),
33205ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato     m_createArrayParcel(createArrayParcel),
33305ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato     m_readArrayParcel(readArrayParcel),
33405ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato     m_marshallRpc(marshallRpc),
33505ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato     m_unmarshallRpc(unmarshallRpc),
33605ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato     m_writeArrayRpc(writeArrayRpc),
33705ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato     m_createArrayRpc(createArrayRpc),
33805ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato     m_readArrayRpc(readArrayRpc)
3399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
3409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
3439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectBasicType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
3449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
34505ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    addTo->Add(new MethodCall(parcel, m_marshallParcel, 1, v));
3469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
349b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesBasicType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
3509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
35105ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    addTo->Add(new Assignment(v, new MethodCall(parcel, m_unmarshallParcel)));
3529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectbool
3559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectBasicType::CanBeArray() const
3569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
3579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return true;
3589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
3619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectBasicType::WriteArrayToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
3629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
36305ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    addTo->Add(new MethodCall(parcel, m_writeArrayParcel, 1, v));
3649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
3679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectBasicType::CreateArrayFromParcel(StatementBlock* addTo, Variable* v,
368b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                            Variable* parcel, Variable**)
3699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
37005ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    addTo->Add(new Assignment(v, new MethodCall(parcel, m_createArrayParcel)));
3719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
374b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesBasicType::ReadArrayFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
3759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
37605ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    addTo->Add(new MethodCall(parcel, m_readArrayParcel, 1, v));
37705ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato}
37805ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato
37905ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onoratovoid
38005ffbe7c020c59ee4fa7e13e04641c954d591951Joe OnoratoBasicType::WriteToRpcData(StatementBlock* addTo, Expression* k, Variable* v,
38105ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato        Variable* data, int flags)
38205ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato{
38305ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    addTo->Add(new MethodCall(data, m_marshallRpc, 2, k, v));
3849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
38605ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onoratovoid
38705ffbe7c020c59ee4fa7e13e04641c954d591951Joe OnoratoBasicType::CreateFromRpcData(StatementBlock* addTo, Expression* k, Variable* v, Variable* data,
38805ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato        Variable** cl)
38905ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato{
39005ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    addTo->Add(new Assignment(v, new MethodCall(data, m_unmarshallRpc, 1, k)));
39105ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato}
3929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
3949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectBooleanType::BooleanType()
3967db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type("boolean", BUILT_IN, true, true, false)
3979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
3989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
3999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
4019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectBooleanType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
4029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
4039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "writeInt", 1,
4049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                new Ternary(v, new LiteralExpression("1"),
4059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                    new LiteralExpression("0"))));
4069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
409b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesBooleanType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
4109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
4119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new Assignment(v, new Comparison(new LiteralExpression("0"),
4129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                    "!=", new MethodCall(parcel, "readInt"))));
4139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectbool
4169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectBooleanType::CanBeArray() const
4179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
4189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return true;
4199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
4229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectBooleanType::WriteArrayToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
4239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
4249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "writeBooleanArray", 1, v));
4259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
4289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectBooleanType::CreateArrayFromParcel(StatementBlock* addTo, Variable* v,
429b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                            Variable* parcel, Variable**)
4309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
4319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new Assignment(v, new MethodCall(parcel, "createBooleanArray")));
4329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
435b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesBooleanType::ReadArrayFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
4369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
4379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "readBooleanArray", 1, v));
4389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
44005ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onoratovoid
44105ffbe7c020c59ee4fa7e13e04641c954d591951Joe OnoratoBooleanType::WriteToRpcData(StatementBlock* addTo, Expression* k, Variable* v,
44205ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato        Variable* data, int flags)
44305ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato{
44405ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    addTo->Add(new MethodCall(data, "putBoolean", 2, k, v));
44505ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato}
44605ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato
44705ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onoratovoid
44805ffbe7c020c59ee4fa7e13e04641c954d591951Joe OnoratoBooleanType::CreateFromRpcData(StatementBlock* addTo, Expression* k, Variable* v, Variable* data,
44905ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato        Variable** cl)
45005ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato{
45105ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    addTo->Add(new Assignment(v, new MethodCall(data, "getBoolean", 1, k)));
45205ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato}
4539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
4559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectCharType::CharType()
4577db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type("char", BUILT_IN, true, true, false)
4589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
4599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
4629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectCharType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
4639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
4649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "writeInt", 1,
4659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                    new Cast(INT_TYPE, v)));
4669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
469b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesCharType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
4709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
4719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new Assignment(v, new MethodCall(parcel, "readInt"), this));
4729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectbool
4759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectCharType::CanBeArray() const
4769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
4779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return true;
4789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
4819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectCharType::WriteArrayToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
4829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
4839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "writeCharArray", 1, v));
4849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
4879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectCharType::CreateArrayFromParcel(StatementBlock* addTo, Variable* v,
488b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                            Variable* parcel, Variable**)
4899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
4909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new Assignment(v, new MethodCall(parcel, "createCharArray")));
4919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
494b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesCharType::ReadArrayFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
4959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
4969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "readCharArray", 1, v));
4979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
4989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
49905ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onoratovoid
50005ffbe7c020c59ee4fa7e13e04641c954d591951Joe OnoratoCharType::WriteToRpcData(StatementBlock* addTo, Expression* k, Variable* v,
50105ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato        Variable* data, int flags)
50205ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato{
50305ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    addTo->Add(new MethodCall(data, "putChar", 2, k, v));
50405ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato}
50505ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato
50605ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onoratovoid
50705ffbe7c020c59ee4fa7e13e04641c954d591951Joe OnoratoCharType::CreateFromRpcData(StatementBlock* addTo, Expression* k, Variable* v, Variable* data,
50805ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato        Variable** cl)
50905ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato{
51005ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    addTo->Add(new Assignment(v, new MethodCall(data, "getChar", 1, k)));
51105ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato}
51205ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato
5139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
5149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectStringType::StringType()
5167db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type("java.lang", "String", BUILT_IN, true, true, false)
5179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
5189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
5199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstring
5219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectStringType::CreatorName() const
5229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
5239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return "android.os.Parcel.STRING_CREATOR";
5249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
5259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
5279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectStringType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
5289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
5299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "writeString", 1, v));
5309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
5319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
533b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesStringType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
5349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
5359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new Assignment(v, new MethodCall(parcel, "readString")));
5369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
5379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectbool
5399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectStringType::CanBeArray() const
5409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
5419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return true;
5429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
5439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
5459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectStringType::WriteArrayToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
5469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
5479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "writeStringArray", 1, v));
5489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
5499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
5519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectStringType::CreateArrayFromParcel(StatementBlock* addTo, Variable* v,
552b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                            Variable* parcel, Variable**)
5539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
5549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new Assignment(v, new MethodCall(parcel, "createStringArray")));
5559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
5569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
558b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesStringType::ReadArrayFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
5599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
5609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "readStringArray", 1, v));
5619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
5629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
563fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onoratovoid
564fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe OnoratoStringType::WriteToRpcData(StatementBlock* addTo, Expression* k, Variable* v,
565fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato        Variable* data, int flags)
566fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato{
567fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato    addTo->Add(new MethodCall(data, "putString", 2, k, v));
568fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato}
569fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato
570fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onoratovoid
571fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe OnoratoStringType::CreateFromRpcData(StatementBlock* addTo, Expression* k, Variable* v,
572fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato        Variable* data, Variable**)
573fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato{
574fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato    addTo->Add(new Assignment(v, new MethodCall(data, "getString", 1, k)));
575fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato}
576fdfe2ff8c60c367a4eb7cecb4cbe1d62b41a8c20Joe Onorato
5779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
5789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectCharSequenceType::CharSequenceType()
5807db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type("java.lang", "CharSequence", BUILT_IN, true, true, false)
5819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
5829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
5839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstring
5859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectCharSequenceType::CreatorName() const
5869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
5879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return "android.os.Parcel.STRING_CREATOR";
5889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
5899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
5919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectCharSequenceType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
5929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
5939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // if (v != null) {
5949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    //     parcel.writeInt(1);
5959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    //     v.writeToParcel(parcel);
5969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // } else {
5979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    //     parcel.writeInt(0);
5989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // }
5999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    IfStatement* elsepart = new IfStatement();
6009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    elsepart->statements->Add(new MethodCall(parcel, "writeInt", 1,
6019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                                new LiteralExpression("0")));
6029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    IfStatement* ifpart = new IfStatement;
6039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->expression = new Comparison(v, "!=", NULL_VALUE);
6049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->elseif = elsepart;
6059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->statements->Add(new MethodCall(parcel, "writeInt", 1,
6069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                                new LiteralExpression("1")));
6079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->statements->Add(new MethodCall(TEXT_UTILS_TYPE, "writeToParcel",
6089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                                3, v, parcel, BuildWriteToParcelFlags(flags)));
6099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(ifpart);
6119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
6149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectCharSequenceType::CreateFromParcel(StatementBlock* addTo, Variable* v,
615b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                                Variable* parcel, Variable**)
6169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
6179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // if (0 != parcel.readInt()) {
6189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    //     v = TextUtils.createFromParcel(parcel)
6199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // } else {
6209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    //     v = null;
6219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // }
6229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    IfStatement* elsepart = new IfStatement();
6239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    elsepart->statements->Add(new Assignment(v, NULL_VALUE));
6249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    IfStatement* ifpart = new IfStatement();
6269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->expression = new Comparison(new LiteralExpression("0"), "!=",
6279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                new MethodCall(parcel, "readInt"));
6289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->elseif = elsepart;
6299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->statements->Add(new Assignment(v,
6309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                new MethodCall(TEXT_UTILS_TYPE,
6319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                                    "CHAR_SEQUENCE_CREATOR.createFromParcel", 1, parcel)));
6329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(ifpart);
6349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
6389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectRemoteExceptionType::RemoteExceptionType()
6407db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type("android.os", "RemoteException", BUILT_IN, false, false, false)
6419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
6429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
6459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectRemoteExceptionType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
6469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
6479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d\n", __FILE__, __LINE__);
6489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
651b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesRemoteExceptionType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
6529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
6539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d\n", __FILE__, __LINE__);
6549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
6579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectRuntimeExceptionType::RuntimeExceptionType()
6597db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type("java.lang", "RuntimeException", BUILT_IN, false, false, false)
6609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
6619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
6649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectRuntimeExceptionType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
6659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
6669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d\n", __FILE__, __LINE__);
6679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
670b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesRuntimeExceptionType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
6719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
6729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d\n", __FILE__, __LINE__);
6739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
6779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectIBinderType::IBinderType()
6797db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type("android.os", "IBinder", BUILT_IN, true, false, false)
6809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
6819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
6849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectIBinderType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
6859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
6869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "writeStrongBinder", 1, v));
6879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
690b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesIBinderType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
6919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
6929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new Assignment(v, new MethodCall(parcel, "readStrongBinder")));
6939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
6959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
6969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectIBinderType::WriteArrayToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
6979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
6989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "writeBinderArray", 1, v));
6999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
7029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectIBinderType::CreateArrayFromParcel(StatementBlock* addTo, Variable* v,
703b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                            Variable* parcel, Variable**)
7049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
7059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new Assignment(v, new MethodCall(parcel, "createBinderArray")));
7069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
709b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesIBinderType::ReadArrayFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
7109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
7119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "readBinderArray", 1, v));
7129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
7169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectIInterfaceType::IInterfaceType()
7187db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type("android.os", "IInterface", BUILT_IN, false, false, false)
7199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
7209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
7239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectIInterfaceType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
7249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
7259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d\n", __FILE__, __LINE__);
7269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
729b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesIInterfaceType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
7309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
7319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d\n", __FILE__, __LINE__);
7329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
7369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectBinderType::BinderType()
7387db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type("android.os", "Binder", BUILT_IN, false, false, false)
7399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
7409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
7439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectBinderType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
7449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
7459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d\n", __FILE__, __LINE__);
7469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
7499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectBinderType::CreateFromParcel(StatementBlock* addTo, Variable* v,
750b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                                    Variable* parcel, Variable**)
7519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
7529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d\n", __FILE__, __LINE__);
7539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
7579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectBinderProxyType::BinderProxyType()
7597db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type("android.os", "BinderProxy", BUILT_IN, false, false, false)
7609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
7619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
7649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectBinderProxyType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
7659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
7669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d\n", __FILE__, __LINE__);
7679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
7709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectBinderProxyType::CreateFromParcel(StatementBlock* addTo, Variable* v,
771b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                                    Variable* parcel, Variable**)
7729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
7739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d\n", __FILE__, __LINE__);
7749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
7789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectParcelType::ParcelType()
7807db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type("android.os", "Parcel", BUILT_IN, false, false, false)
7819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
7829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
7859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectParcelType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
7869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
7879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d\n", __FILE__, __LINE__);
7889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
791b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesParcelType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
7929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
7939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d\n", __FILE__, __LINE__);
7949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
7959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
7979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
7989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectParcelableInterfaceType::ParcelableInterfaceType()
7997db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type("android.os", "Parcelable", BUILT_IN, false, false, false)
8009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
8019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
8029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
8049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectParcelableInterfaceType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
8059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
8069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d\n", __FILE__, __LINE__);
8079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
8089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
810b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesParcelableInterfaceType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
8119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
8129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "aidl:internal error %s:%d\n", __FILE__, __LINE__);
8139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
8149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
8169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectMapType::MapType()
8187db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type("java.util", "Map", BUILT_IN, true, false, true)
8199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
8209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
8219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
8239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectMapType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
8249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
8259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "writeMap", 1, v));
8269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
8279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
828b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughesstatic void EnsureClassLoader(StatementBlock* addTo, Variable** cl)
829b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes{
830b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes    // We don't want to look up the class loader once for every
831b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes    // collection argument, so ensure we do it at most once per method.
832b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes    if (*cl == NULL) {
833b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes        *cl = new Variable(CLASSLOADER_TYPE, "cl");
834b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes        addTo->Add(new VariableDeclaration(*cl,
835b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                new LiteralExpression("this.getClass().getClassLoader()"),
836b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                CLASSLOADER_TYPE));
837b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes    }
838b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes}
839b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes
8409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
841b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesMapType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable** cl)
8429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
843b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes    EnsureClassLoader(addTo, cl);
844b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes    addTo->Add(new Assignment(v, new MethodCall(parcel, "readHashMap", 1, *cl)));
8459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
8469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
84805ffbe7c020c59ee4fa7e13e04641c954d591951Joe OnoratoMapType::ReadFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable** cl)
8499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
850b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes    EnsureClassLoader(addTo, cl);
851b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes    addTo->Add(new MethodCall(parcel, "readMap", 2, v, *cl));
8529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
8539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
8569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectListType::ListType()
8587db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type("java.util", "List", BUILT_IN, true, true, true)
8599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
8609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
8619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstring
8639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectListType::InstantiableName() const
8649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
8659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return "java.util.ArrayList";
8669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
8679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
8699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectListType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
8709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
8719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "writeList", 1, v));
8729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
8739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
875b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesListType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable** cl)
8769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
877b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes    EnsureClassLoader(addTo, cl);
878b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes    addTo->Add(new Assignment(v, new MethodCall(parcel, "readArrayList", 1, *cl)));
8799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
8809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
8819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
8829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectListType::ReadFromParcel(StatementBlock* addTo, Variable* v,
883b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                    Variable* parcel, Variable** cl)
8849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
885b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes    EnsureClassLoader(addTo, cl);
886b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes    addTo->Add(new MethodCall(parcel, "readList", 2, v, *cl));
8879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
8889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
88905ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onoratovoid
89005ffbe7c020c59ee4fa7e13e04641c954d591951Joe OnoratoListType::WriteToRpcData(StatementBlock* addTo, Expression* k, Variable* v,
89105ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato        Variable* data, int flags)
89205ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato{
89305ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    addTo->Add(new MethodCall(data, "putList", 2, k, v));
89405ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato}
89505ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato
89605ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onoratovoid
89705ffbe7c020c59ee4fa7e13e04641c954d591951Joe OnoratoListType::CreateFromRpcData(StatementBlock* addTo, Expression* k, Variable* v, Variable* data,
89805ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato        Variable** cl)
89905ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato{
90005ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    addTo->Add(new Assignment(v, new MethodCall(data, "getList", 1, k)));
90105ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato}
9029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
9049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
905a1c6d909c22e196ef62ddb065fc7821deda8a602Joe OnoratoUserDataType::UserDataType(const string& package, const string& name,
906a1c6d909c22e196ef62ddb065fc7821deda8a602Joe Onorato                        bool builtIn, bool canWriteToParcel, bool canWriteToRpcData,
907a1c6d909c22e196ef62ddb065fc7821deda8a602Joe Onorato                        const string& declFile, int declLine)
908a1c6d909c22e196ef62ddb065fc7821deda8a602Joe Onorato    :Type(package, name, builtIn ? BUILT_IN : USERDATA, canWriteToParcel, canWriteToRpcData,
909a1c6d909c22e196ef62ddb065fc7821deda8a602Joe Onorato            true, declFile, declLine)
9106c0236c53a30ea9fef28ee7c95a4dce2fa5ce2e1Joe Onorato{
9116c0236c53a30ea9fef28ee7c95a4dce2fa5ce2e1Joe Onorato}
9126c0236c53a30ea9fef28ee7c95a4dce2fa5ce2e1Joe Onorato
9139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstring
914a1c6d909c22e196ef62ddb065fc7821deda8a602Joe OnoratoUserDataType::CreatorName() const
9159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
9169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return QualifiedName() + ".CREATOR";
9179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
9189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
91979824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onoratostring
92079824179b8ceb77d4ddb392a7c104e873d61ccc8Joe OnoratoUserDataType::RpcCreatorName() const
92179824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato{
92279824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato    return QualifiedName() + ".RPC_CREATOR";
92379824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato}
92479824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato
9259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
926a1c6d909c22e196ef62ddb065fc7821deda8a602Joe OnoratoUserDataType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
9279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
9289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // if (v != null) {
9299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    //     parcel.writeInt(1);
9309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    //     v.writeToParcel(parcel);
9319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // } else {
9329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    //     parcel.writeInt(0);
9339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // }
9349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    IfStatement* elsepart = new IfStatement();
9359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    elsepart->statements->Add(new MethodCall(parcel, "writeInt", 1,
9369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                                new LiteralExpression("0")));
9379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    IfStatement* ifpart = new IfStatement;
9389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->expression = new Comparison(v, "!=", NULL_VALUE);
9399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->elseif = elsepart;
9409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->statements->Add(new MethodCall(parcel, "writeInt", 1,
9419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                                new LiteralExpression("1")));
9429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->statements->Add(new MethodCall(v, "writeToParcel", 2,
9439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                                parcel, BuildWriteToParcelFlags(flags)));
9449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(ifpart);
9469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
9479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
949a1c6d909c22e196ef62ddb065fc7821deda8a602Joe OnoratoUserDataType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
9509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
9519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // if (0 != parcel.readInt()) {
9529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    //     v = CLASS.CREATOR.createFromParcel(parcel)
9539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // } else {
9549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    //     v = null;
9559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // }
9569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    IfStatement* elsepart = new IfStatement();
9579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    elsepart->statements->Add(new Assignment(v, NULL_VALUE));
9589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    IfStatement* ifpart = new IfStatement();
9609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->expression = new Comparison(new LiteralExpression("0"), "!=",
9619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                new MethodCall(parcel, "readInt"));
9629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->elseif = elsepart;
9639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->statements->Add(new Assignment(v,
9649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                new MethodCall(v->type, "CREATOR.createFromParcel", 1, parcel)));
9659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(ifpart);
9679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
9689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
970a1c6d909c22e196ef62ddb065fc7821deda8a602Joe OnoratoUserDataType::ReadFromParcel(StatementBlock* addTo, Variable* v,
971b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                    Variable* parcel, Variable**)
9729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
9739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // TODO: really, we don't need to have this extra check, but we
9749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // don't have two separate marshalling code paths
9759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // if (0 != parcel.readInt()) {
9769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    //     v.readFromParcel(parcel)
9779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // }
9789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    IfStatement* ifpart = new IfStatement();
9799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->expression = new Comparison(new LiteralExpression("0"), "!=",
9809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                new MethodCall(parcel, "readInt"));
9819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ifpart->statements->Add(new MethodCall(v, "readFromParcel", 1, parcel));
9829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(ifpart);
9839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
9849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectbool
986a1c6d909c22e196ef62ddb065fc7821deda8a602Joe OnoratoUserDataType::CanBeArray() const
9879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
9889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return true;
9899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
9909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
992a1c6d909c22e196ef62ddb065fc7821deda8a602Joe OnoratoUserDataType::WriteArrayToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
9939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
9949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "writeTypedArray", 2, v,
9959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                BuildWriteToParcelFlags(flags)));
9969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
9979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
9989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
999a1c6d909c22e196ef62ddb065fc7821deda8a602Joe OnoratoUserDataType::CreateArrayFromParcel(StatementBlock* addTo, Variable* v,
1000b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                            Variable* parcel, Variable**)
10019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
10029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    string creator = v->type->QualifiedName() + ".CREATOR";
10039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new Assignment(v, new MethodCall(parcel,
10049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                "createTypedArray", 1, new LiteralExpression(creator))));
10059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
10069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
10079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
1008a1c6d909c22e196ef62ddb065fc7821deda8a602Joe OnoratoUserDataType::ReadArrayFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
10099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
10109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    string creator = v->type->QualifiedName() + ".CREATOR";
10119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "readTypedArray", 2,
10129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                    v, new LiteralExpression(creator)));
10139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
10149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
10157db766c3fec2795b08d237f29b972f474983684bJoe Onoratovoid
1016a1c6d909c22e196ef62ddb065fc7821deda8a602Joe OnoratoUserDataType::WriteToRpcData(StatementBlock* addTo, Expression* k, Variable* v,
10177db766c3fec2795b08d237f29b972f474983684bJoe Onorato                                    Variable* data, int flags)
10187db766c3fec2795b08d237f29b972f474983684bJoe Onorato{
1019c3a7bb6563288373b4b6531ab5c8abfc3d048a77Joe Onorato    // data.putFlattenable(k, v);
1020c3a7bb6563288373b4b6531ab5c8abfc3d048a77Joe Onorato    addTo->Add(new MethodCall(data, "putFlattenable", 2, k, v));
10217db766c3fec2795b08d237f29b972f474983684bJoe Onorato}
10227db766c3fec2795b08d237f29b972f474983684bJoe Onorato
10237db766c3fec2795b08d237f29b972f474983684bJoe Onoratovoid
1024a1c6d909c22e196ef62ddb065fc7821deda8a602Joe OnoratoUserDataType::CreateFromRpcData(StatementBlock* addTo, Expression* k, Variable* v,
10257db766c3fec2795b08d237f29b972f474983684bJoe Onorato                                    Variable* data, Variable** cl)
10267db766c3fec2795b08d237f29b972f474983684bJoe Onorato{
1027c3a7bb6563288373b4b6531ab5c8abfc3d048a77Joe Onorato    // data.getFlattenable(k, CLASS.RPC_CREATOR);
1028c3a7bb6563288373b4b6531ab5c8abfc3d048a77Joe Onorato    addTo->Add(new Assignment(v, new MethodCall(data, "getFlattenable", 2, k,
1029c3a7bb6563288373b4b6531ab5c8abfc3d048a77Joe Onorato                new FieldVariable(v->type, "RPC_CREATOR"))));
10307db766c3fec2795b08d237f29b972f474983684bJoe Onorato}
10317db766c3fec2795b08d237f29b972f474983684bJoe Onorato
10329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
10339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
10349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectInterfaceType::InterfaceType(const string& package, const string& name,
10359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                        bool builtIn, bool oneway,
10369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                        const string& declFile, int declLine)
10377db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type(package, name, builtIn ? BUILT_IN : INTERFACE, true, false, false,
10389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                        declFile, declLine)
10399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    ,m_oneway(oneway)
10409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
10419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
10429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
10439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectbool
10449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectInterfaceType::OneWay() const
10459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
10469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return m_oneway;
10479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
10489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
10499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
10509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectInterfaceType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
10519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
10529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // parcel.writeStrongBinder(v != null ? v.asBinder() : null);
10539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new MethodCall(parcel, "writeStrongBinder", 1,
10549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                new Ternary(
10559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                    new Comparison(v, "!=", NULL_VALUE),
10569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                    new MethodCall(v, "asBinder"),
10579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                    NULL_VALUE)));
10589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
10599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
10609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
1061b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesInterfaceType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
10629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
10639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    // v = Interface.asInterface(parcel.readStrongBinder());
10649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    string type = v->type->QualifiedName();
10659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    type += ".Stub";
10669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    addTo->Add(new Assignment(v,
10679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                new MethodCall( NAMES.Find(type), "asInterface", 1,
10689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                    new MethodCall(parcel, "readStrongBinder"))));
10699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
10709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
10719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
10729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
10739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
10749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectGenericType::GenericType(const string& package, const string& name,
10759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                         const vector<Type*>& args)
10767db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type(package, name, BUILT_IN, true, true, true)
10779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
10789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    m_args = args;
10799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
10809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    m_importName = package + '.' + name;
10819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
10829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    string gen = "<";
10839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    int N = args.size();
10849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    for (int i=0; i<N; i++) {
10859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        Type* t = args[i];
10869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        gen += t->QualifiedName();
10879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        if (i != N-1) {
10889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            gen += ',';
10899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
10909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
10919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    gen += '>';
10929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    m_genericArguments = gen;
10939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    SetQualifiedName(m_importName + gen);
10949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
10959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
109605ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onoratoconst vector<Type*>&
109705ffbe7c020c59ee4fa7e13e04641c954d591951Joe OnoratoGenericType::GenericArgumentTypes() const
109805ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato{
109905ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato    return m_args;
110005ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato}
110105ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato
11029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstring
11039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectGenericType::GenericArguments() const
11049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
11059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return m_genericArguments;
11069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
11079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
11089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstring
11099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectGenericType::ImportType() const
11109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
11119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return m_importName;
11129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
11139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
11149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
11159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectGenericType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
11169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
11179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "implement GenericType::WriteToParcel\n");
11189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
11199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
11209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
1121b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesGenericType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
11229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
11239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "implement GenericType::CreateFromParcel\n");
11249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
11259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
11269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
11279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectGenericType::ReadFromParcel(StatementBlock* addTo, Variable* v,
1128b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                            Variable* parcel, Variable**)
11299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
11309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    fprintf(stderr, "implement GenericType::ReadFromParcel\n");
11319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
11329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
11339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
11349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
11359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
11369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectGenericListType::GenericListType(const string& package, const string& name,
11379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                         const vector<Type*>& args)
11389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    :GenericType(package, name, args),
11399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     m_creator(args[0]->CreatorName())
11409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
11419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
11429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
11439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstring
11449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectGenericListType::CreatorName() const
11459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
11469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return "android.os.Parcel.arrayListCreator";
11479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
11489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
11499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstring
11509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectGenericListType::InstantiableName() const
11519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
11529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return "java.util.ArrayList" + GenericArguments();
11539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
11549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
11559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
11569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectGenericListType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
11579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
11589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (m_creator == STRING_TYPE->CreatorName()) {
11599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        addTo->Add(new MethodCall(parcel, "writeStringList", 1, v));
11609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    } else if (m_creator == IBINDER_TYPE->CreatorName()) {
11619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        addTo->Add(new MethodCall(parcel, "writeBinderList", 1, v));
11629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    } else {
11639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        // parcel.writeTypedListXX(arg);
11649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        addTo->Add(new MethodCall(parcel, "writeTypedList", 1, v));
11659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
11669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
11679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
11689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
1169b9eba866b203b28e58f35598023f49b4b58a0635Elliott HughesGenericListType::CreateFromParcel(StatementBlock* addTo, Variable* v, Variable* parcel, Variable**)
11709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
11719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (m_creator == STRING_TYPE->CreatorName()) {
11729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        addTo->Add(new Assignment(v,
11739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                   new MethodCall(parcel, "createStringArrayList", 0)));
11749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    } else if (m_creator == IBINDER_TYPE->CreatorName()) {
11759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        addTo->Add(new Assignment(v,
11769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                   new MethodCall(parcel, "createBinderArrayList", 0)));
11779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    } else {
11789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        // v = _data.readTypedArrayList(XXX.creator);
11799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        addTo->Add(new Assignment(v,
11809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                   new MethodCall(parcel, "createTypedArrayList", 1,
11819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                   new LiteralExpression(m_creator))));
11829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
11839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
11849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
11859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectvoid
11869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectGenericListType::ReadFromParcel(StatementBlock* addTo, Variable* v,
1187b9eba866b203b28e58f35598023f49b4b58a0635Elliott Hughes                            Variable* parcel, Variable**)
11889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
11899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    if (m_creator == STRING_TYPE->CreatorName()) {
11909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        addTo->Add(new MethodCall(parcel, "readStringList", 1, v));
11919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    } else if (m_creator == IBINDER_TYPE->CreatorName()) {
11929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        addTo->Add(new MethodCall(parcel, "readBinderList", 1, v));
11939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    } else {
11949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        // v = _data.readTypedList(v, XXX.creator);
11959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        addTo->Add(new MethodCall(parcel, "readTypedList", 2,
11969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                       v,
11979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                       new LiteralExpression(m_creator)));
11989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
11999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
12009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
120105ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onoratovoid
120205ffbe7c020c59ee4fa7e13e04641c954d591951Joe OnoratoGenericListType::WriteToRpcData(StatementBlock* addTo, Expression* k, Variable* v,
120305ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato        Variable* data, int flags)
120405ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato{
120579824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato    Type* generic = GenericArgumentTypes()[0];
120679824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato    if (generic == RPC_DATA_TYPE) {
120779824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato        addTo->Add(new MethodCall(data, "putRpcDataList", 2, k, v));
120879824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato    } else if (generic->RpcCreatorName() != "") {
120979824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato        addTo->Add(new MethodCall(data, "putFlattenableList", 2, k, v));
121079824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato    } else {
121179824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato        addTo->Add(new MethodCall(data, "putList", 2, k, v));
121279824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato    }
121305ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato}
121405ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato
121505ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onoratovoid
121605ffbe7c020c59ee4fa7e13e04641c954d591951Joe OnoratoGenericListType::CreateFromRpcData(StatementBlock* addTo, Expression* k, Variable* v,
121705ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato        Variable* data, Variable** cl)
121805ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato{
121979824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato    Type* generic = GenericArgumentTypes()[0];
122079824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato    if (generic == RPC_DATA_TYPE) {
122179824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato        addTo->Add(new Assignment(v, new MethodCall(data, "getRpcDataList", 2, k)));
122279824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato    } else if (generic->RpcCreatorName() != "") {
122379824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato        addTo->Add(new Assignment(v, new MethodCall(data, "getFlattenableList", 2, k,
122479824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato                        new LiteralExpression(generic->RpcCreatorName()))));
122579824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato    } else {
122679824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato        string classArg = GenericArgumentTypes()[0]->QualifiedName();
122779824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato        classArg += ".class";
122879824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato        addTo->Add(new Assignment(v, new MethodCall(data, "getList", 2, k,
122979824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato                        new LiteralExpression(classArg))));
123079824179b8ceb77d4ddb392a7c104e873d61ccc8Joe Onorato    }
123105ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato}
123205ffbe7c020c59ee4fa7e13e04641c954d591951Joe Onorato
12331eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato
12341eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato// ================================================================
12351eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato
12361eb720446dec3248ba102c4635bf113d450d0d73Joe OnoratoRpcDataType::RpcDataType()
123717a452f00c188173f48d0d490d98750cbb4529caMike Lockwood    :UserDataType("android.support.place.rpc", "RpcData", true, true, true)
12381eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato{
12391eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato}
12401eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato
12411eb720446dec3248ba102c4635bf113d450d0d73Joe Onoratovoid
12421eb720446dec3248ba102c4635bf113d450d0d73Joe OnoratoRpcDataType::WriteToRpcData(StatementBlock* addTo, Expression* k, Variable* v,
12431eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato        Variable* data, int flags)
12441eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato{
12451eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato    addTo->Add(new MethodCall(data, "putRpcData", 2, k, v));
12461eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato}
12471eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato
12481eb720446dec3248ba102c4635bf113d450d0d73Joe Onoratovoid
12491eb720446dec3248ba102c4635bf113d450d0d73Joe OnoratoRpcDataType::CreateFromRpcData(StatementBlock* addTo, Expression* k, Variable* v, Variable* data,
12501eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato        Variable** cl)
12511eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato{
12521eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato    addTo->Add(new Assignment(v, new MethodCall(data, "getRpcData", 1, k)));
12531eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato}
12541eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato
12551eb720446dec3248ba102c4635bf113d450d0d73Joe Onorato
12569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
12579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
12589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectClassLoaderType::ClassLoaderType()
12597db766c3fec2795b08d237f29b972f474983684bJoe Onorato    :Type("java.lang", "ClassLoader", BUILT_IN, false, false, false)
12609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
12619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
12629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
12639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
12649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// ================================================================
12659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
12669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectNamespace::Namespace()
12679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
12689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
12699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
12709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source ProjectNamespace::~Namespace()
12719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
12729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    int N = m_types.size();
12739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    for (int i=0; i<N; i++) {
12749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        delete m_types[i];
12759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
12769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
12779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1278