Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: mojo/public/tools/bindings/pylib/mojom/generate/module.py

Issue 551053002: mojo: Adding struct's fields for python bindings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding constructors. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 return (self.namespace + '.' + 142 return (self.namespace + '.' +
143 (self.parent_kind and (self.parent_kind.name + '.') or "") + 143 (self.parent_kind and (self.parent_kind.name + '.') or "") +
144 self.name) 144 self.name)
145 145
146 146
147 class BuiltinValue(object): 147 class BuiltinValue(object):
148 def __init__(self, value): 148 def __init__(self, value):
149 self.value = value 149 self.value = value
150 150
151 151
152 class ConstantValue(NamedValue):
153 def __init__(self, module, parent_kind, constant):
154 NamedValue.__init__(self, module, parent_kind, constant.name)
155 self.constant = constant
156
157
152 class EnumValue(NamedValue): 158 class EnumValue(NamedValue):
153 def __init__(self, module, enum, field): 159 def __init__(self, module, enum, field):
154 NamedValue.__init__(self, module, enum.parent_kind, field.name) 160 NamedValue.__init__(self, module, enum.parent_kind, field.name)
155 self.enum = enum 161 self.enum = enum
156 162
157 def GetSpec(self): 163 def GetSpec(self):
158 return (self.namespace + '.' + 164 return (self.namespace + '.' +
159 (self.parent_kind and (self.parent_kind.name + '.') or "") + 165 (self.parent_kind and (self.parent_kind.name + '.') or "") +
160 self.enum.name + '.' + self.name) 166 self.enum.name + '.' + self.name)
161 167
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 def IsMoveOnlyKind(kind): 416 def IsMoveOnlyKind(kind):
411 return IsObjectKind(kind) or IsAnyHandleKind(kind) 417 return IsObjectKind(kind) or IsAnyHandleKind(kind)
412 418
413 419
414 def HasCallbacks(interface): 420 def HasCallbacks(interface):
415 for method in interface.methods: 421 for method in interface.methods:
416 if method.response_parameters != None: 422 if method.response_parameters != None:
417 return True 423 return True
418 return False 424 return False
419 425
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698