All Frameworks Class Hierarchy This Framework Previous Next Indexes
System Class CATRscCatalog
CATRscCatalog
Usage: you must use this class as is. You should never derive it.
public class CATRscCatalog
Resource catalog class.
Role: Processing a resource catalog file.
The resource catalog file contains keys and their corresponding values. Values are parameterized ASCII string
(see CATString ) which may, for example, identify resources. NLS (National Langage Support) is not supported, this class must be compared to the
CATMsgCatalog class: the current class must be used for all non hard-coded strings which must not be translated into other languages.
A common use of this class corresponds to the storage of resource identifications through the use of dedicated
sub-keys. See for example the use of the Icon.Normal sub-key described into the
CATImplementHeaderResources documentation.
A resource catalog file value may be used to represent a directly resource (for example, a
workbench category, i.e. the place where a given
workbench appears in the menu tree). It may also be used to represent a reference to a resource (for example,
for an icon, you will put the icon file name).
The class does not support control
characters (for example \a, \n, \t).
A value can be parameterized, ie contains parameters you
value at run-time. A parameter begins with /p or /P in the value.
Here is an example of a resource catalog file content:
Key1 = "This is a simple parameterized string.";
Key2 = "This parameterized string includes the parameter /P1 that
is valued by your application at run-time.";
Key3 = "This is a", "compound ", "parameterized string.";
A resource catalog file posess the .CATRsc suffix and is retrieved from the folders specified by the
CATMsgCatalogPath variable.
The localized version of the resource catalog is searched first. If it does not exist,
the english version is taken.
Example:
In a japanese environment, if the CATMsgCatalogPath variable is valued the following way:
CATMsgCatalogPath=C:\PersonalFolder;C:\Program Files\Dassault Systemes\B12
then, CATIA search the resource catalog file into the following paths:
1 - C:\PersonalFolder\Japanese
2 - C:\PersonalFolder
3 - C:\Program Files\Dassault Systemes\B12\Japanese
4 - C:\Program Files\Dassault Systemes\B12
Constructor and Destructor Index
- o
CATRscCatalog()
- Constructs an empty resource catalog.
- o
CATRscCatalog(CATRscCatalog&)
-
- o
~CATRscCatalog()
-
Method Index
- o
BuildResource(CATString&,CATString&,CATString&,CATString*,int,CATString&)
- Computes a message from a given resource catalog.
- o
GetCatalogKeys(CATListValCATString*)
- Retrieves the list of keys of the catalog.
- o
GetCatalogRsc(CATString&,CATString&,CATString*,int)
- Computes a message from the resource catalog.
- o
GetError()
- Returns a syntax error.
- o
LoadRscCatalog(CATString&,char*)
- Loads a resource catalog by means of its name and (if desired)
of a path.
- o
UnloadRscCatalog(CATString&)
- Unloads a resource catalog by means of its name.
- o
operator =(CATRscCatalog&)
- Assignment operator.
Constructor and Destructor
o CATRscCatalog
-
Constructs an empty resource catalog.
o CATRscCatalog
-
o ~CATRscCatalog
-
Methods
o BuildResource
-
Computes a message from a given resource catalog.
Role: Computes a message from a given resource catalog
using the message key. This service does not require
that a call to LoadRscCatalog have been made: it loads
it if it not already done (this service is a static method).
- Parameters:
-
- iCatalogName
- Name of the resource catalog containing the resource to be retrieved.
- iRscKey
- Key of the resource to be retrieved
- oRsc
- The computed output output resource string.
- iParams
- Array giving to the method possible parameter values
which the method will integrate into the parameterized
message.
The value count should correspond to the message parameter
count. If it is not the cases, a default behaviour
is foreseen: "?" characters are introduced into the
computed output resource string.
NULL default value coresponds to no parameter values.
- iNbParams
- iParams array parameters count.
- iDefaultRsc
- Resource that the method should use in case of error.
- Returns:
-
Legal values: 0: False
if a problem has occured, or Other: True
otherwise.
Use GetError to retrieve the current error
o GetCatalogKeys
-
Retrieves the list of keys of the catalog.
- Parameters:
-
- oKeyList
- Key list.
Legal values: NULL
to get the key count, or Other
to get also the keys themselves. A call with the NULL value
should be done first to get the key count and thus allocate
correctly the oKeyList list for the next call.
- Returns:
- Key count.
o GetCatalogRsc
-
Computes a message from the resource catalog.
Role: Computes a message from the resource catalog using
the message key. Before calling the service,
the resource catalog must have been loaded using
LoadRscCatalog.
- Parameters:
-
- iRscKey
- Key of the resource to be retrieved
- oRsc
- The retrieved resource.
- iParams
- Array giving to the method possible parameter values
which the method will integrate into the parameterized
message.
The value count should correspond to the message parameter
count. If it is not the cases, a default behaviour
is foreseen: "?" characters are introduced into the
computed output resource string.
NULL default value coresponds to no parameter values.
- iNbParams
- iParams array value count.
0 default value corresponds to no parameter values.
- Returns:
-
Legal values: 0: False
if a problem occured, or Other: True
otherwise.
Use
CATRscCatalog.GetError to retrieve the current error
o GetError
-
Returns a syntax error.
Role:
Returns the first syntax error found detected in the resource
catalog during the
CATRscCatalog.LoadRscCatalog operation. This service should be called after calling
CATRscCatalog.LoadRscCatalog to check potential errors.
- Returns:
- String containing the error message.
o LoadRscCatalog
public int LoadRscCatalog( | const CATString& | iNameOfCatalogToLoad, |
| const char* | iPathName | = NULL) |
-
Loads a resource catalog by means of its name and (if desired)
of a path.
Don't forget to call
CATRscCatalog.GetError after calling this service to check potential syntax errors in the resource
catalog.
- Parameters:
-
- iNameOfCatalogToLoad
- Name of the resource catalog to be retrieved
- iPathName
- Path for searching the catalog to be retrieved
- Returns:
- boolean which indicates if the catalog has been loaded.
Legal values: 0: False
if the catalog is not loaded, or Other: True
if the catalog is loaded.
o UnloadRscCatalog
public static int UnloadRscCatalog( | const CATString& | iCatalogName) |
-
Unloads a resource catalog by means of its name.
- Parameters:
-
- iCatalogName
- Name of the catalog to be unloaded.
- Returns:
-
Legal values: 0: False
if a problem has occured, or Other: True
otherwise.
o operator =
-
Assignment operator.
- Parameters:
-
- iRscCatalog
- The resource catalog to be copied
- Returns:
- The resource catalog resulting from the assignment
This object is included in the file: CATRscCatalog.h
If needed, your Imakefile.mk should include the module: JS0GROUP