AsonBuffer2Sink

Undocumented in source.

Members

Functions

put
void put(inout(char)[] value)
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

slice
char[] slice [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

offset
size_t offset;
Undocumented in source.

Examples

Assists in walking an SDL tree which supports the StAX method of parsing. Examples:

Tag tag;
AsonWalker walker = AsonWalker(&tag, sdl);
while(walker.pop()) {
    // use tag to process the current tag

    auto depth = tag.childrenDepth();
    while(walker.pop(depth)) {
        // process tag again as a child tag
    }

}
/+
  mixin(scopedTest!"AsonWalker");

  void testPackage(bool copyAson, string sdlText, ref Package expectedPackage)
  {
    Package parsedPackage;

    parsedPackage.parseAsonPackage(copyAson, sdlText);

    if(expectedPackage != parsedPackage) {
      writefln("Expected package: %s", expectedPackage);
      writefln(" but got package: %s", parsedPackage);
      assert(0);
    }
  }

  string sdl;
  Package expectedPackage;

  expectedPackage = Package("my-package", "an example sdl package",
			    ["Jonathan", "David", "Amy"]);

  testPackage(false, `
name        "my-package"
description "an example sdl package"
authors     "Jonathan" "David" "Amy"
`, expectedPackage);

  sdl = `
name        "my-package"
description "an example sdl package"

authors     "Jonathan" "David" "Amy"
`;

+/

Meta