void tRemoteControlDeviceModel::sort( int column, Qt::SortOrder order /* = Qt::AscendingOrder */ )
{
    switch (column)
    {
    case eColumn_Name:       SortByName(order);       break;
    case eColumn_Permission: SortByPermission(order); break;
    }
}
Exemple #2
0
AirspaceSelectInfoVector
FilterAirspaces(const Airspaces &airspaces, const GeoPoint &location,
                const AirspaceFilterData &filter)
{
  AirspaceFilterVisitor visitor(location, airspaces.GetProjection(), filter);

  if (!negative(filter.distance))
    airspaces.VisitWithinRange(location, filter.distance, visitor);
  else
    for (const auto &i : airspaces)
      visitor.Visit(i.GetAirspace());

  if (filter.direction.IsNegative() && negative(filter.distance))
    SortByName(visitor.result);
  else
    SortByDistance(visitor.result, location, airspaces.GetProjection());

  return visitor.result;
}
Exemple #3
0
void CDriveViewer::Sort ()
{
	switch (m_State.m_nSortColumn)
	{
		case 0:	
			std::sort (m_Array.begin (), m_Array.end (), SortByName(m_State.m_bAscending));
			break;
		 case 1:
			 std::sort (m_Array.begin (), m_Array.end (), SortByType(m_State.m_bAscending));
		 case 2:
			if (m_State.m_bAscending)
				std::stable_sort (m_Array.begin (), m_Array.end (), sort_by_total_size_a);
			else
				std::stable_sort (m_Array.begin (), m_Array.end (), sort_by_total_size_d);
			break;		
		 case 3:
			if (m_State.m_bAscending)
				std::stable_sort (m_Array.begin (), m_Array.end (), sort_by_free_size_a);
			else
				std::stable_sort (m_Array.begin (), m_Array.end (), sort_by_free_size_d);
			break;		
	}
}
/* Also see NBookmarkHelper::Sort. */
int CALLBACK CShellBrowser::Sort(int InternalIndex1,int InternalIndex2) const
{
	int ComparisonResult = 0;

	bool IsFolder1 = ((m_pwfdFiles[InternalIndex1].dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) ? true : false;
	bool IsFolder2 = ((m_pwfdFiles[InternalIndex2].dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) ? true : false;
	
	/* Folders will always be sorted separately from files,
	except in the recycle bin. */
	if(IsFolder1 && !IsFolder2 && !CompareVirtualFolders(CSIDL_BITBUCKET))
	{
		ComparisonResult = -1;
	}
	else if(!IsFolder1 && IsFolder2 && !CompareVirtualFolders(CSIDL_BITBUCKET))
	{
		ComparisonResult = 1;
	}
	else
	{
		switch(m_SortMode)
		{
		case FSM_NAME:
			ComparisonResult = SortByName(InternalIndex1,InternalIndex2);
			break;

		case FSM_TYPE:
			ComparisonResult = SortByType(InternalIndex1,InternalIndex2);
			break;

		case FSM_SIZE:
			ComparisonResult = SortBySize(InternalIndex1,InternalIndex2);
			break;

		case FSM_DATEMODIFIED:
			ComparisonResult = SortByDate(InternalIndex1,InternalIndex2,DATE_TYPE_MODIFIED);
			break;

		case FSM_TOTALSIZE:
			ComparisonResult = SortByTotalSize(InternalIndex1,InternalIndex2,TRUE);
			break;

		case FSM_FREESPACE:
			ComparisonResult = SortByTotalSize(InternalIndex1,InternalIndex2,FALSE);
			break;

		case FSM_DATEDELETED:
			ComparisonResult = SortByDateDeleted(InternalIndex1,InternalIndex2);
			break;

		case FSM_ORIGINALLOCATION:
			ComparisonResult = SortByOriginalLocation(InternalIndex1,InternalIndex2);
			break;

		case FSM_ATTRIBUTES:
			ComparisonResult = SortByAttributes(InternalIndex1,InternalIndex2);
			break;

		case FSM_REALSIZE:
			ComparisonResult = SortByRealSize(InternalIndex1,InternalIndex2);
			break;

		case FSM_SHORTNAME:
			ComparisonResult = SortByShortName(InternalIndex1,InternalIndex2);
			break;

		case FSM_OWNER:
			ComparisonResult = SortByOwner(InternalIndex1,InternalIndex2);
			break;

		case FSM_PRODUCTNAME:
			ComparisonResult = SortByVersionInfo(InternalIndex1,InternalIndex2,VERSION_INFO_PRODUCT_NAME);
			break;

		case FSM_COMPANY:
			ComparisonResult = SortByVersionInfo(InternalIndex1,InternalIndex2,VERSION_INFO_COMPANY);
			break;

		case FSM_DESCRIPTION:
			ComparisonResult = SortByVersionInfo(InternalIndex1,InternalIndex2,VERSION_INFO_DESCRIPTION);
			break;

		case FSM_FILEVERSION:
			ComparisonResult = SortByVersionInfo(InternalIndex1,InternalIndex2,VERSION_INFO_FILE_VERSION);
			break;

		case FSM_PRODUCTVERSION:
			ComparisonResult = SortByVersionInfo(InternalIndex1,InternalIndex2,VERSION_INFO_PRODUCT_VERSION);
			break;

		case FSM_SHORTCUTTO:
			ComparisonResult = SortByShortcutTo(InternalIndex1,InternalIndex2);
			break;

		case FSM_HARDLINKS:
			ComparisonResult = SortByHardlinks(InternalIndex1,InternalIndex2);
			break;

		case FSM_EXTENSION:
			ComparisonResult = SortByExtension(InternalIndex1,InternalIndex2);
			break;

		case FSM_CREATED:
			ComparisonResult = SortByDate(InternalIndex1,InternalIndex2,DATE_TYPE_CREATED);
			break;

		case FSM_ACCESSED:
			ComparisonResult = SortByDate(InternalIndex1,InternalIndex2,DATE_TYPE_ACCESSED);
			break;

		case FSM_TITLE:
			ComparisonResult = SortBySummaryProperty(InternalIndex1,InternalIndex2,PROPERTY_ID_TITLE);
			break;

		case FSM_SUBJECT:
			ComparisonResult = SortBySummaryProperty(InternalIndex1,InternalIndex2,PROPERTY_ID_SUBJECT);
			break;

		case FSM_AUTHOR:
			ComparisonResult = SortBySummaryProperty(InternalIndex1,InternalIndex2,PROPERTY_ID_AUTHOR);
			break;

		case FSM_KEYWORDS:
			ComparisonResult = SortBySummaryProperty(InternalIndex1,InternalIndex2,PROPERTY_ID_KEYWORDS);
			break;

		case FSM_COMMENTS:
			ComparisonResult = SortBySummaryProperty(InternalIndex1,InternalIndex2,PROPERTY_ID_COMMENT);
			break;

		case FSM_CAMERAMODEL:
			ComparisonResult = SortByImageProperty(InternalIndex1,InternalIndex2,PropertyTagEquipModel);
			break;

		case FSM_DATETAKEN:
			ComparisonResult = SortByImageProperty(InternalIndex1,InternalIndex2,PropertyTagDateTime);
			break;

		case FSM_WIDTH:
			ComparisonResult = SortByImageProperty(InternalIndex1,InternalIndex2,PropertyTagImageWidth);
			break;

		case FSM_HEIGHT:
			ComparisonResult = SortByImageProperty(InternalIndex1,InternalIndex2,PropertyTagImageHeight);
			break;

		case FSM_VIRTUALCOMMENTS:
			ComparisonResult = SortByVirtualComments(InternalIndex1,InternalIndex2);
			break;

		case FSM_FILESYSTEM:
			ComparisonResult = SortByFileSystem(InternalIndex1,InternalIndex2);
			break;

		case FSM_NUMPRINTERDOCUMENTS:
			ComparisonResult = SortByPrinterProperty(InternalIndex1,InternalIndex2,PRINTER_INFORMATION_TYPE_NUM_JOBS);
			break;

		case FSM_PRINTERSTATUS:
			ComparisonResult = SortByPrinterProperty(InternalIndex1,InternalIndex2,PRINTER_INFORMATION_TYPE_STATUS);
			break;

		case FSM_PRINTERCOMMENTS:
			ComparisonResult = SortByPrinterProperty(InternalIndex1,InternalIndex2,PRINTER_INFORMATION_TYPE_COMMENTS);
			break;

		case FSM_PRINTERLOCATION:
			ComparisonResult = SortByPrinterProperty(InternalIndex1,InternalIndex2,PRINTER_INFORMATION_TYPE_LOCATION);
			break;

		case FSM_NETWORKADAPTER_STATUS:
			ComparisonResult = SortByNetworkAdapterStatus(InternalIndex1,InternalIndex2);
			break;

		case FSM_MEDIA_BITRATE:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_BITRATE);
			break;

		case FSM_MEDIA_COPYRIGHT:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_COPYRIGHT);
			break;

		case FSM_MEDIA_DURATION:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_DURATION);
			break;

		case FSM_MEDIA_PROTECTED:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_PROTECTED);
			break;

		case FSM_MEDIA_RATING:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_RATING);
			break;

		case FSM_MEDIA_ALBUMARTIST:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_ALBUM_ARTIST);
			break;

		case FSM_MEDIA_ALBUM:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_ALBUM_TITLE);
			break;

		case FSM_MEDIA_BEATSPERMINUTE:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_BEATS_PER_MINUTE);
			break;

		case FSM_MEDIA_COMPOSER:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_COMPOSER);
			break;

		case FSM_MEDIA_CONDUCTOR:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_CONDUCTOR);
			break;

		case FSM_MEDIA_DIRECTOR:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_DIRECTOR);
			break;

		case FSM_MEDIA_GENRE:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_GENRE);
			break;

		case FSM_MEDIA_LANGUAGE:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_LANGUAGE);
			break;

		case FSM_MEDIA_BROADCASTDATE:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_BROADCASTDATE);
			break;

		case FSM_MEDIA_CHANNEL:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_CHANNEL);
			break;

		case FSM_MEDIA_STATIONNAME:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_STATIONNAME);
			break;

		case FSM_MEDIA_MOOD:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_MOOD);
			break;

		case FSM_MEDIA_PARENTALRATING:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_PARENTALRATING);
			break;

		case FSM_MEDIA_PARENTALRATINGREASON:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_PARENTALRATINGREASON);
			break;

		case FSM_MEDIA_PERIOD:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_PERIOD);
			break;

		case FSM_MEDIA_PRODUCER:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_PRODUCER);
			break;

		case FSM_MEDIA_PUBLISHER:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_PUBLISHER);
			break;

		case FSM_MEDIA_WRITER:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_WRITER);
			break;

		case FSM_MEDIA_YEAR:
			ComparisonResult = SortByMediaMetadata(InternalIndex1,InternalIndex2,MEDIAMETADATA_TYPE_YEAR);
			break;

		default:
			assert(false);
			break;
		}
	}

	if(ComparisonResult == 0)
	{
		/* By default, items that are equal will be sub-sorted
		by their display names. */
		ComparisonResult = StrCmpLogicalW(m_pExtraItemInfo[InternalIndex1].szDisplayName,
			m_pExtraItemInfo[InternalIndex2].szDisplayName);
	}

	if(!m_bSortAscending)
	{
		ComparisonResult = -ComparisonResult;
	}

	return ComparisonResult;
}
Exemple #5
0
void Clink::cstudent()
{
	CStudent * pStu = new CStudent;
	pStu->Next = NULL;
	InitializeStruct(pStu);
	OutPutStudent(pStu);
	int nchoose;
	while (true){
		cout << "请输入指令编码:" << endl;
		cout << "1,从链表中删除某个学生;" << endl;
		cout << "2,从链表中增加某个学生;" << endl;
		cout << "3,根据名字查找某个学生;" << endl;
		cout << "4,根据学号查找某个学生;" << endl;
		cout << "5,将学生按照姓名排列;" << endl;
		cout << "6,将学生按照学号排列;" << endl;
		cout << "7,将学生按照成绩排列;" << endl;
		cin >> nchoose;
		switch (nchoose){
		case 1:{
				   char name[20];
				   cout << "请输入姓名:" << endl;
				   cin >> name;
				   DeleteStu(pStu, name);
				   OutPutStudent(pStu);
				   break;
		}
		case 2:{
				   InsertStu(pStu, name_a_student());
				   OutPutStudent(pStu);
				   break;
		}
		case 3:{
				   char name[10];
				   cout << "输入学生名字:" << endl;
				   cin >> name;
				   FindStudentByName(pStu, name);
				   break;
		}
		case 4:{
				   char id[20];
				   cout << "输入学生ID:" << endl;
				   cin >> id;
				   FindStudentByID(pStu, id);
				   break;
		}
		case 5:{
				   bool b;
				   cout << "正序排列请输入1,倒序排列请输入0:" << endl;
				   cin >> b;
				   SortByName(pStu, b);
				   OutPutStudent(pStu);
				   break;
		}
		case 6:{
				   bool b;
				   cout << "正序排列请输入1,倒序排列请输入0:" << endl;
				   cin >> b;
				   SortByID(pStu, b);
				   OutPutStudent(pStu);
				   break;
		}
		case 7:{
				   int choose;
				   bool b;
				   cout << "正序排列请输入1,倒序排列请输入0:" << endl;
				   cin >> b;
				   cout << "请输入科目代号:1,语文;2,英语;3,数学:" << endl;
				   cin >> choose;
				   /*EnumScoreType  c, e, m;*/
				   switch (choose){
				   case 1:{
							  SortByScore(pStu, c, b);
							  break;
				   }
				   case 2:{
							  SortByScore(pStu, e, b);
							  break;
				   }
				   case 3:{
							  SortByScore(pStu, m, b);
							  break;
				   }
				   default:{
							   cout << "指令错误!" << endl;
				   }
				   }
				   OutPutStudent(pStu);
				   break;
		}
		default:{
					cout << "指令错误!" << endl;
		}
		}
	}
}
/* Also see NBookmarkHelper::Sort. */
int CALLBACK CShellBrowser::Sort(int InternalIndex1,int InternalIndex2) const
{
	int ComparisonResult = 0;

	BasicItemInfo_t basicItemInfo1 = getBasicItemInfo(InternalIndex1);
	BasicItemInfo_t basicItemInfo2 = getBasicItemInfo(InternalIndex2);

	bool IsFolder1 = ((basicItemInfo1.wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) ? true : false;
	bool IsFolder2 = ((basicItemInfo2.wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) ? true : false;
	
	/* Folders will always be sorted separately from files,
	except in the recycle bin. */
	if(IsFolder1 && !IsFolder2 && !CompareVirtualFolders(CSIDL_BITBUCKET))
	{
		ComparisonResult = -1;
	}
	else if(!IsFolder1 && IsFolder2 && !CompareVirtualFolders(CSIDL_BITBUCKET))
	{
		ComparisonResult = 1;
	}
	else
	{
		switch(m_folderSettings.sortMode)
		{
		case SortMode::Name:
			ComparisonResult = SortByName(basicItemInfo1, basicItemInfo2, m_config->globalFolderSettings);
			break;

		case SortMode::Type:
			ComparisonResult = SortByType(basicItemInfo1,basicItemInfo2);
			break;

		case SortMode::Size:
			ComparisonResult = SortBySize(InternalIndex1,InternalIndex2);
			break;

		case SortMode::DateModified:
			ComparisonResult = SortByDate(InternalIndex1,InternalIndex2,DATE_TYPE_MODIFIED);
			break;

		case SortMode::TotalSize:
			ComparisonResult = SortByTotalSize(basicItemInfo1,basicItemInfo2,TRUE);
			break;

		case SortMode::FreeSpace:
			ComparisonResult = SortByTotalSize(basicItemInfo1,basicItemInfo2,FALSE);
			break;

		case SortMode::DateDeleted:
			ComparisonResult = SortByItemDetails(basicItemInfo1, basicItemInfo2, &SCID_DATE_DELETED);
			break;

		case SortMode::OriginalLocation:
			ComparisonResult = SortByItemDetails(basicItemInfo1, basicItemInfo2, &SCID_ORIGINAL_LOCATION);
			break;

		case SortMode::Attributes:
			ComparisonResult = SortByAttributes(basicItemInfo1, basicItemInfo2);
			break;

		case SortMode::RealSize:
			ComparisonResult = SortByRealSize(basicItemInfo1, basicItemInfo2);
			break;

		case SortMode::ShortName:
			ComparisonResult = SortByShortName(basicItemInfo1, basicItemInfo2);
			break;

		case SortMode::Owner:
			ComparisonResult = SortByOwner(basicItemInfo1, basicItemInfo2);
			break;

		case SortMode::ProductName:
			ComparisonResult = SortByVersionInfo(basicItemInfo1, basicItemInfo2,VERSION_INFO_PRODUCT_NAME);
			break;

		case SortMode::Company:
			ComparisonResult = SortByVersionInfo(basicItemInfo1, basicItemInfo2,VERSION_INFO_COMPANY);
			break;

		case SortMode::Description:
			ComparisonResult = SortByVersionInfo(basicItemInfo1, basicItemInfo2,VERSION_INFO_DESCRIPTION);
			break;

		case SortMode::FileVersion:
			ComparisonResult = SortByVersionInfo(basicItemInfo1, basicItemInfo2,VERSION_INFO_FILE_VERSION);
			break;

		case SortMode::ProductVersion:
			ComparisonResult = SortByVersionInfo(basicItemInfo1, basicItemInfo2,VERSION_INFO_PRODUCT_VERSION);
			break;

		case SortMode::ShortcutTo:
			ComparisonResult = SortByShortcutTo(basicItemInfo1, basicItemInfo2);
			break;

		case SortMode::HardLinks:
			ComparisonResult = SortByHardlinks(basicItemInfo1, basicItemInfo2);
			break;

		case SortMode::Extension:
			ComparisonResult = SortByExtension(basicItemInfo1,basicItemInfo2);
			break;

		case SortMode::Created:
			ComparisonResult = SortByDate(InternalIndex1,InternalIndex2,DATE_TYPE_CREATED);
			break;

		case SortMode::Accessed:
			ComparisonResult = SortByDate(InternalIndex1,InternalIndex2,DATE_TYPE_ACCESSED);
			break;

		case SortMode::Title:
			ComparisonResult = SortByItemDetails(basicItemInfo1, basicItemInfo2,&PKEY_Title);
			break;

		case SortMode::Subject:
			ComparisonResult = SortByItemDetails(basicItemInfo1, basicItemInfo2,&PKEY_Subject);
			break;

		case SortMode::Authors:
			ComparisonResult = SortByItemDetails(basicItemInfo1, basicItemInfo2,&PKEY_Author);
			break;

		case SortMode::Keywords:
			ComparisonResult = SortByItemDetails(basicItemInfo1, basicItemInfo2,&PKEY_Keywords);
			break;

		case SortMode::Comments:
			ComparisonResult = SortByItemDetails(basicItemInfo1, basicItemInfo2,&PKEY_Comment);
			break;

		case SortMode::CameraModel:
			ComparisonResult = SortByImageProperty(basicItemInfo1, basicItemInfo2,PropertyTagEquipModel);
			break;

		case SortMode::DateTaken:
			ComparisonResult = SortByImageProperty(basicItemInfo1, basicItemInfo2,PropertyTagDateTime);
			break;

		case SortMode::Width:
			ComparisonResult = SortByImageProperty(basicItemInfo1, basicItemInfo2,PropertyTagImageWidth);
			break;

		case SortMode::Height:
			ComparisonResult = SortByImageProperty(basicItemInfo1, basicItemInfo2,PropertyTagImageHeight);
			break;

		case SortMode::VirtualComments:
			ComparisonResult = SortByVirtualComments(basicItemInfo1, basicItemInfo2);
			break;

		case SortMode::FileSystem:
			ComparisonResult = SortByFileSystem(basicItemInfo1,basicItemInfo2);
			break;

		case SortMode::NumPrinterDocuments:
			ComparisonResult = SortByPrinterProperty(basicItemInfo1,basicItemInfo2,PRINTER_INFORMATION_TYPE_NUM_JOBS);
			break;

		case SortMode::PrinterStatus:
			ComparisonResult = SortByPrinterProperty(basicItemInfo1,basicItemInfo2,PRINTER_INFORMATION_TYPE_STATUS);
			break;

		case SortMode::PrinterComments:
			ComparisonResult = SortByPrinterProperty(basicItemInfo1,basicItemInfo2,PRINTER_INFORMATION_TYPE_COMMENTS);
			break;

		case SortMode::PrinterLocation:
			ComparisonResult = SortByPrinterProperty(basicItemInfo1,basicItemInfo2,PRINTER_INFORMATION_TYPE_LOCATION);
			break;

		case SortMode::NetworkAdapterStatus:
			ComparisonResult = SortByNetworkAdapterStatus(basicItemInfo1,basicItemInfo2);
			break;

		case SortMode::MediaBitrate:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_BITRATE);
			break;

		case SortMode::MediaCopyright:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_COPYRIGHT);
			break;

		case SortMode::MediaDuration:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_DURATION);
			break;

		case SortMode::MediaProtected:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_PROTECTED);
			break;

		case SortMode::MediaRating:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_RATING);
			break;

		case SortMode::MediaAlbumArtist:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_ALBUM_ARTIST);
			break;

		case SortMode::MediaAlbum:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_ALBUM_TITLE);
			break;

		case SortMode::MediaBeatsPerMinute:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_BEATS_PER_MINUTE);
			break;

		case SortMode::MediaComposer:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_COMPOSER);
			break;

		case SortMode::MediaConductor:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_CONDUCTOR);
			break;

		case SortMode::MediaDirector:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_DIRECTOR);
			break;

		case SortMode::MediaGenre:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_GENRE);
			break;

		case SortMode::MediaLanguage:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_LANGUAGE);
			break;

		case SortMode::MediaBroadcastDate:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_BROADCASTDATE);
			break;

		case SortMode::MediaChannel:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_CHANNEL);
			break;

		case SortMode::MediaStationName:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_STATIONNAME);
			break;

		case SortMode::MediaMood:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_MOOD);
			break;

		case SortMode::MediaParentalRating:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_PARENTALRATING);
			break;

		case SortMode::MediaParentalRatingReason:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_PARENTALRATINGREASON);
			break;

		case SortMode::MediaPeriod:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_PERIOD);
			break;

		case SortMode::MediaProducer:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_PRODUCER);
			break;

		case SortMode::MediaPublisher:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_PUBLISHER);
			break;

		case SortMode::MediaWriter:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_WRITER);
			break;

		case SortMode::MediaYear:
			ComparisonResult = SortByMediaMetadata(basicItemInfo1, basicItemInfo2,MEDIAMETADATA_TYPE_YEAR);
			break;

		default:
			assert(false);
			break;
		}
	}

	if(ComparisonResult == 0)
	{
		/* By default, items that are equal will be sub-sorted
		by their display names. */
		ComparisonResult = StrCmpLogicalW(m_itemInfoMap.at(InternalIndex1).szDisplayName,
			m_itemInfoMap.at(InternalIndex2).szDisplayName);
	}

	if(!m_folderSettings.sortAscending)
	{
		ComparisonResult = -ComparisonResult;
	}

	return ComparisonResult;
}
    //=====================================================================================================================
    //=====================================================================================================================
    DX11PipelineResourceSchema* DX11PipelineResourceSchema::Create( const void* pVS, const void* pGS, const void* pPS,  uint nVSLength, uint nGSLength, uint nPSLength, uint nVertexBuffers )
    {
        std::vector<VariableRef> vars;
        std::vector<SamplerRef> samplers;
        std::vector<TextureRef> textures;
        std::vector<ConstantBuffer> buffers;
      
        DX11PipelineResourceSchema* pS = new DX11PipelineResourceSchema();
        
        ComPtr<ID3D11ShaderReflection> pVSReflection;
        D3DReflect( pVS, nVSLength, __uuidof(ID3D11ShaderReflection), (void**)&pVSReflection );
        ParseShaderReflection(pVSReflection, 0, vars, textures, samplers, buffers );
        
        if( pPS && nPSLength )
        {
            ComPtr<ID3D11ShaderReflection> pPSReflection;
            D3DReflect( pPS, nPSLength, __uuidof(ID3D11ShaderReflection),  (void**)&pPSReflection );
            ParseShaderReflection(pPSReflection, STAGE_PS, vars, textures, samplers, buffers );
        }

        if( pGS && nGSLength )
        {
            ComPtr<ID3D11ShaderReflection> pGSReflection;
            D3DReflect( pGS, nGSLength, __uuidof(ID3D11ShaderReflection), (void**)&pGSReflection );
            ParseShaderReflection(pGSReflection, STAGE_GS, vars, textures, samplers, buffers );
        }

        // extract unique names
        SortByName(samplers);
        SortByName(textures);
        SortByName(vars);
        BuildNameArray( pS->m_SamplerNames,  samplers );
        BuildNameArray( pS->m_SRVNames,      textures );
        BuildNameArray( pS->m_ConstantNames, vars );

        // Layout the constant staging block.  Each unique named constant gets an allocation in the staging block
        pS->m_nConstantStageBytes=0;
        for( uint i=0; i<vars.size(); )
        {
            uint i0=i;

            // different shader stages could have different notions of the size of a given variable 
            //  (e.g. one declares float3, the other float4). 
            //  Deal with this by choosing the largest
            uint nSize=0; 
            do
            {
                nSize = MAX( nSize, vars[i].nVariableSize );
                i++;
            } while( i < vars.size() && vars[i].nName == vars[i0].nName );

            // store this variable's staging buffer offset in each of the 'ref' structures
            uint nOffset = pS->m_nConstantStageBytes;
            while( i0 < i )
                vars[i0++].nStageOffset = nOffset;

            UniqueConstant constant;
            constant.nStageOffset = nOffset;
            constant.nStageSize   = nSize;
            pS->m_StagingLayout.push_back(constant);
            pS->m_nConstantStageBytes += nSize;
        }

        // one more constant so that out-of-range names can be returned for 'not-found'
        UniqueConstant dummy;
        dummy.nStageOffset = 0;
        dummy.nStageSize=0;
        pS->m_StagingLayout.push_back( dummy );

        // collapse constant buffers across stages whose layouts are identical
        SortByBufferLocation( vars );
        FuseConstantBuffers( buffers, vars );

        for( uint i=0; i<buffers.size(); i++ )
        {
            if( buffers[i].nName != i )
                continue; // duplicate

            // store sizes of unique CBs
            pS->m_CBSizes.push_back( buffers[i].nBufferSize );
        
            // build the 'CB movement' set.  There is one CB movement per variable per constant buffer
            for( uint v=0; v<buffers[i].nVarCount; v++ )
            {
                const VariableRef* pVar = &vars[buffers[i].nFirstVar+v];
                CBMovement m;
                m.nBufferIndex  = buffers[i].nName;
                m.nBufferOffset = pVar->nCBufferOffset;
                m.nStageOffset  = pVar->nStageOffset;
                m.nSize         = pVar->nVariableSize;
                pS->m_CBMovements.push_back(m);
            }
        }
       
        // build bind index arrays for samplers/SRVs/CBs
        //  This is an array which contains the name of the resource to be bound to each stage's bind slots
        SortByStageThenSlot( samplers );
        SortByStageThenSlot( textures );
        SortByStageThenSlot( buffers );
        BuildBindArray( pS->m_BindIndices, samplers );
        BuildBindArray( pS->m_BindIndices, textures );
        BuildBindArray( pS->m_BindIndices, buffers );

        CountThingsByStage( pS->m_pStageSamplerCounts, samplers );
        CountThingsByStage( pS->m_pStageSRVCounts, textures );
        CountThingsByStage( pS->m_pStageCBCounts, buffers );

        
        return pS;
    }