1 /* Copyright 2015-present Samsung Electronics Co., Ltd. and other contributors
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef IOTJS_MODULE_BUFFER_H
17 #define IOTJS_MODULE_BUFFER_H
20 #include "iotjs_objectwrap.h"
24 iotjs_jobjectwrap_t jobjectwrap;
27 } IOTJS_VALIDATED_STRUCT(iotjs_bufferwrap_t);
30 iotjs_bufferwrap_t* iotjs_bufferwrap_create(const iotjs_jval_t* jbuiltin,
33 iotjs_bufferwrap_t* iotjs_bufferwrap_from_jbuiltin(
34 const iotjs_jval_t* jbuiltin);
35 iotjs_bufferwrap_t* iotjs_bufferwrap_from_jbuffer(const iotjs_jval_t* jbuffer);
37 iotjs_jval_t* iotjs_bufferwrap_jbuiltin(iotjs_bufferwrap_t* bufferwrap);
38 iotjs_jval_t iotjs_bufferwrap_jbuffer(iotjs_bufferwrap_t* bufferwrap);
40 char* iotjs_bufferwrap_buffer(iotjs_bufferwrap_t* bufferwrap);
41 size_t iotjs_bufferwrap_length(iotjs_bufferwrap_t* bufferwrap);
43 int iotjs_bufferwrap_compare(const iotjs_bufferwrap_t* bufferwrap,
44 const iotjs_bufferwrap_t* other);
46 size_t iotjs_bufferwrap_copy(iotjs_bufferwrap_t* bufferwrap, const char* src,
49 // Create buffer object.
50 iotjs_jval_t iotjs_bufferwrap_create_buffer(size_t len);
53 #endif /* IOTJS_MODULE_BUFFER_H */