GfmlDocWtr_.java 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. XOWA: the XOWA Offline Wiki Application
  3. Copyright (C) 2012-2017 gnosygnu@gmail.com
  4. XOWA is licensed under the terms of the General Public License (GPL) Version 3,
  5. or alternatively under the terms of the Apache License Version 2.0.
  6. You may use XOWA according to either of these licenses as is most appropriate
  7. for your project on a case-by-case basis.
  8. The terms of each license can be found in the source code repository:
  9. GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
  10. Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
  11. */
  12. package gplx.gfml; import gplx.*;
  13. import gplx.core.strings.*;
  14. public class GfmlDocWtr_ {
  15. public String To_str_and_clear() {return sb.To_str_and_clear();}
  16. public void BuildAttrib(GfmlAtr atr) {Build(atr);}
  17. public void BuildNode(GfmlNde nde) {Build(nde);}
  18. void Build(GfmlItm owner) {
  19. for (int i = 0; i < owner.SubObjs_Count(); i++) {
  20. GfmlObj subObj = owner.SubObjs_GetAt(i);
  21. GfmlItm subItm = GfmlItm_.as_(subObj);
  22. if (subItm == null)
  23. sb.Add(GfmlTkn_.as_(subObj).Raw());
  24. else
  25. Build(subItm);
  26. }
  27. }
  28. String_bldr sb = String_bldr_.new_();
  29. public static String xtoStr_(GfmlNde nde) {
  30. GfmlDocWtr_ wtr = new GfmlDocWtr_();
  31. wtr.BuildNode(nde);
  32. return wtr.To_str_and_clear();
  33. }
  34. }