Use Google3 style guide with .clang-format

Test: style change only, builds ok
Change-Id: I885180e24cb2e7b58cfb4967c3bcb40058ce4078
diff --git a/tools/aapt2/io/Data.h b/tools/aapt2/io/Data.h
index 34eed63..0479228b 100644
--- a/tools/aapt2/io/Data.h
+++ b/tools/aapt2/io/Data.h
@@ -18,105 +18,95 @@
 #define AAPT_IO_DATA_H
 
 #include <android-base/macros.h>
-#include <memory>
 #include <utils/FileMap.h>
+#include <memory>
 
 namespace aapt {
 namespace io {
 
 /**
- * Interface for a block of contiguous memory. An instance of this interface owns the data.
+ * Interface for a block of contiguous memory. An instance of this interface
+ * owns the data.
  */
 class IData {
-public:
-    virtual ~IData() = default;
+ public:
+  virtual ~IData() = default;
 
-    virtual const void* data() const = 0;
-    virtual size_t size() const = 0;
+  virtual const void* data() const = 0;
+  virtual size_t size() const = 0;
 };
 
 class DataSegment : public IData {
-public:
-    explicit DataSegment(std::unique_ptr<IData> data, size_t offset, size_t len) :
-            mData(std::move(data)), mOffset(offset), mLen(len) {
-    }
+ public:
+  explicit DataSegment(std::unique_ptr<IData> data, size_t offset, size_t len)
+      : mData(std::move(data)), mOffset(offset), mLen(len) {}
 
-    const void* data() const override {
-        return static_cast<const uint8_t*>(mData->data()) + mOffset;
-    }
+  const void* data() const override {
+    return static_cast<const uint8_t*>(mData->data()) + mOffset;
+  }
 
-    size_t size() const override {
-        return mLen;
-    }
+  size_t size() const override { return mLen; }
 
-private:
-    DISALLOW_COPY_AND_ASSIGN(DataSegment);
+ private:
+  DISALLOW_COPY_AND_ASSIGN(DataSegment);
 
-    std::unique_ptr<IData> mData;
-    size_t mOffset;
-    size_t mLen;
+  std::unique_ptr<IData> mData;
+  size_t mOffset;
+  size_t mLen;
 };
 
 /**
- * Implementation of IData that exposes a memory mapped file. The mmapped file is owned by this
+ * Implementation of IData that exposes a memory mapped file. The mmapped file
+ * is owned by this
  * object.
  */
 class MmappedData : public IData {
-public:
-    explicit MmappedData(android::FileMap&& map) : mMap(std::forward<android::FileMap>(map)) {
-    }
+ public:
+  explicit MmappedData(android::FileMap&& map)
+      : mMap(std::forward<android::FileMap>(map)) {}
 
-    const void* data() const override {
-        return mMap.getDataPtr();
-    }
+  const void* data() const override { return mMap.getDataPtr(); }
 
-    size_t size() const override {
-        return mMap.getDataLength();
-    }
+  size_t size() const override { return mMap.getDataLength(); }
 
-private:
-    android::FileMap mMap;
+ private:
+  android::FileMap mMap;
 };
 
 /**
- * Implementation of IData that exposes a block of memory that was malloc'ed (new'ed). The
+ * Implementation of IData that exposes a block of memory that was malloc'ed
+ * (new'ed). The
  * memory is owned by this object.
  */
 class MallocData : public IData {
-public:
-    MallocData(std::unique_ptr<const uint8_t[]> data, size_t size) :
-            mData(std::move(data)), mSize(size) {
-    }
+ public:
+  MallocData(std::unique_ptr<const uint8_t[]> data, size_t size)
+      : mData(std::move(data)), mSize(size) {}
 
-    const void* data() const override {
-        return mData.get();
-    }
+  const void* data() const override { return mData.get(); }
 
-    size_t size() const override {
-        return mSize;
-    }
+  size_t size() const override { return mSize; }
 
-private:
-    std::unique_ptr<const uint8_t[]> mData;
-    size_t mSize;
+ private:
+  std::unique_ptr<const uint8_t[]> mData;
+  size_t mSize;
 };
 
 /**
- * When mmap fails because the file has length 0, we use the EmptyData to simulate data of length 0.
+ * When mmap fails because the file has length 0, we use the EmptyData to
+ * simulate data of length 0.
  */
 class EmptyData : public IData {
-public:
-    const void* data() const override {
-        static const uint8_t d = 0;
-        return &d;
-    }
+ public:
+  const void* data() const override {
+    static const uint8_t d = 0;
+    return &d;
+  }
 
-    size_t size() const override {
-        return 0u;
-    }
+  size_t size() const override { return 0u; }
 };
 
-} // namespace io
-} // namespace aapt
+}  // namespace io
+}  // namespace aapt
 
 #endif /* AAPT_IO_DATA_H */
diff --git a/tools/aapt2/io/File.h b/tools/aapt2/io/File.h
index 807981e..012f446 100644
--- a/tools/aapt2/io/File.h
+++ b/tools/aapt2/io/File.h
@@ -30,83 +30,90 @@
 namespace io {
 
 /**
- * Interface for a file, which could be a real file on the file system, or a file inside
+ * Interface for a file, which could be a real file on the file system, or a
+ * file inside
  * a ZIP archive.
  */
 class IFile {
-public:
-    virtual ~IFile() = default;
+ public:
+  virtual ~IFile() = default;
 
-    /**
-     * Open the file and return it as a block of contiguous memory. How this occurs is
-     * implementation dependent. For example, if this is a file on the file system, it may
-     * simply mmap the contents. If this file represents a compressed file in a ZIP archive,
-     * it may need to inflate it to memory, incurring a copy.
-     *
-     * Returns nullptr on failure.
-     */
-    virtual std::unique_ptr<IData> openAsData() = 0;
+  /**
+   * Open the file and return it as a block of contiguous memory. How this
+   * occurs is
+   * implementation dependent. For example, if this is a file on the file
+   * system, it may
+   * simply mmap the contents. If this file represents a compressed file in a
+   * ZIP archive,
+   * it may need to inflate it to memory, incurring a copy.
+   *
+   * Returns nullptr on failure.
+   */
+  virtual std::unique_ptr<IData> openAsData() = 0;
 
-    /**
-     * Returns the source of this file. This is for presentation to the user and may not be a
-     * valid file system path (for example, it may contain a '@' sign to separate the files within
-     * a ZIP archive from the path to the containing ZIP archive.
-     */
-    virtual const Source& getSource() const = 0;
+  /**
+   * Returns the source of this file. This is for presentation to the user and
+   * may not be a
+   * valid file system path (for example, it may contain a '@' sign to separate
+   * the files within
+   * a ZIP archive from the path to the containing ZIP archive.
+   */
+  virtual const Source& getSource() const = 0;
 
-    IFile* createFileSegment(size_t offset, size_t len);
+  IFile* createFileSegment(size_t offset, size_t len);
 
-private:
-    // Any segments created from this IFile need to be owned by this IFile, so keep them
-    // in a list. This will never be read, so we prefer better insertion performance
-    // than cache locality, hence the list.
-    std::list<std::unique_ptr<IFile>> mSegments;
+ private:
+  // Any segments created from this IFile need to be owned by this IFile, so
+  // keep them
+  // in a list. This will never be read, so we prefer better insertion
+  // performance
+  // than cache locality, hence the list.
+  std::list<std::unique_ptr<IFile>> mSegments;
 };
 
 /**
- * An IFile that wraps an underlying IFile but limits it to a subsection of that file.
+ * An IFile that wraps an underlying IFile but limits it to a subsection of that
+ * file.
  */
 class FileSegment : public IFile {
-public:
-    explicit FileSegment(IFile* file, size_t offset, size_t len) :
-            mFile(file), mOffset(offset), mLen(len) {
-    }
+ public:
+  explicit FileSegment(IFile* file, size_t offset, size_t len)
+      : mFile(file), mOffset(offset), mLen(len) {}
 
-    std::unique_ptr<IData> openAsData() override;
+  std::unique_ptr<IData> openAsData() override;
 
-    const Source& getSource() const override {
-        return mFile->getSource();
-    }
+  const Source& getSource() const override { return mFile->getSource(); }
 
-private:
-    DISALLOW_COPY_AND_ASSIGN(FileSegment);
+ private:
+  DISALLOW_COPY_AND_ASSIGN(FileSegment);
 
-    IFile* mFile;
-    size_t mOffset;
-    size_t mLen;
+  IFile* mFile;
+  size_t mOffset;
+  size_t mLen;
 };
 
 class IFileCollectionIterator {
-public:
-    virtual ~IFileCollectionIterator() = default;
+ public:
+  virtual ~IFileCollectionIterator() = default;
 
-    virtual bool hasNext() = 0;
-    virtual IFile* next() = 0;
+  virtual bool hasNext() = 0;
+  virtual IFile* next() = 0;
 };
 
 /**
- * Interface for a collection of files, all of which share a common source. That source may
+ * Interface for a collection of files, all of which share a common source. That
+ * source may
  * simply be the filesystem, or a ZIP archive.
  */
 class IFileCollection {
-public:
-    virtual ~IFileCollection() = default;
+ public:
+  virtual ~IFileCollection() = default;
 
-    virtual IFile* findFile(const StringPiece& path) = 0;
-    virtual std::unique_ptr<IFileCollectionIterator> iterator() = 0;
+  virtual IFile* findFile(const StringPiece& path) = 0;
+  virtual std::unique_ptr<IFileCollectionIterator> iterator() = 0;
 };
 
-} // namespace io
-} // namespace aapt
+}  // namespace io
+}  // namespace aapt
 
 #endif /* AAPT_IO_FILE_H */
diff --git a/tools/aapt2/io/FileSystem.h b/tools/aapt2/io/FileSystem.h
index 72a932a..8584d48 100644
--- a/tools/aapt2/io/FileSystem.h
+++ b/tools/aapt2/io/FileSystem.h
@@ -28,47 +28,47 @@
  * A regular file from the file system. Uses mmap to open the data.
  */
 class RegularFile : public IFile {
-public:
-    explicit RegularFile(const Source& source);
+ public:
+  explicit RegularFile(const Source& source);
 
-    std::unique_ptr<IData> openAsData() override;
-    const Source& getSource() const override;
+  std::unique_ptr<IData> openAsData() override;
+  const Source& getSource() const override;
 
-private:
-    Source mSource;
+ private:
+  Source mSource;
 };
 
 class FileCollection;
 
 class FileCollectionIterator : public IFileCollectionIterator {
-public:
-    explicit FileCollectionIterator(FileCollection* collection);
+ public:
+  explicit FileCollectionIterator(FileCollection* collection);
 
-    bool hasNext() override;
-    io::IFile* next() override;
+  bool hasNext() override;
+  io::IFile* next() override;
 
-private:
-    std::map<std::string, std::unique_ptr<IFile>>::const_iterator mCurrent, mEnd;
+ private:
+  std::map<std::string, std::unique_ptr<IFile>>::const_iterator mCurrent, mEnd;
 };
 
 /**
  * An IFileCollection representing the file system.
  */
 class FileCollection : public IFileCollection {
-public:
-    /**
-     * Adds a file located at path. Returns the IFile representation of that file.
-     */
-    IFile* insertFile(const StringPiece& path);
-    IFile* findFile(const StringPiece& path) override;
-    std::unique_ptr<IFileCollectionIterator> iterator() override;
+ public:
+  /**
+   * Adds a file located at path. Returns the IFile representation of that file.
+   */
+  IFile* insertFile(const StringPiece& path);
+  IFile* findFile(const StringPiece& path) override;
+  std::unique_ptr<IFileCollectionIterator> iterator() override;
 
-private:
-    friend class FileCollectionIterator;
-    std::map<std::string, std::unique_ptr<IFile>> mFiles;
+ private:
+  friend class FileCollectionIterator;
+  std::map<std::string, std::unique_ptr<IFile>> mFiles;
 };
 
-} // namespace io
-} // namespace aapt
+}  // namespace io
+}  // namespace aapt
 
-#endif // AAPT_IO_FILESYSTEM_H
+#endif  // AAPT_IO_FILESYSTEM_H
diff --git a/tools/aapt2/io/Io.h b/tools/aapt2/io/Io.h
index e1e9107..49b9fc3 100644
--- a/tools/aapt2/io/Io.h
+++ b/tools/aapt2/io/Io.h
@@ -30,12 +30,10 @@
  * The code style here matches the protobuf style.
  */
 class InputStream : public google::protobuf::io::ZeroCopyInputStream {
-public:
-    virtual std::string GetError() const {
-        return {};
-    }
+ public:
+  virtual std::string GetError() const { return {}; }
 
-    virtual bool HadError() const = 0;
+  virtual bool HadError() const = 0;
 };
 
 /**
@@ -45,12 +43,10 @@
  * The code style here matches the protobuf style.
  */
 class OutputStream : public google::protobuf::io::ZeroCopyOutputStream {
-public:
-    virtual std::string GetError() const {
-        return {};
-    }
+ public:
+  virtual std::string GetError() const { return {}; }
 
-    virtual bool HadError() const = 0;
+  virtual bool HadError() const = 0;
 };
 
 /**
@@ -60,7 +56,7 @@
  */
 bool copy(OutputStream* out, InputStream* in);
 
-} // namespace io
-} // namespace aapt
+}  // namespace io
+}  // namespace aapt
 
 #endif /* AAPT_IO_IO_H */
diff --git a/tools/aapt2/io/ZipArchive.h b/tools/aapt2/io/ZipArchive.h
index 565588e..e04525f 100644
--- a/tools/aapt2/io/ZipArchive.h
+++ b/tools/aapt2/io/ZipArchive.h
@@ -20,64 +20,66 @@
 #include "io/File.h"
 #include "util/StringPiece.h"
 
-#include <map>
 #include <ziparchive/zip_archive.h>
+#include <map>
 
 namespace aapt {
 namespace io {
 
 /**
- * An IFile representing a file within a ZIP archive. If the file is compressed, it is uncompressed
- * and copied into memory when opened. Otherwise it is mmapped from the ZIP archive.
+ * An IFile representing a file within a ZIP archive. If the file is compressed,
+ * it is uncompressed
+ * and copied into memory when opened. Otherwise it is mmapped from the ZIP
+ * archive.
  */
 class ZipFile : public IFile {
-public:
-    ZipFile(ZipArchiveHandle handle, const ZipEntry& entry, const Source& source);
+ public:
+  ZipFile(ZipArchiveHandle handle, const ZipEntry& entry, const Source& source);
 
-    std::unique_ptr<IData> openAsData() override;
-    const Source& getSource() const override;
+  std::unique_ptr<IData> openAsData() override;
+  const Source& getSource() const override;
 
-private:
-    ZipArchiveHandle mZipHandle;
-    ZipEntry mZipEntry;
-    Source mSource;
+ private:
+  ZipArchiveHandle mZipHandle;
+  ZipEntry mZipEntry;
+  Source mSource;
 };
 
 class ZipFileCollection;
 
 class ZipFileCollectionIterator : public IFileCollectionIterator {
-public:
-    explicit ZipFileCollectionIterator(ZipFileCollection* collection);
+ public:
+  explicit ZipFileCollectionIterator(ZipFileCollection* collection);
 
-    bool hasNext() override;
-    io::IFile* next() override;
+  bool hasNext() override;
+  io::IFile* next() override;
 
-private:
-    std::map<std::string, std::unique_ptr<IFile>>::const_iterator mCurrent, mEnd;
+ private:
+  std::map<std::string, std::unique_ptr<IFile>>::const_iterator mCurrent, mEnd;
 };
 
 /**
  * An IFileCollection that represents a ZIP archive and the entries within it.
  */
 class ZipFileCollection : public IFileCollection {
-public:
-    static std::unique_ptr<ZipFileCollection> create(const StringPiece& path,
-                                                     std::string* outError);
+ public:
+  static std::unique_ptr<ZipFileCollection> create(const StringPiece& path,
+                                                   std::string* outError);
 
-    io::IFile* findFile(const StringPiece& path) override;
-    std::unique_ptr<IFileCollectionIterator> iterator() override;
+  io::IFile* findFile(const StringPiece& path) override;
+  std::unique_ptr<IFileCollectionIterator> iterator() override;
 
-    ~ZipFileCollection() override;
+  ~ZipFileCollection() override;
 
-private:
-    friend class ZipFileCollectionIterator;
-    ZipFileCollection();
+ private:
+  friend class ZipFileCollectionIterator;
+  ZipFileCollection();
 
-    ZipArchiveHandle mHandle;
-    std::map<std::string, std::unique_ptr<IFile>> mFiles;
+  ZipArchiveHandle mHandle;
+  std::map<std::string, std::unique_ptr<IFile>> mFiles;
 };
 
-} // namespace io
-} // namespace aapt
+}  // namespace io
+}  // namespace aapt
 
 #endif /* AAPT_IO_ZIPARCHIVE_H */