cleaning events resources file for Scanner

This commit is contained in:
a-Sansara 2018-08-20 01:30:58 +02:00
parent 87664f31b4
commit 4d6ad37810
2 changed files with 19 additions and 29 deletions

View File

@ -28,7 +28,6 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/ */
using GLib; using GLib;
using Gee; using Gee;
using Pluie; using Pluie;
@ -47,31 +46,6 @@ int main (string[] args)
root.display_childs (); root.display_childs ();
var obj = (Yaml.Example) Yaml.Builder.from_node (root.first ()); var obj = (Yaml.Example) Yaml.Builder.from_node (root.first ());
of.action ("Getting Hard coded values for Yaml.Object %s".printf (of.c (ECHO.MICROTIME).s (obj.get_type().name ())), obj.yaml_name);
of.keyval("yaml_name" , "%s" .printf(obj.yaml_name));
of.keyval("type_int" , "%d" .printf(obj.type_int));
of.keyval("type_bool" , "%s" .printf(obj.type_bool.to_string ()));
of.keyval("type_char" , "%c" .printf(obj.type_char));
of.keyval("type_string" , "%s" .printf(obj.type_string));
of.keyval("type_uchar" , "%c" .printf(obj.type_uchar));
of.keyval("type_uint" , "%u" .printf(obj.type_uint));
of.keyval("type_float" , "%f" .printf(obj.type_float));
of.keyval("type_double" , "%f" .printf(obj.type_double));
of.keyval("type_enum" , "%s" .printf(obj.type_enum.to_string ()));
of.keyval("type_struct" , "%s" .printf(obj.type_struct.to_string ()));
of.keyval("type_object" , "%s" .printf(obj.type_object.get_type ().name ()));
of.keyval(" toto" , "%s (string)" .printf(obj.type_object.toto));
of.keyval(" tapa" , "%s (string)" .printf(obj.type_object.tata));
of.keyval(" titi" , "%d (int)" .printf(obj.type_object.titi));
of.keyval(" tutu" , "%s (bool)" .printf(obj.type_object.tutu.to_string ()));
obj.type_object.method_a ();
if (obj.type_gee_al != null) {
of.keyval("type_gee_al", "(%s)" .printf(obj.type_gee_al.get_type ().name ()));
foreach (string v in obj.type_gee_al) {
of.echo(" - item : %s".printf (v));
}
}
var n = Yaml.Builder.to_node (obj); var n = Yaml.Builder.to_node (obj);
if ((done = n !=null)) { if ((done = n !=null)) {
n.display_childs (); n.display_childs ();

View File

@ -38,6 +38,7 @@ extern void yaml_parse_file(string srcPath, string destPath);
*/ */
public class Pluie.Yaml.Scanner public class Pluie.Yaml.Scanner
{ {
string path;
/** /**
* Regex pattern use to find EVENT * Regex pattern use to find EVENT
*/ */
@ -112,9 +113,24 @@ public class Pluie.Yaml.Scanner
*/ */
public Scanner (string path) public Scanner (string path)
{ {
var destPath = Path.build_filename (Environment.get_tmp_dir (), Path.get_basename(path)); var date = new GLib.DateTime.now_local ().format ("%s");
yaml_parse_file(path, destPath); this.path = Path.build_filename (Environment.get_tmp_dir (), "pluie-yaml-%s-%s.events".printf (date, Path.get_basename(path)));
this.reader = new Io.Reader (destPath); yaml_parse_file(path, this.path);
this.reader = new Io.Reader (this.path);
}
/**
*
*/
~Scanner()
{
var f = GLib.File.new_for_path (this.path);
try {
f.delete ();
}
catch (GLib.Error e) {
of.error (e.message);
}
} }
/** /**