35 lines
1.1 KiB
C++
35 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include "TopKVideoHolder.h"
|
|
|
|
struct SoundInfo {
|
|
const std::string* musicId = nullptr;
|
|
const std::string* musicName = nullptr;
|
|
const std::string* musicAuthor = nullptr;
|
|
long totalViews = 0;
|
|
TopKVideoHolder topVideos;
|
|
|
|
SoundInfo() = default;
|
|
|
|
SoundInfo(const std::string* id, const std::string* name, const std::string* author)
|
|
: musicId(id), musicName(name), musicAuthor(author), totalViews(0) {}
|
|
};
|
|
|
|
struct CompareSoundPtr {
|
|
bool operator()(const SoundInfo* a, const SoundInfo* b) const {
|
|
if (a->totalViews != b->totalViews) return a->totalViews > b->totalViews;
|
|
if (a->musicId && b->musicId) return *a->musicId < *b->musicId;
|
|
if (a->musicId) return true;
|
|
return false;
|
|
}
|
|
};
|
|
|
|
struct CompareSoundPtrForHeap {
|
|
bool operator()(const SoundInfo* a, const SoundInfo* b) const {
|
|
if (a->totalViews != b->totalViews) return a->totalViews > b->totalViews;
|
|
if (a->musicId && b->musicId) return *a->musicId > *b->musicId;
|
|
if (a->musicId) return false;
|
|
return true;
|
|
}
|
|
}; |