| Revision: 607
          http://svn.sourceforge.net/pygccxml/?rev=607&view=rev
Author:   mbaas
Date:     2006-09-29 09:40:15 -0700 (Fri, 29 Sep 2006)
Log Message:
-----------
Added the ConstFilter class. Small bugfix on the type filter (variables weren't properly processed).
Modified Paths:
--------------
    pyplusplus_dev/contrib/pypp_api/pypp_api/filters.py
Modified: pyplusplus_dev/contrib/pypp_api/pypp_api/filters.py
===================================================================
--- pyplusplus_dev/contrib/pypp_api/pypp_api/filters.py	2006-09-29 16:36:53 UTC (rev 606)
+++ pyplusplus_dev/contrib/pypp_api/pypp_api/filters.py	2006-09-29 16:40:15 UTC (rev 607)
@@ -341,6 +341,8 @@
             t.append("CONSTRUCTOR")
         if f & ENUM:
             t.append("ENUM")
+        if f & VARIABLE:
+            t.append("VARIABLE")
         return "type==%s"%("|".join(t))
 
     def __call__(self, decl):
@@ -364,6 +366,8 @@
             res |= ENUM
         elif isinstance(decl, namespace_t):
             res |= NAMESPACE
+        elif isinstance(decl, variable_t):
+            res |= VARIABLE
 
         if isinstance(decl, constructor_t):
             res |= CONSTRUCTOR
@@ -430,6 +434,27 @@
             return False
         return at==self.accesstype
 
+# ConstFilter
+class ConstFilter(FilterBase):
+    """Filter by constness.
+    """
+
+    def __init__(self, constness):
+        """Constructor.
+
+        constness is a boolean that specifies whether a declaration
+        has to be declared const or not to match the filter.
+        """
+        FilterBase.__init__(self)
+        self.constness = constness
+
+    def __str__(self):
+        return "const==%s"%self.constness
+
+    def __call__(self, decl):
+        const = bool(getattr(decl, "has_const", False))
+        return const==self.constness
+
 # CustomFilter
 class CustomFilter(FilterBase):
     """Filter by user defined function.
@@ -443,4 +468,4 @@
         return "custom"
 
     def __call__(self, decl):
-        return self.func(decl)
\ No newline at end of file
+        return self.func(decl)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |