pidl/NDR: add ContainsPipe() function
authorStefan Metzmacher <metze@samba.org>
Tue, 21 Sep 2010 00:20:14 +0000 (02:20 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 10 Mar 2011 15:19:33 +0000 (16:19 +0100)
metze
(cherry picked from commit eaa7ecdda7938e12db94f5ecbb978e5e7bca5f16)

pidl/lib/Parse/Pidl/NDR.pm

index 3edb9b732f26454f922aeed3cde915051153b330..69205d9a46b424beafeb50b5e6283a416f3dc721 100644 (file)
@@ -34,7 +34,7 @@ require Exporter;
 use vars qw($VERSION);
 $VERSION = '0.01';
 @ISA = qw(Exporter);
-@EXPORT = qw(GetPrevLevel GetNextLevel ContainsDeferred ContainsString);
+@EXPORT = qw(GetPrevLevel GetNextLevel ContainsDeferred ContainsPipe ContainsString);
 @EXPORT_OK = qw(GetElementLevelTable ParseElement ValidElement align_type mapToScalar ParseType can_contain_deferred is_charset_array);
 
 use strict;
@@ -851,6 +851,20 @@ sub ContainsDeferred($$)
        return 0;
 }
 
+sub ContainsPipe($$)
+{
+       my ($e,$l) = @_;
+
+       return 1 if ($l->{TYPE} eq "PIPE");
+
+       while ($l = GetNextLevel($e,$l))
+       {
+               return 1 if ($l->{TYPE} eq "PIPE");
+       }
+
+       return 0;
+}
+
 sub el_name($)
 {
        my $e = shift;