当前位置: 首页>>代码示例>>C++>>正文


C++ GroupList::size方法代码示例

本文整理汇总了C++中GroupList::size方法的典型用法代码示例。如果您正苦于以下问题:C++ GroupList::size方法的具体用法?C++ GroupList::size怎么用?C++ GroupList::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GroupList的用法示例。


在下文中一共展示了GroupList::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SortGroups

void CPdpManager::SortGroups()
{
	//here is a little hack to sort the groups into the correct order so that they
	//will save out properly.

	GroupList gListSort = m_GroupList;
	sort(gListSort.begin(), gListSort.end());
	for (int newIdx = 0; newIdx < (int)gListSort.size(); newIdx++)
	{
		if (gListSort[newIdx] != m_GroupList[newIdx])
		{
			int oldIdx = 0;
			for (oldIdx = 0; oldIdx < (int)m_GroupList.size(); oldIdx++)
			{
				if (m_GroupList[oldIdx] == gListSort[newIdx])
				{
					dprintf("%s - old: %d, new: %d\n", m_GroupList[oldIdx].c_str(), oldIdx, newIdx);
					break;
				}
			}
			assert(oldIdx != gListSort.size());

			for (FileListItr itr = m_FileList.begin(); itr != m_FileList.end(); itr++)
			{
				if (itr->nGroupInx == oldIdx)
				{
					//set the new index to the negative value so it doesn't get re-remapped
					itr->nGroupInx = -newIdx;
				}
			}
		}
	}
	m_GroupList = gListSort;

	//fix the negative indexes.
	for (FileListItr itr = m_FileList.begin(); itr != m_FileList.end(); itr++)
	{
		if (itr->nGroupInx < 0)
			itr->nGroupInx = -itr->nGroupInx;
	}

	sort(m_FileList.begin(), m_FileList.end(), CPdpManager::SFileCompare);

	for (FileListItr itr = m_FileList.begin(); itr != m_FileList.end(); itr++)
	{
		dprintf(itr->filename.c_str());
		dprintf("\n");
	}
		
}
开发者ID:lassoan,项目名称:PythonVisualDebugger,代码行数:50,代码来源:PdpManager.cpp

示例2: collectParameters

/*!
  Insert Parameters in AST of given scad file
  form of annotations
*/
void CommentParser::collectParameters(const char *fulltext, FileModule *root_module)
{
	// Get all groups of parameters
	GroupList groupList = collectGroups(std::string(fulltext));
	int parseTill=getLineToStop(fulltext);
	// Extract parameters for all literal assignments
	for (auto &assignment : root_module->scope.assignments) {
		if (!assignment.expr.get()->isLiteral()) continue; // Only consider literals

		// get location of assignment node
		int firstLine = assignment.location().firstLine();
		if(firstLine>=parseTill ) continue;

		// making list to add annotations
		AnnotationList *annotationList = new AnnotationList();
 
		// Extracting the parameter comment
		std::string comment = getComment(std::string(fulltext), firstLine);
		// getting the node for parameter annnotataion
		shared_ptr<Expression> params = CommentParser::parser(comment.c_str());
		if (!params) {
			params = shared_ptr<Expression>(new Literal(ValuePtr(std::string(""))));
		}

		// adding parameter to the list
		annotationList->push_back(Annotation("Parameter", params));

		//extracting the description
		std::string descr = getDescription(std::string(fulltext), firstLine - 1);
		if (descr != "") {
			//creating node for description
			shared_ptr<Expression> expr(new Literal(ValuePtr(std::string(descr.c_str()))));
			annotationList->push_back(Annotation("Description", expr));
		}

		// Look for the group to which the given assignment belong
		int i=0;
		for (;i<groupList.size() && groupList[i].lineNo<firstLine;i++);
		i--;

		if (i >= 0) {
			//creating node for description
			shared_ptr<Expression> expr(new Literal(ValuePtr(groupList[i].commentString)));
			annotationList->push_back(Annotation("Group", expr));
		}
		assignment.addAnnotations(annotationList);
	}
}
开发者ID:doug-moen,项目名称:openscad,代码行数:52,代码来源:comment.cpp


注:本文中的GroupList::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。