[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bperlqt=5D_qtcore/lib/QtCore4=3A_Method_access_defau?=
From:       Chris Burel <cburel () rhythm ! com>
Date:       2011-01-31 22:19:34
Message-ID: 20110131221934.DF536A60B4 () git ! kde ! org
[Download RAW message or body]

Git commit 9e8d572543149a19a678ac2e232d7f7697a46309 by Chris Burel.
Pushed by burel into branch 'master'.

Method access defaults to public.  Can specify public/private in one use line now.

M  +16   -4    qtcore/lib/QtCore4/signals.pm     
M  +16   -4    qtcore/lib/QtCore4/slots.pm     

http://commits.kde.org/perlqt/9e8d572543149a19a678ac2e232d7f7697a46309

diff --git a/qtcore/lib/QtCore4/signals.pm b/qtcore/lib/QtCore4/signals.pm
index 979b6a0..7708fa5 100644
--- a/qtcore/lib/QtCore4/signals.pm
+++ b/qtcore/lib/QtCore4/signals.pm
@@ -31,15 +31,27 @@ sub import {
     # This makes any call to the signal name call XS_SIGNAL
     Qt::_internal::installqt_metacall( $caller ) unless defined &{$caller."::qt_metacall"};
 
-    my $public = grep { $signals[$_*2] eq 'public' &&
-        looks_like_number( $signals[$_*2+1] ) &&
-        $signals[$_*2+1] > 0
-    } 0..$#signals/2;
+    my $public = 1;
+
+    my %publicprivate;
+    @publicprivate{qw(public private)} = undef;
 
     for ( my $i = 0; $i < @signals; $i += 2 ) {
         my $signalname = $signals[$i];
         my $signalargs = $signals[$i+1];
 
+        if ( exists $publicprivate{$signalname} &&
+            looks_like_number( $signalargs ) &&
+            $signalargs > 0 ) {
+            if ( $signalname eq 'public' ) {
+                $public = 1;
+            }
+            else {
+                $public = 0;
+            }
+            next;
+        }
+
         # Build the signature for this signal
         my $signature = join '', ("$signalname(", join(',', @{$signalargs}), ')');
 
diff --git a/qtcore/lib/QtCore4/slots.pm b/qtcore/lib/QtCore4/slots.pm
index ae366a1..bee8685 100644
--- a/qtcore/lib/QtCore4/slots.pm
+++ b/qtcore/lib/QtCore4/slots.pm
@@ -30,15 +30,27 @@ sub import {
 
     Qt::_internal::installqt_metacall( $caller ) unless defined &{$caller."::qt_metacall"};
 
-    my $public = grep { $slots[$_*2] eq 'public' &&
-        looks_like_number( $slots[$_*2+1] ) &&
-        $slots[$_*2+1] > 0
-    } 0..$#slots/2;
+    my $public = 1;
+
+    my %publicprivate;
+    @publicprivate{qw(public private)} = undef;
 
     for ( my $i = 0; $i < @slots; $i += 2 ) {
         my $fullslotname = $slots[$i];
         my $slotargs = $slots[$i+1];
 
+        if ( exists $publicprivate{$fullslotname} &&
+            looks_like_number( $slotargs ) &&
+            $slotargs > 0 ) {
+            if ( $fullslotname eq 'public' ) {
+                $public = 1;
+            }
+            else {
+                $public = 0;
+            }
+            next;
+        }
+
         # Determine the slot return type, if there is one
         my @returnParts = split / +/, $fullslotname;
         my $slotname = pop @returnParts; # Remove actual method name


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic