示例#1
0
文件: list.cpp 项目: Hydro8182/taiga
int SortListBySeason(const anime::Item& item1, const anime::Item& item2,
                     int order) {
  anime::Season season1(item1.GetDateStart());
  anime::Season season2(item2.GetDateStart());

  if (season1 != season2)
    return CompareValues<anime::Season>(season1, season2);

  if (item1.GetAiringStatus() != item2.GetAiringStatus())
    return SortListByAiringStatus(item1, item2);

  return SortListByTitle(item1, item2) * order;
}
示例#2
0
文件: list.cpp 项目: Hydro8182/taiga
int SortListByDateStart(const anime::Item& item1, const anime::Item& item2) {
  Date date1 = item1.GetDateStart();
  Date date2 = item2.GetDateStart();

  if (date1 != date2) {
    if (!date1.year)
      date1.year = static_cast<unsigned short>(-1);  // Hello.
    if (!date2.year)
      date2.year = static_cast<unsigned short>(-1);  // We come from the future.
    if (!date1.month)
      date1.month = 12;
    if (!date2.month)
      date2.month = 12;
    if (!date1.day)
      date1.day = 31;
    if (!date2.day)
      date2.day = 31;
  }

  return CompareValues<Date>(date1, date2);
}