MCPcopy Create free account
hub / github.com/catboost/catboost / TTag

Class TTag

library/cpp/testing/unittest/junit.cpp:444–532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442class TXmlWriter {
443public:
444 class TTag {
445 friend class TXmlWriter;
446
447 explicit TTag(TXmlWriter* parent, TStringBuf name, size_t indent)
448 : Parent(parent)
449 , Name(name)
450 , Indent(indent)
451 {
452 Start();
453 }
454
455 public:
456 TTag(TTag&& tag)
457 : Parent(tag.Parent)
458 , Name(tag.Name)
459 {
460 tag.Parent = nullptr;
461 }
462
463 ~TTag() {
464 if (Parent) {
465 End();
466 }
467 }
468
469 template <class T>
470 TTag& Attribute(TStringBuf name, const T& value) {
471 return Attribute(name, TStringBuf(ToString(value)));
472 }
473
474 TTag& Attribute(TStringBuf name, const TStringBuf& value) {
475 Y_ABORT_UNLESS(!HasChildren);
476 Parent->Out << ' ';
477 Parent->Escape(name);
478 Parent->Out << "=\"";
479 Parent->Escape(value);
480 Parent->Out << '\"';
481 return *this;
482 }
483
484 TTag Tag(TStringBuf name) {
485 if (!HasChildren) {
486 HasChildren = true;
487 Close();
488 }
489 return TTag(Parent, name, Indent + 1);
490 }
491
492 TTag& Text(TStringBuf text) {
493 if (!HasChildren) {
494 HasChildren = true;
495 Close();
496 }
497 Parent->Escape(text);
498 if (!text.empty() && text.back() == '\n') {
499 NewLineBeforeIndent = false;
500 }
501 return *this;

Callers 2

TagMethod · 0.70
TagMethod · 0.70

Calls 6

AttributeClass · 0.85
CloseFunction · 0.85
ToStringFunction · 0.50
EscapeMethod · 0.45
emptyMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected