|
libscipaper 1.0.x
|
Api for use by libscipaper users. More...
Data Structures | |
| struct | VersionFixed |
| This struct contains the version of libscipaper in use. More... | |
| struct | BackendInfo |
| Backend information struct. More... | |
| struct | FillReqest |
| This bitfield tells libscipaper what fields you require to have filled. More... | |
| struct | DocumentMeta |
| This struct contains the metadata of a paper, must be created via document_meta_new() and freed via document_meta_free() More... | |
| struct | RequestReturn |
| This struct is details the result of a metadata search. More... | |
| struct | PdfData |
| This struct contains the raw data of a PDF document. More... | |
Enumerations | |
| enum | loglevel_t { LL_NONE = 0 , LL_CRIT = 1 , LL_ERR = 2 , LL_WARN = 3 , LL_DEFAULT = LL_WARN , LL_INFO = 4 , LL_DEBUG = 5 } |
| Severity of loglevels. More... | |
| enum | capability_flags_t { SCI_CAP_FILL = 1 , SCI_CAP_GET_TEXT = (1<<1) , SCI_CAP_GET_PDF = (1<<2) } |
| Flags that describe what a backend can do. More... | |
Functions | |
| void | sci_log_set_verbosity (loglevel_t verbosity) |
| Sets the verbosity of sicpaper output. | |
| RequestReturn * | sci_fill_meta (const DocumentMeta *meta, const FillReqest *fill, size_t maxCount, size_t page) |
| Takes a DocumentMeta and tries to find maxCount documents that match the fields set in the meta struct. | |
| DocumentMeta * | sci_find_by_doi (const char *doi, int backendId) |
| Tries to find the metadata of the document with the given DOI. | |
| DocumentMeta * | sci_find_by_title (const char *title) |
| Tries to find the metadata of the document with the given title. | |
| RequestReturn * | sci_find_by_author (const char *author, size_t maxCount) |
| Tries to find the documents by a certain author. | |
| RequestReturn * | sci_find_by_journal (const char *journal, size_t maxCount) |
| Tries to find the documents by in a certain journal. | |
| char * | sci_get_document_text (const DocumentMeta *meta) |
| Tries to get the full text of a certain document. | |
| PdfData * | sci_get_document_pdf_data (const DocumentMeta *meta) |
| Tries to get the PDF data of a certain document. | |
| bool | sci_save_pdf_to_file (const PdfData *data, const char *fileName) |
| Tries to get save the PDF of a certain document to disk. | |
| bool | sci_save_document_to_file (const DocumentMeta *meta, const char *fileName) |
| Saves the PDF of a certain document to disk. | |
| const BackendInfo ** | sci_get_all_backends (void) |
| gives you an array describing each backend registered with libscipaper. | |
| const BackendInfo * | sci_get_backend_info (int id) |
| gives you a BackendInfo struct describing the backend with the id | |
| int | sci_backend_get_id_by_name (const char *name) |
| gives you the id of the backend with a given name | |
| const char * | sci_get_backend_name (int id) |
| gives you the name of the backend with id | |
| size_t | sci_get_backend_count (void) |
| gives you the number of backends currently registered | |
| bool | sci_paper_init (const char *config_file, const char *data, size_t length) |
| Inits libscipaper, this function must be your first call to libscipaper, besides sci_get_version() and sci_log_set_verbosity() | |
| void | sci_paper_exit (void) |
| Exits libscipaper, this function must be your final call to libscipaper, it is an error to reinit libscipaper sci_paper_init() after executing sci_paper_exit() | |
| const VersionFixed * | sci_get_version (void) |
| get the version of scipaper in use | |
| char * | capability_flags_get_str (capability_flags_t capabilities) |
| returns the capabilities flags as a human readable string. | |
| DocumentMeta * | document_meta_new (void) |
| Mallocs a DocumentMeta struct and initializes it. | |
| DocumentMeta * | document_meta_copy (const DocumentMeta *meta) |
| Dose a deep copy of a DocumentMeta struct. | |
| void | document_meta_free (DocumentMeta *meta) |
| Frees a document meta struct. | |
| void | document_meta_combine (DocumentMeta *target, const DocumentMeta *source) |
| Adds the fields set in source but not in target to target. | |
| char * | document_meta_get_string (const DocumentMeta *meta) |
| Creates a human readable string describing a DocumentMeta. | |
| char * | document_meta_get_json (const DocumentMeta *meta, const char *fullText, size_t *length) |
| Get string containing json data of the supplied DoucmentMeta. | |
| DocumentMeta * | document_meta_load_from_json (char *jsonFile) |
| create a DocumentMeta from json data saved by document_meta_get_json() | |
| DocumentMeta * | document_meta_load_from_json_file (const char *jsonFileName) |
| create a DocumentMeta from json file saved by document_meta_save() | |
| char * | document_meta_load_full_text_from_json_file (const char *jsonFileName) |
| create a DocumentMeta from json file saved by document_meta_save() | |
| char * | document_meta_get_biblatex (const DocumentMeta *meta, size_t *length, const char *type) |
| Get string containing biblatex entry of the supplied DoucmentMeta. | |
| bool | document_meta_save (const char *fileName, const DocumentMeta *meta, const char *fullText) |
| Saves a DocumentMeta to disk. | |
| void | document_meta_free_list (DocumentMeta **meta, size_t length) |
| Frees a list/array of document metas. | |
| bool | document_meta_is_equal (const DocumentMeta *a, const DocumentMeta *b) |
| Compares to document metas and returns if they are equal. | |
| RequestReturn * | request_return_new (size_t count, size_t maxCount) |
| Allocates a empty RequestReturn struct. | |
| void | request_return_free (RequestReturn *reqRet) |
| Frees a RequestReturn struct. | |
| void | pdf_data_free (PdfData *data) |
| Frees a PdfData struct. | |
Api for use by libscipaper users.
....
This API allows you to lookup documents, find their full texts and grab PDF files.
| enum capability_flags_t |
Flags that describe what a backend can do.
| Enumerator | |
|---|---|
| SCI_CAP_FILL | Backend can fill DocumentMeta structs. |
| SCI_CAP_GET_TEXT | Backend can get full text of documents. |
| SCI_CAP_GET_PDF | Backend can get pdfs of documents. |
| enum loglevel_t |
| char * capability_flags_get_str | ( | capability_flags_t | capabilities | ) |
returns the capabilities flags as a human readable string.
| capabilities | Print with INFO priority if true and DEBUG priority if false |
| void document_meta_combine | ( | DocumentMeta * | target, |
| const DocumentMeta * | source ) |
Adds the fields set in source but not in target to target.
| target | The DocumentMeta struct where the fields of source are to be added to |
| source | The DocumentMeta struct where to get the fields from |
| DocumentMeta * document_meta_copy | ( | const DocumentMeta * | meta | ) |
Dose a deep copy of a DocumentMeta struct.
| meta | The DocumentMeta struct to copy |
| void document_meta_free | ( | DocumentMeta * | meta | ) |
Frees a document meta struct.
| meta | The DocumentMeta struct to free, it is safe to pass NULL here |
| void document_meta_free_list | ( | DocumentMeta ** | meta, |
| size_t | length ) |
Frees a list/array of document metas.
| meta | The DocumentMeta array to free, it is safe to pass NULL here |
| char * document_meta_get_biblatex | ( | const DocumentMeta * | meta, |
| size_t * | length, | ||
| const char * | type ) |
Get string containing biblatex entry of the supplied DoucmentMeta.
| meta | The DocumentMeta struct to save into the string |
| length | length of the returned string containing the biblatex data |
| type | string with type of biblatex entry or NULL for default/dont care |
| char * document_meta_get_json | ( | const DocumentMeta * | meta, |
| const char * | fullText, | ||
| size_t * | length ) |
Get string containing json data of the supplied DoucmentMeta.
| meta | The DocumentMeta struct to save into the string |
| fullText | Optionally the full text associated with the DocumentMeta |
| length | length of the returned string containing the json data |
| char * document_meta_get_string | ( | const DocumentMeta * | meta | ) |
Creates a human readable string describing a DocumentMeta.
| meta | The DocumentMeta struct to print |
| bool document_meta_is_equal | ( | const DocumentMeta * | a, |
| const DocumentMeta * | b ) |
Compares to document metas and returns if they are equal.
This function doesn't tell you if a and b refer to the same document, it only tells you if the DocumentMetas are bitwise the same
| a | A DocumentMeta struct |
| b | Another DocumentMeta struct to compare to a |
| DocumentMeta * document_meta_load_from_json | ( | char * | jsonFile | ) |
create a DocumentMeta from json data saved by document_meta_get_json()
| jsonFile | a c string containing the json data |
| DocumentMeta * document_meta_load_from_json_file | ( | const char * | jsonFileName | ) |
create a DocumentMeta from json file saved by document_meta_save()
| jsonFileName | a filename of a json file to load |
| char * document_meta_load_full_text_from_json_file | ( | const char * | jsonFileName | ) |
create a DocumentMeta from json file saved by document_meta_save()
| jsonFileName | a filename of a json file to load |
| DocumentMeta * document_meta_new | ( | void | ) |
Mallocs a DocumentMeta struct and initializes it.
| bool document_meta_save | ( | const char * | fileName, |
| const DocumentMeta * | meta, | ||
| const char * | fullText ) |
Saves a DocumentMeta to disk.
| fileName | The file name under which to save the DocumentMeta |
| meta | The DocumentMeta struct to save to disk |
| fullText | Optionally the full text associated with the DocumentMeta |
| void pdf_data_free | ( | PdfData * | data | ) |
| void request_return_free | ( | RequestReturn * | reqRet | ) |
Frees a RequestReturn struct.
| reqRet | The RequestReturn to free, it is safe to pass NULL here |
| RequestReturn * request_return_new | ( | size_t | count, |
| size_t | maxCount ) |
Allocates a empty RequestReturn struct.
| count | number of DocumentMeta structs this struct contains |
| maxCount | maximum number of DocumentMeta structs requested by interface user |
| int sci_backend_get_id_by_name | ( | const char * | name | ) |
gives you the id of the backend with a given name
| name | the name of the backend |
| RequestReturn * sci_fill_meta | ( | const DocumentMeta * | meta, |
| const FillReqest * | fill, | ||
| size_t | maxCount, | ||
| size_t | page ) |
Takes a DocumentMeta and tries to find maxCount documents that match the fields set in the meta struct.
| meta | A DocumentMeta struct with at least one value set. If backendId == 0 all backends will be checked until one can identify the document otherwise the backend with the id backendId will be used |
| fill | A pointer to a FillReqest struct that describes what fields are required by user, can be NULL for "don't care" |
| maxCount | maximum number of documents to match |
| page | if page is set > 0, the first page*maxCount entries are skipped and the subsequent results are returned instead |
| RequestReturn * sci_find_by_author | ( | const char * | author, |
| size_t | maxCount ) |
Tries to find the documents by a certain author.
| author | Author to search for |
| maxCount | maximum number of documents to match |
| DocumentMeta * sci_find_by_doi | ( | const char * | doi, |
| int | backendId ) |
Tries to find the metadata of the document with the given DOI.
| doi | DOI to search for |
| backendId | The backend to use to find the DOI, or 0 for "any" |
| RequestReturn * sci_find_by_journal | ( | const char * | journal, |
| size_t | maxCount ) |
Tries to find the documents by in a certain journal.
| journal | journal to search for |
| maxCount | maximum number of documents to match |
| DocumentMeta * sci_find_by_title | ( | const char * | title | ) |
Tries to find the metadata of the document with the given title.
| title | Title to search for |
| const BackendInfo ** sci_get_all_backends | ( | void | ) |
gives you an array describing each backend registered with libscipaper.
| size_t sci_get_backend_count | ( | void | ) |
gives you the number of backends currently registered
| const BackendInfo * sci_get_backend_info | ( | int | id | ) |
gives you a BackendInfo struct describing the backend with the id
| id | the id of the backend you want information on |
| const char * sci_get_backend_name | ( | int | id | ) |
gives you the name of the backend with id
| id | the id of the backend you want the name for |
| PdfData * sci_get_document_pdf_data | ( | const DocumentMeta * | meta | ) |
Tries to get the PDF data of a certain document.
Will give only the PDF of the first document that matches meta
| meta | A DocumentMeta struct with at least one value set if backendId == 0 all backends will be checked until one can identify the document otherwise the backend with the id backendId will be used |
| char * sci_get_document_text | ( | const DocumentMeta * | meta | ) |
Tries to get the full text of a certain document.
| meta | A DocumentMeta struct with at least one value set if backendId == 0 all backends will be checked until one can identify the document otherwise the backend with the id backendId will be used |
| const VersionFixed * sci_get_version | ( | void | ) |
get the version of scipaper in use
| void sci_log_set_verbosity | ( | loglevel_t | verbosity | ) |
Sets the verbosity of sicpaper output.
| verbosity | The verbosity to set |
| bool sci_paper_init | ( | const char * | config_file, |
| const char * | data, | ||
| size_t | length ) |
Inits libscipaper, this function must be your first call to libscipaper, besides sci_get_version() and sci_log_set_verbosity()
| config_file | An optional file name to a config ini file for libscipaper, or NULL |
| data | An optional pointer to a keyfile in ram |
| length | The length of the data at data |
| bool sci_save_document_to_file | ( | const DocumentMeta * | meta, |
| const char * | fileName ) |
Saves the PDF of a certain document to disk.
Will only save the first document that matches meta
| meta | A DocumentMeta struct with at least one value set if backendId == 0 all backends will be checked until one can identify the document otherwise the backend with the id backendId will be used |