Compare commits
No commits in common. "master" and "0.55" have entirely different histories.
|
@ -4,7 +4,7 @@
|
||||||
!v!Pluie.Berel.Meta meta :
|
!v!Pluie.Berel.Meta meta :
|
||||||
keys :
|
keys :
|
||||||
software : pluie-yaml; <https://git.pluie.org/pluie/lib-yaml>
|
software : pluie-yaml; <https://git.pluie.org/pluie/lib-yaml>
|
||||||
version : 0.60
|
version : 0.55
|
||||||
type : library
|
type : library
|
||||||
date : 2018
|
date : 2018
|
||||||
license : GPLv3.0; <http://www.gnu.org/licenses/>
|
license : GPLv3.0; <http://www.gnu.org/licenses/>
|
||||||
|
@ -38,7 +38,6 @@
|
||||||
- vala :
|
- vala :
|
||||||
dir :
|
dir :
|
||||||
- src
|
- src
|
||||||
- samples
|
|
||||||
extension :
|
extension :
|
||||||
- .vala
|
- .vala
|
||||||
- .c
|
- .c
|
||||||
|
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -2,7 +2,3 @@ build/
|
||||||
bin/
|
bin/
|
||||||
doc/
|
doc/
|
||||||
pluie-yaml-*.tar.gz
|
pluie-yaml-*.tar.gz
|
||||||
.geany
|
|
||||||
docfix*
|
|
||||||
docsvg.tar.gz
|
|
||||||
tag-generated.yml
|
|
||||||
|
|
65
README.md
65
README.md
|
@ -28,7 +28,7 @@ GNU GPL v3
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
`valac meson ninja libyaml glib gobject gmodule gio gee pluie-echo`
|
`valac meson ninja libyaml glib gobject gmodule gee pluie-echo`
|
||||||
|
|
||||||
see https://git.pluie.org/pluie/libpluie-echo in order to install pluie-echo-0.2 pkg
|
see https://git.pluie.org/pluie/libpluie-echo in order to install pluie-echo-0.2 pkg
|
||||||
|
|
||||||
|
@ -45,32 +45,15 @@ sudo ninja install -C build
|
||||||
## Compilation
|
## Compilation
|
||||||
|
|
||||||
```
|
```
|
||||||
valac --pkg glib-2.0 \
|
valac --pkg pluie-echo-0.2 --pkg pluie-yaml-0.4 main.vala
|
||||||
--pkg gobject-2.0 \
|
|
||||||
--pkg gmodule-2.0 \
|
|
||||||
--pkg gio-2.0 \
|
|
||||||
--pkg gee-0.8 \
|
|
||||||
--pkg pluie-echo-0.2 \
|
|
||||||
--pkg pluie-yaml-0.4 \
|
|
||||||
main.vala
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You can use `./build.sh` to rebuild/install the **pluie-yaml** lib and compile samples files
|
You can use `./build.sh` to rebuild/install the **pluie-yaml** lib and compile samples files
|
||||||
|
|
||||||
```
|
|
||||||
# rebuild lib + build all samples
|
|
||||||
./build.sh
|
|
||||||
# rebuild lib + build only single sample (give sample file name without extension)
|
|
||||||
./build.sh yaml-serialize
|
|
||||||
# rebuild lib in local mode
|
|
||||||
# local mode avoid to rebuild when modifying yaml files in resources dir
|
|
||||||
# must be in the root directory
|
|
||||||
./build.sh yaml-serialize 1
|
|
||||||
```
|
|
||||||
|
|
||||||
## Api / Documentation
|
## Api / Documentation
|
||||||
|
|
||||||
https://pluie.org/pluie-yaml-0.6/index.htm
|
https://pluie.org/pluie-yaml-0.5/index.htm
|
||||||
|
|
||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
|
@ -297,7 +280,7 @@ on yaml side, proceed like that :
|
||||||
%YAML 1.2
|
%YAML 1.2
|
||||||
%TAG !v! tag:pluie.org,2018:vala/
|
%TAG !v! tag:pluie.org,2018:vala/
|
||||||
---
|
---
|
||||||
!v!Pluie.Samples.YamlObject test1 :
|
!v!Pluie.Yaml.Example test1 :
|
||||||
myname : test1object
|
myname : test1object
|
||||||
type_int : !v!int 3306
|
type_int : !v!int 3306
|
||||||
type_bool : !v!bool false
|
type_bool : !v!bool false
|
||||||
|
@ -308,12 +291,12 @@ on yaml side, proceed like that :
|
||||||
type_float : !v!float 42.36
|
type_float : !v!float 42.36
|
||||||
type_double : !v!double 95542123.4579512128
|
type_double : !v!double 95542123.4579512128
|
||||||
type_enum : !v!Pluie.Yaml.NODE_TYPE scalar # or int
|
type_enum : !v!Pluie.Yaml.NODE_TYPE scalar # or int
|
||||||
!v!Pluie.Samples.YamlChild type_object :
|
!v!Pluie.Yaml.ExampleChild type_object :
|
||||||
toto : totovalue1
|
toto : totovalue1
|
||||||
tata : tatavalue1
|
tata : tatavalue1
|
||||||
titi : 123
|
titi : 123
|
||||||
tutu : 1
|
tutu : 1
|
||||||
!v!Pluie.Samples.YamlStruct type_struct :
|
!v!Pluie.Yaml.ExampleStruct type_struct :
|
||||||
red : !v!uint8 214
|
red : !v!uint8 214
|
||||||
green : !v!uint8 78
|
green : !v!uint8 78
|
||||||
blue : 153
|
blue : 153
|
||||||
|
@ -328,18 +311,16 @@ on yaml side, proceed like that :
|
||||||
**note :**
|
**note :**
|
||||||
only the first level of yaml node matching a vala object need a tag.
|
only the first level of yaml node matching a vala object need a tag.
|
||||||
**pluie-yaml** has mechanisms to retriew properties types of a Yaml.Object.
|
**pluie-yaml** has mechanisms to retriew properties types of a Yaml.Object.
|
||||||
So basic vala types tag, enum tag, struct tag and derived Yaml.Object (here Samples.YamlObject & Samples.YamlChild)
|
So basic vala types tag, enum tag, struct tag and derived Yaml.Object (here ExampleChild)
|
||||||
or GLib.Object.
|
or GLib.Object vala tags are not necessary inside a Yaml.Object.
|
||||||
vala tags are not necessary inside a Yaml.Object.
|
|
||||||
|
|
||||||
on vala side :
|
on vala side :
|
||||||
|
|
||||||
```vala
|
```vala
|
||||||
using pluie;
|
|
||||||
...
|
...
|
||||||
var obj = (Samples.YamlObject) Yaml.Builder.from_node (root.first ());
|
var obj = (Yaml.Example) Yaml.Builder.from_node (root.first ());
|
||||||
of.echo("obj.type_int : %d".printf (obj.type_int));
|
of.echo("obj.type_int : %d".printf (obj.type_int));
|
||||||
// calling Samples.YamlChild method
|
// calling ExampleChild method
|
||||||
obj.type_object.method_a ()
|
obj.type_object.method_a ()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -356,15 +337,13 @@ We cannot do introspection on Structure's properties, so you need to implement a
|
||||||
First at all, in the static construct of your class, you need to register (properties) types that need some glue for instanciation.
|
First at all, in the static construct of your class, you need to register (properties) types that need some glue for instanciation.
|
||||||
|
|
||||||
```vala
|
```vala
|
||||||
using Pluie;
|
public class Yaml.Example : Yaml.Object
|
||||||
|
|
||||||
public class Pluie.Samples.YamlObject : Yaml.Object
|
|
||||||
{
|
{
|
||||||
static construct
|
static construct
|
||||||
{
|
{
|
||||||
Yaml.Register.add_type (
|
Yaml.Register.add_type (
|
||||||
typeof (Samples.YamlObject), // owner type
|
typeof (Yaml.Example), // owned type
|
||||||
typeof (Samples.YamlStruct), // property type
|
typeof (Yaml.ExampleStruct), // property type
|
||||||
typeof (Gee.ArrayList) // property type
|
typeof (Gee.ArrayList) // property type
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -374,13 +353,13 @@ public class Pluie.Samples.YamlObject : Yaml.Object
|
||||||
Secondly you must override the `public void populate_from_node (Glib.Type, Yaml.Node node)` Yaml.Object original method.
|
Secondly you must override the `public void populate_from_node (Glib.Type, Yaml.Node node)` Yaml.Object original method.
|
||||||
`populate_from_node` is automatically called by the Yaml.Builder if the type property is prealably registered.
|
`populate_from_node` is automatically called by the Yaml.Builder if the type property is prealably registered.
|
||||||
|
|
||||||
Example of implementation from `src/vala/Pluie/Samples.YamlObject.vala` :
|
Example of implementation from `src/vala/Pluie/Yaml.Example.vala` :
|
||||||
|
|
||||||
```vala
|
```vala
|
||||||
public override void populate_from_node(GLib.Type type, Yaml.Node node)
|
public override void populate_from_node(GLib.Type type, Yaml.Node node)
|
||||||
{
|
{
|
||||||
if (type == typeof (Samples.YamlStruct)) {
|
if (type == typeof (Yaml.ExampleStruct)) {
|
||||||
this.type_struct = Samples.YamlStruct.from_yaml_node (node);
|
this.type_struct = ExampleStruct.from_yaml_node (node);
|
||||||
}
|
}
|
||||||
else if (type == typeof (Gee.ArrayList)) {
|
else if (type == typeof (Gee.ArrayList)) {
|
||||||
this.type_gee_al = new Gee.ArrayList<string> ();
|
this.type_gee_al = new Gee.ArrayList<string> ();
|
||||||
|
@ -396,9 +375,9 @@ Once your class has this glue, you can deal with complex object and populate the
|
||||||
directly from yaml files.
|
directly from yaml files.
|
||||||
|
|
||||||
for more details see :
|
for more details see :
|
||||||
* `src/vala/Pluie/Samples.YamlObject.vala`
|
* `src/vala/Pluie/Yaml.Example.vala`
|
||||||
* `src/vala/Pluie/Samples.YamlChild.vala`
|
* `src/vala/Pluie/Yaml.ExampleChild.vala`
|
||||||
* `src/vala/Pluie/Samples.YamlStruct.vala`
|
* `src/vala/Pluie/Yaml.ExampleStruct.vala`
|
||||||
* `samples/yaml-tag.vala`
|
* `samples/yaml-tag.vala`
|
||||||
|
|
||||||
code from samples/yaml-tag.vala :
|
code from samples/yaml-tag.vala :
|
||||||
|
@ -420,7 +399,7 @@ reverse build mechanism is also possible but have the same limitation.
|
||||||
root.display_childs ();
|
root.display_childs ();
|
||||||
|
|
||||||
of.action ("Yaml.Builder.from_node", root.first ().name);
|
of.action ("Yaml.Builder.from_node", root.first ().name);
|
||||||
var obj = (Samples.YamlObject) Yaml.Builder.from_node (root.first ());
|
var obj = (Yaml.Example) Yaml.Builder.from_node (root.first ());
|
||||||
obj.type_object.method_a ();
|
obj.type_object.method_a ();
|
||||||
|
|
||||||
of.action ("Yaml.Builder.to_node", obj.get_type ().name ());
|
of.action ("Yaml.Builder.to_node", obj.get_type ().name ());
|
||||||
|
@ -433,7 +412,7 @@ reverse build mechanism is also possible but have the same limitation.
|
||||||
you need to override the `public Yaml.Node? populate_to_node(GLib.Type type, string name)` Yaml.Object original method
|
you need to override the `public Yaml.Node? populate_to_node(GLib.Type type, string name)` Yaml.Object original method
|
||||||
`populate_to_node` is also automatically called by the Yaml.Builder if the type property is prealably registered.
|
`populate_to_node` is also automatically called by the Yaml.Builder if the type property is prealably registered.
|
||||||
|
|
||||||
Example of implementation from `src/vala/Pluie/Samples.YamlObject.vala` :
|
Example of implementation from `src/vala/Pluie/Yaml.Example.vala` :
|
||||||
|
|
||||||
```vala
|
```vala
|
||||||
public override Yaml.Node? populate_to_node(GLib.Type type, string name)
|
public override Yaml.Node? populate_to_node(GLib.Type type, string name)
|
||||||
|
@ -441,7 +420,7 @@ Example of implementation from `src/vala/Pluie/Samples.YamlObject.vala` :
|
||||||
Yaml.Node? node = base.populate_to_node (type, name);
|
Yaml.Node? node = base.populate_to_node (type, name);
|
||||||
// non Yaml.Object type & registered type
|
// non Yaml.Object type & registered type
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
if (type == typeof (Samples.YamlStruct)) {
|
if (type == typeof (Yaml.ExampleStruct)) {
|
||||||
node = this.type_struct.to_yaml_node (name);
|
node = this.type_struct.to_yaml_node (name);
|
||||||
}
|
}
|
||||||
else if (type == typeof (Gee.ArrayList)) {
|
else if (type == typeof (Gee.ArrayList)) {
|
||||||
|
|
13
build.sh
13
build.sh
|
@ -2,7 +2,7 @@
|
||||||
#^# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
#^# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
#
|
#
|
||||||
# @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
# @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
# @version : 0.60
|
# @version : 0.55
|
||||||
# @type : library
|
# @type : library
|
||||||
# @date : 2018
|
# @date : 2018
|
||||||
# @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
# @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
lib="pluie-yaml-0.6"
|
lib="pluie-yaml-0.5"
|
||||||
samples=" src/vala/Pluie/Samples.YamlObject.vala \
|
samples=" src/vala/Pluie/Samples.YamlObject.vala \
|
||||||
src/vala/Pluie/Samples.YamlChild.vala \
|
src/vala/Pluie/Samples.YamlChild.vala \
|
||||||
src/vala/Pluie/Samples.YamlStruct.vala "
|
src/vala/Pluie/Samples.YamlStruct.vala "
|
||||||
|
@ -65,11 +65,6 @@ function build.lib()
|
||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
build.title "$lib LIB BUILD"
|
build.title "$lib LIB BUILD"
|
||||||
meson --prefix=/usr ./ build
|
meson --prefix=/usr ./ build
|
||||||
if [ "$1" -eq 1 ]; then
|
|
||||||
meson configure -DLOCAL=true build
|
|
||||||
else
|
|
||||||
meson configure -DLOCAL=false build
|
|
||||||
fi
|
|
||||||
if [ "$UID" != "0" ]; then
|
if [ "$UID" != "0" ]; then
|
||||||
sudo ninja -v install -C build
|
sudo ninja -v install -C build
|
||||||
else
|
else
|
||||||
|
@ -117,10 +112,10 @@ function build.main()
|
||||||
if [ ! -z "$1" ]; then
|
if [ ! -z "$1" ]; then
|
||||||
onefile="./samples/$1.vala"
|
onefile="./samples/$1.vala"
|
||||||
fi
|
fi
|
||||||
build.lib "$2"
|
build.lib
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
build.samples $onefile
|
build.samples $onefile
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
build.main "$1" "${2:-0}"
|
build.main "$1"
|
||||||
|
|
16
meson.build
16
meson.build
|
@ -1,7 +1,7 @@
|
||||||
#^# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
#^# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
#
|
#
|
||||||
# @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
# @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
# @version : 0.60
|
# @version : 0.55
|
||||||
# @type : library
|
# @type : library
|
||||||
# @date : 2018
|
# @date : 2018
|
||||||
# @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
# @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
#
|
#
|
||||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #^#
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #^#
|
||||||
|
|
||||||
project('pluie-yaml', ['vala', 'c'], version:'0.6')
|
project('pluie-yaml', ['vala', 'c'], version:'0.5')
|
||||||
|
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
version = meson.project_version()
|
version = meson.project_version()
|
||||||
|
@ -38,14 +38,10 @@ incdir = join_paths(get_option('prefix'), get_option('includedir'), 'plui
|
||||||
conf = configuration_data()
|
conf = configuration_data()
|
||||||
conf.set('VERSION' , version)
|
conf.set('VERSION' , version)
|
||||||
conf.set('INSTALL_PATH', bindir)
|
conf.set('INSTALL_PATH', bindir)
|
||||||
if get_option('LOCAL')
|
|
||||||
conf.set('DATA_PATH' , './resources')
|
|
||||||
else
|
|
||||||
conf.set('DATA_PATH' , datadir)
|
conf.set('DATA_PATH' , datadir)
|
||||||
endif
|
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
input: 'src/vala/install.vala.in',
|
input: 'src/install.vala',
|
||||||
output: 'install.vala',
|
output: 'install.vala',
|
||||||
configuration: conf
|
configuration: conf
|
||||||
)
|
)
|
||||||
|
@ -53,7 +49,6 @@ configure_file(
|
||||||
install_data([
|
install_data([
|
||||||
'resources/main.yml',
|
'resources/main.yml',
|
||||||
'resources/tag.yml',
|
'resources/tag.yml',
|
||||||
'resources/bug.yml',
|
|
||||||
'resources/test.yml',
|
'resources/test.yml',
|
||||||
'resources/test.json'
|
'resources/test.json'
|
||||||
],
|
],
|
||||||
|
@ -64,12 +59,9 @@ install_data('resources/config/subdir/test.yml', install_dir : join_paths(datadi
|
||||||
|
|
||||||
subdir('src')
|
subdir('src')
|
||||||
|
|
||||||
add_global_arguments('-D DEBUG', language : 'valac')
|
|
||||||
|
|
||||||
|
|
||||||
libpluie_yaml = library(
|
libpluie_yaml = library(
|
||||||
'pluie-yaml-' + version,
|
'pluie-yaml-' + version,
|
||||||
src_files,
|
src_files + [ 'build/install.vala' ],
|
||||||
vala_header : 'pluie_yaml.h',
|
vala_header : 'pluie_yaml.h',
|
||||||
vala_vapi : 'pluie-yaml-' +version+'.vapi',
|
vala_vapi : 'pluie-yaml-' +version+'.vapi',
|
||||||
dependencies : [
|
dependencies : [
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
option('LOCAL', type : 'boolean', value : false)
|
|
|
@ -1,82 +0,0 @@
|
||||||
%YAML 1.2
|
|
||||||
%TAG !v! tag:pluie.org,2018:vala/
|
|
||||||
---
|
|
||||||
!v!Pluie.Berel.Meta meta :
|
|
||||||
!v!Gee.ArrayList keys :
|
|
||||||
- software : berel; <https://git.pluie.org/pluie/berel>
|
|
||||||
- version : 0.24
|
|
||||||
- type : program
|
|
||||||
- date : 2018
|
|
||||||
- license : GPLv3.0; <http://www.gnu.org/licenses/>
|
|
||||||
- author : a-Sansara; <[dev]at[pluie]dot[org]>
|
|
||||||
- copyright : pluie.org; <http://www.pluie.org>
|
|
||||||
|
|
||||||
!v!Gee.ArrayList headers :
|
|
||||||
- !v!Pluie.Berel.HeaderDef sh :
|
|
||||||
file :
|
|
||||||
- build.sh
|
|
||||||
startline : 2 # to embed shebang before header tpl
|
|
||||||
sepline :
|
|
||||||
motif : "# "
|
|
||||||
repeat : 40
|
|
||||||
comment :
|
|
||||||
start : "#^#"
|
|
||||||
end : "#^#"
|
|
||||||
begin : "# "
|
|
||||||
- !v!Pluie.Berel.HeaderDef meson :
|
|
||||||
file :
|
|
||||||
- meson.build
|
|
||||||
- src/meson.build
|
|
||||||
sepline :
|
|
||||||
motif : "# "
|
|
||||||
repeat : 40
|
|
||||||
comment :
|
|
||||||
start : "#^#"
|
|
||||||
end : "#^#"
|
|
||||||
begin : "# "
|
|
||||||
- !v!Pluie.Berel.HeaderDef vala :
|
|
||||||
dir :
|
|
||||||
- src
|
|
||||||
extension :
|
|
||||||
- .vala
|
|
||||||
sepline :
|
|
||||||
motif : " *"
|
|
||||||
repeat : 40
|
|
||||||
comment :
|
|
||||||
start : "/*^"
|
|
||||||
end : "^*/"
|
|
||||||
begin : " * "
|
|
||||||
|
|
||||||
tpl : |
|
|
||||||
^sepline^
|
|
||||||
|
|
||||||
^keys^
|
|
||||||
|
|
||||||
^sepline^
|
|
||||||
|
|
||||||
This file is part of ^software.name^.
|
|
||||||
|
|
||||||
^software.name^ is free software (free as in speech) : you can redistribute it
|
|
||||||
and/or modify it under the terms of the GNU General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of the License,
|
|
||||||
or (at your option) any later version.
|
|
||||||
|
|
||||||
^software.name^ is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with ^software.name^. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
^sepline^
|
|
||||||
|
|
||||||
product:
|
|
||||||
- sku : BL394D
|
|
||||||
quantity : 5
|
|
||||||
description : Basketball
|
|
||||||
price : 450.00
|
|
||||||
- sku : BL394D
|
|
||||||
quantity : 5
|
|
||||||
description : Basketball
|
|
||||||
price : 450.00
|
|
File diff suppressed because one or more lines are too long
|
@ -43,35 +43,3 @@
|
||||||
tata : tatavalue4
|
tata : tatavalue4
|
||||||
titi : 44
|
titi : 44
|
||||||
tutu : 0
|
tutu : 0
|
||||||
!v!Gee.HashMap type_gee_hmap :
|
|
||||||
- key : key1
|
|
||||||
!v!Pluie.Samples.YamlChild val :
|
|
||||||
toto : key1toto
|
|
||||||
tata : kay1tata
|
|
||||||
titi : 5
|
|
||||||
tutu : 0
|
|
||||||
- key : key2
|
|
||||||
val :
|
|
||||||
toto : key2toto
|
|
||||||
tata : kay2tata
|
|
||||||
titi : 46
|
|
||||||
tutu : 1
|
|
||||||
!v!Gee.HashMap type_gee_hmap2 :
|
|
||||||
- !v!Pluie.Samples.YamlStruct key :
|
|
||||||
red : !v!uint8 214
|
|
||||||
green : !v!uint8 78
|
|
||||||
blue : 153
|
|
||||||
!v!Pluie.Samples.YamlChild val :
|
|
||||||
toto : key1toto
|
|
||||||
tata : kay1tata
|
|
||||||
titi : 5
|
|
||||||
tutu : 0
|
|
||||||
- key :
|
|
||||||
red : !v!uint8 82
|
|
||||||
green : !v!uint8 109
|
|
||||||
blue : 35
|
|
||||||
val :
|
|
||||||
toto : key2toto
|
|
||||||
tata : kay2tata
|
|
||||||
titi : 46
|
|
||||||
tutu : 1
|
|
||||||
|
|
|
@ -1,32 +1,3 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
|
||||||
* @version : 0.60
|
|
||||||
* @type : library
|
|
||||||
* @date : 2018
|
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* This file is part of pluie-yaml.
|
|
||||||
*
|
|
||||||
* pluie-yaml is free software (free as in speech) : you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the License,
|
|
||||||
* or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* pluie-yaml is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
|
@ -69,7 +40,7 @@ int main (string[] args)
|
||||||
var done = false;
|
var done = false;
|
||||||
|
|
||||||
of.title ("Pluie Yaml Library", Pluie.Yaml.VERSION, "a-sansara");
|
of.title ("Pluie Yaml Library", Pluie.Yaml.VERSION, "a-sansara");
|
||||||
Pluie.Yaml.DEBUG = true;
|
Pluie.Yaml.DEBUG = false;
|
||||||
var loader = new Yaml.Loader (path, true, true);
|
var loader = new Yaml.Loader (path, true, true);
|
||||||
if ((done = loader.done)) {
|
if ((done = loader.done)) {
|
||||||
var root = loader.get_nodes ();
|
var root = loader.get_nodes ();
|
||||||
|
|
|
@ -1,85 +0,0 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
|
||||||
* @version : 0.60
|
|
||||||
* @type : library
|
|
||||||
* @date : 2018
|
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* This file is part of pluie-yaml.
|
|
||||||
*
|
|
||||||
* pluie-yaml is free software (free as in speech) : you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the License,
|
|
||||||
* or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* pluie-yaml is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
|
||||||
* @version : 0.5
|
|
||||||
* @type : library
|
|
||||||
* @date : 2018
|
|
||||||
* @licence : GPLv3.0 <http://www.gnu.org/licenses/>
|
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
|
||||||
* @copyright : pluie.org <http://www.pluie.org/>
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* This file is part of pluie-yaml.
|
|
||||||
*
|
|
||||||
* pluie-yaml is free software (free as in speech) : you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the License,
|
|
||||||
* or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* pluie-yaml is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
using GLib;
|
|
||||||
using Gee;
|
|
||||||
using Pluie;
|
|
||||||
|
|
||||||
int main (string[] args)
|
|
||||||
{
|
|
||||||
Echo.init(false);
|
|
||||||
|
|
||||||
var path = Yaml.DATA_PATH + "/bug.yml";
|
|
||||||
var done = false;
|
|
||||||
|
|
||||||
of.title ("Pluie Yaml Library", Pluie.Yaml.VERSION, "a-sansara");
|
|
||||||
Pluie.Yaml.DEBUG = false;
|
|
||||||
Yaml.Loader.PACK_NESTED_ENTRIES = true;
|
|
||||||
var loader = new Yaml.Loader (path, true, true);
|
|
||||||
if ((done = loader.done)) {
|
|
||||||
var root = loader.get_nodes ();
|
|
||||||
done = root != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
of.rs (done);
|
|
||||||
of.echo ();
|
|
||||||
return (int) done;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,32 +1,3 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
|
||||||
* @version : 0.60
|
|
||||||
* @type : library
|
|
||||||
* @date : 2018
|
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* This file is part of pluie-yaml.
|
|
||||||
*
|
|
||||||
* pluie-yaml is free software (free as in speech) : you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the License,
|
|
||||||
* or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* pluie-yaml is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
|
|
|
@ -1,32 +1,3 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
|
||||||
* @version : 0.60
|
|
||||||
* @type : library
|
|
||||||
* @date : 2018
|
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* This file is part of pluie-yaml.
|
|
||||||
*
|
|
||||||
* pluie-yaml is free software (free as in speech) : you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the License,
|
|
||||||
* or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* pluie-yaml is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
|
|
|
@ -1,32 +1,3 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
|
||||||
* @version : 0.60
|
|
||||||
* @type : library
|
|
||||||
* @date : 2018
|
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* This file is part of pluie-yaml.
|
|
||||||
*
|
|
||||||
* pluie-yaml is free software (free as in speech) : you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the License,
|
|
||||||
* or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* pluie-yaml is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
|
|
|
@ -1,32 +1,3 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
|
||||||
* @version : 0.60
|
|
||||||
* @type : library
|
|
||||||
* @date : 2018
|
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* This file is part of pluie-yaml.
|
|
||||||
*
|
|
||||||
* pluie-yaml is free software (free as in speech) : you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the License,
|
|
||||||
* or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* pluie-yaml is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
|
|
|
@ -1,32 +1,3 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
|
||||||
* @version : 0.60
|
|
||||||
* @type : library
|
|
||||||
* @date : 2018
|
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* This file is part of pluie-yaml.
|
|
||||||
*
|
|
||||||
* pluie-yaml is free software (free as in speech) : you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the License,
|
|
||||||
* or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* pluie-yaml is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
|
|
|
@ -1,32 +1,3 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
|
||||||
* @version : 0.60
|
|
||||||
* @type : library
|
|
||||||
* @date : 2018
|
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* This file is part of pluie-yaml.
|
|
||||||
*
|
|
||||||
* pluie-yaml is free software (free as in speech) : you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the License,
|
|
||||||
* or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* pluie-yaml is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.5
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @licence : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
* @copyright : pluie.org <http://www.pluie.org/>
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
|
@ -25,7 +25,8 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
|
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
*/
|
||||||
|
|
||||||
using GLib;
|
using GLib;
|
||||||
using Gee;
|
using Gee;
|
||||||
|
@ -67,31 +68,6 @@ public void test_object(Samples.YamlObject obj)
|
||||||
of.keyval(" tutu" , "%s (bool)" .printf(child.tutu.to_string ()));
|
of.keyval(" tutu" , "%s (bool)" .printf(child.tutu.to_string ()));
|
||||||
child.method_a ();
|
child.method_a ();
|
||||||
}
|
}
|
||||||
if (obj.type_gee_hmap != null) {
|
|
||||||
of.keyval("type_gee_hmap", "(%s<%s, %s>)" .printf(obj.type_gee_hmap.get_type ().name (), obj.type_gee_hmap.key_type.name (), obj.type_gee_hmap.value_type.name ()));
|
|
||||||
foreach (var child in obj.type_gee_hmap.entries) {
|
|
||||||
of.echo(" == entry (%s) ==".printf(child.key));
|
|
||||||
of.keyval(" toto" , "%s (string)" .printf(child.value.toto));
|
|
||||||
of.keyval(" tapa" , "%s (string)" .printf(child.value.tata));
|
|
||||||
of.keyval(" titi" , "%d (int)" .printf(child.value.titi));
|
|
||||||
of.keyval(" tutu" , "%s (bool)" .printf(child.value.tutu.to_string ()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (obj.type_gee_hmap2 != null) {
|
|
||||||
of.keyval("type_gee_hmap", "(%s<%s, %s>)" .printf(obj.type_gee_hmap2.get_type ().name (), obj.type_gee_hmap2.key_type.name (), obj.type_gee_hmap2.value_type.name ()));
|
|
||||||
foreach (var child in obj.type_gee_hmap2.entries) {
|
|
||||||
of.echo(" == key ==");
|
|
||||||
of.keyval(" obj :" , "%s" .printf(child.key.to_string ()));
|
|
||||||
of.echo(" == val (%s) ==".printf(child.value.get_type ( ).name ()));
|
|
||||||
of.keyval(" toto" , "%s (string)" .printf(child.value.toto));
|
|
||||||
of.keyval(" tapa" , "%s (string)" .printf(child.value.tata));
|
|
||||||
of.keyval(" titi" , "%d (int)" .printf(child.value.titi));
|
|
||||||
of.keyval(" tutu" , "%s (bool)" .printf(child.value.tutu.to_string ()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
of.echo ("hmap2 null");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,3 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
|
||||||
* @version : 0.60
|
|
||||||
* @type : library
|
|
||||||
* @date : 2018
|
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* This file is part of pluie-yaml.
|
|
||||||
*
|
|
||||||
* pluie-yaml is free software (free as in speech) : you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the License,
|
|
||||||
* or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* pluie-yaml is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
|
@ -129,31 +100,6 @@ int main (string[] args)
|
||||||
child.method_a ();
|
child.method_a ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (o.type_gee_hmap != null) {
|
|
||||||
of.keyval("type_gee_hmap", "(%s<%s, %s>)" .printf(o.type_gee_hmap.get_type ().name (), o.type_gee_hmap.key_type.name (), o.type_gee_hmap.value_type.name ()));
|
|
||||||
foreach (var child in o.type_gee_hmap.entries) {
|
|
||||||
of.echo(" == entry (%s) ==".printf(child.key));
|
|
||||||
of.keyval(" toto" , "%s (string)" .printf(child.value.toto));
|
|
||||||
of.keyval(" tapa" , "%s (string)" .printf(child.value.tata));
|
|
||||||
of.keyval(" titi" , "%d (int)" .printf(child.value.titi));
|
|
||||||
of.keyval(" tutu" , "%s (bool)" .printf(child.value.tutu.to_string ()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (o.type_gee_hmap2 != null) {
|
|
||||||
of.keyval("type_gee_hmap", "(%s<%s, %s>)" .printf(o.type_gee_hmap2.get_type ().name (), o.type_gee_hmap2.key_type.name (), o.type_gee_hmap2.value_type.name ()));
|
|
||||||
foreach (var child in o.type_gee_hmap2.entries) {
|
|
||||||
of.echo(" == key ==");
|
|
||||||
of.keyval(" obj :" , "%s" .printf(child.key.to_string ()));
|
|
||||||
of.echo(" == val (%s) ==".printf(child.value.get_type ( ).name ()));
|
|
||||||
of.keyval(" toto" , "%s (string)" .printf(child.value.toto));
|
|
||||||
of.keyval(" tapa" , "%s (string)" .printf(child.value.tata));
|
|
||||||
of.keyval(" titi" , "%d (int)" .printf(child.value.titi));
|
|
||||||
of.keyval(" tutu" , "%s (bool)" .printf(child.value.tutu.to_string ()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
of.echo ("hmap2 null");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,3 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
|
||||||
* @version : 0.60
|
|
||||||
* @type : library
|
|
||||||
* @date : 2018
|
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* This file is part of pluie-yaml.
|
|
||||||
*
|
|
||||||
* pluie-yaml is free software (free as in speech) : you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the License,
|
|
||||||
* or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* pluie-yaml is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
|
|
|
@ -1,32 +1,3 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
|
||||||
* @version : 0.60
|
|
||||||
* @type : library
|
|
||||||
* @date : 2018
|
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* This file is part of pluie-yaml.
|
|
||||||
*
|
|
||||||
* pluie-yaml is free software (free as in speech) : you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the License,
|
|
||||||
* or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* pluie-yaml is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
|
@ -135,7 +106,6 @@ int main (string[] args)
|
||||||
Pluie.Yaml.DEBUG = false;
|
Pluie.Yaml.DEBUG = false;
|
||||||
var config = new Yaml.Config (path, true);
|
var config = new Yaml.Config (path, true);
|
||||||
var root = config.root_node ();
|
var root = config.root_node ();
|
||||||
root.display_childs ();
|
|
||||||
root.first ().display_childs ();
|
root.first ().display_childs ();
|
||||||
|
|
||||||
of.action ("Yaml.Builder.from_node", root.first ().name);
|
of.action ("Yaml.Builder.from_node", root.first ().name);
|
||||||
|
|
|
@ -1,32 +1,3 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
|
||||||
* @version : 0.60
|
|
||||||
* @type : library
|
|
||||||
* @date : 2018
|
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* This file is part of pluie-yaml.
|
|
||||||
*
|
|
||||||
* pluie-yaml is free software (free as in speech) : you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the License,
|
|
||||||
* or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* pluie-yaml is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.56
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -27,38 +27,8 @@
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
||||||
|
|
||||||
/**
|
|
||||||
* root namespace of various Pluie lib
|
|
||||||
*/
|
|
||||||
namespace Pluie
|
namespace Pluie
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Pluie.Io is dedicated to various input/ouput operations
|
|
||||||
*/
|
|
||||||
namespace Io
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Samples namespace to illustrate or test functionnalities
|
|
||||||
*/
|
|
||||||
namespace Samples
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pluie.Yaml provides various tools to deal with yaml files and yaml nodes :
|
|
||||||
*
|
|
||||||
* Use {@link Yaml.Config} to load a .yml file and build a {@link Yaml.Root} node<<BR>>
|
|
||||||
* Use {@link Yaml.Config.get} to retriew a particular {@link Yaml.Node}<<BR>>
|
|
||||||
* Use {@link Yaml.Builder} to convert a {@link Yaml.Node} into a {@link Yaml.Object}<<BR>>
|
|
||||||
* Use {@link Yaml.Dumper} to dump a {@link Yaml.Object} or {@link Yaml.Node} into a yaml string<<BR>>
|
|
||||||
* Use {@link Yaml.serialize} to serialize a {@link Yaml.Object} or {@link Yaml.Node} into a string<<BR>>
|
|
||||||
* Use {@link Yaml.deserialize} to deserialize a serialized string into a {@link Yaml.Node}<<BR>>
|
|
||||||
* Use {@link Yaml.Collection} and {@link Yaml.AbstractChild} methods for Node traversing
|
|
||||||
*/
|
|
||||||
namespace Yaml
|
namespace Yaml
|
||||||
{
|
{
|
||||||
protected const string INSTALL_PATH = "@INSTALL_PATH@";
|
protected const string INSTALL_PATH = "@INSTALL_PATH@";
|
|
@ -1,7 +1,7 @@
|
||||||
#^# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
#^# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
#
|
#
|
||||||
# @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
# @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
# @version : 0.60
|
# @version : 0.55
|
||||||
# @type : library
|
# @type : library
|
||||||
# @date : 2018
|
# @date : 2018
|
||||||
# @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
# @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
src_files = [
|
src_files = [
|
||||||
'src/c/yaml.c',
|
'src/c/yaml.c',
|
||||||
'build/install.vala',
|
|
||||||
'src/vala/Pluie/Io.Reader.vala',
|
'src/vala/Pluie/Io.Reader.vala',
|
||||||
'src/vala/Pluie/Io.InputChunkStream.vala',
|
'src/vala/Pluie/Io.InputChunkStream.vala',
|
||||||
'src/vala/Pluie/Io.StreamLineMark.vala',
|
'src/vala/Pluie/Io.StreamLineMark.vala',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -34,25 +34,10 @@ using GLib;
|
||||||
*/
|
*/
|
||||||
class Pluie.Io.InputChunkStream : Object
|
class Pluie.Io.InputChunkStream : Object
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected ulong chunk_index;
|
protected ulong chunk_index;
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected uint8 chunk_size;
|
protected uint8 chunk_size;
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected uint8 buffer_size;
|
protected uint8 buffer_size;
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected uint8[] buffer;
|
protected uint8[] buffer;
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected FileStream fs;
|
protected FileStream fs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a YamlCHild test class
|
* a test class to implements yamlize
|
||||||
*/
|
*/
|
||||||
public class Pluie.Samples.YamlChild : Yaml.Object
|
public class Pluie.Samples.YamlChild : Yaml.Object
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -32,7 +32,7 @@ using Gee;
|
||||||
using Pluie;
|
using Pluie;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a YamlObject test class
|
* a test class to implements yamlize
|
||||||
*/
|
*/
|
||||||
public class Pluie.Samples.YamlObject : Yaml.Object
|
public class Pluie.Samples.YamlObject : Yaml.Object
|
||||||
{
|
{
|
||||||
|
@ -65,8 +65,6 @@ public class Pluie.Samples.YamlObject : Yaml.Object
|
||||||
public Samples.YamlStruct type_struct { get; set; }
|
public Samples.YamlStruct type_struct { get; set; }
|
||||||
public Gee.ArrayList<double?> type_gee_al { get; set; }
|
public Gee.ArrayList<double?> type_gee_al { get; set; }
|
||||||
public Gee.ArrayList<Samples.YamlChild> type_gee_alobject { get; set; }
|
public Gee.ArrayList<Samples.YamlChild> type_gee_alobject { get; set; }
|
||||||
public Gee.HashMap<string, Samples.YamlChild> type_gee_hmap { get; set; }
|
|
||||||
public Gee.HashMap<YamlStruct?, Samples.YamlChild> type_gee_hmap2 { get; set; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -77,8 +75,7 @@ public class Pluie.Samples.YamlObject : Yaml.Object
|
||||||
typeof (Samples.YamlObject),
|
typeof (Samples.YamlObject),
|
||||||
typeof (Samples.YamlChild),
|
typeof (Samples.YamlChild),
|
||||||
typeof (Samples.YamlStruct),
|
typeof (Samples.YamlStruct),
|
||||||
typeof (Gee.ArrayList),
|
typeof (Gee.ArrayList)
|
||||||
typeof (Gee.HashMap)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,8 +86,6 @@ public class Pluie.Samples.YamlObject : Yaml.Object
|
||||||
{
|
{
|
||||||
this.type_gee_al = new Gee.ArrayList<double?> ();
|
this.type_gee_al = new Gee.ArrayList<double?> ();
|
||||||
this.type_gee_alobject = new Gee.ArrayList<Samples.YamlChild> ();
|
this.type_gee_alobject = new Gee.ArrayList<Samples.YamlChild> ();
|
||||||
this.type_gee_hmap = new Gee.HashMap<string, Samples.YamlChild> ();
|
|
||||||
this.type_gee_hmap2 = new Gee.HashMap<Samples.YamlStruct?, Samples.YamlChild> ();
|
|
||||||
Yaml.Register.add_namespace("Gee", "Pluie.Samples");
|
Yaml.Register.add_namespace("Gee", "Pluie.Samples");
|
||||||
Dbg.msg ("%s (%s) instantiated".printf (this.yaml_name, this.get_type().name ()), Log.LINE, Log.FILE);
|
Dbg.msg ("%s (%s) instantiated".printf (this.yaml_name, this.get_type().name ()), Log.LINE, Log.FILE);
|
||||||
}
|
}
|
||||||
|
@ -122,24 +117,6 @@ public class Pluie.Samples.YamlObject : Yaml.Object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == typeof (Gee.HashMap)) {
|
|
||||||
Yaml.Mapping? c;
|
|
||||||
foreach (var child in node) {
|
|
||||||
c = child as Yaml.Mapping;
|
|
||||||
switch (name) {
|
|
||||||
case "type_gee_hmap":
|
|
||||||
Value key = c.item ("key").val (typeof (string));
|
|
||||||
var entry = (Samples.YamlChild) Yaml.Builder.from_node (c.item ("val"), typeof (Samples.YamlChild));
|
|
||||||
this.type_gee_hmap.set((string) key, entry);
|
|
||||||
break;
|
|
||||||
case "type_gee_hmap2":
|
|
||||||
var key = Samples.YamlStruct.from_yaml_node (c.item ("key"));
|
|
||||||
var entry = (Samples.YamlChild) Yaml.Builder.from_node (c.item ("val"), typeof (Samples.YamlChild));
|
|
||||||
this.type_gee_hmap2.set(key, entry);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
var obj = Yaml.Builder.from_node(node, type);
|
var obj = Yaml.Builder.from_node(node, type);
|
||||||
if (name == "type_object") {
|
if (name == "type_object") {
|
||||||
|
@ -170,35 +147,9 @@ public class Pluie.Samples.YamlObject : Yaml.Object
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == typeof (Gee.HashMap)) {
|
|
||||||
switch (name) {
|
|
||||||
case "type_gee_hmap" :
|
|
||||||
Yaml.Object.objects_mapkstr_to_node (this.type_gee_hmap, name, parent);
|
|
||||||
break;
|
|
||||||
case "type_gee_hmap2" :
|
|
||||||
this.hmap2_to_node (name, parent);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
base.populate_to_node (name, type, parent);
|
base.populate_to_node (name, type, parent);
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void hmap2_to_node (string name, Yaml.Node? parent = null)
|
|
||||||
{
|
|
||||||
of.echo (Log.METHOD);
|
|
||||||
var node = new Yaml.Sequence (parent, name);
|
|
||||||
node.tag = new Yaml.Tag (Yaml.Register.resolve_namespace_type(this.type_gee_hmap2.get_type ()), "v");
|
|
||||||
var i = 0;
|
|
||||||
foreach (var child in this.type_gee_hmap2.entries) {
|
|
||||||
var entryNode = new Yaml.Mapping (node, "_%d".printf (i));
|
|
||||||
entryNode.add (child.key.to_yaml_node ("key"));
|
|
||||||
Yaml.Builder.to_node ((GLib.Object) child.value, entryNode, false, null, "val");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* YamlStruct test structure
|
*
|
||||||
*/
|
*/
|
||||||
public struct Pluie.Samples.YamlStruct
|
public struct Pluie.Samples.YamlStruct
|
||||||
{
|
{
|
||||||
|
@ -46,8 +46,7 @@ public struct Pluie.Samples.YamlStruct
|
||||||
public uint blue;
|
public uint blue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get a new YamlStruct populated by specified node
|
*
|
||||||
* @param node the source Yaml.Node
|
|
||||||
*/
|
*/
|
||||||
public static YamlStruct from_yaml_node (Yaml.Node node)
|
public static YamlStruct from_yaml_node (Yaml.Node node)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -28,44 +28,7 @@
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Yaml.Config class to manage Yaml configuration files and provide a Yaml.Root node.
|
* Yaml.Config class to manage Yaml configuration files
|
||||||
*
|
|
||||||
* Yaml.Config use a Yaml.Finder to easily retriew a particular node. <<BR>>
|
|
||||||
* The Yaml.Config.get method is bind to the Yaml.Finder.find method with <<BR>>
|
|
||||||
* the root node as context. (more details on {@link Yaml.Finder})
|
|
||||||
*
|
|
||||||
* {{{
|
|
||||||
* var config = new Yaml.Config (path);
|
|
||||||
* var node = config.get ("ship-to.address.city{0}");
|
|
||||||
* if (node != null) {
|
|
||||||
* of.echo (node.data)
|
|
||||||
* }
|
|
||||||
* }}}
|
|
||||||
*
|
|
||||||
* You can use a special import clause to embed a set of yaml files into your current document.
|
|
||||||
*
|
|
||||||
* {{{
|
|
||||||
* # | use special key word '^imports' to import other yaml config files in
|
|
||||||
* # | current yaml document
|
|
||||||
* # | '^imports' must be uniq and a direct child of root node
|
|
||||||
* # | imported files are injected as mapping nodes at top document level
|
|
||||||
* # | so you cannot use keys that already exists in the document
|
|
||||||
* ^imports :
|
|
||||||
* # you can redefine default import path with the special key '^path'
|
|
||||||
* # if you do not use it, the default path value will be the current directory
|
|
||||||
* # redefined path values are relative to the current directory (if a relative path
|
|
||||||
* # is provided)
|
|
||||||
* ^path : ./config
|
|
||||||
* # you can also define any other var by prefixing key with ^
|
|
||||||
* ^dir : subdir
|
|
||||||
* # and use it enclosed by ^
|
|
||||||
* # here final test path will be "./config/subdir/test.yml"
|
|
||||||
* test : ^dir^/test.yml
|
|
||||||
* # here final db path will be "./config/db.yml"
|
|
||||||
* db : db.yml
|
|
||||||
* }}}
|
|
||||||
*
|
|
||||||
* {{doc/img/pluie-yaml-imports2.png}}
|
|
||||||
*/
|
*/
|
||||||
public class Pluie.Yaml.Config
|
public class Pluie.Yaml.Config
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -33,19 +33,6 @@ using Pluie;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finder class used to easily retriew Yaml.Node
|
* Finder class used to easily retriew Yaml.Node
|
||||||
*
|
|
||||||
* Path definition has two mode :
|
|
||||||
* default mode is ''Yaml.FIND_MODE.DOT''
|
|
||||||
*
|
|
||||||
* * child mapping node are separated by dot :
|
|
||||||
* * sequence entry must be enclosed in curly brace
|
|
||||||
* ex : ``grandfather.father.son{2}.age``
|
|
||||||
*
|
|
||||||
* other mode is ''Yaml.FIND_MODE.SQUARE_BRACKETS''.
|
|
||||||
*
|
|
||||||
* * node's key name must be enclosed in square brackets
|
|
||||||
* * sequence entry must be enclosed in curly brace
|
|
||||||
* ex : ``[grandfather][father][son]{2}[age]``
|
|
||||||
*/
|
*/
|
||||||
public class Pluie.Yaml.Finder : GLib.Object
|
public class Pluie.Yaml.Finder : GLib.Object
|
||||||
{
|
{
|
||||||
|
@ -65,7 +52,17 @@ public class Pluie.Yaml.Finder : GLib.Object
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a specific child Yaml.Node corresponding to path definition.
|
* find a specific child Yaml.Node corresponding to path definition
|
||||||
|
* path definition has two mode.
|
||||||
|
* default mode is Yaml.FIND_MODE.DOT
|
||||||
|
* - child mapping node are separated by dot :
|
||||||
|
* - sequence entry must be enclosed in curly brace
|
||||||
|
* ex : grandfather.father.son{2}.age
|
||||||
|
*
|
||||||
|
* other mode is Yaml.FIND_MODE.DOTSQUARE_BRACKETS
|
||||||
|
* - node's key name must be enclosed in square brackets
|
||||||
|
* - sequence entry must be enclosed in curly brace
|
||||||
|
* ex : [grandfather][father][son]{2}[age]
|
||||||
*
|
*
|
||||||
* @param path the definition to retriew the child node
|
* @param path the definition to retriew the child node
|
||||||
* @param context the Yaml.Node context to operate
|
* @param context the Yaml.Node context to operate
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -38,6 +38,7 @@ public class Pluie.Yaml.GeeBuilder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* transform a Gee.Collection with fundamental type to a Yaml.Node
|
* transform a Gee.Collection with fundamental type to a Yaml.Node
|
||||||
|
* @param Gee.ArrayList* a pointer to the list
|
||||||
* @param property_name name of related property
|
* @param property_name name of related property
|
||||||
* @param parent parent Yaml.Node of the list
|
* @param parent parent Yaml.Node of the list
|
||||||
* @param is_char flag indicating data with char representation
|
* @param is_char flag indicating data with char representation
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -36,14 +36,11 @@ using Pluie;
|
||||||
*/
|
*/
|
||||||
public class Pluie.Yaml.Loader
|
public class Pluie.Yaml.Loader
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Flag PACK_NESTED_ENTRIES
|
|
||||||
*/
|
|
||||||
public static bool PACK_NESTED_ENTRIES { public get; public set; default = false; }
|
|
||||||
/**
|
/**
|
||||||
* Yaml.Scanner used to retriew yaml events
|
* Yaml.Scanner used to retriew yaml events
|
||||||
*/
|
*/
|
||||||
Yaml.Scanner scanner { public get; internal set; }
|
Yaml.Scanner scanner { public get; internal set; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* indicate if file has been sucessfully loaded
|
* indicate if file has been sucessfully loaded
|
||||||
*/
|
*/
|
||||||
|
@ -87,33 +84,7 @@ public class Pluie.Yaml.Loader
|
||||||
*/
|
*/
|
||||||
public Yaml.Node? get_nodes ()
|
public Yaml.Node? get_nodes ()
|
||||||
{
|
{
|
||||||
Yaml.Node? n = this.scanner.get_nodes ();
|
return this.scanner.get_nodes ();
|
||||||
if (PACK_NESTED_ENTRIES) {
|
|
||||||
this.pack_entries (n);
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private void pack_entries (Yaml.Node? node = null)
|
|
||||||
{
|
|
||||||
bool restart = false;
|
|
||||||
if (node != null) {
|
|
||||||
if (node.ntype.is_sequence ()) {
|
|
||||||
foreach (var child in node) {
|
|
||||||
if (child.ntype.is_mapping () && child.name[0] == '_' && child.count () == 1) {
|
|
||||||
var sub = child.first ().clone_node ();
|
|
||||||
node.replace_node (child, sub);
|
|
||||||
restart = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (restart) pack_entries (node);
|
|
||||||
}
|
|
||||||
else foreach (var child in node) this.pack_entries (child);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -76,8 +76,6 @@ public class Pluie.Yaml.Node : Yaml.AbstractChild, Pluie.Yaml.Collection
|
||||||
}
|
}
|
||||||
catch (Yaml.AddNodeError e) {
|
catch (Yaml.AddNodeError e) {
|
||||||
of.warn (e.message);
|
of.warn (e.message);
|
||||||
Yaml.dbg (this.to_string ());
|
|
||||||
this.display_childs ();
|
|
||||||
}
|
}
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
@ -263,21 +261,6 @@ public class Pluie.Yaml.Node : Yaml.AbstractChild, Pluie.Yaml.Collection
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void replace_node (Yaml.Node child, Yaml.Node new_child)
|
|
||||||
{
|
|
||||||
int index = this.list.index_of (child);
|
|
||||||
if (index > -1) {
|
|
||||||
new_child.level = this.level + 1;
|
|
||||||
new_child.parent = this;
|
|
||||||
new_child.update_level ();
|
|
||||||
this.list.remove_at (index);
|
|
||||||
this.list.insert (index, new_child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* display childs
|
* display childs
|
||||||
* @param withTitle display a title before the childs node presentation
|
* @param withTitle display a title before the childs node presentation
|
||||||
|
@ -343,7 +326,7 @@ public class Pluie.Yaml.Node : Yaml.AbstractChild, Pluie.Yaml.Collection
|
||||||
)
|
)
|
||||||
: "",
|
: "",
|
||||||
of.c (ECHO.OPTION).s ("]"),
|
of.c (ECHO.OPTION).s ("]"),
|
||||||
withTag && this.ntype.is_root () && (this as Yaml.Root) !=null ? (this as Yaml.Root).get_display_tag_directives () : ""
|
withTag && this.ntype.is_root () ? (this as Yaml.Root).get_display_tag_directives () : ""
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -127,53 +127,18 @@ public abstract class Pluie.Yaml.Object : GLib.Object
|
||||||
*/
|
*/
|
||||||
public static Yaml.Node? objects_collection_to_node (Gee.Collection list, string name, Yaml.Node? parent = null)
|
public static Yaml.Node? objects_collection_to_node (Gee.Collection list, string name, Yaml.Node? parent = null)
|
||||||
{
|
{
|
||||||
|
of.echo (Log.METHOD);
|
||||||
var node = new Yaml.Sequence (parent, name);
|
var node = new Yaml.Sequence (parent, name);
|
||||||
node.tag = new Yaml.Tag (Yaml.Register.resolve_namespace_type(list.get_type ()), "v");
|
node.tag = new Yaml.Tag (Yaml.Register.resolve_namespace_type(list.get_type ()), "v");
|
||||||
var it = list.iterator ();
|
var it = list.iterator ();
|
||||||
var i = 0;
|
var i = 0;
|
||||||
while (it.next ()) {
|
while (it.next ()) {
|
||||||
Yaml.Builder.to_node ((GLib.Object) it.get (), node, false, i++);
|
Yaml.Builder.to_node (
|
||||||
}
|
(GLib.Object) it.get (),
|
||||||
return node;
|
node,
|
||||||
}
|
false,
|
||||||
|
i++
|
||||||
/**
|
);
|
||||||
* build an object Gee.HashMap<string, Yaml.Object> to a Yaml.Node
|
|
||||||
* @param map the gee hashmap to transform
|
|
||||||
* @param name name of map sequence node
|
|
||||||
* @param parent parent node of the map
|
|
||||||
* @return the resulting Yaml.Node
|
|
||||||
*/
|
|
||||||
public static Yaml.Node? objects_mapkstr_to_node (Gee.HashMap map, string name, Yaml.Node? parent = null)
|
|
||||||
{
|
|
||||||
var node = new Yaml.Sequence (parent, name);
|
|
||||||
node.tag = new Yaml.Tag (Yaml.Register.resolve_namespace_type(map.get_type ()), "v");
|
|
||||||
var i = 0;
|
|
||||||
foreach (var child in map.entries) {
|
|
||||||
var entryNode = new Yaml.Mapping (node, "_%d".printf (i++));
|
|
||||||
new Yaml.Mapping.with_scalar (entryNode, "key", (string) child.key);
|
|
||||||
Yaml.Builder.to_node ((GLib.Object) child.value, entryNode, false, null, "val");
|
|
||||||
}
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* build an object Gee.HashMap<string, Yaml.Object> to a Yaml.Node
|
|
||||||
* @param map the gee hashmap to transform
|
|
||||||
* @param name name of map sequence node
|
|
||||||
* @param parent parent node of the map
|
|
||||||
* @return the resulting Yaml.Node
|
|
||||||
*/
|
|
||||||
public static Yaml.Node? objects_mapobjects_to_node (Gee.HashMap map, string name, Yaml.Node? parent = null)
|
|
||||||
{
|
|
||||||
var node = new Yaml.Sequence (parent, name);
|
|
||||||
node.tag = new Yaml.Tag (Yaml.Register.resolve_namespace_type(map.get_type ()), "v");
|
|
||||||
var i = 0;
|
|
||||||
foreach (var child in map.entries) {
|
|
||||||
var entryNode = new Yaml.Mapping (node, "_%d".printf (i++));
|
|
||||||
Yaml.Builder.to_node ((GLib.Object) child.key, entryNode, false, null, "key");
|
|
||||||
Yaml.Builder.to_node ((GLib.Object) child.value, entryNode, false, null, "val");
|
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -46,21 +46,6 @@ public class Pluie.Yaml.Processor
|
||||||
*/
|
*/
|
||||||
bool change;
|
bool change;
|
||||||
|
|
||||||
/**
|
|
||||||
* indicates if document start begin
|
|
||||||
*/
|
|
||||||
bool begin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* indicates if new node is a sequence entry
|
|
||||||
*/
|
|
||||||
bool isEntry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* indicates if new node is a sequence entry mapping
|
|
||||||
*/
|
|
||||||
bool isEntryMapping;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* indicates if begon a flow sequence
|
* indicates if begon a flow sequence
|
||||||
*/
|
*/
|
||||||
|
@ -189,7 +174,7 @@ public class Pluie.Yaml.Processor
|
||||||
this.reset ();
|
this.reset ();
|
||||||
for (var has_next = this.iterator.next (); has_next; has_next = this.iterator.next ()) {
|
for (var has_next = this.iterator.next (); has_next; has_next = this.iterator.next ()) {
|
||||||
this.event = this.iterator.get ();
|
this.event = this.iterator.get ();
|
||||||
Yaml.dbg (" [[[ EVENT %d %s ]]]".printf (this.indexEvt++, this.event.evtype.infos ()));
|
Yaml.dbg (" 0>>>>> [EVENT event [%d] %s <<<<< %s".printf (this.indexEvt++, this.event.evtype.infos (), Log.METHOD));
|
||||||
if (this.event.evtype.is_tag_directive ()) {
|
if (this.event.evtype.is_tag_directive ()) {
|
||||||
this.on_tag_directive ();
|
this.on_tag_directive ();
|
||||||
}
|
}
|
||||||
|
@ -197,54 +182,34 @@ public class Pluie.Yaml.Processor
|
||||||
this.on_error ();
|
this.on_error ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!this.begin) {
|
if (this.event.evtype.is_mapping_end () || this.event.evtype.is_sequence_end ()) {
|
||||||
if (this.event.evtype.is_sequence_start () || this.event.evtype.is_mapping_start ()) {
|
|
||||||
this.begin = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (this.event.evtype.is_document_start ()) {
|
|
||||||
this.begin = true;
|
|
||||||
// to do
|
|
||||||
this.event = this.next_event ();
|
|
||||||
if (this.event.evtype.is_tag ()) {
|
|
||||||
this.root.tag = new Yaml.Tag (this.event.data["suffix"], this.event.data["handle"].replace("!", ""));
|
|
||||||
this.event = this.next_event ();
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (this.event.evtype.is_anchor ()) {
|
|
||||||
this.on_anchor ();
|
|
||||||
}
|
|
||||||
else if (this.event.evtype.is_alias ()) {
|
|
||||||
this.on_alias ();
|
|
||||||
}
|
|
||||||
else if (this.event.evtype.is_mapping_end () || this.event.evtype.is_sequence_end ()) {
|
|
||||||
this.on_block_end ();
|
this.on_block_end ();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (this.event.evtype.is_key () && (this.event = this.get_value_key_event ()) != null) {
|
if (this.event.evtype.is_entry ()) {
|
||||||
this.on_key ();
|
|
||||||
}
|
|
||||||
else if (this.event.evtype.is_entry ()) {
|
|
||||||
this.on_entry ();
|
this.on_entry ();
|
||||||
}
|
}
|
||||||
else if (this.event.evtype.is_mapping_start ()) {
|
if (this.beginFlowSeq && this.event.evtype.is_scalar ()) {
|
||||||
this.create_mapping (this.isEntry);
|
if (!this.change) {
|
||||||
|
this.on_scalar (true);
|
||||||
|
}
|
||||||
|
this.beginFlowSeq = false;
|
||||||
|
}
|
||||||
|
if (this.event.evtype.is_key () && (this.event = this.get_value_key_event ()) != null) {
|
||||||
|
this.on_key ();
|
||||||
|
}
|
||||||
|
if (this.event.evtype.is_value () && (this.event = this.get_value_event ()) != null) {
|
||||||
|
this.on_value ();
|
||||||
|
if (this.event.evtype.is_mapping_start ()) {
|
||||||
|
this.on_mapping_start ();
|
||||||
}
|
}
|
||||||
else if (this.event.evtype.is_sequence_start ()) {
|
else if (this.event.evtype.is_sequence_start ()) {
|
||||||
this.on_sequence_start ();
|
this.on_sequence_start ();
|
||||||
}
|
}
|
||||||
else if (this.event.evtype.is_value ()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (this.event.evtype.is_scalar ()) {
|
|
||||||
this.on_scalar ();
|
|
||||||
}
|
|
||||||
this.add_anchor_if_needed ();
|
this.add_anchor_if_needed ();
|
||||||
this.on_update ();
|
this.ckey = null;
|
||||||
}
|
}
|
||||||
|
this.on_update ();
|
||||||
}
|
}
|
||||||
this.done = error_event == null && this.root != null;
|
this.done = error_event == null && this.root != null;
|
||||||
return done;
|
return done;
|
||||||
|
@ -268,9 +233,6 @@ public class Pluie.Yaml.Processor
|
||||||
this.beginFlowSeq = false;
|
this.beginFlowSeq = false;
|
||||||
this.nextValueEvt = null;
|
this.nextValueEvt = null;
|
||||||
this.indexEvt = 0;
|
this.indexEvt = 0;
|
||||||
this.isEntry = false;
|
|
||||||
this.begin = false;
|
|
||||||
this.isEntryMapping = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -281,20 +243,7 @@ public class Pluie.Yaml.Processor
|
||||||
Yaml.Event? evt = null;
|
Yaml.Event? evt = null;
|
||||||
if (this.iterator.has_next () && this.iterator.next ()) {
|
if (this.iterator.has_next () && this.iterator.next ()) {
|
||||||
evt = this.iterator.get ();
|
evt = this.iterator.get ();
|
||||||
Yaml.dbg (" >>>>> [EVENT event [%d] %s <<<<< %s".printf (this.indexEvt++, evt.evtype.infos (), Log.METHOD));
|
Yaml.dbg (" 1>>>>> [EVENT event [%d] %s <<<<< %s".printf (this.indexEvt++, evt.evtype.infos (), Log.METHOD));
|
||||||
}
|
|
||||||
return evt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* retriew the next Yaml Event without use of iterator
|
|
||||||
*/
|
|
||||||
private Yaml.Event? get_next_event ()
|
|
||||||
{
|
|
||||||
Yaml.Event? evt = null;
|
|
||||||
var i = this.indexEvt;
|
|
||||||
if (i < this.events.size) {
|
|
||||||
evt = this.events.get (i);
|
|
||||||
}
|
}
|
||||||
return evt;
|
return evt;
|
||||||
}
|
}
|
||||||
|
@ -332,15 +281,13 @@ public class Pluie.Yaml.Processor
|
||||||
private Yaml.Event? get_next_value_event ()
|
private Yaml.Event? get_next_value_event ()
|
||||||
{
|
{
|
||||||
Yaml.Event? evt = null;
|
Yaml.Event? evt = null;
|
||||||
var i = this.indexEvt;
|
var i = this.indexEvt+1;
|
||||||
Yaml.dbg (" >>> %s from %d".printf (Log.METHOD, i));
|
|
||||||
var search = true;
|
var search = true;
|
||||||
while (search) {
|
while (search) {
|
||||||
if (i < this.events.size) {
|
if (i < this.events.size) {
|
||||||
var e = this.events.get (i++);
|
var e = this.events.get (i++);
|
||||||
if (e != null && e.evtype.is_value ()) {
|
if (e != null && e.evtype.is_value ()) {
|
||||||
evt = this.events.get (i);
|
evt = this.events.get (i);
|
||||||
Yaml.dbg (" >>> %s > %d : %s".printf (Log.METHOD, i, evt.evtype.infos ()));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,27 +327,38 @@ public class Pluie.Yaml.Processor
|
||||||
*/
|
*/
|
||||||
private void on_block_end ()
|
private void on_block_end ()
|
||||||
{
|
{
|
||||||
if (this.prev_node.ntype.is_scalar () || (this.prev_node.ntype.is_single_pair () && this.prev_node.parent != null && this.prev_node.parent.ntype.is_mapping ())) {
|
if (!this.prev_node.ntype.is_collection ()) {
|
||||||
this.prev_node = this.prev_node.parent;
|
this.prev_node = this.prev_node.parent;
|
||||||
}
|
}
|
||||||
|
bool is_nested = this.is_entry_nested_block (this.prev_node);
|
||||||
|
if (!is_nested || (is_nested && (this.prev_node as Yaml.Sequence).close_block)) {
|
||||||
this.parent_node = this.prev_node.parent != null && this.prev_node.parent != this.root
|
this.parent_node = this.prev_node.parent != null && this.prev_node.parent != this.root
|
||||||
? this.prev_node.parent
|
? this.prev_node.parent
|
||||||
: this.root;
|
: this.root;
|
||||||
this.prev_node = this.parent_node;
|
this.prev_node = this.parent_node;
|
||||||
}
|
}
|
||||||
|
if (is_nested) {
|
||||||
|
var seq = this.prev_node as Yaml.Sequence;
|
||||||
|
if (seq != null) {
|
||||||
|
seq.close_block = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void on_entry ()
|
private void on_entry ()
|
||||||
{
|
{
|
||||||
this.isEntry = true;
|
this.event = this.next_event();
|
||||||
this.ckey = null;
|
Yaml.Event? e = null;
|
||||||
var e = this.get_next_event ();
|
// look up for sequence enrty nested block
|
||||||
if (e!= null && e.evtype.is_mapping_start ()) {
|
e = get_next_value_event ();
|
||||||
this.isEntryMapping = true;
|
if (this.event.evtype.is_mapping_start () && (e!= null && !e.evtype.is_mapping_start ())) {
|
||||||
this.create_mapping (true);
|
this.on_mapping_start (true);
|
||||||
this.next_event ();
|
}
|
||||||
|
else if (this.event.evtype.is_scalar ()) {
|
||||||
|
this.on_scalar (true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,9 +390,23 @@ public class Pluie.Yaml.Processor
|
||||||
private void on_key ()
|
private void on_key ()
|
||||||
{
|
{
|
||||||
this.on_tag (true);
|
this.on_tag (true);
|
||||||
if (this.event.evtype.is_scalar ()) {
|
|
||||||
this.ckey = this.event.data["data"];
|
this.ckey = this.event.data["data"];
|
||||||
Yaml.dbg (" >> node name : %s".printf (this.ckey));
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private void on_value ()
|
||||||
|
{
|
||||||
|
this.on_tag (false);
|
||||||
|
if (this.event.evtype.is_scalar ()) {
|
||||||
|
this.on_scalar ();
|
||||||
|
}
|
||||||
|
else if (this.event.evtype.is_anchor ()) {
|
||||||
|
this.on_anchor ();
|
||||||
|
}
|
||||||
|
else if (this.event.evtype.is_alias ()) {
|
||||||
|
this.on_alias ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,23 +415,25 @@ public class Pluie.Yaml.Processor
|
||||||
*/
|
*/
|
||||||
private void on_scalar (bool entry = false)
|
private void on_scalar (bool entry = false)
|
||||||
{
|
{
|
||||||
if (this.ckey != null && this.parent_node.ntype.is_collection ()) {
|
if (!entry) {
|
||||||
|
if (this.ckey != null) {
|
||||||
this.node = new Yaml.Mapping.with_scalar (this.parent_node, this.ckey, this.event.data["data"]);
|
this.node = new Yaml.Mapping.with_scalar (this.parent_node, this.ckey, this.event.data["data"]);
|
||||||
|
this.change = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.node = new Yaml.Scalar (this.parent_node, this.event.data["data"]);
|
this.node = new Yaml.Scalar (this.parent_node, this.event.data["data"]);
|
||||||
}
|
|
||||||
this.change = true;
|
this.change = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void on_anchor ()
|
private void on_anchor ()
|
||||||
{
|
{
|
||||||
if (this.event.data != null) {
|
|
||||||
this.idAnchor = this.event.data["id"];
|
this.idAnchor = this.event.data["id"];
|
||||||
}
|
this.event = this.next_event ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -467,7 +441,6 @@ public class Pluie.Yaml.Processor
|
||||||
*/
|
*/
|
||||||
private void on_alias ()
|
private void on_alias ()
|
||||||
{
|
{
|
||||||
if (this.event.data != null) {
|
|
||||||
this.idAnchor = this.event.data["id"];
|
this.idAnchor = this.event.data["id"];
|
||||||
Yaml.Node? refnode = this.anchors.get(this.idAnchor);
|
Yaml.Node? refnode = this.anchors.get(this.idAnchor);
|
||||||
if (refnode != null) {
|
if (refnode != null) {
|
||||||
|
@ -476,7 +449,6 @@ public class Pluie.Yaml.Processor
|
||||||
this.prev_node = this.node;
|
this.prev_node = this.node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -485,6 +457,7 @@ public class Pluie.Yaml.Processor
|
||||||
{
|
{
|
||||||
this.node = new Yaml.Sequence (this.parent_node, this.ckey);
|
this.node = new Yaml.Sequence (this.parent_node, this.ckey);
|
||||||
this.change = true;
|
this.change = true;
|
||||||
|
this.beginFlowSeq = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -492,24 +465,11 @@ public class Pluie.Yaml.Processor
|
||||||
*/
|
*/
|
||||||
private void on_mapping_start (bool entry = false)
|
private void on_mapping_start (bool entry = false)
|
||||||
{
|
{
|
||||||
|
if (entry) {
|
||||||
|
this.create_mapping (entry);
|
||||||
this.ckey = null;
|
this.ckey = null;
|
||||||
this.event = this.next_event ();
|
|
||||||
if (this.event.evtype.is_key ()) {
|
|
||||||
this.event = this.next_event ();
|
|
||||||
this.on_tag (true);
|
|
||||||
if (this.event.evtype.is_scalar ()) {
|
|
||||||
this.ckey = this.event.data["data"];
|
|
||||||
}
|
|
||||||
var e = this.get_next_value_event();
|
|
||||||
if (e!=null) {
|
|
||||||
if ( e.evtype.is_sequence_start ()) {
|
|
||||||
this.on_sequence_start ();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.create_mapping (this.isEntry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else this.create_mapping ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -517,7 +477,7 @@ public class Pluie.Yaml.Processor
|
||||||
*/
|
*/
|
||||||
private void create_mapping (bool entry = false)
|
private void create_mapping (bool entry = false)
|
||||||
{
|
{
|
||||||
if (entry && this.ckey == null) {
|
if (entry) {
|
||||||
this.ckey = "_%d".printf(this.parent_node.count());
|
this.ckey = "_%d".printf(this.parent_node.count());
|
||||||
}
|
}
|
||||||
this.node = new Yaml.Mapping (this.parent_node, this.ckey);
|
this.node = new Yaml.Mapping (this.parent_node, this.ckey);
|
||||||
|
@ -529,8 +489,10 @@ public class Pluie.Yaml.Processor
|
||||||
*/
|
*/
|
||||||
private void add_anchor_if_needed ()
|
private void add_anchor_if_needed ()
|
||||||
{
|
{
|
||||||
if (this.idAnchor != null && this.node != null) {
|
if (this.idAnchor != null) {
|
||||||
|
if (this.node != null) {
|
||||||
this.anchors.set(this.idAnchor, this.node);
|
this.anchors.set(this.idAnchor, this.node);
|
||||||
|
}
|
||||||
this.idAnchor = null;
|
this.idAnchor = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -541,10 +503,7 @@ public class Pluie.Yaml.Processor
|
||||||
private void on_update ()
|
private void on_update ()
|
||||||
{
|
{
|
||||||
if (this.node != null) {
|
if (this.node != null) {
|
||||||
Yaml.dbg (Log.METHOD);
|
|
||||||
Yaml.dbg (this.node.name);
|
Yaml.dbg (this.node.name);
|
||||||
Yaml.dbg (this.node.ntype.infos ());
|
|
||||||
Yaml.dbg ("anchor ? %s".printf (this.idAnchor));
|
|
||||||
}
|
}
|
||||||
if (this.change) {
|
if (this.change) {
|
||||||
if (this.node.parent.ntype.is_sequence ()) {
|
if (this.node.parent.ntype.is_sequence ()) {
|
||||||
|
@ -575,10 +534,7 @@ public class Pluie.Yaml.Processor
|
||||||
this.keyTag = null;
|
this.keyTag = null;
|
||||||
this.valueTag = null;
|
this.valueTag = null;
|
||||||
this.node = null;
|
this.node = null;
|
||||||
this.isEntryMapping = false;
|
|
||||||
this.change = false;
|
this.change = false;
|
||||||
this.isEntry = false;
|
|
||||||
this.ckey = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
* @version : 0.60
|
* @version : 0.55
|
||||||
* @type : library
|
* @type : library
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -27,7 +27,9 @@
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
||||||
|
|
||||||
namespace Pluie.Yaml
|
namespace Pluie
|
||||||
|
{
|
||||||
|
namespace Yaml
|
||||||
{
|
{
|
||||||
const string YAML_VERSION = "1.2";
|
const string YAML_VERSION = "1.2";
|
||||||
const string YAML_VALA_PREFIX = "v";
|
const string YAML_VALA_PREFIX = "v";
|
||||||
|
@ -47,7 +49,7 @@ namespace Pluie.Yaml
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
internal static void dbg_action (string msg, string? val = null)
|
public static void dbg_action (string msg, string? val = null)
|
||||||
{
|
{
|
||||||
if (Pluie.Yaml.DEBUG) of.action (msg, val);
|
if (Pluie.Yaml.DEBUG) of.action (msg, val);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +57,7 @@ namespace Pluie.Yaml
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
internal static void dbg_keyval (string key, string val)
|
public static void dbg_keyval (string key, string val)
|
||||||
{
|
{
|
||||||
if (Pluie.Yaml.DEBUG) of.keyval (key, val);
|
if (Pluie.Yaml.DEBUG) of.keyval (key, val);
|
||||||
}
|
}
|
||||||
|
@ -63,7 +65,7 @@ namespace Pluie.Yaml
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
internal static void dbg_state (bool done)
|
public static void dbg_state (bool done)
|
||||||
{
|
{
|
||||||
if (Pluie.Yaml.DEBUG) of.state (done);
|
if (Pluie.Yaml.DEBUG) of.state (done);
|
||||||
}
|
}
|
||||||
|
@ -71,7 +73,7 @@ namespace Pluie.Yaml
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
internal static void dbg (string? msg = null)
|
public static void dbg (string? msg = null)
|
||||||
{
|
{
|
||||||
if (Pluie.Yaml.DEBUG && msg != null) of.echo (msg);
|
if (Pluie.Yaml.DEBUG && msg != null) of.echo (msg);
|
||||||
}
|
}
|
||||||
|
@ -100,9 +102,7 @@ namespace Pluie.Yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* serialize an object as a yaml compressed document data
|
*
|
||||||
* @param obj the object to serialize
|
|
||||||
* @param dest path destination if you want to write to a file
|
|
||||||
*/
|
*/
|
||||||
public static uint8[] serialize (GLib.Object? obj, string? dest = null)
|
public static uint8[] serialize (GLib.Object? obj, string? dest = null)
|
||||||
{
|
{
|
||||||
|
@ -139,8 +139,7 @@ namespace Pluie.Yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* deserialize yaml compressed document data to a Yaml.Object
|
*
|
||||||
* @param zdata the data to deserialized
|
|
||||||
*/
|
*/
|
||||||
public static Yaml.Root deserialize (uint8[] zdata)
|
public static Yaml.Root deserialize (uint8[] zdata)
|
||||||
{
|
{
|
||||||
|
@ -322,22 +321,6 @@ namespace Pluie.Yaml
|
||||||
return this == EVT.NONE;
|
return this == EVT.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return event is document start event
|
|
||||||
*/
|
|
||||||
public bool is_document_start ()
|
|
||||||
{
|
|
||||||
return this == EVT.DOCUMENT_START;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return event is stream start event
|
|
||||||
*/
|
|
||||||
public bool is_stream_start ()
|
|
||||||
{
|
|
||||||
return this == EVT.STREAM_START;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -439,7 +422,7 @@ namespace Pluie.Yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*@return a universal unique identifier (type 4)
|
*@return universal infos related to NODE_TYPE
|
||||||
*/
|
*/
|
||||||
public string uuid ()
|
public string uuid ()
|
||||||
{
|
{
|
||||||
|
@ -459,3 +442,4 @@ namespace Pluie.Yaml
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
11
valadoc.sh
11
valadoc.sh
|
@ -2,7 +2,7 @@
|
||||||
#^# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
#^# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
#
|
#
|
||||||
# @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
# @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
|
||||||
# @version : 0.60
|
# @version : 0.55
|
||||||
# @type : library
|
# @type : library
|
||||||
# @date : 2018
|
# @date : 2018
|
||||||
# @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
# @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
|
@ -29,20 +29,13 @@
|
||||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #^#
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #^#
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
lib="pluie-yaml-0.6"
|
lib="pluie-yaml-0.5"
|
||||||
cd $DIR
|
cd $DIR
|
||||||
valadoc --package-name=$lib --verbose --force --deps -o ./doc --pkg gee-0.8 --pkg gio-2.0 --pkg gobject-2.0 --pkg gmodule-2.0 --pkg glib-2.0 --pkg pluie-echo-0.2 ./src/vala/Pluie/*.vala ./build/install.vala
|
valadoc --package-name=$lib --verbose --force --deps -o ./doc --pkg gee-0.8 --pkg gio-2.0 --pkg gobject-2.0 --pkg gmodule-2.0 --pkg glib-2.0 --pkg pluie-echo-0.2 ./src/vala/Pluie/*.vala ./build/install.vala
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
rm doc/*.png
|
rm doc/*.png
|
||||||
cp resources/doc-scripts.js ./doc/scripts.js
|
cp resources/doc-scripts.js ./doc/scripts.js
|
||||||
cp resources/doc-style.css ./doc/style.css
|
cp resources/doc-style.css ./doc/style.css
|
||||||
if [ -f "./docfix" ]; then
|
|
||||||
./docfix
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
rm $lib.tar.gz
|
rm $lib.tar.gz
|
||||||
tar -czvf $lib.tar.gz doc/
|
tar -czvf $lib.tar.gz doc/
|
||||||
scp $lib.tar.gz pluie@pluie.org:/home/pluie/
|
|
||||||
ssh pluie@pluie.org "./updatedoc.sh $lib"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user