// September 2015 // Levee Patroller / Dijk Patrouille // This source file is (c) by Deltares. This source file is open source but only available to select users. Do not redistribute without written permission of Stichting Deltares, Delft, The Netherlands. // This header has been automatically generated. class LocalLog extends XMLlog; //filelog variable var FileLog logfile; //static array for buffering the elements (max depth 10) var string buffer[10]; //counter of the number of elements in the array var int count; //number of spaces to make it look nice var string space; var string _totalbuffer; function string getBuffer() { //Log("getbuffer: " $ _totalbuffer); return _totalbuffer; } function startDocument(string version, string type) { local string nline; nline = ""; logfile.Logf(nline); _totalbuffer = nline; } function startElement(string elm) { local string nline; buffer[count]=elm; nline = "<"$elm$">"; logfile.Logf(generateSpace()$nline); addBuffer(nline); count++; } function writeAttribute(string att, string val) { local string nline; if(count > 1) { nline ="<"$att$">"$val$""; logfile.Logf( generateSpace()$nline); addBuffer(nline); } } function endElement() { local string nline; local string t; if(count > 0) { t = buffer[count-1]; count--; nline =""; logfile.Logf( generateSpace()$nline); addBuffer(nline); } } // test: function addBuffer(coerce string text) { // if (len(_totalbuffer) > 800) // { // Log("current: " $ _totalbuffer); // _totalbuffer = text; // } else { _totalbuffer = _totalbuffer $ text; // } } function string generateSpace() { local string t; local int i; return ""; for(i = 0; i < count; i++) { t = t$Chr(9); } return t; } function openLog(string loc) { logfile = Spawn(class'FileLog'); logfile.OpenLog(loc); } function closeLog() { endElement(); logfile.CloseLog(); } function closeTempLog() { logfile.CloseLog(); } defaultproperties { count = 0; }