Re-order cmGlobalXCodeGenerator implementation

This defines class cmGlobalXCodeGenerator::BuildObjectListOrString early
in the source file so it can be used in more places.
This commit is contained in:
Brad King 2009-07-29 16:39:45 -04:00
parent 2537a72f8e
commit 8ab2548d6c
1 changed files with 51 additions and 51 deletions

View File

@ -62,6 +62,57 @@ public:
};
#endif
// Builds either an object list or a space-separated string from the
// given inputs.
class cmGlobalXCodeGenerator::BuildObjectListOrString
{
cmGlobalXCodeGenerator *Generator;
cmXCodeObject *Group;
bool Empty;
std::string String;
public:
BuildObjectListOrString(cmGlobalXCodeGenerator *gen, bool buildObjectList)
: Generator(gen), Group(0), Empty(true)
{
if (buildObjectList)
{
this->Group = this->Generator->CreateObject(cmXCodeObject::OBJECT_LIST);
}
}
bool IsEmpty() const { return this->Empty; }
void Add(const char *newString)
{
this->Empty = false;
if (this->Group)
{
this->Group->AddObject(this->Generator->CreateString(newString));
}
else
{
this->String += newString;
this->String += ' ';
}
}
const std::string &GetString() const { return this->String; }
cmXCodeObject *CreateList()
{
if (this->Group)
{
return this->Group;
}
else
{
return this->Generator->CreateString(this->String.c_str());
}
}
};
//----------------------------------------------------------------------------
cmGlobalXCodeGenerator::cmGlobalXCodeGenerator()
{
@ -452,57 +503,6 @@ cmStdString GetGroupMapKey(cmTarget& cmtarget, cmSourceFile* sf)
return key;
}
// Builds either an object list or a space-separated string from the
// given inputs.
class cmGlobalXCodeGenerator::BuildObjectListOrString
{
cmGlobalXCodeGenerator *Generator;
cmXCodeObject *Group;
bool Empty;
std::string String;
public:
BuildObjectListOrString(cmGlobalXCodeGenerator *gen, bool buildObjectList)
: Generator(gen), Group(0), Empty(true)
{
if (buildObjectList)
{
this->Group = this->Generator->CreateObject(cmXCodeObject::OBJECT_LIST);
}
}
bool IsEmpty() const { return this->Empty; }
void Add(const char *newString)
{
this->Empty = false;
if (this->Group)
{
this->Group->AddObject(this->Generator->CreateString(newString));
}
else
{
this->String += newString;
this->String += ' ';
}
}
const std::string &GetString() const { return this->String; }
cmXCodeObject *CreateList()
{
if (this->Group)
{
return this->Group;
}
else
{
return this->Generator->CreateString(this->String.c_str());
}
}
};
//----------------------------------------------------------------------------
cmXCodeObject*
cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,