NAME

QML::File - Basic parsing of the high-level structure of QML files.

SYNOPSIS

use QML::File 

my $parser = new QML::File('main.qml');

my @imports = $parser->imports;
foreach my $import (@imports) {
  print "Found import of $import->{name} on line $import->{lineNum}\n";
}
my $objectType = $parser->objectType;

my $id = $parser->id
my @properties = $parser->propertyDeclarations;
my @signals = $parser->signalDeclarations;
my @functions = $parser->javaScriptFunctions;
my @objectProperties = $parser->objectProperties;
my @childObjects = $parser->childObjects;

DESCRIPTION

This module parses QML files at a very high level, allowing you to determine basic information like the signals, properties, functions, and child objects defined in the QML file.

CONSTRUCTOR

new

use QML::File;
my $file = new QML::File('Filename.qml');

Returns a newly created QML::File object for the specified QML file.

METHODS

childObjects

Returns a list of child objects. Each element in the returned array is a hash of the form:

my $child = {type => $childType, line => $line, lineNum => $lineNum};

id

Returns the ID of the main component.

imports

my @imports = $parser->imports;

Returns the list of imports defined in the file. Each element in the returned array is a hash of the form:

my $fileImport = {filename => $filename, line => $line, lineNum => $lineNum};

or

my $namedImport = {name => $name, line => $line, lineNum => $lineNum};

depending on the type of import.

javaScriptFunctions

Returns an array of Javascript functions defined in the QML component. Each element in the returned array is a hash of the form:

my $function = {name => $functionName, line => $line, lineNum => $lineNum};

name

Returns the name of the QML component defined by the QML file.

objectProperties

Returns an array of object properties assigned. Each element in the returned array is a hash of the form:

my $objectProperty = {name => $name, line => $line, lineNum => $lineNum};

objectType

Returns the type of the main component defined in the QML file.

propertyDeclarations

Returns an array of property declarations. Each element in the returned array is a hash of the form:

my $property = {name => $name, line => $line, lineNum => $lineNum};

signalDeclarations

Returns an array of signal declarations. Each element in the returned array is a hash of the form:

my $signal = {name => $name, line => $line, lineNum => $lineNum};

SEE ALSO

check_qml.pl - Checks a QML file for coding conventions described at http://doc.qt.digia.com/qt/qml-coding-conventions.html

AUTHOR

Zachary Blair, <zblair@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2013 by Zachary Blair

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.