<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 *    Copyright 2014-2017 (c) Fraunhofer IOSB (Author: <NAME>)
 *    Copyright 2018 (c) Fraunhofer IOSB (Author: <NAME>)
 */

#ifndef UA_TYPES_ENCODING_JSON_H_
#define UA_TYPES_ENCODING_JSON_H_

#include <open62541/types.h>

#include "ua_types_encoding_binary.h"
#include "ua_types_encoding_json.h"
#include "ua_util_internal.h"

#include "../deps/jsmn/jsmn.h"

_UA_BEGIN_DECLS

#define UA_JSON_MAXTOKENCOUNT 1000

/* Returns the number of bytes the value src takes in json encoding. Returns
 * zero if an error occurs. */
size_t
UA_calcSizeJsonInternal(const void *src, const UA_DataType *type,
                        const UA_String *namespaces, size_t namespaceSize,
                        const UA_String *serverUris, size_t serverUriSize,
                        UA_Boolean useReversible) UA_FUNC_ATTR_WARN_UNUSED_RESULT;

/* Encodes the scalar value described by type to json encoding.
 *
 * @param src The value. Must not be NULL.
 * @param type The value type. Must not be NULL.
 * @param bufPos Points to a pointer to the current position in the encoding
 *        buffer. Must not be NULL.
 * @param bufEnd Points to a pointer to the end of the encoding buffer (encoding
 *        always stops before *buf_end). Must not be NULL.
 * @param namespaces An array of namespaces
 * @param namespaceSize The size of the namespaces array
 * @param serverUris An array of serverUris<commit_msg>refactor(core): Increase the max number of JSON tokens<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 *    Copyright 2014-2017 (c) Fraunhofer IOSB (Author: <NAME>)
 *    Copyright 2018 (c) Fraunhofer IOSB (Author: <NAME>)
 */

#ifndef UA_TYPES_ENCODING_JSON_H_
#define UA_TYPES_ENCODING_JSON_H_

#include <open62541/types.h>

#include "ua_types_encoding_binary.h"
#include "ua_types_encoding_json.h"
#include "ua_util_internal.h"

#include "../deps/jsmn/jsmn.h"

_UA_BEGIN_DECLS

#define UA_JSON_MAXTOKENCOUNT 2048

/* Returns the number of bytes the value src takes in json encoding. Returns
 * zero if an error occurs. */
size_t
UA_calcSizeJsonInternal(const void *src, const UA_DataType *type,
                        const UA_String *namespaces, size_t namespaceSize,
                        const UA_String *serverUris, size_t serverUriSize,
                        UA_Boolean useReversible) UA_FUNC_ATTR_WARN_UNUSED_RESULT;

/* Encodes the scalar value described by type to json encoding.
 *
 * @param src The value. Must not be NULL.
 * @param type The value type. Must not be NULL.
 * @param bufPos Points to a pointer to the current position in the encoding
 *        buffer. Must not be NULL.
 * @param bufEnd Points to a pointer to the end of the encoding buffer (encoding
 *        always stops before *buf_end). Must not be NULL.
 * @param namespaces An array of namespaces
 * @param namespaceSize The size of the namespaces array
 * @param serverUris An array of serverUris
{'fraction_non_alphanumeric': 0.07476350320415014, 'fraction_numerical': 0.015257857796765334, 'mean_word_length': 3.417789757412399, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5368635', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1008, 'n_words': 390}