DS3 C SDK  4.1.0
Provides access to the Spectra S3 API with C
ds3_string.h
Go to the documentation of this file.
1 /*
2  * ******************************************************************************
3  * Copyright 2014-2017 Spectra Logic Corporation. All Rights Reserved.
4  * Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5  * this file except in compliance with the License. A copy of the License is located at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * or in the "license" file accompanying this file.
10  * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11  * CONDITIONS OF ANY KIND, either express or implied. See the License for the
12  * specific language governing permissions and limitations under the License.
13  * ****************************************************************************
14  */
15 
16 #ifndef __DS3_STRING__
17 #define __DS3_STRING__
18 
19 #include <stdlib.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 // For windows DLL symbol exports.
26 #ifdef _WIN32
27 # ifdef LIBRARY_EXPORTS
28 # define LIBRARY_API __declspec(dllexport)
29 # else
30 # define LIBRARY_API __declspec(dllimport)
31 # endif
32 #else
33 # define LIBRARY_API
34 #endif
35 
36 typedef struct{
37  char* value;
38  size_t size;
39 }ds3_str;
40 
41 LIBRARY_API ds3_str* ds3_str_init(const char* string);
42 LIBRARY_API ds3_str* ds3_str_init_with_size(const char* string, size_t size);
43 LIBRARY_API char* ds3_str_value(const ds3_str* string);
44 LIBRARY_API size_t ds3_str_size(const ds3_str* string);
45 LIBRARY_API ds3_str* ds3_str_dup(const ds3_str* string);
46 LIBRARY_API void ds3_str_free(ds3_str* string);
47 
48 #ifdef __cplusplus
49 }
50 #endif
51 #endif
size_t size
Definition: ds3_string.h:38
LIBRARY_API ds3_str * ds3_str_init_with_size(const char *string, size_t size)
Definition: ds3_string.c:25
LIBRARY_API size_t ds3_str_size(const ds3_str *string)
Definition: ds3_string.c:46
LIBRARY_API ds3_str * ds3_str_init(const char *string)
Definition: ds3_string.c:20
LIBRARY_API ds3_str * ds3_str_dup(const ds3_str *string)
Definition: ds3_string.c:32
LIBRARY_API void ds3_str_free(ds3_str *string)
Definition: ds3_string.c:50
#define LIBRARY_API
Definition: ds3_string.h:33
LIBRARY_API char * ds3_str_value(const ds3_str *string)
Definition: ds3_string.c:42
char * value
Definition: ds3_string.h:37