Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 20c9c840 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

RUST: Expose more things to the C part of lektor for the SQLite connexion

parent 178aaf0a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -7,6 +7,7 @@ extern "C" {
#include <stdint.h>
struct lkt_uri;
struct lkt_sqlite_connection;
typedef struct lkt_sqlite_connection lkt_sqlite_connection;
......@@ -27,6 +28,15 @@ bool lkt_database_delete_kara_by_local_id(lkt_sqlite_connection *, int64_t);
bool lkt_database_get_kara_info(lkt_sqlite_connection *, int64_t, lkt_info_cb, void *restrict);
bool lkt_database_get_kara_tags(lkt_sqlite_connection *, int64_t, lkt_info_cb, void *restrict);
bool lkt_database_add_to_history(lkt_sqlite_connection *, int64_t);
bool lkt_database_iter_history(lkt_sqlite_connection *, void (*)(int64_t, void *restrict),
void *restrict);
bool lkt_database_clear_history(lkt_sqlite_connection *);
bool lkt_database_search(lkt_sqlite_connection *, lkt_uri *, void (*)(int64_t, void *restrict),
void *restrict);
bool lkt_database_search_playlist(lkt_sqlite_connection *, const char *, lkt_uri *,
void (*)(int64_t, void *restrict), void *restrict);
#if defined(__cplusplus)
}
#endif
......
......@@ -234,11 +234,6 @@ impl LktDatabaseConnection {
todo!()
}
/// Search the queue by URIs. We return the local ids.
pub fn search_queue(&mut self, _uri: LktCUri) -> LktDatabaseResult<Vec<i64>> {
todo!()
}
/// Search the given playlist by URIs. We return the local ids.
pub fn search_playlist<S: AsRef<str>>(
&mut self,
......
......@@ -120,3 +120,69 @@ pub unsafe extern "C" fn lkt_database_get_kara_tags(
) -> bool {
unimplemented!()
}
/// Add the kara to the history.
/// ### Safety
/// The passed db pointer must be created by
/// [`lkt_database_establish_connection`].
#[no_mangle]
pub unsafe extern "C" fn lkt_database_add_to_history(
db: *mut LktDatabaseConnection,
local_id: i64,
) -> bool {
todo!()
}
/// Iterate over the history.
/// ### Safety
/// The passed db pointer must be created by
/// [`lkt_database_establish_connection`].
#[no_mangle]
pub unsafe extern "C" fn lkt_database_iter_history(
db: *mut LktDatabaseConnection,
cb: extern "C" fn(i64, usize, *mut c_void),
user: *mut c_void,
) -> bool {
todo!()
}
/// Clear the history.
/// ### Safety
/// The passed db pointer must be created by
/// [`lkt_database_establish_connection`].
#[no_mangle]
pub unsafe extern "C" fn lkt_database_clear_history(db: *mut LktDatabaseConnection) -> bool {
todo!()
}
/// Search the database.
/// ### Safety
/// The passed db pointer must be created by
/// [`lkt_database_establish_connection`]. The passed uri pointer must be a
/// valid an address to a URI.
#[no_mangle]
pub unsafe extern "C" fn lkt_database_search(
db: *mut LktDatabaseConnection,
uri: LktUriPtr,
cb: extern "C" fn(i64, *mut c_void),
user: *mut c_void,
) -> bool {
todo!()
}
/// Search the specified playlist in database.
/// ### Safety
/// The passed db pointer must be created by
/// [`lkt_database_establish_connection`]. The passed uri pointer must be a
/// valid an address to a URI. The passed playlist name must be a valid C
/// string (a null terminated string).
#[no_mangle]
pub unsafe extern "C" fn lkt_database_search_playlist(
db: *mut LktDatabaseConnection,
playlist: *mut c_char,
uri: LktUriPtr,
cb: extern "C" fn(i64, *mut c_void),
user: *mut c_void,
) -> bool {
todo!()
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter