Modest/include/mycore/incoming.h

66 lines
2.7 KiB
C
Raw Normal View History

2016-08-29 00:20:40 +03:00
/*
Copyright (C) 2016-2017 Alexander Borisov
2016-08-29 00:20:40 +03:00
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Author: lex.borisov@gmail.com (Alexander Borisov)
*/
#ifndef MyCORE_INCOMING_H
#define MyCORE_INCOMING_H
2016-08-29 00:20:40 +03:00
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <mycore/myosi.h>
#include <mycore/utils/mcobject.h>
2016-08-29 00:20:40 +03:00
struct mycore_incoming_buffer {
2016-08-29 00:20:40 +03:00
const char* data;
size_t length; // use of data
size_t size; // size of data
size_t offset; // begin global offset
struct mycore_incoming_buffer* prev;
struct mycore_incoming_buffer* next;
2016-08-29 00:20:40 +03:00
};
mycore_incoming_buffer_t * mycore_incoming_buffer_add(mycore_incoming_buffer_t *current, mcobject_t *mcobject, const char *html, size_t html_size);
void mycore_incoming_buffer_clean(mycore_incoming_buffer_t *current);
mycore_incoming_buffer_t * mycore_incoming_buffer_split(mycore_incoming_buffer_t *current, mcobject_t *mcobject, size_t global_pos);
2016-08-29 00:20:40 +03:00
mycore_incoming_buffer_t * mycore_incoming_buffer_find_by_position(mycore_incoming_buffer_t *inc_buf, size_t begin);
2016-08-29 00:20:40 +03:00
const char * mycore_incoming_buffer_data(mycore_incoming_buffer_t *inc_buf);
size_t mycore_incoming_buffer_length(mycore_incoming_buffer_t *inc_buf);
size_t mycore_incoming_buffer_size(mycore_incoming_buffer_t *inc_buf);
size_t mycore_incoming_buffer_offset(mycore_incoming_buffer_t *inc_buf);
size_t mycore_incoming_buffer_relative_begin(mycore_incoming_buffer_t *inc_buf, size_t begin);
size_t mycore_incoming_buffer_available_length(mycore_incoming_buffer_t *inc_buf, size_t relative_begin, size_t length);
2016-08-29 00:20:40 +03:00
mycore_incoming_buffer_t * mycore_incoming_buffer_next(mycore_incoming_buffer_t *inc_buf);
mycore_incoming_buffer_t * mycore_incoming_buffer_prev(mycore_incoming_buffer_t *inc_buf);
2016-08-29 00:20:40 +03:00
size_t mycore_incoming_buffer_convert_one_escaped_to_code_point(mycore_incoming_buffer_t **inc_buf, size_t *relative_pos);
size_t mycore_incoming_buffer_escaped_case_cmp(mycore_incoming_buffer_t **inc_buf, const char *to, size_t to_size, size_t *relative_pos);
2016-08-29 00:20:40 +03:00
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* MyCORE_INCOMING_H */