Chapter 3. Architecture

Table of Contents

1. API

The CF Engine is based on the Gecko browser which is core of the Firefox / Mozilla browsers (formerly Netscape). The CF Engine uses the "new" embedding API.

1. API

The CF Engine is implemented as class CF_Engine . Refer to cf_engine.h for details. This class encapsulates a whole Gecko instance / Mozilla browser.

The constructor of CF_Engine takes a flag which indicates whether the browser should be controlled in a separate process or separate thread. We recommend that the separate process (via fork) is used for normal production.

The load_cf method must be used to load a task file.

When a task is loaded, a task may be executed with the run_task or run_task_opt methods. The latter does not return an error if a task given does not exist (it is optional).

For loaded CF files, we may also run tests by invoking the run_tests method.

A browser instance is destroyed when the destructor of CF_Engine is invoked.

The engine may throw exception CF_Engine_Error.

Refer to the cfhello.cpp for a simple example of the use of the API. The cfrun.cpp might also be inspected.