RSExportType *RSExportElement::CreateFromDecl(RSContext *Context, const clang::DeclaratorDecl *DD) { const clang::Type* T = RSExportType::GetTypeOfDecl(DD); const clang::Type* CT = GET_CANONICAL_TYPE(T); const ElementInfo* EI = NULL; // Note: RS element like rs_pixel_rgb elements are either in the type of // primitive or vector. if ((CT->getTypeClass() != clang::Type::Builtin) && (CT->getTypeClass() != clang::Type::ExtVector)) { return RSExportType::Create(Context, T); } // Following the typedef chain to see whether it's an element name like // rs_pixel_rgb or its alias (via typedef). while (T != CT) { if (T->getTypeClass() != clang::Type::Typedef) { break; } else { const clang::TypedefType *TT = static_cast<const clang::TypedefType*>(T); const clang::TypedefNameDecl *TD = TT->getDecl(); EI = GetElementInfo(TD->getName()); if (EI != NULL) break; T = TD->getUnderlyingType().getTypePtr(); } } if (EI == NULL) { return RSExportType::Create(Context, T); } else { return RSExportElement::Create(Context, T, EI); } }
void doGetInfo(info & info) { GetElementInfo(info); info.AddInfo("index", index); info.AddInfo("posx", posx); info.AddInfo("posy", posy); info.AddInfo("bright_ture_x", bright_ture_x); info.AddInfo("bright_ture_y", bright_ture_y); info.AddInfo("bright_ture_w", bright_ture_w); info.AddInfo("bright_ture_h", bright_ture_h); info.AddInfo("node_w", node_w); info.AddInfo("node_h", node_h); info.AddInfo("horizontal", horizontal); info.AddInfo("vertical", vertical); }