ocarina/include/core/filter.h

46 lines
1.1 KiB
C
Raw Normal View History

/**
* Copyright 2013 (c) Anna Schumaker.
*/
#ifndef OCARINA_CORE_FILTER_H
#define OCARINA_CORE_FILTER_H
extern "C" {
#include <core/set.h>
}
#include <string>
/**
* The filter layer is used to find a subset of songs based on an input
* string. Since this layer does text processing, it also provides a
* functions for converting strings to lowercase.
*
* The text processing is mostly interested in alphanumeric characters, so
* any special characters included in the input text will be stripped out.
* Tabs, spaces and the following characters are used to delimit words:
*
* \/,;()_-~+"
*/
namespace filter {
/**
* Converts the input text to lowercase and returns the result.
*
* @param text The text to be converted.
* @return The lowercase form of the input text.
*/
std::string lowercase(const std::string &);
};
void filter_init();
void filter_deinit();
/* Add the input string to the index. */
void filter_add(const gchar *, unsigned int);
/* Search for the input string in the index. */
void filter_search(const gchar *, struct set *);
#endif /* OCARINA_CORE_FILTER_H */