RifPlugin
|
Listing 1 (BBones.cpp)
|
Occasionaly it is beneficial to divide a single C++ file into two files. One file contains the interface declarations of a class and the other file contains the implementations of the class methods. Two Source Code Files
This page provides an example of how the source of a rif plugin
is divided in to an interface (.h) and an implementation file (.cpp).
The rif plugin, implemented in the first listing, echoes the type of each Attribute "identifier" "string name" ["pSphereShape1"] Attribute "identifier" "float id" [1] Then the same rib after rif'ing by BBones would have these lines, #identifier Attribute "identifier" "string name" ["pSphereShape1"] #identifier Attribute "identifier" "float id" [1]
Not a very useful plugin but adequate for the purposes of this tutorial.
Listings 2 and 3 gives the code for the interface file (.h) and a separate
implementation file (.cpp). Notice the contents of the .h file are "wrapped"
in a |
Listing 2 (BBones.h - interface file)
|
The next listing is very similar to original code show in listing 1. However, it contains only the implementations of the class methods. |
Listing 3 (BBones.cpp - implementation file)
|
© 2002- Malcolm Kesson. All rights reserved.