blob: b8f7e7beda9768c82059a44f6d96010b2d3f598d [file] [log] [blame]
Paul Stewart1dce1ae2014-10-01 05:30:18 -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_PROXY_GENERATOR_H_
6#define CHROMEOS_DBUS_BINDINGS_PROXY_GENERATOR_H_
7
8#include <string>
9#include <vector>
10
11#include <base/macros.h>
12
13#include "chromeos-dbus-bindings/header_generator.h"
14#include "chromeos-dbus-bindings/indented_text.h"
15#include "chromeos-dbus-bindings/interface.h"
16
17namespace base {
18
19class FilePath;
20
21} // namespace base
22
23namespace chromeos_dbus_bindings {
24
25class IndentedText;
26struct Interface;
27
28class ProxyGenerator : public HeaderGenerator {
29 public:
Alex Vakulenkofafef132014-11-03 14:52:09 -080030 static bool GenerateProxy(const std::vector<Interface>& interfaces,
Paul Stewart1dce1ae2014-10-01 05:30:18 -070031 const base::FilePath& output_file);
32
33 private:
34 friend class ProxyGeneratorTest;
35
36 // Generates the constructor and destructor for the proxy.
Alex Vakulenkofafef132014-11-03 14:52:09 -080037 static void AddConstructor(const std::vector<Interface>& interfaces,
Paul Stewart1dce1ae2014-10-01 05:30:18 -070038 const std::string& class_name,
39 IndentedText* text);
40 static void AddDestructor(const std::string& class_name,
41 IndentedText* text);
42
43 // Generates a callback for signal receiver registration completion.
44 static void AddSignalConnectedCallback(IndentedText *text);
45
46 // Generates the method signatures for signal receivers.
Alex Vakulenkofafef132014-11-03 14:52:09 -080047 static void AddSignalReceiver(const std::vector<Interface>& interfaces,
48 IndentedText* text);
Paul Stewart1dce1ae2014-10-01 05:30:18 -070049
50 // Generates a native C++ method which calls a D-Bus method on the proxy.
51 static void AddMethodProxy(const Interface::Method& interface,
52 const std::string& interface_name,
53 IndentedText* text);
54
55 // Generates the signal handler name for a given signal name.
56 static std::string GetHandlerNameForSignal(const std::string& signal);
57
58 DISALLOW_COPY_AND_ASSIGN(ProxyGenerator);
59};
60
61} // namespace chromeos_dbus_bindings
62
63#endif // CHROMEOS_DBUS_BINDINGS_PROXY_GENERATOR_H_