diff options
author | Adam Lesinski <adamlesinski@google.com> | 2016-10-21 17:56:45 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2016-10-26 19:30:23 -0700 |
commit | ce5e56e243d262a9b65459c3bd0bb9eaadd40628 (patch) | |
tree | cf0ecea98883d090d8d2856fc6d32046c7e3d9e8 /tools/aapt2/StringPool.h | |
parent | 0f7cc4dc2c49a30c072cbc7aa6c0c5d5c31496d4 (diff) |
AAPT2: Rename to match new style
Use Google3 naming style to match new
projects' and open source google projects' style.
Preferred to do this in a massive CL so as to avoid
style inconsistencies that plague legacy code bases.
This is a relatively NEW code base, may as well keep
it up to date.
Test: name/style refactor - existing tests pass
Change-Id: Ie80ecb78d46ec53efdfca2336bb57d96cbb7fb87
Diffstat (limited to 'tools/aapt2/StringPool.h')
-rw-r--r-- | tools/aapt2/StringPool.h | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/tools/aapt2/StringPool.h b/tools/aapt2/StringPool.h index 6e0d646cae12..a4f556ca52e4 100644 --- a/tools/aapt2/StringPool.h +++ b/tools/aapt2/StringPool.h @@ -17,22 +17,22 @@ #ifndef AAPT_STRING_POOL_H #define AAPT_STRING_POOL_H -#include "ConfigDescription.h" -#include "util/BigBuffer.h" -#include "util/StringPiece.h" - #include <functional> #include <memory> #include <string> #include <unordered_map> #include <vector> +#include "ConfigDescription.h" +#include "util/BigBuffer.h" +#include "util/StringPiece.h" + namespace aapt { struct Span { std::string name; - uint32_t firstChar; - uint32_t lastChar; + uint32_t first_char; + uint32_t last_char; }; struct StyleString { @@ -72,15 +72,15 @@ class StringPool { const std::string* operator->() const; const std::string& operator*() const; - size_t getIndex() const; - const Context& getContext() const; + size_t index() const; + const Context& GetContext() const; private: friend class StringPool; explicit Ref(Entry* entry); - Entry* mEntry; + Entry* entry_; }; class StyleEntry; @@ -95,15 +95,15 @@ class StringPool { const StyleEntry* operator->() const; const StyleEntry& operator*() const; - size_t getIndex() const; - const Context& getContext() const; + size_t index() const; + const Context& GetContext() const; private: friend class StringPool; explicit StyleRef(StyleEntry* entry); - StyleEntry* mEntry; + StyleEntry* entry_; }; class Entry { @@ -116,13 +116,13 @@ class StringPool { friend class StringPool; friend class Ref; - int ref; + int ref_; }; struct Span { Ref name; - uint32_t firstChar; - uint32_t lastChar; + uint32_t first_char; + uint32_t last_char; }; class StyleEntry { @@ -134,13 +134,13 @@ class StringPool { friend class StringPool; friend class StyleRef; - int ref; + int ref_; }; using const_iterator = std::vector<std::unique_ptr<Entry>>::const_iterator; - static bool flattenUtf8(BigBuffer* out, const StringPool& pool); - static bool flattenUtf16(BigBuffer* out, const StringPool& pool); + static bool FlattenUtf8(BigBuffer* out, const StringPool& pool); + static bool FlattenUtf16(BigBuffer* out, const StringPool& pool); StringPool() = default; StringPool(const StringPool&) = delete; @@ -149,84 +149,84 @@ class StringPool { * Adds a string to the pool, unless it already exists. Returns * a reference to the string in the pool. */ - Ref makeRef(const StringPiece& str); + Ref MakeRef(const StringPiece& str); /** * Adds a string to the pool, unless it already exists, with a context * object that can be used when sorting the string pool. Returns * a reference to the string in the pool. */ - Ref makeRef(const StringPiece& str, const Context& context); + Ref MakeRef(const StringPiece& str, const Context& context); /** * Adds a style to the string pool and returns a reference to it. */ - StyleRef makeRef(const StyleString& str); + StyleRef MakeRef(const StyleString& str); /** * Adds a style to the string pool with a context object that * can be used when sorting the string pool. Returns a reference * to the style in the string pool. */ - StyleRef makeRef(const StyleString& str, const Context& context); + StyleRef MakeRef(const StyleString& str, const Context& context); /** * Adds a style from another string pool. Returns a reference to the * style in the string pool. */ - StyleRef makeRef(const StyleRef& ref); + StyleRef MakeRef(const StyleRef& ref); /** * Moves pool into this one without coalescing strings. When this * function returns, pool will be empty. */ - void merge(StringPool&& pool); + void Merge(StringPool&& pool); /** - * Retuns the number of strings in the table. + * Returns the number of strings in the table. */ inline size_t size() const; /** * Reserves space for strings and styles as an optimization. */ - void hintWillAdd(size_t stringCount, size_t styleCount); + void HintWillAdd(size_t string_count, size_t style_count); /** * Sorts the strings according to some comparison function. */ - void sort(const std::function<bool(const Entry&, const Entry&)>& cmp); + void Sort(const std::function<bool(const Entry&, const Entry&)>& cmp); /** * Removes any strings that have no references. */ - void prune(); + void Prune(); private: friend const_iterator begin(const StringPool& pool); friend const_iterator end(const StringPool& pool); - static bool flatten(BigBuffer* out, const StringPool& pool, bool utf8); + static bool Flatten(BigBuffer* out, const StringPool& pool, bool utf8); - Ref makeRefImpl(const StringPiece& str, const Context& context, bool unique); + Ref MakeRefImpl(const StringPiece& str, const Context& context, bool unique); - std::vector<std::unique_ptr<Entry>> mStrings; - std::vector<std::unique_ptr<StyleEntry>> mStyles; - std::unordered_multimap<StringPiece, Entry*> mIndexedStrings; + std::vector<std::unique_ptr<Entry>> strings_; + std::vector<std::unique_ptr<StyleEntry>> styles_; + std::unordered_multimap<StringPiece, Entry*> indexed_strings_; }; // // Inline implementation // -inline size_t StringPool::size() const { return mStrings.size(); } +inline size_t StringPool::size() const { return strings_.size(); } inline StringPool::const_iterator begin(const StringPool& pool) { - return pool.mStrings.begin(); + return pool.strings_.begin(); } inline StringPool::const_iterator end(const StringPool& pool) { - return pool.mStrings.end(); + return pool.strings_.end(); } } // namespace aapt |