cmGlobalXCodeGenerator: Convert CreateString signature to string_view

This commit is contained in:
Brad King
2025-06-06 07:37:50 -04:00
parent 39da8f69a1
commit ced6b31c48
4 changed files with 7 additions and 5 deletions

View File

@@ -850,7 +850,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::Type type)
return ptr;
}
cmXCodeObject* cmGlobalXCodeGenerator::CreateString(std::string const& s)
cmXCodeObject* cmGlobalXCodeGenerator::CreateString(cm::string_view s)
{
cmXCodeObject* obj = this->CreateObject(cmXCodeObject::STRING);
obj->SetString(s);

View File

@@ -192,7 +192,7 @@ private:
cmXCodeObject* CreateObject(cmXCodeObject::PBXType ptype,
cm::string_view key = {});
cmXCodeObject* CreateObject(cmXCodeObject::Type type);
cmXCodeObject* CreateString(std::string const& s);
cmXCodeObject* CreateString(cm::string_view s);
cmXCodeObject* CreateObjectReference(cmXCodeObject*);
cmXCodeObject* CreateFlatClone(cmXCodeObject*);
cmXCodeObject* CreateXCodeTarget(cmGeneratorTarget* gtgt,

View File

@@ -4,6 +4,7 @@
#include <ostream>
#include <cm/string_view>
#include <cmext/string_view>
char const* cmXCodeObject::PBXTypeNames[] = {
@@ -225,7 +226,7 @@ void cmXCodeObject::PrintString(std::ostream& os) const
cmXCodeObject::PrintString(os, this->String);
}
void cmXCodeObject::SetString(std::string const& s)
void cmXCodeObject::SetString(cm::string_view s)
{
this->String = s;
this->String = std::string(s);
}

View File

@@ -12,6 +12,7 @@
#include <utility>
#include <vector>
#include <cm/string_view>
#include <cmext/algorithm>
class cmGeneratorTarget;
@@ -64,7 +65,7 @@ public:
bool IsEmpty() const;
void SetString(std::string const& s);
void SetString(cm::string_view s);
std::string const& GetString() const { return this->String; }
void AddAttribute(std::string const& name, cmXCodeObject* value)