|Home | Tutorial | Classes | Functions | QSA Workbench | Language | Qt API | QSA Articles Qt Script for Applications

[Prev: QSA Input Dialog Framework] [Home]

QSA Utility Framework

The QSA Utility Framework is a set of classes that extends QSA to enable the user to read and write files, access directory structures and start processes synchronously and asynchronously. The Utility Framework is available in the QSObjectFactory subclass QSUtilFactory

File Class Reference

The File class provides functionallity for reading and writing binary and text files. A File can be instantiated as an object, giving the scripter complete flexibility when reading and writing files. In addition, the File class provides a set of static convenence functions for reading and writing files in one go.

Typical use of a File is:

// Reads an entire file in one go
var log = File.read('file.log');
// Writes an entire file in one go
File.write('copy_of_file.log', log);

// Read and write a file line by line
var infile = new File('file.log');
infile.open(File.ReadOnly);

var outfile = new File('copy_of_file.log');
outfile.open(File.WriteOnly);

while (!infile.eof) {
    var line = infile.readLine();
    outfile.write( line );
}

infile.close();
outfile.close();

Enums

AccessMode

The enum AccessMode is used in conjunction with File.open to specify the mode in which the file is opened.

Static Functions

Constructor

Properties

The File object's properties are read-only.

Member Functions

Dir Class Reference

The Dir class provides access to directory structures and their contents in a platform-independent way. It provides a means of listing directory content, creating filenames with proper path separators, etc.

An example use of the Dir class is:

var dir = new Dir;
var codeFiles = dir.entryList('*.cpp');
for (var i = 0; i < codeFiles.length; ++i) 
    print(codeFiles[i]);

Enums

FilterSpec

This enum describes the filtering options available to Dir for entryList(). The filter value is specified by OR-ing together values from the following list.

SortSpec

This enum describes the sort options available to Dir for entryList(). The sort value is specified by OR-ing together values from the following list:

Static Properties

Static Functions

Qt uses "/" as a directory separator throughout (although it understands the conventions of the platform it is used on). If you are working with paths, use "/" within your code, and use convertSeparators() when you want to display a path to the user.

Constructor

Properties

Member Functions

Process Class Reference

The Process class is used to start external programs and to communicate with them. The Process class can start programs synchronously using Process.execute(), and asynchronously using new Process(...).start().

Static Properties

Static Functions

Constructor

Properties

Member Functions


Copyright © 2001-2006 TrolltechTrademarks
QSA version 1.1.5