'\" t
.\" Title: loc_database_new
.\" Author: [see the "Authors" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 12/02/2022
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "LOC_DATABASE_NEW" "3" "" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
loc_database_new \- Create a new libloc context
.SH "SYNOPSIS"
.sp
.nf
#include
#include
.fi
.sp
struct loc_database;
.sp
int loc_database_new(struct loc_ctx* ctx, struct loc_database** database, FILE* f);
.sp
Reference Counting:
.sp
struct loc_database* loc_database_ref(struct loc_database* db);
.sp
struct loc_database* loc_database_unref(struct loc_database* db);
.sp
Access some data:
.sp
time_t loc_database_created_at(struct loc_database* db);
.sp
const char* loc_database_get_vendor(struct loc_database* db);
.sp
const char* loc_database_get_description(struct loc_database* db);
.sp
const char* loc_database_get_license(struct loc_database* db);
.SH "DESCRIPTION"
.sp
loc_database_new() opens a new database from the given file descriptor\&. The file descriptor can be closed after this operation because the function is creating its own copy\&.
.sp
If the database could be opened successfully, zero is returned\&. Otherwise a non\-zero return code will indicate an error and errno will be set appropriately\&.
.sp
Various meta\-data about the database can be retrieved with loc_database_created_at(), loc_database_get_vendor(), loc_database_get_description(), and loc_database_get_license()\&.
.SH "SEE ALSO"
.sp
\fBlibloc\fR(3)
.SH "AUTHORS"
.sp
Michael Tremer