FTL: Standardize style

Adopt STL-flavored Google style for internal and libbase consistency.

Add README.

Bug: 160012986
Test: ftl_test
Change-Id: I1056f6fa890d68717386d634c398bb2faa46775c
diff --git a/libs/ftl/Android.bp b/libs/ftl/Android.bp
index eb8e57a..883d138 100644
--- a/libs/ftl/Android.bp
+++ b/libs/ftl/Android.bp
@@ -5,9 +5,9 @@
         address: true,
     },
     srcs: [
-        "SmallMap_test.cpp",
-        "SmallVector_test.cpp",
-        "StaticVector_test.cpp",
+        "small_map_test.cpp",
+        "small_vector_test.cpp",
+        "static_vector_test.cpp",
     ],
     cflags: [
         "-Wall",
diff --git a/libs/ftl/README.md b/libs/ftl/README.md
new file mode 100644
index 0000000..bdd750f
--- /dev/null
+++ b/libs/ftl/README.md
@@ -0,0 +1,41 @@
+# FTL
+
+FTL is a template library shared by SurfaceFlinger and InputFlinger, inspired by
+and supplementing the C++ Standard Library. The intent is to fill gaps for areas
+not (yet) covered—like cache-efficient data structures and lock-free concurrency
+primitives—and implement proposals that are missing or experimental in Android's
+libc++ branch. The design takes some liberties with standard compliance, notably
+assuming that exceptions are disabled.
+
+## Tests
+
+    atest ftl_test
+
+## Style
+
+- Based on [Google C++ Style](https://google.github.io/styleguide/cppguide.html).
+- Informed by [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines).
+
+Naming conventions are as follows:
+
+- `PascalCase`
+    - Types and aliases, except standard interfaces.
+    - Template parameters, including non-type ones.
+- `snake_case`
+    - Variables, and data members with trailing underscore.
+    - Functions, free and member alike.
+    - Type traits, with standard `_t` and `_v` suffixes.
+- `kCamelCase`
+    - Enumerators and `constexpr` constants with static storage duration.
+- `MACRO_CASE`
+    - Macros, with `FTL_` prefix unless `#undef`ed.
+
+Template parameter packs are named with the following convention:
+
+    typename T, typename... Ts
+    typename Arg, typename... Args
+
+    std::size_t I, std::size_t... Is
+    std::size_t Size, std::size_t... Sizes
+
+The `details` namespace contains implementation details.
diff --git a/libs/ftl/SmallMap_test.cpp b/libs/ftl/small_map_test.cpp
similarity index 99%
rename from libs/ftl/SmallMap_test.cpp
rename to libs/ftl/small_map_test.cpp
index fa00c06..4e7662b 100644
--- a/libs/ftl/SmallMap_test.cpp
+++ b/libs/ftl/small_map_test.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include <ftl/SmallMap.h>
+#include <ftl/small_map.h>
 #include <gtest/gtest.h>
 
 #include <cctype>
diff --git a/libs/ftl/SmallVector_test.cpp b/libs/ftl/small_vector_test.cpp
similarity index 96%
rename from libs/ftl/SmallVector_test.cpp
rename to libs/ftl/small_vector_test.cpp
index d0c2858..dbb2d4f 100644
--- a/libs/ftl/SmallVector_test.cpp
+++ b/libs/ftl/small_vector_test.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include <ftl/SmallVector.h>
+#include <ftl/small_vector.h>
 #include <gtest/gtest.h>
 
 #include <algorithm>
@@ -72,8 +72,8 @@
     }
     {
         // Array constructor.
-        const float kFloats[] = {.1f, .2f, .3f};
-        SmallVector vector(kFloats);
+        const float floats[] = {.1f, .2f, .3f};
+        SmallVector vector(floats);
 
         EXPECT_EQ(vector, (SmallVector{.1f, .2f, .3f}));
         EXPECT_FALSE(vector.dynamic());
@@ -149,8 +149,8 @@
     EXPECT_STREQ(chars.begin(), "abcdefghij");
 
     // Constructor takes iterator range.
-    const char kString[] = "123456";
-    SmallVector<char, 10> string(std::begin(kString), std::end(kString));
+    const char numbers[] = "123456";
+    SmallVector<char, 10> string(std::begin(numbers), std::end(numbers));
 
     EXPECT_FALSE(string.dynamic());
     EXPECT_STREQ(string.begin(), "123456");
@@ -171,7 +171,7 @@
 
 TEST(SmallVector, CopyableElement) {
     struct Pair {
-        // Needed because std::vector emplace does not use uniform initialization.
+        // Needed because std::vector does not use list initialization to emplace.
         Pair(int a, int b) : a(a), b(b) {}
 
         const int a, b;
@@ -325,8 +325,8 @@
 
     // Constructor takes array reference.
     {
-        const char* kStrings[] = {"cake", "lie"};
-        strings = SmallVector(kStrings);
+        const char* array[] = {"cake", "lie"};
+        strings = SmallVector(array);
         EXPECT_FALSE(strings.dynamic());
     }
 
diff --git a/libs/ftl/StaticVector_test.cpp b/libs/ftl/static_vector_test.cpp
similarity index 95%
rename from libs/ftl/StaticVector_test.cpp
rename to libs/ftl/static_vector_test.cpp
index db42d23..3e66282 100644
--- a/libs/ftl/StaticVector_test.cpp
+++ b/libs/ftl/static_vector_test.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include <ftl/StaticVector.h>
+#include <ftl/static_vector.h>
 #include <gtest/gtest.h>
 
 #include <algorithm>
@@ -68,8 +68,8 @@
     }
     {
         // Array constructor.
-        const float kFloats[] = {.1f, .2f, .3f};
-        StaticVector vector(kFloats);
+        const float floats[] = {.1f, .2f, .3f};
+        StaticVector vector(floats);
         EXPECT_EQ(vector, (StaticVector{.1f, .2f, .3f}));
     }
     {
@@ -122,11 +122,11 @@
             const char* str;
         };
 
-        const char* kStrings[] = {"a", "b", "c", "d"};
+        const char* strings[] = {"a", "b", "c", "d"};
 
         {
             // Two iterator-like elements.
-            StaticVector<String, 3> vector(kStrings, kStrings + 3);
+            StaticVector<String, 3> vector(strings, strings + 3);
             ASSERT_EQ(vector.size(), 2u);
 
             EXPECT_STREQ(vector[0].str, "a");
@@ -134,7 +134,7 @@
         }
         {
             // Disambiguating iterator constructor.
-            StaticVector<String, 3> vector(ftl::IteratorRange, kStrings, kStrings + 3);
+            StaticVector<String, 3> vector(ftl::kIteratorRange, strings, strings + 3);
             ASSERT_EQ(vector.size(), 3u);
 
             EXPECT_STREQ(vector[0].str, "a");
@@ -153,8 +153,8 @@
     EXPECT_STREQ(chars.begin(), "abcdefghi");
 
     // Constructor takes iterator range.
-    const char kString[] = "123456";
-    StaticVector<char, 10> string(std::begin(kString), std::end(kString));
+    const char numbers[] = "123456";
+    StaticVector<char, 10> string(std::begin(numbers), std::end(numbers));
 
     EXPECT_STREQ(string.begin(), "123456");
     EXPECT_EQ(string.size(), 7u);
@@ -290,8 +290,8 @@
 
     // Constructor takes array reference.
     {
-        const char* kStrings[] = {"cake", "lie"};
-        strings = StaticVector(kStrings);
+        const char* array[] = {"cake", "lie"};
+        strings = StaticVector(array);
     }
 
     EXPECT_GT(sorted, strings);