subrascasse

Sub Rascasse: an iPhone dive log for Subsurface cloud storage, with a pure-Swift git client (GPL-2.0)
git clone https://git.schurger.org/subrascasse.git
Log | Files | Refs | README | LICENSE

buffer.h (1753B)


      1 /*
      2  * libdivecomputer
      3  *
      4  * Copyright (C) 2009 Jef Driesen
      5  *
      6  * This library is free software; you can redistribute it and/or
      7  * modify it under the terms of the GNU Lesser General Public
      8  * License as published by the Free Software Foundation; either
      9  * version 2.1 of the License, or (at your option) any later version.
     10  *
     11  * This library is distributed in the hope that it will be useful,
     12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14  * Lesser General Public License for more details.
     15  *
     16  * You should have received a copy of the GNU Lesser General Public
     17  * License along with this library; if not, write to the Free Software
     18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
     19  * MA 02110-1301 USA
     20  */
     21 
     22 #ifndef DC_BUFFER_H
     23 #define DC_BUFFER_H
     24 
     25 #include <stddef.h>
     26 
     27 #ifdef __cplusplus
     28 extern "C" {
     29 #endif /* __cplusplus */
     30 
     31 typedef struct dc_buffer_t dc_buffer_t;
     32 
     33 dc_buffer_t *
     34 dc_buffer_new (size_t capacity);
     35 
     36 void
     37 dc_buffer_free (dc_buffer_t *buffer);
     38 
     39 int
     40 dc_buffer_clear (dc_buffer_t *buffer);
     41 
     42 int
     43 dc_buffer_reserve (dc_buffer_t *buffer, size_t capacity);
     44 
     45 int
     46 dc_buffer_resize (dc_buffer_t *buffer, size_t size);
     47 
     48 int
     49 dc_buffer_append (dc_buffer_t *buffer, const unsigned char data[], size_t size);
     50 
     51 int
     52 dc_buffer_prepend (dc_buffer_t *buffer, const unsigned char data[], size_t size);
     53 
     54 int
     55 dc_buffer_insert (dc_buffer_t *buffer, size_t offset, const unsigned char data[], size_t size);
     56 
     57 int
     58 dc_buffer_slice (dc_buffer_t *buffer, size_t offset, size_t size);
     59 
     60 size_t
     61 dc_buffer_get_size (dc_buffer_t *buffer);
     62 
     63 unsigned char *
     64 dc_buffer_get_data (dc_buffer_t *buffer);
     65 
     66 #ifdef __cplusplus
     67 }
     68 #endif /* __cplusplus */
     69 #endif /* DC_BUFFER_H */