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

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

Issue 545433002: mojo: Generate top level enums for python bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unhelpful conditional 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 EnumValue(NamedValue): 152 class EnumValue(NamedValue):
153 def __init__(self, module, enum, field): 153 def __init__(self, module, enum, field):
154 NamedValue.__init__(self, module, enum.parent_kind, field.name) 154 NamedValue.__init__(self, module, enum.parent_kind, field.name)
155 self.enum_name = enum.name 155 self.enum = enum
156 156
157 def GetSpec(self): 157 def GetSpec(self):
158 return (self.namespace + '.' + 158 return (self.namespace + '.' +
159 (self.parent_kind and (self.parent_kind.name + '.') or "") + 159 (self.parent_kind and (self.parent_kind.name + '.') or "") +
160 self.enum_name + '.' + self.name) 160 self.enum.name + '.' + self.name)
161 161
162 162
163 class Constant(object): 163 class Constant(object):
164 def __init__(self, name=None, kind=None, value=None): 164 def __init__(self, name=None, kind=None, value=None):
165 self.name = name 165 self.name = name
166 self.kind = kind 166 self.kind = kind
167 self.value = value 167 self.value = value
168 168
169 169
170 class Field(object): 170 class Field(object):
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 def IsMoveOnlyKind(kind): 410 def IsMoveOnlyKind(kind):
411 return IsObjectKind(kind) or IsAnyHandleKind(kind) 411 return IsObjectKind(kind) or IsAnyHandleKind(kind)
412 412
413 413
414 def HasCallbacks(interface): 414 def HasCallbacks(interface):
415 for method in interface.methods: 415 for method in interface.methods:
416 if method.response_parameters != None: 416 if method.response_parameters != None:
417 return True 417 return True
418 return False 418 return False
419 419
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698