Difference between revisions of "Ide/Creating new Project Items/Creating a Interface"

From wiki.visual-prolog.com
m (Category)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<noinclude>[[Category:Ide]]</noinclude>
<noinclude>[[Category:Ide/Create New Project Items]]</noinclude>
'''How to Create a New Interface?'''
== Creating an Interface ==


An interface definition defines the named object type.
An interface definition defines the named object type.

Latest revision as of 15:17, 13 June 2013

Creating an Interface

An interface definition defines the named object type. All predicates declared in an interface are object members in objects of the interface type. To create a new interface and to add it into one of the packages registered in the project you should activate the File | New IDE command. In the left pane of the opened Create Project Item dialog you should select Interface. Then the dialog accepts the following shape:

The New Interface Dialog

Name:

In the Name edit control you should type in an interface name (the interfaceName on the picture).

Package:

In the Package list button you should select one of the packages registered in the project (the NewPackage.pack on the picture). The created interface will be included into this package. The created file with the default declaration of this interface will be placed into the selected package subdirectory. This subdirectory name is displayed after the package name; it is (NewPackage\) in the picture.

After you fill in all required settings you can press the Create button. The IDE creates the interface definition file (it appears in the project tree in the Project Window after compilation of the package) and the #include @"NewPackage\interfaceName.i" directive is added into the package header file NewPackage.ph of the specified package:

% exported interfaces
#include @"NewPackage\interfaceName.i"

Since the package header file should be inserted by the #include @"NewPackage.ph" directive in all places, where the package is used, so in all these places the #include @"NewPackage\interfaceName.i" directive also be seen. This means that the interface interfaceName is public.

If you wish to create an interface that should be private to the NewPackage package, then the include directive for this interface can be manually moved into the package implementation file NewPackage.pack:

% private interfaces 
#include @"NewPackage\interfaceName.i"

Therefore, the interface declaration will not be seen outside of the package implementation. So the interface will be private to the package implementation.

Notice that information about a new interface does not appear in the project browse information until the package including this interface is compiled.