blob: 689d5bf4320c5ba2cdb8c64240f8adf7231dbab5 [file] [log] [blame]
Paul Stewartb9b3f9d2014-09-10 15:12:39 -07001// 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 Stewart1dce1ae2014-10-01 05:30:18 -070013#include "chromeos-dbus-bindings/header_generator.h"
Paul Stewartb9b3f9d2014-09-10 15:12:39 -070014#include "chromeos-dbus-bindings/indented_text.h"
15
16namespace base {
17
18class FilePath;
19
20} // namespace base
21
22namespace chromeos_dbus_bindings {
23
24class IndentedText;
25struct Interface;
26
Paul Stewart1dce1ae2014-10-01 05:30:18 -070027class AdaptorGenerator : public HeaderGenerator {
Paul Stewartb9b3f9d2014-09-10 15:12:39 -070028 public:
Paul Stewart1dce1ae2014-10-01 05:30:18 -070029 static bool GenerateAdaptor(const Interface& interface,
30 const base::FilePath& output_file);
Paul Stewartb9b3f9d2014-09-10 15:12:39 -070031
32 private:
33 friend class AdaptorGeneratorTest;
34
Paul Stewartb9b3f9d2014-09-10 15:12:39 -070035 // Generates the constructor for the adaptor.
36 static void AddConstructor(const Interface& interface,
37 const std::string& class_name,
Paul Stewartb9b3f9d2014-09-10 15:12:39 -070038 IndentedText *text);
39
40 // Generates the method interface class.
41 static void AddMethodInterface(const Interface& interface,
Paul Stewartb9b3f9d2014-09-10 15:12:39 -070042 IndentedText *text);
43
Alex Deymob19e92f2014-10-23 23:04:11 -070044 // 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 Stewartb9b3f9d2014-09-10 15:12:39 -070052 DISALLOW_COPY_AND_ASSIGN(AdaptorGenerator);
53};
54
55} // namespace chromeos_dbus_bindings
56
57#endif // CHROMEOS_DBUS_BINDINGS_ADAPTOR_GENERATOR_H_