SetFileByLeo/Test/BTest.mq5

51 lines
2 KiB
MQL5
Raw Permalink Normal View History

2026-07-07 15:36:07 -05:00
//+------------------------------------------------------------------+
//| BTest.mq5 |
//| Copyright 2026, Niquel Mendoza. |
//| https://www.mql5.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza."
#property link "https://www.mql5.com/"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include "..\\Src\\Node.mqh"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
TSN::CSetFileParser setfile;
const string set = "; este es un set file de prueba...\n" +
"; basicamente sirve paa testear el paer\n" +
"InpValor=10\n" +
"InpSuma=\n" +
"InpVa=aaaaaaaa\n" +
"InpS=10.0\n" +
"InpMul=10||20||1||30||Y\n" +
2026-07-07 16:05:26 -05:00
"InpBoolean=true||false||0||true||Y\n" +
"InpSumas=10\n" +
"InpValores=20\n"
;
2026-07-07 15:36:07 -05:00
setfile.Assing(set);
setfile.CorrectPading();
setfile.Parse();
setfile.PrintCintaTypes(0, WHOLE_ARRAY);
//---
TSN::CSetNode root = setfile.GetRoot();
Print("Root size: ", root.RootSize());
string keys[];
const int t = root.GetKeys(keys);
Print("Keys: ", t);
string key_two = root.AtObjKey(2);
PrintFormat("Key 2 = %s, pos = %d", key_two, root.KeyToPosition(key_two));
ArrayPrint(keys, 1, " | ");
Print(root["InpMul"].Step().ToInt());
Print(root["InpBoolean"].Value().ToBool());
}
//+------------------------------------------------------------------+