Public Member Functions | Public Attributes | List of all members
search.Finder Class Reference

Public Member Functions

def __init__ (self, cn, name, row_type=str)
 
def match (self, row)
 
def fileName (self, id_file)
 
def fileId (self, name)
 
def references (self)
 
def function (self)
 
def file (self)
 
def macro (self)
 
def typedef (self)
 
def variable (self)
 
def params (self)
 
def struct (self)
 
def includers (self)
 
def includees (self)
 
def members (self)
 
def baseClasses (self)
 
def subClasses (self)
 

Public Attributes

 cn
 
 name
 
 row_type
 

Detailed Description

Definition at line 64 of file search.py.

Constructor & Destructor Documentation

def search.Finder.__init__ (   self,
  cn,
  name,
  row_type = str 
)

Definition at line 65 of file search.py.

65  def __init__(self,cn,name,row_type=str):
66  self.cn=cn
67  self.name=name
68  self.row_type=row_type
69 
def __init__(self, cn, name, row_type=str)
Definition: search.py:65

Member Function Documentation

def search.Finder.baseClasses (   self)

Definition at line 236 of file search.py.

236  def baseClasses(self):
237  o=[]
238  c=self.cn.execute('SELECT base FROM basecompoundref WHERE'+self.match("derived"),[self.name])
239  for r in c.fetchall():
240  item={}
241  item['name'] = r['base']
242  o.append(item)
243  return o
def baseClasses(self)
Definition: search.py:236
def match(self, row)
Definition: search.py:70
def search.Finder.file (   self)

Definition at line 135 of file search.py.

135  def file(self):
136  o=[]
137  for r in self.cn.execute("SELECT rowid,* FROM files WHERE"+self.match("name"),[self.name]).fetchall():
138  item={}
139  item['name'] = r['name']
140  item['id'] = r['rowid']
141  o.append(item)
142  return o
143 
def file(self)
Definition: search.py:135
def match(self, row)
Definition: search.py:70
def search.Finder.fileId (   self,
  name 
)

Definition at line 88 of file search.py.

88  def fileId(self,name):
89  if self.cn.execute("SELECT COUNT(*) FROM files WHERE"+self.match("name"),[name]).fetchone()[0] > 1:
90  print >>sys.stderr,"WARNING: non-uniq file name [%s]. Considering only the first match." % name
91 
92  for r in self.cn.execute("SELECT rowid FROM files WHERE"+self.match("name"),[name]).fetchall():
93  return r[0]
94 
95  return -1
def fileId(self, name)
Definition: search.py:88
def match(self, row)
Definition: search.py:70
def search.Finder.fileName (   self,
  id_file 
)

Definition at line 79 of file search.py.

79  def fileName(self,id_file):
80  if self.cn.execute("SELECT COUNT(*) FROM files WHERE rowid=?",[id_file]).fetchone()[0] > 1:
81  print >>sys.stderr,"WARNING: non-uniq fileid [%s]. Considering only the first match." % id_file
82 
83  for r in self.cn.execute("SELECT * FROM files WHERE rowid=?",[id_file]).fetchall():
84  return r['name']
85 
86  return ""
87 
def fileName(self, id_file)
Definition: search.py:79
def search.Finder.function (   self)

Definition at line 121 of file search.py.

121  def function(self):
122  o=[]
123  c=self.cn.execute('SELECT * FROM memberdef WHERE'+self.match("name")+' AND kind=?',[self.name,MemberType.Function])
124  for r in c.fetchall():
125  item={}
126  item['name'] = r['name']
127  item['definition'] = r['definition']
128  item['argsstring'] = r['argsstring']
129  item['file'] = self.fileName(r['id_file'])
130  item['line'] = r['line']
131  item['detaileddescription'] = r['detaileddescription']
132  o.append(item)
133  return o
def fileName(self, id_file)
Definition: search.py:79
def match(self, row)
Definition: search.py:70
def function(self)
Definition: search.py:121
def search.Finder.includees (   self)

Definition at line 212 of file search.py.

212  def includees(self):
213  o=[]
214  fid = self.fileId(self.name)
215  c=self.cn.execute('SELECT * FROM includes WHERE id_src=?',[fid])
216  for r in c.fetchall():
217  item={}
218  item['name'] = self.fileName(r['id_dst'])
219  o.append(item)
220  return o
def fileId(self, name)
Definition: search.py:88
def includees(self)
Definition: search.py:212
def fileName(self, id_file)
Definition: search.py:79
def search.Finder.includers (   self)

Definition at line 202 of file search.py.

202  def includers(self):
203  o=[]
204  fid = self.fileId(self.name)
205  c=self.cn.execute('SELECT * FROM includes WHERE id_dst=?',[fid])
206  for r in c.fetchall():
207  item={}
208  item['name'] = self.fileName(r['id_src'])
209  o.append(item)
210  return o
def includers(self)
Definition: search.py:202
def fileId(self, name)
Definition: search.py:88
def fileName(self, id_file)
Definition: search.py:79
def search.Finder.macro (   self)

Definition at line 145 of file search.py.

145  def macro(self):
146  o=[]
147  c=self.cn.execute('SELECT * FROM memberdef WHERE'+self.match("name")+' AND kind=?',[self.name,MemberType.Define])
148  for r in c.fetchall():
149  item={}
150  item['name'] = r['name']
151  if r['argsstring']:
152  item['argsstring'] = r['argsstring']
153  item['definition'] = r['initializer']
154  item['file'] = self.fileName(r['id_file'])
155  item['line'] = r['line']
156  o.append(item)
157  return o
def macro(self)
Definition: search.py:145
def fileName(self, id_file)
Definition: search.py:79
def match(self, row)
Definition: search.py:70
def search.Finder.match (   self,
  row 
)

Definition at line 70 of file search.py.

70  def match(self,row):
71  if self.row_type is int:
72  return " id=?"
73  else:
74  if g_use_regexp == True:
75  return " REGEXP (?,%s)" %row
76  else:
77  return " %s=?" %row
78 
def match(self, row)
Definition: search.py:70
def search.Finder.members (   self)

Definition at line 222 of file search.py.

222  def members(self):
223  o=[]
224  c=self.cn.execute('SELECT * FROM memberdef WHERE'+self.match("scope"),[self.name])
225  for r in c.fetchall():
226  item={}
227  item['name'] = r['name']
228  item['definition'] = r['definition']
229  item['argsstring'] = r['argsstring']
230  item['file'] = self.fileName(r['id_file'])
231  item['line'] = r['line']
232  #item['documentation'] = r['documentation']
233  o.append(item)
234  return o
def members(self)
Definition: search.py:222
def fileName(self, id_file)
Definition: search.py:79
def match(self, row)
Definition: search.py:70
def search.Finder.params (   self)

Definition at line 183 of file search.py.

183  def params(self):
184  o=[]
185  c=self.cn.execute('SELECT id FROM memberdef WHERE'+self.match("name"),[self.name])
186  for r in c.fetchall():
187  #a=("SELECT * FROM params where id=(SELECT id_param FROM memberdef_params where id_memberdef=?",[id_memberdef])
188  item={}
189  item['id'] = r['id']
190  o.append(item)
191  return o
def params(self)
Definition: search.py:183
def match(self, row)
Definition: search.py:70
def search.Finder.references (   self)

Definition at line 97 of file search.py.

97  def references(self):
98  o=[]
99  cur = self.cn.cursor()
100  cur.execute("SELECT refid FROM memberdef WHERE"+self.match("name"),[self.name])
101  refids = cur.fetchall()
102 
103  if len(refids) == 0:
104  return o
105 
106  refid = refids[0]['refid']
107  cur = self.cn.cursor()
108  #TODO:SELECT rowid from refids where refid=refid
109  for info in cur.execute("SELECT * FROM xrefs WHERE refid_dst LIKE '%"+refid+"%'"):
110  item={}
111  cur = self.cn.cursor()
112  for i2 in cur.execute("SELECT * FROM memberdef WHERE refid=?",[info['src']]):
113  item['name']=i2['name']
114  item['src']=info['src']
115  item['file']=self.fileName(info['id_file'])
116  item['line']=info['line']
117 
118  o.append(item)
119  return o
def references(self)
Definition: search.py:97
def fileName(self, id_file)
Definition: search.py:79
def match(self, row)
Definition: search.py:70
def search.Finder.struct (   self)

Definition at line 193 of file search.py.

193  def struct(self):
194  o=[]
195  c=self.cn.execute('SELECT * FROM compounddef WHERE'+self.match("name"),[self.name])
196  for r in c.fetchall():
197  item={}
198  item['name'] = r['name']
199  o.append(item)
200  return o
def match(self, row)
Definition: search.py:70
def struct(self)
Definition: search.py:193
def search.Finder.subClasses (   self)

Definition at line 245 of file search.py.

245  def subClasses(self):
246  o=[]
247  c=self.cn.execute('SELECT derived FROM basecompoundref WHERE'+self.match("base"),[self.name])
248  for r in c.fetchall():
249  item={}
250  item['name'] = r['derived']
251  o.append(item)
252  return o
def subClasses(self)
Definition: search.py:245
def match(self, row)
Definition: search.py:70
def search.Finder.typedef (   self)

Definition at line 159 of file search.py.

159  def typedef(self):
160  o=[]
161  c=self.cn.execute('SELECT * FROM memberdef WHERE'+self.match("name")+' AND kind=?',[self.name,MemberType.Typedef])
162  for r in c.fetchall():
163  item={}
164  item['name'] = r['name']
165  item['definition'] = r['definition']
166  item['file'] = self.fileName(r['id_file'])
167  item['line'] = r['line']
168  o.append(item)
169  return o
def typedef(self)
Definition: search.py:159
def fileName(self, id_file)
Definition: search.py:79
def match(self, row)
Definition: search.py:70
def search.Finder.variable (   self)

Definition at line 171 of file search.py.

171  def variable(self):
172  o=[]
173  c=self.cn.execute('SELECT * FROM memberdef WHERE'+self.match("name")+' AND kind=?',[self.name,MemberType.Variable])
174  for r in c.fetchall():
175  item={}
176  item['name'] = r['name']
177  item['definition'] = r['definition']
178  item['file'] = self.fileName(r['id_file'])
179  item['line'] = r['line']
180  o.append(item)
181  return o
def variable(self)
Definition: search.py:171
def fileName(self, id_file)
Definition: search.py:79
def match(self, row)
Definition: search.py:70

Member Data Documentation

search.Finder.cn

Definition at line 66 of file search.py.

search.Finder.name

Definition at line 67 of file search.py.

search.Finder.row_type

Definition at line 68 of file search.py.


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