summaryrefslogtreecommitdiff
path: root/Source/cmXCodeObject.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2005-01-24 17:35:54 -0500
committerBill Hoffman <bill.hoffman@kitware.com>2005-01-24 17:35:54 -0500
commite57b17df7ea01e259cbd74590ebfaff7a32d987d (patch)
tree5cca482fb9f80fefe818c65e7d379c28b24a3fa7 /Source/cmXCodeObject.cxx
parenta921ccaa2a590d2f83c6e81c1c41093a73d9abb8 (diff)
downloadcmake-e57b17df7ea01e259cbd74590ebfaff7a32d987d.tar.gz
ENH: initial xcode stuff
Diffstat (limited to 'Source/cmXCodeObject.cxx')
-rw-r--r--Source/cmXCodeObject.cxx50
1 files changed, 27 insertions, 23 deletions
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index a218b53cb8..9104ca4656 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -8,8 +8,7 @@ const char* cmXCodeObject::PBXTypeNames[] = {
"None"
};
-std::vector<cmXCodeObject*> cmXCodeObject::s_AllObjects;
-
+//----------------------------------------------------------------------------
cmXCodeObject::cmXCodeObject(PBXType ptype, Type type)
{
m_IsA = ptype;
@@ -17,10 +16,13 @@ cmXCodeObject::cmXCodeObject(PBXType ptype, Type type)
str << (void*)this;
m_Id = str.str();
m_Type = type;
- cmXCodeObject::s_AllObjects.push_back(this);
+ if(m_Type == OBJECT)
+ {
+ this->AddAttribute("isa", PBXTypeNames[m_IsA]);
+ }
}
-
+//----------------------------------------------------------------------------
void cmXCodeObject::Indent(int level, std::ostream& out)
{
while(level)
@@ -30,9 +32,10 @@ void cmXCodeObject::Indent(int level, std::ostream& out)
}
}
+//----------------------------------------------------------------------------
void cmXCodeObject::Print(std::ostream& out)
{
- this->Indent(1, out);
+ cmXCodeObject::Indent(2, out);
out << m_Id << " = {\n";
std::map<cmStdString, cmXCodeObject*>::iterator i;
for(i = m_ObjectAttributes.begin(); i != m_ObjectAttributes.end(); ++i)
@@ -40,58 +43,59 @@ void cmXCodeObject::Print(std::ostream& out)
cmXCodeObject* object = i->second;
if(object->m_Type == OBJECT_LIST)
{
- this->Indent(2, out);
+ cmXCodeObject::Indent(3, out);
out << i->first << " = {\n";
for(unsigned int k = 0; k < i->second->m_List.size(); k++)
{
- this->Indent(3, out);
+ cmXCodeObject::Indent(4, out);
out << i->second->m_List[k]->m_Id << ",\n";
}
- this->Indent(2, out);
+ cmXCodeObject::Indent(3, out);
out << "};\n";
}
else if(object->m_Type == ATTRIBUTE_GROUP)
{
std::map<cmStdString, cmStdString>::iterator j;
- this->Indent(2, out);
+ cmXCodeObject::Indent(3, out);
out << i->first << " = {\n";
for(j = object->m_StringAttributes.begin(); j != object->m_StringAttributes.end(); ++j)
{
- this->Indent(3, out);
+ cmXCodeObject::Indent(4, out);
out << j->first << " = " << j->second << ";\n";
}
- this->Indent(2, out);
- out << " }\n";
+ cmXCodeObject::Indent(3, out);
+ out << "}\n";
}
else if(object->m_Type == OBJECT_REF)
{
- this->Indent(2, out);
+ cmXCodeObject::Indent(3, out);
out << i->first << " = " << object->m_Object->m_Id << ";\n";
}
}
-
- this->Indent(2, out);
- out << "isa = " << PBXTypeNames[m_IsA] << ";\n";
std::map<cmStdString, cmStdString>::iterator j;
for(j = m_StringAttributes.begin(); j != m_StringAttributes.end(); ++j)
{
- this->Indent(2, out);
+ cmXCodeObject::Indent(3, out);
out << j->first << " = " << j->second << ";\n";
}
- this->Indent(1, out);
+ cmXCodeObject::Indent(2, out);
out << "};\n";
}
-void cmXCodeObject::PrintAll(std::ostream& out)
-{
+//----------------------------------------------------------------------------
+void cmXCodeObject::PrintList(std::vector<cmXCodeObject*> const& objs,
+ std::ostream& out)
+{
+ cmXCodeObject::Indent(1, out);
out << "objects = {\n";
- for(unsigned int i = 0; i < s_AllObjects.size(); ++i)
+ for(unsigned int i = 0; i < objs.size(); ++i)
{
- if(s_AllObjects[i]->m_Type == OBJECT)
+ if(objs[i]->m_Type == OBJECT)
{
- s_AllObjects[i]->Print(out);
+ objs[i]->Print(out);
}
}
+ cmXCodeObject::Indent(1, out);
out << "};\n";
}