Paul Stewart | b9b3f9d | 2014-09-10 15:12:39 -0700 | [diff] [blame] | 1 | // Copyright 2014 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROMEOS_DBUS_BINDINGS_ADAPTOR_GENERATOR_H_ |
| 6 | #define CHROMEOS_DBUS_BINDINGS_ADAPTOR_GENERATOR_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
| 11 | #include <base/macros.h> |
| 12 | |
Paul Stewart | 1dce1ae | 2014-10-01 05:30:18 -0700 | [diff] [blame] | 13 | #include "chromeos-dbus-bindings/header_generator.h" |
Paul Stewart | b9b3f9d | 2014-09-10 15:12:39 -0700 | [diff] [blame] | 14 | #include "chromeos-dbus-bindings/indented_text.h" |
| 15 | |
| 16 | namespace base { |
| 17 | |
| 18 | class FilePath; |
| 19 | |
| 20 | } // namespace base |
| 21 | |
| 22 | namespace chromeos_dbus_bindings { |
| 23 | |
| 24 | class IndentedText; |
| 25 | struct Interface; |
| 26 | |
Paul Stewart | 1dce1ae | 2014-10-01 05:30:18 -0700 | [diff] [blame] | 27 | class AdaptorGenerator : public HeaderGenerator { |
Paul Stewart | b9b3f9d | 2014-09-10 15:12:39 -0700 | [diff] [blame] | 28 | public: |
Paul Stewart | 1dce1ae | 2014-10-01 05:30:18 -0700 | [diff] [blame] | 29 | static bool GenerateAdaptor(const Interface& interface, |
| 30 | const base::FilePath& output_file); |
Paul Stewart | b9b3f9d | 2014-09-10 15:12:39 -0700 | [diff] [blame] | 31 | |
| 32 | private: |
| 33 | friend class AdaptorGeneratorTest; |
| 34 | |
Paul Stewart | b9b3f9d | 2014-09-10 15:12:39 -0700 | [diff] [blame] | 35 | // Generates the constructor for the adaptor. |
| 36 | static void AddConstructor(const Interface& interface, |
| 37 | const std::string& class_name, |
Paul Stewart | b9b3f9d | 2014-09-10 15:12:39 -0700 | [diff] [blame] | 38 | IndentedText *text); |
| 39 | |
| 40 | // Generates the method interface class. |
| 41 | static void AddMethodInterface(const Interface& interface, |
Paul Stewart | b9b3f9d | 2014-09-10 15:12:39 -0700 | [diff] [blame] | 42 | IndentedText *text); |
| 43 | |
Alex Deymo | b19e92f | 2014-10-23 23:04:11 -0700 | [diff] [blame^] | 44 | // Generates adaptor methods to send the signals. |
| 45 | static void AddSendSignalMethods(const Interface& interface, |
| 46 | IndentedText *text); |
| 47 | |
| 48 | // Generates DBusSignal data members for the signals. |
| 49 | static void AddSignalDataMembers(const Interface& interface, |
| 50 | IndentedText *text); |
| 51 | |
Paul Stewart | b9b3f9d | 2014-09-10 15:12:39 -0700 | [diff] [blame] | 52 | DISALLOW_COPY_AND_ASSIGN(AdaptorGenerator); |
| 53 | }; |
| 54 | |
| 55 | } // namespace chromeos_dbus_bindings |
| 56 | |
| 57 | #endif // CHROMEOS_DBUS_BINDINGS_ADAPTOR_GENERATOR_H_ |