🌻 📖 Clang::CastXML::Container

NAME

Clang::CastXML::Container - Container class for XML output from CastXML

VERSION

version 0.02

SYNOPSIS

 use Clang::CastXML;
 
 my $castxml = Clang::CastXML->new;
 my $container = $castxml->introspect(' int add(int,int); ');
 
 # get the raw XML output from CastXML
 my $xml = $container->to_xml;
 
 # get a nested datastructure (hash reference)
 # of the output from CastXML
 my $perl = $container->to_href;

DESCRIPTION

This class provides an interface to the output generated from CastXML. You can assume that the CastXML successfully processed the C/C++ source, because the Clang::CastXML method introspect will throw an exception if there is an error there, rather than return a bad object.

PROPERTIES

result

 my $result = $container->result;

This is a Clang::CastXML::Wrapper::Result, which contains the raw output of the process run.

source

 my $source = $container->source.

This is a Path::Tiny which points to the C/C++ source file.

dest

 my $dest = $container->dest;

This is a Path::Tiny which points to the XML output file.

METHODS

to_xml

 my $xml = $xml->to_xml;

Returns the raw XML as a utf-8 string.

to_href

 my $perl = $container->to_href;

Returns a set of nested data structures (hash references, array references, etc) with the same data as what is in the raw XML. This is probably easier for Perl to grock than the raw XML.

May throw an exception:

Clang::CastXML::Exception::ParseException

If there is an error parsing the XML.

SEE ALSO

Clang::CastXML

AUTHOR

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.