本文整理汇总了C++中gd::Project::GetObjectGroups方法的典型用法代码示例。如果您正苦于以下问题:C++ Project::GetObjectGroups方法的具体用法?C++ Project::GetObjectGroups怎么用?C++ Project::GetObjectGroups使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gd::Project
的用法示例。
在下文中一共展示了Project::GetObjectGroups方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StripProjectForExport
void GD_CORE_API ProjectStripper::StripProjectForExport(gd::Project& project) {
project.GetObjectGroups().Clear();
while (project.GetExternalEventsCount() > 0)
project.RemoveExternalEvents(project.GetExternalEvents(0).GetName());
for (unsigned int i = 0; i < project.GetLayoutsCount(); ++i) {
project.GetLayout(i).GetObjectGroups().Clear();
project.GetLayout(i).GetEvents().Clear();
}
}
示例2: if
vector < gd::String > GD_CORE_API GetBehaviorsOfObject(const gd::Project & project, const gd::Layout & layout, gd::String name, bool searchInGroups)
{
bool behaviorsAlreadyInserted = false;
vector < gd::String > behaviors;
//Search in objects
if ( layout.HasObjectNamed(name) ) //We check first layout's objects' list.
{
std::vector < gd::String > objectBehaviors = layout.GetObject(name).GetAllBehaviorNames();
std::copy(objectBehaviors.begin(), objectBehaviors.end(), back_inserter(behaviors));
behaviorsAlreadyInserted = true;
}
else if ( project.HasObjectNamed(name) ) //Then the global object list
{
vector < gd::String > objectBehaviors = project.GetObject(name).GetAllBehaviorNames();
std::copy(objectBehaviors.begin(), objectBehaviors.end(), back_inserter(behaviors));
behaviorsAlreadyInserted = true;
}
//Search in groups
if ( searchInGroups )
{
for (std::size_t i = 0;i<layout.GetObjectGroups().size();++i)
{
if ( layout.GetObjectGroups()[i].GetName() == name )
{
//A group has the name searched
//Verifying now that all objects have common behaviors.
vector < gd::String > groupsObjects = layout.GetObjectGroups()[i].GetAllObjectsNames();
for (std::size_t j = 0;j<groupsObjects.size();++j)
{
//Get behaviors of the object of the group and delete behavior which are not in commons.
vector < gd::String > objectBehaviors = GetBehaviorsOfObject(project, layout, groupsObjects[j], false);
if (!behaviorsAlreadyInserted)
{
behaviorsAlreadyInserted = true;
behaviors = objectBehaviors;
}
else
{
for (std::size_t a = 0 ;a<behaviors.size();++a)
{
if ( find(objectBehaviors.begin(), objectBehaviors.end(), behaviors[a]) == objectBehaviors.end() )
{
behaviors.erase(behaviors.begin() + a);
--a;
}
}
}
}
}
}
for (std::size_t i = 0;i<project.GetObjectGroups().size();++i)
{
if ( project.GetObjectGroups()[i].GetName() == name )
{
//A group has the name searched
//Verifying now that all objects have common behaviors.
vector < gd::String > groupsObjects = project.GetObjectGroups()[i].GetAllObjectsNames();
for (std::size_t j = 0;j<groupsObjects.size();++j)
{
//Get behaviors of the object of the group and delete behavior which are not in commons.
vector < gd::String > objectBehaviors = GetBehaviorsOfObject(project, layout, groupsObjects[j], false);
if (!behaviorsAlreadyInserted)
{
behaviorsAlreadyInserted = true;
behaviors = objectBehaviors;
}
else
{
for (std::size_t a = 0 ;a<behaviors.size();++a)
{
if ( find(objectBehaviors.begin(), objectBehaviors.end(), behaviors[a]) == objectBehaviors.end() )
{
behaviors.erase(behaviors.begin() + a);
--a;
}
}
}
}
}
}
}
return behaviors;
}