OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # This module's classes provide an interface to mojo modules. Modules are | 5 # This module's classes provide an interface to mojo modules. Modules are |
6 # collections of interfaces and structs to be used by mojo ipc clients and | 6 # collections of interfaces and structs to be used by mojo ipc clients and |
7 # servers. | 7 # servers. |
8 # | 8 # |
9 # A simple interface would be created this way: | 9 # A simple interface would be created this way: |
10 # module = mojom.generate.module.Module('Foo') | 10 # module = mojom.generate.module.Module('Foo') |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 class Module(object): | 214 class Module(object): |
215 def __init__(self, name=None, namespace=None): | 215 def __init__(self, name=None, namespace=None): |
216 self.name = name | 216 self.name = name |
217 self.path = name | 217 self.path = name |
218 self.namespace = namespace | 218 self.namespace = namespace |
219 self.structs = [] | 219 self.structs = [] |
220 self.interfaces = [] | 220 self.interfaces = [] |
221 | 221 |
222 def AddInterface(self, name): | 222 def AddInterface(self, name): |
223 interface=Interface(name, module=self); | 223 self.interfaces.append(Interface(name, module=self)) |
224 self.interfaces.append(interface) | |
225 return interface | 224 return interface |
226 | 225 |
227 def AddStruct(self, name): | 226 def AddStruct(self, name): |
228 struct=Struct(name, module=self) | 227 struct=Struct(name, module=self) |
229 self.structs.append(struct) | 228 self.structs.append(struct) |
230 return struct | 229 return struct |
OLD | NEW |