summaryrefslogtreecommitdiff
path: root/Source/cmXCode21Object.cxx
blob: 0a70d78c60dc305429f763836be13b0174bc2c7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include "cmXCode21Object.h"
#include "cmSystemTools.h"

cmXCode21Object::cmXCode21Object(PBXType ptype, Type type)
  :cmXCodeObject(ptype, type)
{
  this->Version = 21;
}

//----------------------------------------------------------------------------
void cmXCode21Object::PrintComment(std::ostream& out)
{
  if(this->Comment.size() == 0)
    {
    cmXCodeObject* n = this->GetObject("name");
    if(n)
      {
      this->Comment = n->GetString();
      cmSystemTools::ReplaceString(this->Comment, "\"", "");
      }
    }
  out << "/* ";
  out << this->Comment;
  out << " */";
}


void cmXCode21Object::PrintList(std::vector<cmXCodeObject*> const& v,
                                std::ostream& out, PBXType t)
{
  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";
  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";
}

void cmXCode21Object::PrintList(std::vector<cmXCodeObject*> const& v,
                                std::ostream& out)
{
  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, 
                             cmXCode21Object::PBXFrameworksBuildPhase);
  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, 
                             cmXCode21Object::PBXShellScriptBuildPhase);
  cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXResourcesBuildPhase);
  cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXSourcesBuildPhase);
  cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXCopyFilesBuildPhase);
  cmXCode21Object::PrintList(v, out, 
                             cmXCode21Object::PBXApplicationReference);
  cmXCode21Object::PrintList(v, out, 
                             cmXCode21Object::PBXExecutableFileReference);
  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";
}