本文整理汇总了C++中StringPool::size方法的典型用法代码示例。如果您正苦于以下问题:C++ StringPool::size方法的具体用法?C++ StringPool::size怎么用?C++ StringPool::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringPool
的用法示例。
在下文中一共展示了StringPool::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST(StringPoolTest, PruneStringsWithNoReferences) {
StringPool pool;
{
StringPool::Ref ref = pool.makeRef(u"wut");
EXPECT_EQ(*ref, u"wut");
EXPECT_EQ(1u, pool.size());
}
EXPECT_EQ(1u, pool.size());
pool.prune();
EXPECT_EQ(0u, pool.size());
}
示例2: flatten
status_t XMLNode::flatten(const sp<AaptFile>& dest,
bool stripComments, bool stripRawValues) const
{
StringPool strings;
Vector<uint32_t> resids;
// First collect just the strings for attribute names that have a
// resource ID assigned to them. This ensures that the resource ID
// array is compact, and makes it easier to deal with attribute names
// in different namespaces (and thus with different resource IDs).
collect_resid_strings(&strings, &resids);
// Next collect all remainibng strings.
collect_strings(&strings, &resids, stripComments, stripRawValues);
#if 0 // No longer compiles
NOISY(printf("Found strings:\n");
const size_t N = strings.size();
for (size_t i=0; i<N; i++) {
printf("%s\n", String8(strings.entryAt(i).string).string());
}
);