System 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 non translatable messages (see ) which may, for example, identify resources. NLS (National Langage Support) is not supported, this class must be compared to the 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 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:

 Message1 = "This is a simple parameterized string.";
 Message2 = "This parameterized string includes the parameter /P1 that
             is valued by your application at run-time.";
 Message3 = "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: Suppose then, if the CATMsgCatalogPath variable is valued the following way:
   CATMsgCatalogPath=C:\PersonalFolder;C:\Program Files\Dassault Systemes\B14
CATIA will search the resource catalog file into the following paths:
   1 - C:\PersonalFolder\Japanese
   2 - C:\PersonalFolder
   3 - C:\Program Files\Dassault Systemes\B14\Japanese
   4 - C:\Program Files\Dassault Systemes\B14
The character set for the message key characters is the following:


Constructor and Destructor Index


o CATRscCatalog()
Constructs a resource catalog.
o CATRscCatalog(CATRscCatalog&)
Copy constructor.
o ~CATRscCatalog()

Method Index


o BuildResource(CATString&,CATString&,CATString&,CATString*,int,CATString&)
Computes a message from an identified non translatable parameterized message of the catalog, given specified parameters values.
o GetCatalogKeys(CATListValCATString*)
Get the list of keys of the catalog.
o GetCatalogRsc(CATString&,CATString&,CATString*,int)
Computes a message from the resource catalog.
o GetError()
Returns the first syntax error found.
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
public CATRscCatalog()
Constructs a resource catalog.
o CATRscCatalog
public CATRscCatalog( const iRscCatalog)
Copy constructor.
Caution: This method should rarely be used, in most cases the use of is enough.
Parameters:
iRscCatalog
Resource catalog to copy
o ~CATRscCatalog
public ~CATRscCatalog()

Methods


o BuildResource
public static BuildResource( const iCatalogName,
const iKey,
oNonTranslatableMessage,
iMsgParameters= NULL,
iParamNb= 0,
const iDefaultMsg=(char*)NULL )
Computes a message from an identified non translatable parameterized message of the catalog, given specified parameters values.
Role: Computes an alphanumeric string from a non transtable message from a resource catalog using the catalog name, the message key, the message parameters and (if needed) a default non translatable message.

The use of this service is as follows: call it at any moment you want during execution. You do not have to store the computed message for a future re-use. Effectively, this service is encapsulated. It takes into account the following things:

Parameters:
iCatalogName
Name of the resource catalog file, without the .CATRsc suffix
iKey
Key of the non translatable message to be retrieved
oNonTranslatableMessage
The computed output resource string.
iMsgParameters
Array giving to the method possible parameter values which the method will integrate into the parameterized message. The parameter value count should correspond to the message parameter highest index (this is not exactly the parameter count: the software authorizes parameter indices that are not consecutive, which would distinguish the message parameters highest index from the parameter count). If the input parameter value count is not sufficient, a default behaviour is foreseen: "?" characters are introduced into the computed output resource string. NULL default value coresponds to no parameter values.
iParamNb
Parameter value count
iDefaultMsg
Non translatable message to be used if a problem occured while accessing the resource catalog file or the key. You may, for example, put in this message an information about an access problem. We suggest you to deliver a valid value to this parameter, so that, if an error occurs, a valid return value be delivered by the service.
Returns:

Legal values: 0: False if a problem has occured, or Other: True otherwise. Use to retrieve the current error
o GetCatalogKeys
public GetCatalogKeys( oKey= NULL )
Get the list of keys of the catalog.
Parameters:
oKey
The key list.
Lifecycle rules deviation: the caller must allocate the object and manage so that, in input, the oKey size be equal to zero.
Returns:
Key count.
o GetCatalogRsc
public GetCatalogRsc( const iKey,
oNonTranslatableMessage,
iMsgParameters= NULL ,
iParamNb= 0 )
Computes a message from the resource catalog.
Role: Computes a message from the resource catalog using the message key.
Caution: This method should rarely be used, in most cases the use of is enough.
Parameters:
iKey
Key of the resource to be retrieved
oNonTranslatableMessage
The computed output resource string.
iMsgParameters
Array giving to the method possible parameter values which the method will integrate into the parameterized message. The parameter value count should correspond to the message parameter highest index (this is not exactly the parameter count: the software authorizes parameter indices that are not consecutive, which would distinguish the message parameters highest index from the parameter count). If the input parameter value count is not sufficient, a default behaviour is foreseen: "?" characters are introduced into the computed output resource string. NULL default value coresponds to no parameter values.
iParamNb
Parameter value count
Returns:

Legal values: 0: False if a problem occured, or Other: True otherwise. Use to retrieve the current error
o GetError
public static GetError()
Returns the first syntax error found.
Role: Returns the first syntax error found after a call to or . See and .
Returns:
String containing the error message.
o LoadRscCatalog
public LoadRscCatalog( const iCatalogName,
const iPath= NULL)
Loads a resource catalog by means of its name and (if desired) of a path.
Caution: This method should rarely be used, in most cases the use of is enough.
Parameters:
iCatalogName
Name of the resource catalog file, without the .CATRsc suffix
iPath
Absolute path where the catalog must be searched for.
The localized version of the resource catalog is searched first. If it does not exist, the english version is taken.
Example: In a japanese Windows environment, if the iPath variable is valued the following way:
      iPath="C:\PersonalFolder;C:\Program Files\Dassault Systemes\B14"
then, CATIA search the resource catalog file into the following paths:
      1 - C:\PersonalFolder\Japanese
      2 - C:\PersonalFolder
      3 - C:\Program Files\Dassault Systemes\B14\Japanese
      4 - C:\Program Files\Dassault Systemes\B14
Returns:

Legal values: 0: False if the resource catalog is not loaded, or Other: True if the resource catalog is loaded.
If the execution gives a 0 value, debug the resource catalog file using .
o UnloadRscCatalog
public static UnloadRscCatalog( const iCatalogName)
Unloads a resource catalog by means of its name.
Parameters:
iCatalogName
Name of the resource catalog file, without the .CATRsc suffix
Returns:

Legal values: 0: False if a problem has occured, or Other: True otherwise.
o operator =
public operator =( const iRscCatalog)
Assignment operator.
Caution: This method should rarely be used, in most cases the use of is enough.
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

Copyright © 1999-2015, Dassault Systèmes. All rights reserved.