コード例 #1
0
ファイル: tEventVisitor.cpp プロジェクト: achacha/AOS
void testCheckpoints()
{
  AEventVisitor visitor(ASWNL("My Visitor's Name"), AEventVisitor::EL_WARN);
  visitor.startEvent(ASWNL("main: Starting the test"));
  visitor.startEvent(ASWNL("main: Adding first line"));
  visitor.startEvent(ASWNL("main: Replacing the initial line"), AEventVisitor::EL_WARN);
  visitor.startEvent(ASWNL("main: Setting second line"));
  visitor.startEvent(ASWNL("main: Debug event state"), AEventVisitor::EL_DEBUG);
  visitor.startEvent(ASWNL("main: Adding first error"), AEventVisitor::EL_ERROR);
  visitor.startEvent(ASWNL("main: Oops, another error"), AEventVisitor::EL_ERROR);
  visitor.startEvent(ASWNL("main: Last event"));
  visitor.endEvent();

  std::cout << "----Textual current----" << std::endl;
  ARope rope;
  visitor.emit(rope);
  std::cout << rope << std::endl;
  
  std::cout << "----Textual debug----" << std::endl;
  rope.clear();
  visitor.emit(rope, AEventVisitor::EL_DEBUG);
  std::cout << rope << std::endl;

  std::cout << "----Textual only errors----" << std::endl;
  rope.clear();
  visitor.emit(rope, AEventVisitor::EL_ERROR);
  std::cout << rope << std::endl;

  std::cout << "----Textual only events and errors----" << std::endl;
  rope.clear();
  visitor.emit(rope, AEventVisitor::EL_EVENT);
  std::cout << rope << std::endl;

  std::cout << "----XML----" << std::endl;
  AFile_IOStream iii;
  AXmlDocument doc("AEventVisitor");
  visitor.emitXml(doc.useRoot());
  doc.emit(iii, 0);
  std::cout << std::endl;
}
コード例 #2
0
ファイル: tNamespace.cpp プロジェクト: achacha/AOS
void __insert(AObjectContainer& ns)
{
  AFile_AString f("<inserted><var a=1 b=2 c=3/><mixed>foo<bar/>baz</mixed></inserted>");
  AXmlElement element;
  element.fromAFile(f);
  ARope rope;
  element.emitXml(rope);
//  element.debugDump(std::cout, 0);
//  std::cout << rope << std::endl;

  AObjectContainer nsNew;
  nsNew.fromElement(element);
  rope.clear();
  element.clear();
  nsNew.publish(element);
//  nsNew.debugDump(std::cout, 0);

  element.debugDump(std::cout, 0);
  element.emitXml(rope);
//  std::cout << rope << std::endl;

  ns.insert("/incoming/", nsNew.clone());
//  ns.debugDump(std::cout, 0);
}