• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ SHARED_TREE_PTR类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中SHARED_TREE_PTR的典型用法代码示例。如果您正苦于以下问题:C++ SHARED_TREE_PTR类的具体用法?C++ SHARED_TREE_PTR怎么用?C++ SHARED_TREE_PTR使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: ptr1

int CGitHeadFileMap::GetHeadHash(const CString &gitdir, CGitHash &hash)
{
	SHARED_TREE_PTR ptr;
	ptr = this->SafeGet(gitdir);

	if(ptr.get() == NULL)
	{
		SHARED_TREE_PTR ptr1(new CGitHeadFileList());
		ptr1->ReadHeadHash(gitdir);

		hash = ptr1->m_Head;

		this->SafeSet(gitdir, ptr1);

	}
	else
	{
		if(ptr->CheckHeadUpdate())
		{
			SHARED_TREE_PTR ptr1(new CGitHeadFileList());
			ptr1->ReadHeadHash(gitdir);

			hash = ptr1->m_Head;
			this->SafeSet(gitdir, ptr1);
	}

		hash = ptr->m_Head;
	}
	return 0;
}
开发者ID:bb-froggy,项目名称:TortoiseGit,代码行数:30,代码来源:GitIndex.cpp


示例2: _T

int CGitHeadFileMap::IsUnderVersionControl(const CString &gitdir, const CString &path, bool isDir, bool *isVersion)
{
    try
    {
        if (path.IsEmpty())
        {
            *isVersion = true;
            return 0;
        }

        CString subpath = path;
        subpath.Replace(_T('\\'), _T('/'));
        if(isDir)
            subpath += _T('/');

        subpath.MakeLower();

        CheckHeadAndUpdate(gitdir);

        SHARED_TREE_PTR treeptr = SafeGet(gitdir);

        // Init Repository
        if (treeptr->HeadFileIsEmpty())
        {
            *isVersion = false;
            return 0;
        }
        else if (treeptr->empty())
        {
            *isVersion = false;
            return 1;
        }

        if(isDir)
            *isVersion = (SearchInSortVector(*treeptr, subpath, subpath.GetLength()) >= 0);
        else
            *isVersion = (SearchInSortVector(*treeptr, subpath, -1) >= 0);
    }
    catch(...)
    {
        return -1;
    }

    return 0;
}
开发者ID:Jopie64,项目名称:tortoisegit,代码行数:45,代码来源:GitIndex.cpp


示例3: SHARED_TREE_PTR

bool CGitHeadFileMap::CheckHeadAndUpdate(const CString &gitdir, bool readTree /* = true */)
{
	SHARED_TREE_PTR ptr = this->SafeGet(gitdir, true);

	if (ptr.get() && !ptr->CheckHeadUpdate() && (!readTree || ptr->HeadHashEqualsTreeHash()))
		return false;

	ptr = SHARED_TREE_PTR(new CGitHeadFileList);
	ptr->ReadHeadHash(gitdir);
	if (readTree)
		ptr->ReadTree();

	this->SafeSet(gitdir, ptr);

	return true;
}
开发者ID:francisoliverlee,项目名称:TortoiseGit,代码行数:16,代码来源:GitIndex.cpp


示例4: _T

int GitStatus::GetDirStatus(const CString &gitdir, const CString &subpath, git_wc_status_kind * status, BOOL IsFul, BOOL IsRecursive, BOOL IsIgnore, FILL_STATUS_CALLBACK callback, void *pData)
{
	try
	{
		CString path =subpath;

		path.Replace(_T('\\'),_T('/'));
		if(!path.IsEmpty())
			if(path[path.GetLength()-1] !=  _T('/'))
				path += _T('/'); //Add trail / to show it is directory, not file name.

		CString lowcasepath = path;
		lowcasepath.MakeLower();

		if(status)
		{
			g_IndexFileMap.CheckAndUpdate(gitdir, true);

			SHARED_INDEX_PTR indexptr = g_IndexFileMap.SafeGet(gitdir);

			if (indexptr == NULL)
			{
				*status = git_wc_status_unversioned;
				return 0;
			}

			int pos = SearchInSortVector(*indexptr, lowcasepath, lowcasepath.GetLength());

			//Not In Version Contorl
			if(pos<0)
			{
				if(!IsIgnore)
				{
					*status = git_wc_status_unversioned;
					if(callback)
						callback(gitdir + _T("/") + path, *status, false, pData, false, false);
					return 0;
				}
				//Check ignore always.
				{
					if (g_IgnoreList.CheckIgnoreChanged(gitdir, path, true))
						g_IgnoreList.LoadAllIgnoreFile(gitdir, path, true);

					if (g_IgnoreList.IsIgnore(path, gitdir, true))
						*status = git_wc_status_ignored;
					else
						*status = git_wc_status_unversioned;

					g_HeadFileMap.CheckHeadAndUpdate(gitdir, false);

					SHARED_TREE_PTR treeptr = g_HeadFileMap.SafeGet(gitdir);
					//Check init repository
					if (treeptr->HeadIsEmpty() && path.IsEmpty())
						*status = git_wc_status_normal;
				}

			}
			else  // In version control
			{
				*status = git_wc_status_normal;

				int start=0;
				int end=0;
				if(path.IsEmpty())
				{
					start=0;
					end = (int)indexptr->size() - 1;
				}
				GetRangeInSortVector(*indexptr, lowcasepath, lowcasepath.GetLength(), &start, &end, pos);
				CGitIndexList::iterator it;

				it = indexptr->begin()+start;

				// Check Conflict;
				for (int i = start; i <= end; ++i)
				{
					if (((*it).m_Flags & GIT_IDXENTRY_STAGEMASK) !=0)
					{
						*status = git_wc_status_conflicted;
						if(callback)
						{
							int dirpos = (*it).m_FileName.Find(_T('/'), path.GetLength());
							if(dirpos<0 || IsRecursive)
								callback(gitdir + _T("\\") + it->m_FileName, git_wc_status_conflicted, false, pData, false, false);
						}
						else
							break;
					}
					++it;
				}

				if( IsFul && (*status != git_wc_status_conflicted))
				{
					*status = git_wc_status_normal;

					g_HeadFileMap.CheckHeadAndUpdate(gitdir);

					//Check Add
					it = indexptr->begin()+start;

//.........这里部分代码省略.........
开发者ID:hellojoker1990,项目名称:TortoiseGit,代码行数:101,代码来源:GitStatus.cpp


示例5: callback

int GitStatus::GetFileStatus(const CString &gitdir, const CString &pathParam, git_wc_status_kind * status,BOOL IsFull, BOOL /*IsRecursive*/,BOOL IsIgnore, FILL_STATUS_CALLBACK callback, void *pData, bool * assumeValid, bool * skipWorktree)
{
	try
	{
		CString path = pathParam;

		path.Replace(_T('\\'),_T('/'));

		CString lowcasepath =path;
		lowcasepath.MakeLower();

		if(status)
		{
			git_wc_status_kind st = git_wc_status_none;
			CGitHash hash;

			g_IndexFileMap.GetFileStatus(gitdir, path, &st, IsFull, false, callback, pData, &hash, true, assumeValid, skipWorktree);

			if( st == git_wc_status_conflicted )
			{
				*status =st;
				if (callback && assumeValid && skipWorktree)
					callback(gitdir + _T("/") + path, st, false, pData, *assumeValid, *skipWorktree);
				return 0;
			}

			if( st == git_wc_status_unversioned )
			{
				if(!IsIgnore)
				{
					*status = git_wc_status_unversioned;
					if (callback && assumeValid && skipWorktree)
						callback(gitdir + _T("/") + path, *status, false, pData, *assumeValid, *skipWorktree);
					return 0;
				}

				if (g_IgnoreList.CheckIgnoreChanged(gitdir, path, false))
				{
					g_IgnoreList.LoadAllIgnoreFile(gitdir, path, false);
				}
				if (g_IgnoreList.IsIgnore(path, gitdir, false))
				{
					st = git_wc_status_ignored;
				}
				*status = st;
				if (callback && assumeValid && skipWorktree)
					callback(gitdir + _T("/") + path, st, false, pData, *assumeValid, *skipWorktree);

				return 0;
			}

			if ((st == git_wc_status_normal || st == git_wc_status_modified) && IsFull)
			{
				{
					g_HeadFileMap.CheckHeadAndUpdate(gitdir);

					SHARED_TREE_PTR treeptr = g_HeadFileMap.SafeGet(gitdir);

					// Check Head Tree Hash;
					{
						//add item

						int start = SearchInSortVector(*treeptr, lowcasepath, -1);

						if(start<0)
						{
							*status =st=git_wc_status_added;
							CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) _T(": File miss in head tree %s"), path);
							if (callback && assumeValid && skipWorktree)
								callback(gitdir + _T("/") + path, st, false, pData, *assumeValid, *skipWorktree);
							return 0;
						}

						//staged and not commit
						if( treeptr->at(start).m_Hash != hash )
						{
							*status =st=git_wc_status_modified;
							if (callback && assumeValid && skipWorktree)
								callback(gitdir + _T("/") + path, st, false, pData, *assumeValid, *skipWorktree);
							return 0;
						}
					}
				}
			}
			*status =st;
			if (callback && assumeValid && skipWorktree)
				callback(gitdir + _T("/") + path, st, false, pData, *assumeValid, *skipWorktree);
			return 0;
		}
	}
	catch(...)
	{
		if(status)
			*status = git_wc_status_none;
		return -1;
	}

	return 0;

}
开发者ID:hellojoker1990,项目名称:TortoiseGit,代码行数:100,代码来源:GitStatus.cpp


示例6: _T

int GitStatus::GetDirStatus(const CString& gitdir, const CString& subpath, git_wc_status_kind* status, BOOL IsFul, BOOL IsRecursive, BOOL IsIgnore)
{
	if (!status)
		return 0;

	CString path = subpath;

	path.Replace(_T('\\'), _T('/'));
	if (!path.IsEmpty() && path[path.GetLength() - 1] != _T('/'))
		path += _T('/'); //Add trail / to show it is directory, not file name.

	g_IndexFileMap.CheckAndUpdate(gitdir, true);

	SHARED_INDEX_PTR indexptr = g_IndexFileMap.SafeGet(gitdir);

	if (!indexptr)
	{
		*status = git_wc_status_unversioned;
		return 0;
	}

	CString lowcasepath = path;
	lowcasepath.MakeLower();

	int pos = SearchInSortVector(*indexptr, lowcasepath, lowcasepath.GetLength());

	// Not In Version Contorl
	if (pos < 0)
	{
		if (!IsIgnore)
		{
			*status = git_wc_status_unversioned;
			return 0;
		}

		// Check ignore always.
		if (g_IgnoreList.CheckIgnoreChanged(gitdir, path, true))
			g_IgnoreList.LoadAllIgnoreFile(gitdir, path, true);

		if (g_IgnoreList.IsIgnore(path, gitdir, true))
			*status = git_wc_status_ignored;
		else
			*status = git_wc_status_unversioned;

		g_HeadFileMap.CheckHeadAndUpdate(gitdir);

		SHARED_TREE_PTR treeptr = g_HeadFileMap.SafeGet(gitdir);
		// Check init repository
		if (treeptr->HeadIsEmpty() && path.IsEmpty())
			*status = git_wc_status_normal;
		// check if only one file in repository is deleted in index
		else if (path.IsEmpty() && !treeptr->empty())
			*status = git_wc_status_deleted;

		return 0;
	}

	// In version control
	*status = git_wc_status_normal;

	int start = 0;
	int end = 0;

	GetRangeInSortVector(*indexptr, lowcasepath, lowcasepath.GetLength(), &start, &end, pos);

	// Check Conflict;
	for (auto it = indexptr->cbegin() + start, itlast = indexptr->cbegin() + end; indexptr->m_bHasConflicts && it <= itlast; ++it)
	{
		if (((*it).m_Flags & GIT_IDXENTRY_STAGEMASK) != 0)
		{
			*status = git_wc_status_conflicted;
			break;
		}
	}

	if (IsFul && (*status != git_wc_status_conflicted))
	{
		*status = git_wc_status_normal;

		g_HeadFileMap.CheckHeadAndUpdate(gitdir);

		// Check Add
		{
			// Check if new init repository
			SHARED_TREE_PTR treeptr = g_HeadFileMap.SafeGet(gitdir);

			if (!treeptr->empty() || treeptr->HeadIsEmpty())
			{
				for (auto it = indexptr->cbegin() + start, itlast = indexptr->cbegin() + end; it <= itlast; ++it)
				{
					pos = SearchInSortVector(*treeptr, (*it).m_FileName, -1);

					if (pos < 0)
					{
						*status = max(git_wc_status_added, *status); // added file found
						break;
					}

					if (pos >= 0 && treeptr->at(pos).m_Hash != (*it).m_IndexHash)
					{
//.........这里部分代码省略.........
开发者ID:iamduyu,项目名称:TortoiseGit,代码行数:101,代码来源:GitStatus.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ SHit类代码示例发布时间:2022-05-31
下一篇:
C++ SHAPE_POLY_SET类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap