You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
2.1 KiB

// Copyright 2020 Siemens Digital Industries Software
// ==================================================
// Copyright 2017.
// Siemens Product Lifecycle Management Software Inc.
// All Rights Reserved.
// ==================================================
// Copyright 2020 Siemens Digital Industries Software
/**
@file
Adding header intended for C++ style APIs. The APIs operate on std::string which cannot be added to C style header FndStringUtils.h.
The purpose of adding APIs having std::string parameter is to make the caller implementation simpler. The caller does not require to free the memory
of the output parameter.
With Visual Studio 2017, there is a build break with std::transform calls. When std::transform calls (with to_lower and to_uppper operations) are replaced by tc_strupr or tc_strlwr, each caller has to take care of freeing the memory of the output string.
Moreover, the memroy cleanup has to be done by C function free() instead of using using scoped_ptr ( which uses "delete" ) and scoped_smptr ( which used SM_free ). This could lead to memory leaks or freeing the memory incorrecty.
Hence, new APIs, provided in this header, abstracts out the memory cleanup implementation and caller does not have to worry about it.
*/
#ifndef FNDSTRINGUTILS_HXX
#define FNDSTRINGUTILS_HXX
#include <unidefs.h>
#include <string>
#include <base_utils/libbase_utils_exports.h>
using namespace std;
namespace Teamcenter
{
class BASE_UTILS_API FndStringUtils
{
public:
/**
Converts a string to a lower case version.
<br/>It correctly performs the lower case conversion for all character sets.
*/
static void stringToLower(std::string& stringToModify /**< (IO) The string to be converted to lower case. */);
/**
Converts a string to an upper case version.
<br/>It correctly performs the upper case conversion for all character sets.
*/
static void stringToUpper(std::string& stringToModify /**< (IO) The string to be converted to upper case. */);
};
}
#include <base_utils/libbase_utils_undef.h>
#endif // FNDSTRINGUTILS_HXX