PointListPtr PointList::FromDelStr (const KKStr& _s) { PointListPtr result = new PointList (true); KKStr s (_s); s.TrimLeft (); while (s.Len () > 0) { char nextCh = s.FirstChar (); char endPairChar = 0; if (nextCh == '[') endPairChar = ']'; else if (nextCh == '(') endPairChar = ')'; else { // Not Bracketed. endPairChar = 0; kkint16 row = (kkint16)s.ExtractTokenInt (",\t\n\t"); kkint16 col = (kkint16)s.ExtractTokenInt (",\t\n\t"); result->PushOnBack (new Point (row, col)); } if (endPairChar != 0) { KKStr pairStr = ""; auto idx = s.Find (endPairChar); if (idx) { pairStr = s.SubStrSeg (0, idx); s = s.SubStrPart (idx + 1); } else { pairStr = s; s = ""; } kkint16 row = (kkint16)pairStr.ExtractTokenInt (","); kkint16 col = (kkint16)pairStr.ExtractTokenInt (","); result->PushOnBack (new Point (row, col)); nextCh = s.FirstChar (); if ((nextCh == ',') || (nextCh == '\n') || (nextCh == '\r') || (nextCh == '\t')) s.ChopFirstChar (); } s.TrimLeft (); } return result; } /* FromDelStr */
XmlTag::XmlTag (istream& i) { tagType = tagNULL; if (i.peek () == '<') i.get (); KKStr tagStr (100); ReadWholeTag (i, tagStr); if (tagStr.FirstChar () == '/') { tagStr.ChopFirstChar (); tagType = tagEnd; } if (tagStr.EndsWith ("/>")) { tagType = tagEmpty; tagStr.ChopLastChar (); tagStr.ChopLastChar (); } else if (tagStr.LastChar () != '>') { tagType = tagStart; } else { if (tagType == tagNULL) tagType = tagStart; tagStr.ChopLastChar (); } name.TrimLeft (); name.TrimRight (); name = tagStr.ExtractToken2 (" \n\r\t"); KKStr attributeName (20); KKStr attributeValue (20); while (!tagStr.Empty ()) { ExtractAttribute (tagStr, attributeName, attributeValue); if (!attributeName.Empty ()) attributes.push_back (XmlAttribute (attributeName, attributeValue)); } }