Lines Matching refs:text

49   IndentedText text;  in GenerateProxies()  local
51 text.AddLine("// Automatic generation of D-Bus interfaces:"); in GenerateProxies()
53 text.AddLine(StringPrintf("// - %s", interface.name.c_str())); in GenerateProxies()
56 text.AddLine(StringPrintf("#ifndef %s", header_guard.c_str())); in GenerateProxies()
57 text.AddLine(StringPrintf("#define %s", header_guard.c_str())); in GenerateProxies()
58 text.AddLine("#include <memory>"); in GenerateProxies()
59 text.AddLine("#include <string>"); in GenerateProxies()
60 text.AddLine("#include <vector>"); in GenerateProxies()
61 text.AddBlankLine(); in GenerateProxies()
62 text.AddLine("#include <base/bind.h>"); in GenerateProxies()
63 text.AddLine("#include <base/callback.h>"); in GenerateProxies()
64 text.AddLine("#include <base/logging.h>"); in GenerateProxies()
65 text.AddLine("#include <base/macros.h>"); in GenerateProxies()
66 text.AddLine("#include <base/memory/ref_counted.h>"); in GenerateProxies()
67 text.AddLine("#include <brillo/any.h>"); in GenerateProxies()
68 text.AddLine("#include <brillo/dbus/dbus_method_invoker.h>"); in GenerateProxies()
69 text.AddLine("#include <brillo/dbus/dbus_property.h>"); in GenerateProxies()
70 text.AddLine("#include <brillo/dbus/dbus_signal_handler.h>"); in GenerateProxies()
71 text.AddLine("#include <brillo/errors/error.h>"); in GenerateProxies()
72 text.AddLine("#include <brillo/variant_dictionary.h>"); in GenerateProxies()
73 text.AddLine("#include <dbus/bus.h>"); in GenerateProxies()
74 text.AddLine("#include <dbus/message.h>"); in GenerateProxies()
75 text.AddLine("#include <dbus/object_manager.h>"); in GenerateProxies()
76 text.AddLine("#include <dbus/object_path.h>"); in GenerateProxies()
77 text.AddLine("#include <dbus/object_proxy.h>"); in GenerateProxies()
78 text.AddBlankLine(); in GenerateProxies()
83 parser.AddOpenNamespaces(&text, false); in GenerateProxies()
84 text.AddLine(StringPrintf("class %s;", in GenerateProxies()
86 parser.AddCloseNamespaces(&text, false); in GenerateProxies()
87 text.AddBlankLine(); in GenerateProxies()
91 GenerateInterfaceProxyInterface(config, interface, &text); in GenerateProxies()
92 GenerateInterfaceProxy(config, interface, &text); in GenerateProxies()
95 ObjectManager::GenerateProxy(config, interfaces, &text); in GenerateProxies()
97 text.AddLine(StringPrintf("#endif // %s", header_guard.c_str())); in GenerateProxies()
98 return WriteTextToFile(output_file, text); in GenerateProxies()
107 IndentedText text; in GenerateMocks() local
109 text.AddLine("// Automatic generation of D-Bus interface mock proxies for:"); in GenerateMocks()
111 text.AddLine(StringPrintf("// - %s", interface.name.c_str())); in GenerateMocks()
114 text.AddLine(StringPrintf("#ifndef %s", header_guard.c_str())); in GenerateMocks()
115 text.AddLine(StringPrintf("#define %s", header_guard.c_str())); in GenerateMocks()
116 text.AddLine("#include <string>"); in GenerateMocks()
117 text.AddLine("#include <vector>"); in GenerateMocks()
118 text.AddBlankLine(); in GenerateMocks()
119 text.AddLine("#include <base/callback_forward.h>"); in GenerateMocks()
120 text.AddLine("#include <base/logging.h>"); in GenerateMocks()
121 text.AddLine("#include <base/macros.h>"); in GenerateMocks()
122 text.AddLine("#include <brillo/any.h>"); in GenerateMocks()
123 text.AddLine("#include <brillo/errors/error.h>"); in GenerateMocks()
124 text.AddLine("#include <brillo/variant_dictionary.h>"); in GenerateMocks()
125 text.AddLine("#include <gmock/gmock.h>"); in GenerateMocks()
126 text.AddBlankLine(); in GenerateMocks()
169 text.AddLine(StringPrintf("#include \"%s\"", in GenerateMocks()
171 text.AddBlankLine(); in GenerateMocks()
177 GenerateInterfaceProxyInterface(config, interface, &text); in GenerateMocks()
178 GenerateInterfaceMock(config, interface, &text); in GenerateMocks()
181 text.AddLine(StringPrintf("#endif // %s", header_guard.c_str())); in GenerateMocks()
182 return WriteTextToFile(mock_file, text); in GenerateMocks()
189 IndentedText* text) { in GenerateInterfaceProxyInterface() argument
194 parser.AddOpenNamespaces(text, false); in GenerateInterfaceProxyInterface()
195 text->AddBlankLine(); in GenerateInterfaceProxyInterface()
197 text->AddLine(StringPrintf("// Abstract interface proxy for %s.", in GenerateInterfaceProxyInterface()
199 text->AddComments(interface.doc_string); in GenerateInterfaceProxyInterface()
200 text->AddLine(StringPrintf("class %s {", base_interface_name.c_str())); in GenerateInterfaceProxyInterface()
201 text->AddLineWithOffset("public:", kScopeOffset); in GenerateInterfaceProxyInterface()
202 text->PushOffset(kBlockOffset); in GenerateInterfaceProxyInterface()
203 text->AddLine( in GenerateInterfaceProxyInterface()
207 AddMethodProxy(method, interface.name, true, text); in GenerateInterfaceProxyInterface()
208 AddAsyncMethodProxy(method, interface.name, true, text); in GenerateInterfaceProxyInterface()
211 AddSignalHandlerRegistration(signal, interface.name, true, text); in GenerateInterfaceProxyInterface()
213 AddProperties(config, interface, true, text); in GenerateInterfaceProxyInterface()
214 text->AddBlankLine(); in GenerateInterfaceProxyInterface()
215 text->AddLine("virtual const dbus::ObjectPath& GetObjectPath() const = 0;"); in GenerateInterfaceProxyInterface()
217 AddPropertyPublicMethods(proxy_name, true, text); in GenerateInterfaceProxyInterface()
219 text->PopOffset(); in GenerateInterfaceProxyInterface()
220 text->AddLine("};"); in GenerateInterfaceProxyInterface()
221 text->AddBlankLine(); in GenerateInterfaceProxyInterface()
223 parser.AddCloseNamespaces(text, false); in GenerateInterfaceProxyInterface()
224 text->AddBlankLine(); in GenerateInterfaceProxyInterface()
230 IndentedText* text) { in GenerateInterfaceProxy() argument
235 parser.AddOpenNamespaces(text, false); in GenerateInterfaceProxy()
236 text->AddBlankLine(); in GenerateInterfaceProxy()
238 text->AddLine(StringPrintf("// Interface proxy for %s.", in GenerateInterfaceProxy()
240 text->AddComments(interface.doc_string); in GenerateInterfaceProxy()
241 text->AddLine(StringPrintf("class %s final : public %s {", in GenerateInterfaceProxy()
243 text->AddLineWithOffset("public:", kScopeOffset); in GenerateInterfaceProxy()
244 text->PushOffset(kBlockOffset); in GenerateInterfaceProxy()
245 AddPropertySet(config, interface, text); in GenerateInterfaceProxy()
246 AddConstructor(config, interface, proxy_name, text); in GenerateInterfaceProxy()
247 AddDestructor(proxy_name, text); in GenerateInterfaceProxy()
249 AddSignalHandlerRegistration(signal, interface.name, false, text); in GenerateInterfaceProxy()
251 AddReleaseObjectProxy(text); in GenerateInterfaceProxy()
252 AddGetObjectPath(text); in GenerateInterfaceProxy()
253 AddGetObjectProxy(text); in GenerateInterfaceProxy()
255 AddPropertyPublicMethods(proxy_name, false, text); in GenerateInterfaceProxy()
257 AddMethodProxy(method, interface.name, false, text); in GenerateInterfaceProxy()
258 AddAsyncMethodProxy(method, interface.name, false, text); in GenerateInterfaceProxy()
260 AddProperties(config, interface, false, text); in GenerateInterfaceProxy()
262 text->PopOffset(); in GenerateInterfaceProxy()
263 text->AddBlankLine(); in GenerateInterfaceProxy()
264 text->AddLineWithOffset("private:", kScopeOffset); in GenerateInterfaceProxy()
266 text->PushOffset(kBlockOffset); in GenerateInterfaceProxy()
268 AddOnPropertyChanged(text); in GenerateInterfaceProxy()
269 text->AddLine("scoped_refptr<dbus::Bus> bus_;"); in GenerateInterfaceProxy()
271 text->AddLine("std::string service_name_;"); in GenerateInterfaceProxy()
273 text->AddLine(StringPrintf("const std::string service_name_{\"%s\"};", in GenerateInterfaceProxy()
277 text->AddLine("dbus::ObjectPath object_path_;"); in GenerateInterfaceProxy()
279 text->AddLine(StringPrintf("const dbus::ObjectPath object_path_{\"%s\"};", in GenerateInterfaceProxy()
283 text->AddLine("PropertySet* property_set_;"); in GenerateInterfaceProxy()
284 text->AddLine( in GenerateInterfaceProxy()
289 text->AddLine("dbus::ObjectProxy* dbus_object_proxy_;"); in GenerateInterfaceProxy()
290 text->AddBlankLine(); in GenerateInterfaceProxy()
293 text->AddLine(StringPrintf( in GenerateInterfaceProxy()
297 text->AddLine(StringPrintf("DISALLOW_COPY_AND_ASSIGN(%s);", in GenerateInterfaceProxy()
299 text->PopOffset(); in GenerateInterfaceProxy()
300 text->AddLine("};"); in GenerateInterfaceProxy()
302 text->AddBlankLine(); in GenerateInterfaceProxy()
304 parser.AddCloseNamespaces(text, false); in GenerateInterfaceProxy()
306 text->AddBlankLine(); in GenerateInterfaceProxy()
312 IndentedText* text) { in GenerateInterfaceMock() argument
318 parser.AddOpenNamespaces(text, false); in GenerateInterfaceMock()
319 text->AddBlankLine(); in GenerateInterfaceMock()
321 text->AddLine(StringPrintf("// Mock object for %s.", in GenerateInterfaceMock()
323 text->AddLine(StringPrintf("class %s : public %s {", in GenerateInterfaceMock()
325 text->AddLineWithOffset("public:", kScopeOffset); in GenerateInterfaceMock()
326 text->PushOffset(kBlockOffset); in GenerateInterfaceMock()
327 text->AddLine(StringPrintf("%s() = default;", mock_name.c_str())); in GenerateInterfaceMock()
328 text->AddBlankLine(); in GenerateInterfaceMock()
331 AddMethodMock(method, interface.name, text); in GenerateInterfaceMock()
332 AddAsyncMethodMock(method, interface.name, text); in GenerateInterfaceMock()
335 AddSignalHandlerRegistrationMock(signal, text); in GenerateInterfaceMock()
344 text->AddLine(StringPrintf("MOCK_CONST_METHOD0(%s, %s());", in GenerateInterfaceMock()
347 text->AddLine(StringPrintf("MOCK_METHOD2(set_%s, void(%s, " in GenerateInterfaceMock()
352 text->AddLine( in GenerateInterfaceMock()
355 text->AddLineAndPushOffsetTo( in GenerateInterfaceMock()
357 text->AddLine(StringPrintf( in GenerateInterfaceMock()
360 text->PopOffset(); in GenerateInterfaceMock()
363 text->PopOffset(); in GenerateInterfaceMock()
364 text->AddBlankLine(); in GenerateInterfaceMock()
365 text->AddLineWithOffset("private:", kScopeOffset); in GenerateInterfaceMock()
366 text->AddLineWithOffset(StringPrintf("DISALLOW_COPY_AND_ASSIGN(%s);", in GenerateInterfaceMock()
369 text->AddLine("};"); in GenerateInterfaceMock()
371 parser.AddCloseNamespaces(text, false); in GenerateInterfaceMock()
372 text->AddBlankLine(); in GenerateInterfaceMock()
379 IndentedText* text) { in AddConstructor() argument
414 text->AddBlock(block); in AddConstructor()
419 IndentedText* text) { in AddDestructor() argument
423 text->AddBlock(block); in AddDestructor()
427 void ProxyGenerator::AddReleaseObjectProxy(IndentedText* text) { in AddReleaseObjectProxy() argument
428 text->AddBlankLine(); in AddReleaseObjectProxy()
429 text->AddLine("void ReleaseObjectProxy(const base::Closure& callback) {"); in AddReleaseObjectProxy()
430 text->AddLineWithOffset( in AddReleaseObjectProxy()
433 text->AddLine("}"); in AddReleaseObjectProxy()
437 void ProxyGenerator::AddGetObjectPath(IndentedText* text) { in AddGetObjectPath() argument
438 text->AddBlankLine(); in AddGetObjectPath()
439 text->AddLine("const dbus::ObjectPath& GetObjectPath() const override {"); in AddGetObjectPath()
440 text->AddLineWithOffset("return object_path_;", kBlockOffset); in AddGetObjectPath()
441 text->AddLine("}"); in AddGetObjectPath()
445 void ProxyGenerator::AddGetObjectProxy(IndentedText* text) { in AddGetObjectProxy() argument
446 text->AddBlankLine(); in AddGetObjectProxy()
447 text->AddLine("dbus::ObjectProxy* GetObjectProxy() const { " in AddGetObjectProxy()
454 IndentedText* text) { in AddPropertyPublicMethods() argument
455 text->AddBlankLine(); in AddPropertyPublicMethods()
456 text->AddLine(StringPrintf("%svoid SetPropertyChangedCallback(", in AddPropertyPublicMethods()
458 text->AddLineWithOffset( in AddPropertyPublicMethods()
465 text->AddLineWithOffset("on_property_changed_ = callback;", kBlockOffset); in AddPropertyPublicMethods()
466 text->AddLine("}"); in AddPropertyPublicMethods()
467 text->AddBlankLine(); in AddPropertyPublicMethods()
469 text->AddLine( in AddPropertyPublicMethods()
471 text->AddLine("PropertySet* GetProperties() { return property_set_; }"); in AddPropertyPublicMethods()
476 void ProxyGenerator::AddOnPropertyChanged(IndentedText* text) { in AddOnPropertyChanged() argument
477 text->AddLine("void OnPropertyChanged(const std::string& property_name) {"); in AddOnPropertyChanged()
478 text->PushOffset(kBlockOffset); in AddOnPropertyChanged()
479 text->AddLine("if (!on_property_changed_.is_null())"); in AddOnPropertyChanged()
480 text->PushOffset(kBlockOffset); in AddOnPropertyChanged()
481 text->AddLine("on_property_changed_.Run(this, property_name);"); in AddOnPropertyChanged()
482 text->PopOffset(); in AddOnPropertyChanged()
483 text->PopOffset(); in AddOnPropertyChanged()
484 text->AddLine("}"); in AddOnPropertyChanged()
485 text->AddBlankLine(); in AddOnPropertyChanged()
492 IndentedText* text) { in AddSignalHandlerRegistration() argument
517 text->AddBlock(block); in AddSignalHandlerRegistration()
523 IndentedText* text) { in AddPropertySet() argument
571 text->AddBlock(block); in AddPropertySet()
578 IndentedText* text) { in AddProperties() argument
584 text->AddBlankLine(); in AddProperties()
589 text->AddLine( in AddProperties()
599 text->AddBlankLine(); in AddProperties()
600 text->AddLine( in AddProperties()
607 text->AddLineWithOffset( in AddProperties()
610 text->AddLine("}"); in AddProperties()
614 text->AddBlankLine(); in AddProperties()
615 text->AddLineAndPushOffsetTo( in AddProperties()
621 text->AddLine( in AddProperties()
624 text->PopOffset(); in AddProperties()
626 text->AddLineWithOffset( in AddProperties()
629 text->AddLine("}"); in AddProperties()
639 IndentedText* text) { in AddMethodProxy() argument
699 text->AddBlock(block); in AddMethodProxy()
706 IndentedText* text) { in AddAsyncMethodProxy() argument
765 text->AddBlock(block); in AddAsyncMethodProxy()
771 IndentedText* text) { in AddMethodMock() argument
792 AddMockMethodDeclaration(method.name, "bool", arguments, text); in AddMethodMock()
798 IndentedText* text) { in AddAsyncMethodMock() argument
824 AddMockMethodDeclaration(method.name + "Async", "void", arguments, text); in AddAsyncMethodMock()
830 IndentedText* text) { in AddMockMethodDeclaration() argument
874 text->AddBlock(block); in AddMockMethodDeclaration()
880 IndentedText* text) { in AddSignalHandlerRegistrationMock() argument
898 text->AddBlock(block); in AddSignalHandlerRegistrationMock()
943 IndentedText* text) { in GenerateProxy() argument
948 object_manager.AddOpenNamespaces(text, false); in GenerateProxy()
949 text->AddBlankLine(); in GenerateProxy()
952 text->AddLine(StringPrintf("class %s : " in GenerateProxy()
955 text->AddLineWithOffset("public:", kScopeOffset); in GenerateProxy()
956 text->PushOffset(kBlockOffset); in GenerateProxy()
958 AddConstructor(config, class_name, interfaces, text); in GenerateProxy()
959 AddDestructor(class_name, interfaces, text); in GenerateProxy()
960 AddGetObjectManagerProxy(text); in GenerateProxy()
962 AddInterfaceAccessors(itf, text); in GenerateProxy()
964 text->PopOffset(); in GenerateProxy()
966 text->AddLineWithOffset("private:", kScopeOffset); in GenerateProxy()
967 text->PushOffset(kBlockOffset); in GenerateProxy()
968 AddOnPropertyChanged(interfaces, text); in GenerateProxy()
969 AddObjectAdded(config, interfaces, text); in GenerateProxy()
970 AddObjectRemoved(interfaces, text); in GenerateProxy()
971 AddCreateProperties(interfaces, class_name, text); in GenerateProxy()
972 AddDataMembers(config, interfaces, class_name, text); in GenerateProxy()
974 text->AddLine(StringPrintf("DISALLOW_COPY_AND_ASSIGN(%s);", in GenerateProxy()
976 text->PopOffset(); in GenerateProxy()
977 text->AddLine("};"); in GenerateProxy()
978 text->AddBlankLine(); in GenerateProxy()
979 object_manager.AddCloseNamespaces(text, false); in GenerateProxy()
980 text->AddBlankLine(); in GenerateProxy()
987 IndentedText* text) { in AddConstructor() argument
989 text->AddLineAndPushOffsetTo( in AddConstructor()
993 text->AddLine("const std::string& service_name)"); in AddConstructor()
994 text->PopOffset(); in AddConstructor()
996 text->AddLine(StringPrintf("%s(const scoped_refptr<dbus::Bus>& bus)", in AddConstructor()
999 text->PushOffset(kLineContinuationOffset); in AddConstructor()
1000 text->AddLine(": bus_{bus},"); in AddConstructor()
1001 text->PushOffset(kBlockOffset); in AddConstructor()
1003 text->AddLine("service_name_{service_name},"); in AddConstructor()
1005 text->AddLine("dbus_object_manager_{bus->GetObjectManager("); in AddConstructor()
1006 text->PushOffset(kLineContinuationOffset); in AddConstructor()
1008 text->AddLine("service_name,"); in AddConstructor()
1010 text->AddLine(StringPrintf("\"%s\",", config.service_name.c_str())); in AddConstructor()
1012 text->AddLine(StringPrintf("dbus::ObjectPath{\"%s\"})} {", in AddConstructor()
1014 text->PopOffset(); in AddConstructor()
1015 text->PopOffset(); in AddConstructor()
1016 text->PopOffset(); in AddConstructor()
1017 text->PushOffset(kBlockOffset); in AddConstructor()
1019 text->AddLine( in AddConstructor()
1023 text->PopOffset(); in AddConstructor()
1024 text->AddLine("}"); in AddConstructor()
1025 text->AddBlankLine(); in AddConstructor()
1031 IndentedText* text) { in AddDestructor() argument
1032 text->AddLine(StringPrintf("~%s() override {", class_name.c_str())); in AddDestructor()
1033 text->PushOffset(kBlockOffset); in AddDestructor()
1035 text->AddLine( in AddDestructor()
1039 text->PopOffset(); in AddDestructor()
1040 text->AddLine("}"); in AddDestructor()
1041 text->AddBlankLine(); in AddDestructor()
1045 IndentedText* text) { in AddGetObjectManagerProxy() argument
1046 text->AddLine("dbus::ObjectManager* GetObjectManagerProxy() const {"); in AddGetObjectManagerProxy()
1047 text->AddLineWithOffset("return dbus_object_manager_;", kBlockOffset); in AddGetObjectManagerProxy()
1048 text->AddLine("}"); in AddGetObjectManagerProxy()
1049 text->AddBlankLine(); in AddGetObjectManagerProxy()
1054 IndentedText* text) { in AddInterfaceAccessors() argument
1061 text->AddLine(StringPrintf("%sInterface* Get%s(", in AddInterfaceAccessors()
1064 text->PushOffset(kLineContinuationOffset); in AddInterfaceAccessors()
1065 text->AddLine("const dbus::ObjectPath& object_path) {"); in AddInterfaceAccessors()
1066 text->PopOffset(); in AddInterfaceAccessors()
1067 text->PushOffset(kBlockOffset); in AddInterfaceAccessors()
1068 text->AddLine(StringPrintf("auto p = %s.find(object_path);", in AddInterfaceAccessors()
1070 text->AddLine(StringPrintf("if (p != %s.end())", map_name.c_str())); in AddInterfaceAccessors()
1071 text->PushOffset(kBlockOffset); in AddInterfaceAccessors()
1072 text->AddLine("return p->second.get();"); in AddInterfaceAccessors()
1073 text->PopOffset(); in AddInterfaceAccessors()
1074 text->AddLine("return nullptr;"); in AddInterfaceAccessors()
1075 text->PopOffset(); in AddInterfaceAccessors()
1076 text->AddLine("}"); in AddInterfaceAccessors()
1080 text->AddLine(StringPrintf("%sInterface* Get%s() {", in AddInterfaceAccessors()
1083 text->PushOffset(kBlockOffset); in AddInterfaceAccessors()
1084 text->AddLine(StringPrintf("if (%s.empty())", map_name.c_str())); in AddInterfaceAccessors()
1085 text->AddLineWithOffset("return nullptr;", kBlockOffset); in AddInterfaceAccessors()
1086 text->AddLine(StringPrintf("return %s.begin()->second.get();", in AddInterfaceAccessors()
1088 text->PopOffset(); in AddInterfaceAccessors()
1089 text->AddLine("}"); in AddInterfaceAccessors()
1093 text->AddLine( in AddInterfaceAccessors()
1097 text->PushOffset(kBlockOffset); in AddInterfaceAccessors()
1098 text->AddLine(StringPrintf("std::vector<%sInterface*> values;", in AddInterfaceAccessors()
1100 text->AddLine(StringPrintf("values.reserve(%s.size());", map_name.c_str())); in AddInterfaceAccessors()
1101 text->AddLine(StringPrintf("for (const auto& pair : %s)", map_name.c_str())); in AddInterfaceAccessors()
1102 text->AddLineWithOffset("values.push_back(pair.second.get());", kBlockOffset); in AddInterfaceAccessors()
1103 text->AddLine("return values;"); in AddInterfaceAccessors()
1104 text->PopOffset(); in AddInterfaceAccessors()
1105 text->AddLine("}"); in AddInterfaceAccessors()
1108 text->AddLine(StringPrintf("void Set%sAddedCallback(", in AddInterfaceAccessors()
1110 text->PushOffset(kLineContinuationOffset); in AddInterfaceAccessors()
1111 text->AddLine( in AddInterfaceAccessors()
1114 text->PopOffset(); in AddInterfaceAccessors()
1115 text->PushOffset(kBlockOffset); in AddInterfaceAccessors()
1116 text->AddLine(StringPrintf("on_%s_added_ = callback;", in AddInterfaceAccessors()
1118 text->PopOffset(); in AddInterfaceAccessors()
1119 text->AddLine("}"); in AddInterfaceAccessors()
1122 text->AddLine(StringPrintf("void Set%sRemovedCallback(", in AddInterfaceAccessors()
1124 text->PushOffset(kLineContinuationOffset); in AddInterfaceAccessors()
1125 text->AddLine("const base::Callback<void(const dbus::ObjectPath&)>& " in AddInterfaceAccessors()
1127 text->PopOffset(); in AddInterfaceAccessors()
1128 text->PushOffset(kBlockOffset); in AddInterfaceAccessors()
1129 text->AddLine(StringPrintf("on_%s_removed_ = callback;", in AddInterfaceAccessors()
1131 text->PopOffset(); in AddInterfaceAccessors()
1132 text->AddLine("}"); in AddInterfaceAccessors()
1134 text->AddBlankLine(); in AddInterfaceAccessors()
1139 IndentedText* text) { in AddOnPropertyChanged() argument
1147 text->AddLineAndPushOffsetTo("void OnPropertyChanged(" in AddOnPropertyChanged()
1150 text->AddLine("const std::string& /* interface_name */,"); in AddOnPropertyChanged()
1151 text->AddLine("const std::string& /* property_name */) {}"); in AddOnPropertyChanged()
1152 text->PopOffset(); in AddOnPropertyChanged()
1153 text->AddBlankLine(); in AddOnPropertyChanged()
1156 text->AddLineAndPushOffsetTo("void OnPropertyChanged(" in AddOnPropertyChanged()
1159 text->AddLine("const std::string& interface_name,"); in AddOnPropertyChanged()
1160 text->AddLine("const std::string& property_name) {"); in AddOnPropertyChanged()
1161 text->PopOffset(); in AddOnPropertyChanged()
1162 text->PushOffset(kBlockOffset); in AddOnPropertyChanged()
1168 text->AddLine(StringPrintf("if (interface_name == \"%s\") {", in AddOnPropertyChanged()
1170 text->PushOffset(kBlockOffset); in AddOnPropertyChanged()
1172 text->AddLine(StringPrintf("auto p = %s.find(object_path);", in AddOnPropertyChanged()
1174 text->AddLine(StringPrintf("if (p == %s.end())", map_name.c_str())); in AddOnPropertyChanged()
1175 text->PushOffset(kBlockOffset); in AddOnPropertyChanged()
1176 text->AddLine("return;"); in AddOnPropertyChanged()
1177 text->PopOffset(); in AddOnPropertyChanged()
1178 text->AddLine("p->second->OnPropertyChanged(property_name);"); in AddOnPropertyChanged()
1179 text->AddLine("return;"); in AddOnPropertyChanged()
1180 text->PopOffset(); in AddOnPropertyChanged()
1181 text->AddLine("}"); in AddOnPropertyChanged()
1183 text->PopOffset(); in AddOnPropertyChanged()
1184 text->AddLine("}"); in AddOnPropertyChanged()
1185 text->AddBlankLine(); in AddOnPropertyChanged()
1191 IndentedText* text) { in AddObjectAdded() argument
1192 text->AddLine("void ObjectAdded("); in AddObjectAdded()
1193 text->PushOffset(kLineContinuationOffset); in AddObjectAdded()
1194 text->AddLine("const dbus::ObjectPath& object_path,"); in AddObjectAdded()
1195 text->AddLine("const std::string& interface_name) override {"); in AddObjectAdded()
1196 text->PopOffset(); in AddObjectAdded()
1197 text->PushOffset(kBlockOffset); in AddObjectAdded()
1201 text->AddLine(StringPrintf("if (interface_name == \"%s\") {", in AddObjectAdded()
1203 text->PushOffset(kBlockOffset); in AddObjectAdded()
1205 text->AddLine("auto property_set ="); in AddObjectAdded()
1206 text->PushOffset(kLineContinuationOffset); in AddObjectAdded()
1207 text->AddLine(StringPrintf("static_cast<%s::PropertySet*>(", in AddObjectAdded()
1209 text->PushOffset(kLineContinuationOffset); in AddObjectAdded()
1210 text->AddLine("dbus_object_manager_->GetProperties(object_path, " in AddObjectAdded()
1212 text->PopOffset(); in AddObjectAdded()
1213 text->PopOffset(); in AddObjectAdded()
1215 text->AddLine(StringPrintf("std::unique_ptr<%s> %s_proxy{", in AddObjectAdded()
1218 text->PushOffset(kBlockOffset); in AddObjectAdded()
1229 text->AddLine(new_instance); in AddObjectAdded()
1230 text->PopOffset(); in AddObjectAdded()
1231 text->AddLine("};"); in AddObjectAdded()
1232 text->AddLine(StringPrintf("auto p = %s_instances_.emplace(object_path, " in AddObjectAdded()
1235 text->AddLine(StringPrintf("if (!on_%s_added_.is_null())", in AddObjectAdded()
1237 text->PushOffset(kBlockOffset); in AddObjectAdded()
1238 text->AddLine(StringPrintf("on_%s_added_.Run(p.first->second.get());", in AddObjectAdded()
1240 text->PopOffset(); in AddObjectAdded()
1241 text->AddLine("return;"); in AddObjectAdded()
1242 text->PopOffset(); in AddObjectAdded()
1243 text->AddLine("}"); in AddObjectAdded()
1245 text->PopOffset(); in AddObjectAdded()
1246 text->AddLine("}"); in AddObjectAdded()
1247 text->AddBlankLine(); in AddObjectAdded()
1252 IndentedText* text) { in AddObjectRemoved() argument
1253 text->AddLine("void ObjectRemoved("); in AddObjectRemoved()
1254 text->PushOffset(kLineContinuationOffset); in AddObjectRemoved()
1255 text->AddLine("const dbus::ObjectPath& object_path,"); in AddObjectRemoved()
1256 text->AddLine("const std::string& interface_name) override {"); in AddObjectRemoved()
1257 text->PopOffset(); in AddObjectRemoved()
1258 text->PushOffset(kBlockOffset); in AddObjectRemoved()
1262 text->AddLine(StringPrintf("if (interface_name == \"%s\") {", in AddObjectRemoved()
1264 text->PushOffset(kBlockOffset); in AddObjectRemoved()
1265 text->AddLine(StringPrintf("auto p = %s_instances_.find(object_path);", in AddObjectRemoved()
1267 text->AddLine(StringPrintf("if (p != %s_instances_.end()) {", in AddObjectRemoved()
1269 text->PushOffset(kBlockOffset); in AddObjectRemoved()
1270 text->AddLine(StringPrintf("if (!on_%s_removed_.is_null())", in AddObjectRemoved()
1272 text->PushOffset(kBlockOffset); in AddObjectRemoved()
1273 text->AddLine(StringPrintf("on_%s_removed_.Run(object_path);", in AddObjectRemoved()
1275 text->PopOffset(); in AddObjectRemoved()
1276 text->AddLine(StringPrintf("%s_instances_.erase(p);", in AddObjectRemoved()
1278 text->PopOffset(); in AddObjectRemoved()
1279 text->AddLine("}"); in AddObjectRemoved()
1280 text->AddLine("return;"); in AddObjectRemoved()
1281 text->PopOffset(); in AddObjectRemoved()
1282 text->AddLine("}"); in AddObjectRemoved()
1284 text->PopOffset(); in AddObjectRemoved()
1285 text->AddLine("}"); in AddObjectRemoved()
1286 text->AddBlankLine(); in AddObjectRemoved()
1292 IndentedText* text) { in AddCreateProperties() argument
1293 text->AddLine("dbus::PropertySet* CreateProperties("); in AddCreateProperties()
1294 text->PushOffset(kLineContinuationOffset); in AddCreateProperties()
1295 text->AddLine("dbus::ObjectProxy* object_proxy,"); in AddCreateProperties()
1296 text->AddLine("const dbus::ObjectPath& object_path,"); in AddCreateProperties()
1297 text->AddLine("const std::string& interface_name) override {"); in AddCreateProperties()
1298 text->PopOffset(); in AddCreateProperties()
1299 text->PushOffset(kBlockOffset); in AddCreateProperties()
1302 text->AddLine(StringPrintf("if (interface_name == \"%s\") {", in AddCreateProperties()
1304 text->PushOffset(kBlockOffset); in AddCreateProperties()
1305 text->AddLine(StringPrintf("return new %s::PropertySet{", in AddCreateProperties()
1307 text->PushOffset(kLineContinuationOffset); in AddCreateProperties()
1308 text->AddLine("object_proxy,"); in AddCreateProperties()
1309 text->AddLineAndPushOffsetTo( in AddCreateProperties()
1313 text->AddLine("weak_ptr_factory_.GetWeakPtr(),"); in AddCreateProperties()
1314 text->AddLine("object_path,"); in AddCreateProperties()
1315 text->AddLine("interface_name)"); in AddCreateProperties()
1316 text->PopOffset(); in AddCreateProperties()
1317 text->PopOffset(); in AddCreateProperties()
1318 text->AddLine("};"); in AddCreateProperties()
1319 text->PopOffset(); in AddCreateProperties()
1320 text->AddLine("}"); in AddCreateProperties()
1322 text->AddLineAndPushOffsetTo("LOG(FATAL) << \"Creating properties for " in AddCreateProperties()
1324 text->AddLine("<< interface_name;"); in AddCreateProperties()
1325 text->PopOffset(); in AddCreateProperties()
1326 text->AddLine("return nullptr;"); in AddCreateProperties()
1327 text->PopOffset(); in AddCreateProperties()
1328 text->AddLine("}"); in AddCreateProperties()
1329 text->AddBlankLine(); in AddCreateProperties()
1336 IndentedText* text) { in AddDataMembers() argument
1337 text->AddLine("scoped_refptr<dbus::Bus> bus_;"); in AddDataMembers()
1339 text->AddLine("std::string service_name_;"); in AddDataMembers()
1341 text->AddLine("dbus::ObjectManager* dbus_object_manager_;"); in AddDataMembers()
1345 text->AddLineAndPushOffsetTo("std::map<dbus::ObjectPath,", 1, '<'); in AddDataMembers()
1346 text->AddLine(StringPrintf("std::unique_ptr<%s>> %s_instances_;", in AddDataMembers()
1349 text->PopOffset(); in AddDataMembers()
1350 text->AddLine( in AddDataMembers()
1354 text->AddLine(StringPrintf("base::Callback<void(const dbus::ObjectPath&)> " in AddDataMembers()
1358 text->AddLine( in AddDataMembers()
1361 text->AddBlankLine(); in AddDataMembers()