Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
scripts.idlnode.IDLNode Class Reference
Inheritance diagram for scripts.idlnode.IDLNode:
scripts.idlnode.IDLArgument scripts.idlnode.IDLCallbackFunction scripts.idlnode.IDLDictNode scripts.idlnode.IDLDictionary scripts.idlnode.IDLEnum scripts.idlnode.IDLExtAttrFunctionValue scripts.idlnode.IDLFile scripts.idlnode.IDLImplementsStatement scripts.idlnode.IDLInterface scripts.idlnode.IDLMember scripts.idlnode.IDLModule scripts.idlnode.IDLParentInterface scripts.idlnode.IDLType scripts.idlnode.IDLTypeDef

Public Member Functions

def __init__ (self, ast, id=None)
 
def __repr__ (self)
 
def __eq__ (self, other)
 
def __hash__ (self)
 
def reset_id (self, newId)
 
def all (self, type_filter=None)
 
def to_dict (self)
 
def to_hash (self)
 

Public Attributes

 id
 
 ext_attrs
 
 annotations
 
 members
 

Detailed Description

Base class for all IDL elements.
IDLNode may contain various child nodes, and have properties. Examples
of IDLNode are interfaces, interface members, function arguments,
etc.

Definition at line 59 of file idlnode.py.

Constructor & Destructor Documentation

◆ __init__()

def scripts.idlnode.IDLNode.__init__ (   self,
  ast,
  id = None 
)

Member Function Documentation

◆ __eq__()

def scripts.idlnode.IDLNode.__eq__ (   self,
  other 
)
Override default equals operation.
IDLNodes are equal if all their properties are equal.

Definition at line 92 of file idlnode.py.

92 def __eq__(self, other):
93 """Override default equals operation.
94 IDLNodes are equal if all their properties are equal."""
95 if other is None or not isinstance(other, IDLNode):
96 return 1
97 return self.__dict__.__eq__(other.__dict__)
98

◆ __hash__()

def scripts.idlnode.IDLNode.__hash__ (   self)
Define default hashing behavior.
In order to comply with a == b => hash(a) == hash(b), we recursively iterate
self.__dict__ and convert all objects to hashable objects.

Definition at line 99 of file idlnode.py.

99 def __hash__(self):
100 """Define default hashing behavior.
101 In order to comply with a == b => hash(a) == hash(b), we recursively iterate
102 self.__dict__ and convert all objects to hashable objects."""
103 return self.to_hash()
104
static uint32_t hash(const SkShaderBase::GradientInfo &v)

◆ __repr__()

def scripts.idlnode.IDLNode.__repr__ (   self)
Generates string of the form <class id extra extra ... 0x12345678>.

Reimplemented in scripts.idlnode.IDLOperation, and scripts.idlnode.IDLArgument.

Definition at line 74 of file idlnode.py.

74 def __repr__(self):
75 """Generates string of the form <class id extra extra ... 0x12345678>."""
76 extras = self._extra_repr()
77 if isinstance(extras, list):
78 extras = ' '.join([str(e) for e in extras])
79 try:
80 if self.id:
81 return '<%s %s 0x%x>' % (type(self).__name__,
82 ('%s %s' % (self.id, extras)).strip(),
83 hash(self))
84 return '<%s %s 0x%x>' % (type(self).__name__, extras, hash(self))
85 except Exception as e:
86 return "can't convert to string: %s" % e
87
GLenum type
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ all()

def scripts.idlnode.IDLNode.all (   self,
  type_filter = None 
)
Returns a list containing this node and all it child nodes
(recursive).

Args:
type_filter -- can be used to limit the results to a specific
node type (e.g. IDLOperation).

Definition at line 110 of file idlnode.py.

110 def all(self, type_filter=None):
111 """Returns a list containing this node and all it child nodes
112 (recursive).
113
114 Args:
115 type_filter -- can be used to limit the results to a specific
116 node type (e.g. IDLOperation).
117 """
118 res = []
119 if type_filter is None or isinstance(self, type_filter):
120 res.append(self)
121 for v in self._all_subnodes():
122 if isinstance(v, IDLNode):
123 res.extend(v.all(type_filter))
124 elif isinstance(v, list):
125 for item in v:
126 if isinstance(item, IDLNode):
127 res.extend(item.all(type_filter))
128 return res
129
SIT bool all(const Vec< 1, T > &x)
Definition: SkVx.h:582

◆ reset_id()

def scripts.idlnode.IDLNode.reset_id (   self,
  newId 
)
Reset the id of the Node.  This is typically done during a normalization
phase (e.g., "DOMWindow" -> "Window").

Reimplemented in scripts.idlnode.IDLInterface.

Definition at line 105 of file idlnode.py.

105 def reset_id(self, newId):
106 """Reset the id of the Node. This is typically done during a normalization
107 phase (e.g., "DOMWindow" -> "Window")."""
108 self.id = newId
109

◆ to_dict()

def scripts.idlnode.IDLNode.to_dict (   self)
Converts the IDLNode and its children into a dictionary.
This method is useful mostly for debugging and pretty printing.

Reimplemented in scripts.idlnode.IDLDictNode.

Definition at line 134 of file idlnode.py.

134 def to_dict(self):
135 """Converts the IDLNode and its children into a dictionary.
136 This method is useful mostly for debugging and pretty printing.
137 """
138 res = {}
139 for (k, v) in self.__dict__.items():
140 if v == None or v == False or v == [] or v == {}:
141 # Skip empty/false members.
142 continue
143 elif isinstance(v, IDLDictNode) and not len(v):
144 # Skip empty dict sub-nodes.
145 continue
146 elif isinstance(v, list):
147 # Convert lists:
148 new_v = []
149 for sub_node in v:
150 if isinstance(sub_node, IDLNode):
151 # Convert sub-node:
152 new_v.append(sub_node.to_dict())
153 else:
154 new_v.append(sub_node)
155 v = new_v
156 elif isinstance(v, IDLNode):
157 # Convert sub-node:
158 v = v.to_dict()
159 res[k] = v
160 return res
161

◆ to_hash()

def scripts.idlnode.IDLNode.to_hash (   self)

Definition at line 162 of file idlnode.py.

162 def to_hash(self):
163 return hash(self._to_hashable(self))
164

Member Data Documentation

◆ annotations

scripts.idlnode.IDLNode.annotations

Definition at line 342 of file idlnode.py.

◆ ext_attrs

scripts.idlnode.IDLNode.ext_attrs

Definition at line 338 of file idlnode.py.

◆ id

scripts.idlnode.IDLNode.id

Definition at line 69 of file idlnode.py.

◆ members

scripts.idlnode.IDLNode.members

Definition at line 346 of file idlnode.py.


The documentation for this class was generated from the following file: