libmobi
C library for handling MOBI format ebook documents
Data Structures | Macros | Enumerations | Functions
parse_rawml.h File Reference
#include "config.h"
#include "mobi.h"

Go to the source code of this file.

Data Structures

struct  MOBIResult
 Result data returned by mobi_search_links_kf7() and mobi_search_links_kf8() More...
 

Macros

#define MOBI_ATTRNAME_MAXSIZE   150
 
#define MOBI_ATTRVALUE_MAXSIZE   150
 

Enumerations

enum  MOBIAttrType { ATTR_ID = 0 , ATTR_NAME }
 HTML attribute type. More...
 

Functions

MOBI_RET mobi_get_id_by_posoff (uint32_t *file_number, char *id, const MOBIRawml *rawml, const size_t pos_fid, const size_t pos_off, MOBIAttrType *pref_attr)
 Convert kindle:pos:fid:x:off:y to html file number and closest "id" attribute following the position. More...
 
MOBI_RET mobi_find_attrvalue (MOBIResult *result, const unsigned char *data_start, const unsigned char *data_end, const MOBIFiletype type, const char *needle)
 Find first occurence of markup attribute with given value. More...
 

Detailed Description

Copyright (c) 2014 Bartek Fabiszewski http://www.fabiszewski.net

This file is part of libmobi. Licensed under LGPL, either version 3, or any later. See http://www.gnu.org/licenses/

Macro Definition Documentation

◆ MOBI_ATTRNAME_MAXSIZE

#define MOBI_ATTRNAME_MAXSIZE   150

Maximum length of tag attribute name, like "href"

◆ MOBI_ATTRVALUE_MAXSIZE

#define MOBI_ATTRVALUE_MAXSIZE   150

Maximum length of tag attribute value

Enumeration Type Documentation

◆ MOBIAttrType

HTML attribute type.

Enumerator
ATTR_ID 

Attribute 'id'

ATTR_NAME 

Attribute 'name'

Function Documentation

◆ mobi_find_attrvalue()

MOBI_RET mobi_find_attrvalue ( MOBIResult result,
const unsigned char *  data_start,
const unsigned char *  data_end,
const MOBIFiletype  type,
const char *  needle 
)

Find first occurence of markup attribute with given value.

Parameters
[in,out]resultMOBIResult structure will be filled with found data
[in]data_startBeginning of the memory area to search in
[in]data_endEnd of the memory area to search in
[in]typeType of data (T_HTML or T_CSS)
[in]needleString to find (len <= MOBI_ATTRNAME_MAXSIZE)
Returns
MOBI_RET status code (on success MOBI_SUCCESS)

◆ mobi_get_id_by_posoff()

MOBI_RET mobi_get_id_by_posoff ( uint32_t *  file_number,
char *  id,
const MOBIRawml rawml,
const size_t  pos_fid,
const size_t  pos_off,
MOBIAttrType pref_attr 
)

Convert kindle:pos:fid:x:off:y to html file number and closest "id" attribute following the position.

Parameters
[in,out]file_numberWill be set to file number value
[in,out]idString value of "id" attribute
[in]rawmlMOBIRawml parsed records structure
[in]pos_fidX value of pos:fid:x
[in]pos_offY value of off:y
[in,out]pref_attrAttribute to link to
Returns
MOBI_RET status code (on success MOBI_SUCCESS)