diff options
author | Timothy Pearson <[email protected]> | 2012-01-01 18:29:30 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-01-01 18:29:30 -0600 |
commit | b2af005db21bd8fd068cb79b2ae700953128af2c (patch) | |
tree | abd0ed633726bf0bbecb57d30e92836c31e02695 /PerlTQt/bin/pqtapi | |
parent | c1b9383f2032d82db5eb8918dca885e37a901dde (diff) | |
download | libtqt-perl-b2af005db21bd8fd068cb79b2ae700953128af2c.tar.gz libtqt-perl-b2af005db21bd8fd068cb79b2ae700953128af2c.zip |
Move PerlQt
Diffstat (limited to 'PerlTQt/bin/pqtapi')
-rwxr-xr-x | PerlTQt/bin/pqtapi | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/PerlTQt/bin/pqtapi b/PerlTQt/bin/pqtapi new file mode 100755 index 0000000..338d600 --- /dev/null +++ b/PerlTQt/bin/pqtapi @@ -0,0 +1,82 @@ +#!/usr/bin/perl + +# Note: this program is part of PerlTQt and makes use of its internal functions. +# You should not rely on those in your own programs. + +use Getopt::Std; +use strict 'vars'; + +our (%o, @x, $h); +getopts('r:hvimp', \%o); + +package TQt::_internal; +use TQt; + +exists $o{'v'} and do{ print "PerlTQt-$TQt::VERSION using TQt-".&TQt::version."\n" and exit 0 }; +exists $o{'h'} and do{ print $h and exit 0 }; +exists $o{'m'} and do{ # interactive mode for driving the TQt Designer Plugin + select(STDOUT); $| = 1; # unbuffered + while(<STDIN>) + { + chomp; + s/^Q(?=[A-Z])/TQt::/; + my $i = find_pclassid( $_ ); + print "__START__\n"; + if ($i) + { + my $a = findAllMethods( $i ); + my $t = dumpCandidates( [map {@{ $$a{$_} }} sort keys %$a] ); + getAllParents($i, \my @sup); + for my $s(@sup) + { + $a = findAllMethods( $s ); + $t.= dumpCandidates( [map {@{ $$a{$_} }} sort keys %$a] ); + } + $t =~ s/\t//gs; + print $t; + } + print "__END__\n"; + } +}; +(my $c = $ARGV[0]) =~ s/^Q(?=[A-Z])/TQt::/; +my $i = $c ? find_pclassid( $c ) : 1; +my $r = exists $o{'r'} ? (exists $o{'i'} ? qr|$o{'r'}|i : qr|$o{'r'}|) : 0; +my $d = ""; + +while ($i) +{ + my $a=findAllMethods($i); + last unless keys %$a; + @x=map {@{ $$a{$_} }} sort keys %$a; + $d = dumpCandidates(\@x); + if($c and $i and exists $o{'p'}) + { + getAllParents($i, \my @sup); + for my $s(@sup) + { + $a = findAllMethods( $s ); + $d.= dumpCandidates( [map {@{ $$a{$_} }} sort keys %$a] ); + } + } + if($r) + { + map { print "$_\n" if $_=~$r } split("\n", $d); + } + else + { + print $d + } + $c and last; + $i++ +} + +BEGIN { + $h = "pqtapi - a PerlTQt introspection tool\t(c) Germain Garand 2003 <germain\@ebooksfrance.org>\n\n". + "usage: pqtapi [-r <re>] [<class>]\n\n". + "options:\n". + "\t-r <re> : find all functions matching regular expression/keyword <re>\n". + "\t-i : together with -r, performs a case insensitive search\n". + "\t-p : display also inherited methods for <class>.\n". + "\t-v : print PerlTQt and TQt versions\n". + "\t-h : print this help message\n"; +} |