CMake/Source/cmXCodeObject.h

132 lines
3.2 KiB
C
Raw Normal View History

2005-01-25 01:35:54 +03:00
#ifndef cmXCodeObject_h
#define cmXCodeObject_h
2005-01-22 00:25:36 +03:00
#include "cmStandardIncludes.h"
2005-02-04 01:42:55 +03:00
class cmTarget;
2005-01-22 00:25:36 +03:00
class cmXCodeObject
{
public:
enum Type { OBJECT_LIST, STRING, ATTRIBUTE_GROUP, OBJECT_REF, OBJECT };
2005-01-22 00:25:36 +03:00
enum PBXType { PBXGroup, PBXBuildStyle, PBXProject, PBXHeadersBuildPhase,
2005-02-04 01:42:55 +03:00
PBXSourcesBuildPhase, PBXFrameworksBuildPhase,
PBXNativeTarget, PBXFileReference, PBXBuildFile,
PBXContainerItemProxy, PBXTargetDependency,
PBXShellScriptBuildPhase, PBXResourcesBuildPhase,
PBXApplicationReference, PBXExecutableFileReference,
PBXLibraryReference, PBXToolTarget, PBXLibraryTarget,
PBXAggregateTarget,
2005-01-22 00:25:36 +03:00
None
};
static const char* PBXTypeNames[];
2005-02-04 01:42:55 +03:00
~cmXCodeObject();
2005-01-22 00:25:36 +03:00
cmXCodeObject(PBXType ptype, Type type);
void SetString(const char* s)
2005-01-22 00:25:36 +03:00
{
2005-02-03 01:16:07 +03:00
m_String = "\"";
m_String += s;
m_String += "\"";
2005-01-22 00:25:36 +03:00
}
2005-02-09 01:12:38 +03:00
const char* GetString()
{
return m_String.c_str();
}
2005-01-22 00:25:36 +03:00
void AddAttribute(const char* name, cmXCodeObject* value)
{
m_ObjectAttributes[name] = value;
}
void SetObject(cmXCodeObject* value)
{
m_Object = value;
}
2005-02-08 01:36:34 +03:00
cmXCodeObject* GetObject()
{
return m_Object;
}
2005-01-22 00:25:36 +03:00
void AddObject(cmXCodeObject* value)
{
m_List.push_back(value);
}
bool HasObject(cmXCodeObject* o)
{
return !(std::find(m_List.begin(), m_List.end(), o) == m_List.end());
}
void AddUniqueObject(cmXCodeObject* value)
{
if(std::find(m_List.begin(), m_List.end(), value) == m_List.end())
{
m_List.push_back(value);
}
}
2005-01-25 01:35:54 +03:00
static void Indent(int level, std::ostream& out);
2005-01-22 00:25:36 +03:00
void Print(std::ostream& out);
2005-01-25 01:35:54 +03:00
static void PrintList(std::vector<cmXCodeObject*> const&, std::ostream& out);
2005-01-22 00:25:36 +03:00
const char* GetId()
{
return m_Id.c_str();
}
2005-02-04 01:42:55 +03:00
cmTarget* GetcmTarget()
{
return m_cmTarget;
}
void SetcmTarget(cmTarget* t)
{
m_cmTarget = t;
}
cmXCodeObject* GetObject(const char* name)
{
if(m_ObjectAttributes.count(name))
{
return m_ObjectAttributes[name];
}
return 0;
}
2005-02-05 01:58:58 +03:00
// serach the attribute list for an object of the specified type
cmXCodeObject* GetObject(cmXCodeObject::PBXType t)
{
for(std::vector<cmXCodeObject*>::iterator i = m_List.begin();
i != m_List.end(); ++i)
{
cmXCodeObject* o = *i;
if(o->m_IsA == t)
{
return o;
}
}
return 0;
}
cmXCodeObject* GetPBXTargetDependency()
{
return m_PBXTargetDependency;
}
void SetPBXTargetDependency(cmXCodeObject* d)
{
m_PBXTargetDependency = d;
}
2005-02-08 01:36:34 +03:00
void CopyAttributes(cmXCodeObject* );
2005-02-04 01:42:55 +03:00
void AddDependLibrary(const char* l)
{
m_DependLibraries.push_back(l);
}
std::vector<cmStdString> const& GetDependLibraries()
{
return m_DependLibraries;
}
2005-01-25 01:35:54 +03:00
private:
2005-02-04 01:42:55 +03:00
cmTarget* m_cmTarget;
2005-01-22 00:25:36 +03:00
Type m_Type;
cmStdString m_Id;
PBXType m_IsA;
cmStdString m_String;
2005-01-22 00:25:36 +03:00
cmXCodeObject* m_Object;
2005-02-05 01:58:58 +03:00
cmXCodeObject* m_PBXTargetDependency;
2005-01-22 00:25:36 +03:00
std::vector<cmXCodeObject*> m_List;
std::vector<cmStdString> m_DependLibraries;
2005-01-22 00:25:36 +03:00
std::map<cmStdString, cmXCodeObject*> m_ObjectAttributes;
};
2005-01-25 01:35:54 +03:00
#endif