2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2007-07-27 18:55:24 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2007-07-27 18:55:24 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
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-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:
|
2005-01-25 23:26:57 +03:00
|
|
|
enum Type { OBJECT_LIST, STRING, ATTRIBUTE_GROUP, OBJECT_REF, OBJECT };
|
2012-08-13 21:42:58 +04:00
|
|
|
enum PBXType { PBXGroup, PBXBuildStyle, PBXProject, PBXHeadersBuildPhase,
|
|
|
|
PBXSourcesBuildPhase, PBXFrameworksBuildPhase,
|
|
|
|
PBXNativeTarget, PBXFileReference, PBXBuildFile,
|
2005-02-04 01:42:55 +03:00
|
|
|
PBXContainerItemProxy, PBXTargetDependency,
|
|
|
|
PBXShellScriptBuildPhase, PBXResourcesBuildPhase,
|
2012-08-13 21:42:58 +04:00
|
|
|
PBXApplicationReference, PBXExecutableFileReference,
|
|
|
|
PBXLibraryReference, PBXToolTarget, PBXLibraryTarget,
|
2005-09-03 00:29:32 +04:00
|
|
|
PBXAggregateTarget,XCBuildConfiguration,XCConfigurationList,
|
2006-03-30 00:02:35 +04:00
|
|
|
PBXCopyFilesBuildPhase,
|
2005-01-22 00:25:36 +03:00
|
|
|
None
|
|
|
|
};
|
2014-02-10 09:21:34 +04:00
|
|
|
class StringVec: public std::vector<std::string> {};
|
2005-01-22 00:25:36 +03:00
|
|
|
static const char* PBXTypeNames[];
|
2005-09-05 17:17:59 +04:00
|
|
|
virtual ~cmXCodeObject();
|
2005-01-22 00:25:36 +03:00
|
|
|
cmXCodeObject(PBXType ptype, Type type);
|
2006-03-15 19:38:47 +03:00
|
|
|
Type GetType() { return this->TypeValue;}
|
2006-03-15 19:02:08 +03:00
|
|
|
PBXType GetIsA() { return this->IsA;}
|
2005-09-03 00:29:32 +04:00
|
|
|
|
2014-02-04 06:16:12 +04:00
|
|
|
void SetString(const std::string& s);
|
2014-02-22 04:05:55 +04:00
|
|
|
const std::string& GetString()
|
2005-02-09 01:12:38 +03:00
|
|
|
{
|
2014-02-22 04:05:55 +04:00
|
|
|
return this->String;
|
2005-02-09 01:12:38 +03:00
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2014-02-22 04:05:55 +04:00
|
|
|
void AddAttribute(const std::string& name, cmXCodeObject* value)
|
2005-01-22 00:25:36 +03:00
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
this->ObjectAttributes[name] = value;
|
2005-01-22 00:25:36 +03:00
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2005-01-22 00:25:36 +03:00
|
|
|
void SetObject(cmXCodeObject* value)
|
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
this->Object = value;
|
2005-01-22 00:25:36 +03:00
|
|
|
}
|
2005-02-08 01:36:34 +03:00
|
|
|
cmXCodeObject* GetObject()
|
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
return this->Object;
|
2005-02-08 01:36:34 +03:00
|
|
|
}
|
2005-01-22 00:25:36 +03:00
|
|
|
void AddObject(cmXCodeObject* value)
|
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
this->List.push_back(value);
|
2005-01-22 00:25:36 +03:00
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
bool HasObject(cmXCodeObject* o)
|
2006-05-12 22:36:39 +04:00
|
|
|
{
|
2012-08-13 21:42:58 +04:00
|
|
|
return !(std::find(this->List.begin(), this->List.end(), o)
|
2006-05-12 22:36:39 +04:00
|
|
|
== this->List.end());
|
|
|
|
}
|
2005-02-18 01:54:14 +03:00
|
|
|
void AddUniqueObject(cmXCodeObject* value)
|
2006-05-12 22:36:39 +04:00
|
|
|
{
|
2012-08-13 21:42:58 +04:00
|
|
|
if(std::find(this->List.begin(), this->List.end(), value)
|
2006-05-12 22:36:39 +04:00
|
|
|
== this->List.end())
|
|
|
|
{
|
|
|
|
this->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-09-03 00:29:32 +04:00
|
|
|
virtual void PrintComment(std::ostream&) {};
|
|
|
|
|
2012-08-13 21:42:58 +04:00
|
|
|
static void PrintList(std::vector<cmXCodeObject*> const&,
|
2006-05-12 22:36:39 +04:00
|
|
|
std::ostream& out);
|
2014-02-22 04:05:55 +04:00
|
|
|
const std::string& GetId()
|
2005-01-22 00:25:36 +03:00
|
|
|
{
|
2014-02-22 04:05:55 +04:00
|
|
|
return this->Id;
|
2005-01-22 00:25:36 +03:00
|
|
|
}
|
2014-02-22 04:05:55 +04:00
|
|
|
void SetId(const std::string& id)
|
2011-08-24 02:22:33 +04:00
|
|
|
{
|
|
|
|
this->Id = id;
|
|
|
|
}
|
2006-03-15 19:38:47 +03:00
|
|
|
cmTarget* GetTarget()
|
2005-02-04 01:42:55 +03:00
|
|
|
{
|
2006-03-15 19:38:47 +03:00
|
|
|
return this->Target;
|
2005-02-04 01:42:55 +03:00
|
|
|
}
|
2006-03-15 19:38:47 +03:00
|
|
|
void SetTarget(cmTarget* t)
|
2005-02-04 01:42:55 +03:00
|
|
|
{
|
2006-03-15 19:38:47 +03:00
|
|
|
this->Target = t;
|
2005-02-04 01:42:55 +03:00
|
|
|
}
|
2014-02-22 04:05:55 +04:00
|
|
|
const std::string& GetComment() {return this->Comment;}
|
|
|
|
bool HasComment() { return (!this->Comment.empty());}
|
2005-02-04 01:42:55 +03:00
|
|
|
cmXCodeObject* GetObject(const char* name)
|
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
if(this->ObjectAttributes.count(name))
|
2005-02-04 01:42:55 +03:00
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
return this->ObjectAttributes[name];
|
2005-02-04 01:42:55 +03:00
|
|
|
}
|
|
|
|
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)
|
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
for(std::vector<cmXCodeObject*>::iterator i = this->List.begin();
|
|
|
|
i != this->List.end(); ++i)
|
2005-02-05 01:58:58 +03:00
|
|
|
{
|
|
|
|
cmXCodeObject* o = *i;
|
2006-03-15 19:38:47 +03:00
|
|
|
if(o->IsA == t)
|
2005-02-05 01:58:58 +03:00
|
|
|
{
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2005-02-08 01:36:34 +03:00
|
|
|
void CopyAttributes(cmXCodeObject* );
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2014-02-10 07:48:34 +04:00
|
|
|
void AddDependLibrary(const std::string& configName,
|
2014-02-04 06:20:56 +04:00
|
|
|
const std::string& l)
|
2005-02-18 01:54:14 +03:00
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
this->DependLibraries[configName].push_back(l);
|
2005-02-18 01:54:14 +03:00
|
|
|
}
|
2014-02-10 09:21:34 +04:00
|
|
|
std::map<std::string, StringVec> const& GetDependLibraries()
|
2005-02-18 01:54:14 +03:00
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
return this->DependLibraries;
|
2005-02-18 01:54:14 +03:00
|
|
|
}
|
2014-02-10 07:48:34 +04:00
|
|
|
void AddDependTarget(const std::string& configName,
|
2014-02-07 02:31:47 +04:00
|
|
|
const std::string& tName)
|
2011-06-07 01:34:43 +04:00
|
|
|
{
|
|
|
|
this->DependTargets[configName].push_back(tName);
|
|
|
|
}
|
2014-02-10 09:21:34 +04:00
|
|
|
std::map<std::string, StringVec> const& GetDependTargets()
|
2011-06-07 01:34:43 +04:00
|
|
|
{
|
|
|
|
return this->DependTargets;
|
|
|
|
}
|
2006-03-15 19:02:08 +03:00
|
|
|
std::vector<cmXCodeObject*> const& GetObjectList() { return this->List;}
|
2014-02-22 04:05:55 +04:00
|
|
|
void SetComment(const std::string& c) { this->Comment = c;}
|
2014-02-10 09:21:34 +04:00
|
|
|
static void PrintString(std::ostream& os,std::string String);
|
2005-09-03 00:29:32 +04:00
|
|
|
protected:
|
2008-09-02 18:27:15 +04:00
|
|
|
void PrintString(std::ostream& os) const;
|
|
|
|
|
2006-03-15 19:38:47 +03:00
|
|
|
cmTarget* Target;
|
|
|
|
Type TypeValue;
|
2014-02-10 09:21:34 +04:00
|
|
|
std::string Id;
|
2006-03-15 19:02:08 +03:00
|
|
|
PBXType IsA;
|
|
|
|
int Version;
|
2014-02-10 09:21:34 +04:00
|
|
|
std::string Comment;
|
|
|
|
std::string String;
|
2006-03-15 19:02:08 +03:00
|
|
|
cmXCodeObject* Object;
|
|
|
|
std::vector<cmXCodeObject*> List;
|
2014-02-10 09:21:34 +04:00
|
|
|
std::map<std::string, StringVec> DependLibraries;
|
|
|
|
std::map<std::string, StringVec> DependTargets;
|
|
|
|
std::map<std::string, cmXCodeObject*> ObjectAttributes;
|
2005-01-22 00:25:36 +03:00
|
|
|
};
|
2005-01-25 01:35:54 +03:00
|
|
|
#endif
|