Revision: 29
Author: roman_yakovenko
Date: 2006-05-01 21:10:19 -0700 (Mon, 01 May 2006)
ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=29&view=rev
Log Message:
-----------
adding 2 new matchers:
custom_matcher_t - as input takes user defined function, useful for creation of complex queries
virtuality_type_matcher_t - matches function by it's "virtual" characteristic
Modified Paths:
--------------
pygccxml_dev/pygccxml/declarations/filters.py
Modified: pygccxml_dev/pygccxml/declarations/filters.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/filters.py 2006-05-02 04:06:14 UTC (rev 28)
+++ pygccxml_dev/pygccxml/declarations/filters.py 2006-05-02 04:10:19 UTC (rev 29)
@@ -468,3 +468,46 @@
def __str__( self ):
return '(access type=%s)' % self.access_type
+class virtuality_type_matcher_t( matcher_base_t ):
+ """
+ Instance of this class will match declaration by its virtuality type: not virtual,
+ virtual or pure virtual. If declarations does not have virtuality type, for example
+ free function, then False will be returned.
+ """
+
+ def __init__( self, virtuality_type ):
+ """
+ @param access_type: declaration access type
+ @type access_type: L{VIRTUALITY_TYPES} defines few consts for your convinience.
+ """
+ matcher_base_t.__init__( self )
+ self.virtuality_type = virtuality_type
+
+ def __call__( self, decl ):
+ if not isinstance( decl.parent, class_declaration.class_t ):
+ return False
+ return self.virtuality_type == decl.virtuality
+
+ def __str__( self ):
+ return '(virtuality type=%s)' % self.virtuality_type
+
+
+class custom_matcher_t( matcher_base_t ):
+ """
+ Instance of this class will match declaration by user custom criteria.
+ """
+
+ def __init__( self, function ):
+ """
+ @param function: callable, that takes single argument - declaration instance
+ should return True or False
+ """
+ matcher_base_t.__init__( self )
+ self.function = function
+
+ def __call__( self, decl ):
+ return bool( self.function( decl ) )
+
+ def __str__( self ):
+ return '(user criteria)'
+
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|