Пример #1
0
inline int StringColumn::compare_values(std::size_t row1, std::size_t row2) const
{
    StringData a = get(row1);
    StringData b = get(row2);

    if (a.is_null() && !b.is_null())
        return 1;
    else if (b.is_null() && !a.is_null())
        return -1;
    else if (a.is_null() && b.is_null())
        return 0;

    if (a == b)
        return 0;
    return utf8_compare(a, b) ? 1 : -1;
}
Пример #2
0
static gint collection_list_sort_cb(gconstpointer a, gconstpointer b)
{
	const CollectInfo *cia = a;
	const CollectInfo *cib = b;

	switch (collection_list_sort_method)
		{
		case SORT_NAME:
			break;
		case SORT_NONE:
			return 0;
			break;
		case SORT_SIZE:
			if (cia->fd->size < cib->fd->size) return -1;
			if (cia->fd->size > cib->fd->size) return 1;
			return 0;
			break;
		case SORT_TIME:
			if (cia->fd->date < cib->fd->date) return -1;
			if (cia->fd->date > cib->fd->date) return 1;
			return 0;
			break;
		case SORT_PATH:
			return utf8_compare(cia->fd->path, cib->fd->path, options->file_sort.case_sensitive);
			break;
#ifdef HAVE_STRVERSCMP
		case SORT_NUMBER:
			return strverscmp(cia->fd->name, cib->fd->name);
			break;
#endif
		default:
			break;
		}

	if (options->file_sort.case_sensitive)
		return strcmp(cia->fd->collate_key_name, cib->fd->collate_key_name);
	else
		return strcmp(cia->fd->collate_key_name_nocase, cib->fd->collate_key_name_nocase);
}
 static bool compare(StringData v1, StringData v2, bool = false, bool = false)
 {
     bool ret = utf8_compare(v1.data(), v2.data());
     return ret;
 }