CMake/Source/cmXCode21Object.cxx

111 lines
4.1 KiB
C++
Raw Normal View History

/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
2005-09-03 00:29:32 +04:00
#include "cmXCode21Object.h"
#include "cmSystemTools.h"
2005-09-03 00:29:32 +04:00
//----------------------------------------------------------------------------
2005-09-03 00:29:32 +04:00
cmXCode21Object::cmXCode21Object(PBXType ptype, Type type)
:cmXCodeObject(ptype, type)
{
2006-03-15 19:02:08 +03:00
this->Version = 21;
2005-09-03 00:29:32 +04:00
}
//----------------------------------------------------------------------------
void cmXCode21Object::PrintComment(std::ostream& out)
{
if(this->Comment.empty())
{
cmXCodeObject* n = this->GetObject("name");
if(n)
{
2006-03-15 19:02:08 +03:00
this->Comment = n->GetString();
cmSystemTools::ReplaceString(this->Comment, "\"", "");
}
}
if(this->Comment.empty())
{
return;
}
out << " /* ";
2006-03-15 19:02:08 +03:00
out << this->Comment;
out << " */";
2005-09-03 00:29:32 +04:00
}
//----------------------------------------------------------------------------
2006-03-10 21:54:57 +03:00
void cmXCode21Object::PrintList(std::vector<cmXCodeObject*> const& v,
std::ostream& out, PBXType t)
2005-09-03 00:29:32 +04:00
{
bool hasOne = false;
for(std::vector<cmXCodeObject*>::const_iterator i = v.begin();
i != v.end(); ++i)
{
cmXCodeObject* obj = *i;
if(obj->GetType() == OBJECT && obj->GetIsA() == t)
{
hasOne = true;
break;
}
}
if(!hasOne)
{
return;
}
out << "\n/* Begin " << PBXTypeNames[t] << " section */\n";
2005-09-03 00:29:32 +04:00
for(std::vector<cmXCodeObject*>::const_iterator i = v.begin();
i != v.end(); ++i)
{
cmXCodeObject* obj = *i;
if(obj->GetType() == OBJECT && obj->GetIsA() == t)
{
obj->Print(out);
}
}
out << "/* End " << PBXTypeNames[t] << " section */\n";
}
//----------------------------------------------------------------------------
2006-03-10 21:54:57 +03:00
void cmXCode21Object::PrintList(std::vector<cmXCodeObject*> const& v,
std::ostream& out)
2005-09-03 00:29:32 +04:00
{
cmXCodeObject::Indent(1, out);
out << "objects = {\n";
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXAggregateTarget);
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXBuildFile);
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXBuildStyle);
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXContainerItemProxy);
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXFileReference);
cmXCode21Object::PrintList(v, out,
2006-05-12 22:36:39 +04:00
cmXCode21Object::PBXFrameworksBuildPhase);
2005-09-03 00:29:32 +04:00
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXGroup);
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXHeadersBuildPhase);
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXNativeTarget);
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXProject);
cmXCode21Object::PrintList(v, out,
2006-03-10 21:54:57 +03:00
cmXCode21Object::PBXShellScriptBuildPhase);
2005-09-03 00:29:32 +04:00
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXResourcesBuildPhase);
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXSourcesBuildPhase);
2006-03-30 01:21:22 +04:00
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXCopyFilesBuildPhase);
cmXCode21Object::PrintList(v, out,
2006-05-12 22:36:39 +04:00
cmXCode21Object::PBXApplicationReference);
cmXCode21Object::PrintList(v, out,
2006-03-10 21:54:57 +03:00
cmXCode21Object::PBXExecutableFileReference);
2005-09-03 00:29:32 +04:00
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXLibraryReference);
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXToolTarget);
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXLibraryTarget);
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXTargetDependency);
cmXCode21Object::PrintList(v, out, cmXCode21Object::XCBuildConfiguration);
cmXCode21Object::PrintList(v, out, cmXCode21Object::XCConfigurationList);
cmXCodeObject::Indent(1, out);
out << "};\n";
}