/** Copyright 2020 Siemens Digital Industries Software ================================================== Copyright 2013. Siemens Product Lifecycle Management Software Inc. All Rights Reserved. ================================================== Copyright 2020 Siemens Digital Industries Software */ /** @file This file contains functions to initialize Teamcenter internal encoding and to convert character data from and to Teamcenter internal encoding */ #ifndef NLS_H #define NLS_H /** @if DOX_IGNORE For "logical" -- coding standards demand that each .c file include unidefs anyway @endif */ #include #include #ifdef __cplusplus extern "C"{ #endif /*** Function prototypes ***/ /** Checks if the Teamcenter system is configured for UTF-8 encoding, and is running as such. The system comprises the server and the database.
Depends on a callback function to determine if the system is configured for UTF-8 encoding, and is running as such. NLS_register_system_is_running_utf8_callback() is used to register the call back function. Typically the callback is registered during startup. #TC_is_system_running_utf8 is the Teamcenter default call back function. @returns */ extern NLS_API logical NLS_is_system_running_utf8(void); /** Checks if the Teamcenter server is properly configured for UTF-8 encoding. The function returns: */ extern NLS_API logical NLS_is_server_utf8_configured(void); /** Converts given character data from platform encoding to Teamcenter internal encoding.
The caller is responsible for freeing the memory associated with the converted data using #MEM_free API. The function does not return any value. */ extern NLS_API void NLS_external_to_internal( const char* str_ext, /**< (I) The input character data in platform encoding */ char** str_int /**< (OF) The converted character data in Teamcenter internal encoding */ ); /** Converts given character data from Teamcenter internal encoding to platform encoding. If any character cannot be converted to platform encoding, it will be substituted with '#' character.
The caller is responsible for freeing the memory associated with the converted data using #MEM_free API. The function does not return any value. */ extern NLS_API void NLS_internal_to_external( const char* str_int, /**< (I) The input character data in Teamcenter internal encoding*/ char** str_ext /**< (OF) The converted character data in platform encoding */ ); /** Converts given argument data from platform encoding to UTF-8 encoding if Teamcenter is running in UTF-8 internal encoding. Otherwise, the argument data is returned as is.
This API should be called once in the beginning of the main program to convert values of all input arguments from platform encoding to UTF-8 encoding, if Teamcenter is running in UTF-8 encoding. The caller is responsible for freeing the memory associated with converted argument data (argv_utf8) using #MEM_free API The function does not return any value. */ extern NLS_API void NLS_init_utf8( int argc, /**< (I) Number of arguments to be converted */ const char **argv,/**< (I) Values of arguments to be converted */ char ***argv_utf8 /**< (OF) Values of arguments converted to UTF-8 encoding */ ); /** Converts a UTF-8 encoded character string to the platform encoding.
If any character cannot be converted to the platform encoding, it will be substituted with the '#' character. However, if conversion error occurs, a copy of the input string is passed in the parameter @p platform_encoded_string. @returns */ extern NLS_API int NLS_convert_from_utf8_to_platform_encoding( const char* utf8_encoded_string, /**< (I) The input character data in UTF-8 encoding */ char** platform_encoded_string /**< (OF) The converted character data in platform encoding */ ); /** Converts a platform encoded character string to the UTF-8 encoding.
If a conversion error occurs, the input platform encoded string is copied into @p utf8_encoded_string. @returns */ extern NLS_API int NLS_convert_from_platform_to_utf8_encoding( const char* platform_encoded_string, /**< (I) The input character data in platform encoding */ char** utf8_encoded_string /**< (OF) The converted character data in UTF-8 encoding */ ); /** @} */ #ifdef __cplusplus } #endif #include #endif