bject(obj) && (
sv_isa(obj, "JSON::PP::Boolean")
|| sv_isa(obj, "Types::Serialiser::BooleanBase")
|| sv_isa(obj, "JSON::XS::Boolean")
|| sv_isa(obj,
a::MessagePack::Boolean")
|| sv_isa(obj, "boolean")
|| sv_isa(obj, "Mojo::JSON::_Bool")
)
) {
return ucl_object_frombool( SvTRUE(obj) );
}
else if (
case UCL_BOOLEAN: {
SV* rv = newSV_type(SVt_IV);
sv_setref_iv(rv, "JSON::PP::Boolean", ucl_object_toboolean(obj) ? 1 : 0);
return rv;
}
case
w($VERSION $ucl_schema_error);
use strict;
use warnings;
use base qw(Exporter);
use bytes ();
use JSON::PP::Boolean;
use XSLoader;
BEGIN {
$VERSION = '0.05';
XSLoader::load( 'Config::UCL', $VE
gs for libucl
=head1 SYNOPSIS
use Config::UCL;
use JSON::PP qw(to_json);
my $hash = ucl_load("key1 : val1");
say to_json $hash; # {"key1":"val1"}
my $text = ucl_dump($hash);
say $text; # key1 = "val1";
# libucl-0.8.1/tests/schema/required.json
my $data1 = { foo => 1 };
my $data2 = { bar => 1 };
my $schema = {
properties => {
foo =>
lib ../blib/arch);
use feature ":5.10";
use Config::UCL;
use JSON::PP qw(encode_json);
my $hash = ucl_load("key1 : val1");
say encode_json $hash;
my $text = ucl_dump($hash);
say $text;
my $data1 =
ucl_object_lua_import (lua_State *L, int idx);
/**
* Import UCL object from lua state, escaping JSON strings
* @param L lua state
* @param idx index of object at the lua stack to convert to UCL
*
#include <iostream>
#include <tuple>
#include "ucl.h"
// C++11 API inspired by json11: https://github.com/dropbox/json11/
namespace ucl {
struct ucl_map_construct_t { };
constexpr ucl_map_construc
t_fromstring_common (value, 0, UCL_STRING_RAW));
}
// Implicit constructor: anything with a to_json() function.
template <class T, class = decltype(&T::to_ucl)>
Ucl(const T &t) : Ucl(t.to_ucl())
return lookup(key);
}
// Serialize.
void dump (std::string &out, ucl_emitter_t type = UCL_EMIT_JSON) const
{
struct ucl_emitter_functions cbdata;
cbdata = Ucl::default_emit_funcs();
cbdata.
rsing and emitting functions
*
* UCL is universal configuration language, which is a form of
* JSON with less strict rules that make it more comfortable for
* using as a configuration language
*/
bject_emit().
*/
typedef enum ucl_emitter {
UCL_EMIT_JSON = 0, /**< Emit fine formatted JSON */
UCL_EMIT_JSON_COMPACT, /**< Emit compacted JSON */
UCL_EMIT_CONFIG, /**< Emit human readable config
UCL_STRING_RAW = 0x0, /**< Treat string as is */
UCL_STRING_ESCAPE = (1 << 0), /**< Perform JSON escape */
UCL_STRING_TRIM = (1 << 1), /**< Trim leading and trailing whitespaces */
UCL_STRI
= (1 << 8),
UCL_CHARACTER_ESCAPE = (1 << 9),
UCL_CHARACTER_KEY_SEP = (1 << 10),
UCL_CHARACTER_JSON_UNSAFE = (1 << 11),
UCL_CHARACTER_UCL_UNSAFE = (1 << 12)
};
struct ucl_macro {
char *name;
un
erdata_dtor dtor;
ucl_userdata_emitter emitter;
};
/**
* Unescape json string inplace
* @param str
*/
size_t ucl_unescape_json_string (char *str, size_t len);
/**
* Handle include macro
* @par
_emitter emit_type);
/**
* Serialize string as JSON string
* @param str string to emit
* @param buf target buffer
*/
void ucl_elt_string_write_json (const char *str, size_t size,
struct ucl_emi
_CHARACTER_DENIED,
UCL_CHARACTER_JSON_UNSAFE|UCL_CHARACTER_UCL_UNSAFE,
UCL_CHARACTER_WHITESPACE|UCL_CHARACTER_WHITESPACE_UNSAFE|UCL_CHARACTER_KEY_SEP|UCL_CHARACTER_JSON_UNSAFE|UCL_CHARACTER_UCL_UNSAFE
E|UCL_CHARACTER_VALUE_END|UCL_CHARACTER_JSON_UNSAFE|UCL_CHARACTER_UCL_UNSAFE,
UCL_CHARACTER_WHITESPACE_UNSAFE,
UCL_CHARACTER_WHITESPACE_UNSAFE|UCL_CHARACTER_JSON_UNSAFE|UCL_CHARACTER_UCL_UNSAFE,
UCL_C
HARACTER_WHITESPACE_UNSAFE|UCL_CHARACTER_VALUE_END|UCL_CHARACTER_JSON_UNSAFE|UCL_CHARACTER_UCL_UNSAFE,
UCL_CHARACTER_DENIED, UCL_CHARACTER_DENIED, UCL_CHARACTER_DENIED,
UCL_CHARACTER_DENIED, UCL_CHARA
Config::UCL;
use JSON::PP;
my $hash = ucl_load('var1 = "${var1}"; var2 = "$var2"',
{
ucl_parser_register_variables => [ var1 => 'val1', val2 => 'val2' ],
}
);
say JSON::PP->new->canon