Click here to Skip to main content
15,884,298 members
Articles / Desktop Programming / ATL

VS File Finder

Rate me:
Please Sign up or sign in to vote.
4.90/5 (39 votes)
8 May 20053 min read 223K   3.3K   37  
A Visual Studio add-in to help navigate around large projects.
#include "StdAfx.h"
#include "ProjectItemSort.h"

ProjectItemSort::ProjectItemSort()
{
}

ProjectItemSort::~ProjectItemSort()
{
}

bool ProjectItemSort::operator()(const ProjectItemData& first, const ProjectItemData& second)
{
	for (SortOrderList::const_iterator i = m_SortOrder.begin(); i != m_SortOrder.end(); ++i)
	{
		const SortItem& order(*i);
		CString a, b;

		switch(order.m_Field)
		{
		case Field_Name:	a = first.m_Name; b = second.m_Name;		break;
		case Field_Path:	a = first.m_Path; b = second.m_Path;		break;
		case Field_Project:	a = first.m_Project; b = second.m_Project;	break;
		}

		a.MakeLower();
		b.MakeLower();

		if (a == b)
			continue;

		if (order.m_Direction == Direction_Ascending)
			return StrCmpLogicalW(a, b) < 0;
		else
			return StrCmpLogicalW(b, a) < 0;
	}
	return false;
}

void ProjectItemSort::SetSortOrder(Field f, Direction d)
{
	m_SortOrder.clear();
	AddSortOrder(f, d);
}

void ProjectItemSort::AddSortOrder(Field f, Direction d)
{
	SortItem s;
	s.m_Field = f;
	s.m_Direction = d;
	m_SortOrder.push_back(s);
}

size_t ProjectItemSort::GetSortCount() const
{
	return m_SortOrder.size();
}

ProjectItemSort::SortItem ProjectItemSort::GetSortItem(int n) const
{
	return m_SortOrder[n];
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions