CREATE_PROJECT: Centralize toUpper

This commit is contained in:
Orgad Shaneh 2022-01-18 09:24:17 +02:00
parent 6744600f57
commit 7998025b98
4 changed files with 19 additions and 19 deletions

View file

@ -29,12 +29,6 @@
namespace CreateProjectTool {
static std::string toUpper(const std::string &str) {
std::string res;
std::transform(str.begin(), str.end(), std::back_inserter(res), toupper);
return res;
}
CMakeProvider::CMakeProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version)
: ProjectProvider(global_warnings, project_warnings, version) {
}

View file

@ -928,11 +928,8 @@ StringList getEngineDefines(const EngineDescList &engines) {
StringList result;
for (EngineDescList::const_iterator i = engines.begin(); i != engines.end(); ++i) {
if (i->enable) {
std::string define = "ENABLE_" + i->name;
std::transform(define.begin(), define.end(), define.begin(), toupper);
result.push_back(define);
}
if (i->enable)
result.push_back("ENABLE_" + CreateProjectTool::toUpper(i->name));
}
return result;
@ -1331,6 +1328,12 @@ std::string toString(int num) {
return os.str();
}
std::string toUpper(const std::string &str) {
std::string res;
std::transform(str.begin(), str.end(), std::back_inserter(res), toupper);
return res;
}
/**
* Checks whether the give file in the specified directory is present in the given
* file list.
@ -2033,11 +2036,8 @@ void ProjectProvider::createModuleList(const std::string &moduleDir, const Strin
if (forDetection) {
std::string::size_type p = moduleRootDir.find('/');
std::string engineName = moduleRootDir.substr(p + 1);
std::string engineNameUpper;
std::string engineNameUpper = toUpper(engineName);
for (std::string::const_iterator i = engineName.begin(); i != engineName.end(); ++i) {
engineNameUpper += toupper(*i);
}
for (;;) {
std::getline(moduleMk, line);
@ -2152,8 +2152,7 @@ void ProjectProvider::createEnginePluginsTable(const BuildSetup &setup) {
}
// Make the engine name all uppercase.
std::string engineName;
std::transform(i->name.begin(), i->name.end(), std::back_inserter(engineName), toupper);
const std::string engineName = toUpper(i->name);
enginePluginsTable << "#if PLUGIN_ENABLED_STATIC(" << engineName << ")\n"
<< "LINK_PLUGIN(" << engineName << ")\n"

View file

@ -433,6 +433,14 @@ bool producesObjectFile(const std::string &fileName);
*/
std::string toString(int num);
/**
* Convert a string to uppercase
*
* @param str the source string
* @return The string transformed to uppercase
*/
std::string toUpper(const std::string &str);
/**
* Returns a list of all files and directories in the specified
* path.

View file

@ -1304,13 +1304,12 @@ std::string XcodeProvider::md5(std::string key) {
#endif
std::string XcodeProvider::newHash() const {
std::string hash = createUUID();
std::string hash = toUpper(createUUID());
// Remove { and - from UUID and resize to 96-bits uppercase hex string
hash.erase(remove_if(hash.begin(), hash.end(), isSeparator), hash.end());
hash.resize(24);
std::transform(hash.begin(), hash.end(), hash.begin(), toupper);
return hash;
}