| 1893 | } |
| 1894 | |
| 1895 | static status_t writeTextLayoutClasses( |
| 1896 | FILE* fp, const sp<AaptAssets>& assets, |
| 1897 | const sp<AaptSymbols>& symbols, bool includePrivate) |
| 1898 | { |
| 1899 | String16 attr16("attr"); |
| 1900 | String16 package16(assets->getPackage()); |
| 1901 | |
| 1902 | bool hasErrors = false; |
| 1903 | |
| 1904 | size_t i; |
| 1905 | size_t N = symbols->getNestedSymbols().size(); |
| 1906 | for (i=0; i<N; i++) { |
| 1907 | sp<AaptSymbols> nsymbols = symbols->getNestedSymbols().valueAt(i); |
| 1908 | String8 realClassName(symbols->getNestedSymbols().keyAt(i)); |
| 1909 | String8 nclassName(flattenSymbol(realClassName)); |
| 1910 | |
| 1911 | SortedVector<uint32_t> idents; |
| 1912 | Vector<uint32_t> origOrder; |
| 1913 | Vector<bool> publicFlags; |
| 1914 | |
| 1915 | size_t a; |
| 1916 | size_t NA = nsymbols->getSymbols().size(); |
| 1917 | for (a=0; a<NA; a++) { |
| 1918 | const AaptSymbolEntry& sym(nsymbols->getSymbols().valueAt(a)); |
| 1919 | int32_t code = sym.typeCode == AaptSymbolEntry::TYPE_INT32 |
| 1920 | ? sym.int32Val : 0; |
| 1921 | bool isPublic = true; |
| 1922 | if (code == 0) { |
| 1923 | String16 name16(sym.name); |
| 1924 | uint32_t typeSpecFlags; |
| 1925 | code = assets->getIncludedResources().identifierForName( |
| 1926 | name16.string(), name16.size(), |
| 1927 | attr16.string(), attr16.size(), |
| 1928 | package16.string(), package16.size(), &typeSpecFlags); |
| 1929 | if (code == 0) { |
| 1930 | fprintf(stderr, "ERROR: In <declare-styleable> %s, unable to find attribute %s\n", |
| 1931 | nclassName.string(), sym.name.string()); |
| 1932 | hasErrors = true; |
| 1933 | } |
| 1934 | isPublic = (typeSpecFlags&ResTable_typeSpec::SPEC_PUBLIC) != 0; |
| 1935 | } |
| 1936 | idents.add(code); |
| 1937 | origOrder.add(code); |
| 1938 | publicFlags.add(isPublic); |
| 1939 | } |
| 1940 | |
| 1941 | NA = idents.size(); |
| 1942 | |
| 1943 | fprintf(fp, "int[] styleable %s {", nclassName.string()); |
| 1944 | |
| 1945 | for (a=0; a<NA; a++) { |
| 1946 | if (a != 0) { |
| 1947 | fprintf(fp, ","); |
| 1948 | } |
| 1949 | fprintf(fp, " 0x%08x", idents[a]); |
| 1950 | } |
| 1951 | |
| 1952 | fprintf(fp, " }\n"); |
no test coverage detected