Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sol-arena.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Soletta (TM) Project
3  *
4  * Copyright (C) 2015 Intel Corporation. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #pragma once
20 
21 #include <sol-str-slice.h>
22 #include <sol-vector.h>
23 #include <sol-macros.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
53 struct sol_arena;
54 typedef struct sol_arena sol_arena;
55 
61 struct sol_arena *sol_arena_new(void);
62 
71 void sol_arena_del(struct sol_arena *arena);
72 
84 int sol_arena_slice_dup_str(struct sol_arena *arena, struct sol_str_slice *dst, const char *src);
85 
98 int sol_arena_slice_dup_str_n(struct sol_arena *arena, struct sol_str_slice *dst, const char *src, size_t n);
99 
111 int sol_arena_slice_dup(struct sol_arena *arena, struct sol_str_slice *dst, struct sol_str_slice src);
112 
125 int sol_arena_slice_sprintf(struct sol_arena *arena, struct sol_str_slice *dst, const char *fmt, ...) SOL_ATTR_PRINTF(3, 4);
126 
135 char *sol_arena_strdup(struct sol_arena *arena, const char *str);
136 
146 char *sol_arena_str_dup_n(struct sol_arena *arena, const char *str, size_t n);
147 
156 char *sol_arena_strdup_slice(struct sol_arena *arena, const struct sol_str_slice slice);
157 
162 #ifdef __cplusplus
163 }
164 #endif
struct sol_arena * sol_arena_new(void)
Creates an Arena.
#define SOL_ATTR_PRINTF(fmt, arg)
Specifies that a function takes printf style arguments which should be type-checked against a format ...
Definition: sol-macros.h:189
int sol_arena_slice_dup_str_n(struct sol_arena *arena, struct sol_str_slice *dst, const char *src, size_t n)
Store a copy of at most n characters of a given string in the arena.
char * sol_arena_str_dup_n(struct sol_arena *arena, const char *str, size_t n)
Store a copy of at most n characters of a given string in the arena.
int sol_arena_slice_dup_str(struct sol_arena *arena, struct sol_str_slice *dst, const char *src)
Store a copy of a given string in the arena.
int char * sol_arena_strdup(struct sol_arena *arena, const char *str)
Store a copy of a given string in the arena.
These are common Soletta macros.
String slice type.
Definition: sol-str-slice.h:84
struct sol_arena sol_arena
Sol Arena type.
Definition: sol-arena.h:54
These are routines that Soletta provides for its string slice implementation.
int sol_arena_slice_dup(struct sol_arena *arena, struct sol_str_slice *dst, struct sol_str_slice src)
Store a copy of a given string slice in the arena.
char * sol_arena_strdup_slice(struct sol_arena *arena, const struct sol_str_slice slice)
Store a copy of a given string slice in the arena.
These are routines that Soletta provides for its vector implementation.
void sol_arena_del(struct sol_arena *arena)
Delete the Arena.
int sol_arena_slice_sprintf(struct sol_arena *arena, struct sol_str_slice *dst, const char *fmt,...) SOL_ATTR_PRINTF(3
Store the output of 'sprintf()' in the arena.