1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmXCodeObject.h,v $
6 <<<<<<< cmXCodeObject.h
7 Date: $Date: 2007/07/27 14:55:24 $
8 Version: $Revision: 1.18 $
10 Date: $Date: 2008-09-02 14:27:15 $
11 Version: $Revision: 1.19 $
14 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
15 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
17 This software is distributed WITHOUT ANY WARRANTY; without even
18 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 PURPOSE. See the above copyright notices for more information.
21 =========================================================================*/
22 #ifndef cmXCodeObject_h
23 #define cmXCodeObject_h
25 #include "cmStandardIncludes.h"
31 enum Type
{ OBJECT_LIST
, STRING
, ATTRIBUTE_GROUP
, OBJECT_REF
, OBJECT
};
32 enum PBXType
{ PBXGroup
, PBXBuildStyle
, PBXProject
, PBXHeadersBuildPhase
,
33 PBXSourcesBuildPhase
, PBXFrameworksBuildPhase
,
34 PBXNativeTarget
, PBXFileReference
, PBXBuildFile
,
35 PBXContainerItemProxy
, PBXTargetDependency
,
36 PBXShellScriptBuildPhase
, PBXResourcesBuildPhase
,
37 PBXApplicationReference
, PBXExecutableFileReference
,
38 PBXLibraryReference
, PBXToolTarget
, PBXLibraryTarget
,
39 PBXAggregateTarget
,XCBuildConfiguration
,XCConfigurationList
,
40 PBXCopyFilesBuildPhase
,
43 class StringVec
: public std::vector
<cmStdString
> {};
44 static const char* PBXTypeNames
[];
45 virtual ~cmXCodeObject();
46 cmXCodeObject(PBXType ptype
, Type type
);
47 Type
GetType() { return this->TypeValue
;}
48 PBXType
GetIsA() { return this->IsA
;}
50 void SetString(const char* s
);
51 const char* GetString()
53 return this->String
.c_str();
56 void AddAttribute(const char* name
, cmXCodeObject
* value
)
58 this->ObjectAttributes
[name
] = value
;
61 void SetObject(cmXCodeObject
* value
)
65 cmXCodeObject
* GetObject()
69 void AddObject(cmXCodeObject
* value
)
71 this->List
.push_back(value
);
73 bool HasObject(cmXCodeObject
* o
)
75 return !(std::find(this->List
.begin(), this->List
.end(), o
)
78 void AddUniqueObject(cmXCodeObject
* value
)
80 if(std::find(this->List
.begin(), this->List
.end(), value
)
83 this->List
.push_back(value
);
86 static void Indent(int level
, std::ostream
& out
);
87 void Print(std::ostream
& out
);
88 virtual void PrintComment(std::ostream
&) {};
90 static void PrintList(std::vector
<cmXCodeObject
*> const&,
94 return this->Id
.c_str();
100 void SetTarget(cmTarget
* t
)
104 const char* GetComment() {return this->Comment
.c_str();}
105 bool HasComment() { return (this->Comment
.size() != 0);}
106 cmXCodeObject
* GetObject(const char* name
)
108 if(this->ObjectAttributes
.count(name
))
110 return this->ObjectAttributes
[name
];
114 // serach the attribute list for an object of the specified type
115 cmXCodeObject
* GetObject(cmXCodeObject::PBXType t
)
117 for(std::vector
<cmXCodeObject
*>::iterator i
= this->List
.begin();
118 i
!= this->List
.end(); ++i
)
120 cmXCodeObject
* o
= *i
;
129 cmXCodeObject
* GetPBXTargetDependency()
131 return this->PBXTargetDependencyValue
;
133 void SetPBXTargetDependency(cmXCodeObject
* d
)
135 this->PBXTargetDependencyValue
= d
;
137 void CopyAttributes(cmXCodeObject
* );
139 void AddDependLibrary(const char* configName
,
146 this->DependLibraries
[configName
].push_back(l
);
148 std::map
<cmStdString
, StringVec
> const& GetDependLibraries()
150 return this->DependLibraries
;
152 std::vector
<cmXCodeObject
*> const& GetObjectList() { return this->List
;}
153 void SetComment(const char* c
) { this->Comment
= c
;}
155 void PrintString(std::ostream
& os
) const;
164 cmXCodeObject
* Object
;
165 cmXCodeObject
* PBXTargetDependencyValue
;
166 std::vector
<cmXCodeObject
*> List
;
167 std::map
<cmStdString
, StringVec
> DependLibraries
;
168 std::map
<cmStdString
, cmXCodeObject
*> ObjectAttributes
;