Simple prototype library implementation based on file system directories. More...
#include <ilviews/protos/proto.h>
Public Member Functions | |
IlvProtoLibrary (IlvDisplay *display, const char *name=0, const char *path=0) | |
Creates a new, empty prototype library named name. More... | |
const char * | getPath () |
Returns the library directory name, or 0 if no directory was specified. | |
void | setPath (const char *path) |
Changes the library directory name. More... | |
Public Member Functions inherited from IlvAbstractProtoLibrary | |
IlvAbstractProtoLibrary (IlvDisplay *display, const char *name=0) | |
Creates a new and empty prototype library named name. More... | |
void | addPrototype (IlvPrototype *prototype) |
Adds a prototype to the prototype library. More... | |
const char * | getName () const |
Returns the name of the prototype library. More... | |
IlvPrototype * | getPrototype (const char *name, IlBoolean reload=IlFalse) |
Fetches a prototype from the library. More... | |
IlvPrototype ** | getPrototypes (IlUInt &count) |
Returns all the prototypes contained in the library. More... | |
virtual IlBoolean | load (istream *stream=0, IlBoolean loadPrototypes=IlvAbstractProtoLibrary::LoadAll)=0 |
Loads the prototype library from stream. More... | |
void | removePrototype (IlvPrototype *prototype) |
Removes a prototype from the prototype library. More... | |
virtual IlBoolean | save (ostream *stream=0, IlBoolean savePrototypes=IlvAbstractProtoLibrary::LoadAll)=0 |
Saves the prototype library to stream. More... | |
Static Public Member Functions | |
static IlBoolean | GetSingleFileMode () |
Returns the current mode used to save prototype libraries. More... | |
static void | SetSingleFileMode (IlBoolean singleFile) |
Sets the mode used to save prototype libraries. More... | |
Static Public Member Functions inherited from IlvAbstractProtoLibrary | |
static void | SetAutoLoadMode (IlBoolean loadAll) |
Sets the default load mode of libraries. More... | |
Friends | |
class | IlvGroup |
class | IlvProtoInstance |
class | IlvPrototype |
Simple prototype library implementation based on file system directories.
Library: ilvproto
An IlvProtoLibrary
object stores prototype descriptions in a file or in several files contained in the same directory, depending on its mode:
.ipl
suffix. .ilv
file (which contains the graphic objects of the prototype), a .ivp
(which contains its structure and its accessors), and an optional .ijs
file (which contains the scripts used in the prototype). In directory mode, the .ipl
contains only the list of the prototypes contained in the library. By default, prototype libraries are stored in single-file mode, unless SetSingleFileMode(IlFalse)
was called. The load()
method accepts prototype libraries in single-file or directory mode indifferently.
Prototype libraries can be stored in "data blocks" (also called "resource files") to build self-contained executables (see the chapter "Packaging Rogue Wave Views Applications" in the Rogue Wave Views Foundation User's Manual). If the prototype library was saved in single-file mode, you only need to include the .ipl
as a data block. If the library was saved in directory mode, you must include the .ipl
file and all the .ilv
, .ivp
, and .ijs
files as data blocks. Furthermore, the names of the data blocks for the .ilv
, .ivp
, and .ijs
files must be prefixed with the name of the library (for example: "mylib/myproto.ivp"
).
Usually, you will not need to manipulate IlvProtoLibrary
objects in your code. Prototypes are loaded automatically when you load a file containing prototype instances. You can also load a prototype explicitly using the function IlvLoadPrototype()
(See "IlvPrototype / Related External Functions").
IlvPrototype
. IlvProtoLibrary::IlvProtoLibrary | ( | IlvDisplay * | display, |
const char * | name = 0 , |
||
const char * | path = 0 |
||
) |
Creates a new, empty prototype library named name.
The path argument specifies the directory where the prototype library file(s) will be located. The directory path may contain environment variable names such as ${ILVHOME}
. If path is 0
, the library file is searched for using the display search path. The library file name is built by adding a .ipl
suffix to the library name.
|
static |
Returns the current mode used to save prototype libraries.
IlTrue
if the save if done in a single file, and IlFalse
otherwise. void IlvProtoLibrary::setPath | ( | const char * | path | ) |
Changes the library directory name.
path | The new directory name of the library. The string is copied. |
|
static |
Sets the mode used to save prototype libraries.
singleFile | If set to IlTrue , each prototype library will be saved into a single .ipl file containing all the prototype descriptions. If singleFile is IlFalse , each prototype will be saved independently into a .ilv , a .ivp , and a .ijs file. The default mode is the single-file mode: use this method only if you need each prototype to be saved independently. |