MCPcopy Create free account
hub / github.com/cjcliffe/CubicSDR / nodeToXML

Method nodeToXML

src/util/DataTree.cpp:610–951  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

608}
609
610void DataTree::nodeToXML(DataNode *elem, TiXmlElement *elxml) {
611 DataNode *child;
612
613 elem->rewind();
614
615 while (elem->hasAnother()) {
616 child = elem->getNext();
617
618 std::string nodeName = child->getName();
619
620 TiXmlElement *element;
621
622 element = new TiXmlElement(nodeName.length() ? nodeName.c_str() : "node");
623 std::string tmp;
624 std::wstring wtmp;
625 std::stringstream tmp_stream;
626 TiXmlText *text;
627 std::vector<float> tmp_floatvect;
628 std::vector<float>::iterator tmp_floatvect_i;
629 std::vector<double> tmp_doublevect;
630 std::vector<double>::iterator tmp_doublevect_i;
631 std::vector<int> tmp_intvect;
632 std::vector<int>::iterator tmp_intvect_i;
633 std::vector<char> tmp_charvect;
634 std::vector<char>::iterator tmp_charvect_i;
635 std::vector<unsigned char> tmp_ucharvect;
636 std::vector<unsigned char>::iterator tmp_ucharvect_i;
637 std::vector<unsigned int> tmp_uintvect;
638 std::vector<unsigned int>::iterator tmp_uintvect_i;
639 std::vector<long> tmp_longvect;
640 std::vector<long>::iterator tmp_longvect_i;
641 std::vector<unsigned long> tmp_ulongvect;
642 std::vector<unsigned long>::iterator tmp_ulongvect_i;
643 std::vector<long long> tmp_llongvect;
644 std::vector<long long>::iterator tmp_llongvect_i;
645
646 std::vector<string> tmp_stringvect;
647
648 TiXmlElement *tmp_node;
649 std::string tmp_pstr_as_string;
650 double tmp_double;
651
652 float tmp_float;
653 char tmp_char;
654 unsigned char tmp_uchar;
655 int tmp_int;
656 unsigned int tmp_uint;
657 long tmp_long;
658 unsigned long tmp_ulong;
659 long long tmp_llong;
660
661 switch (child->element()->getDataType()) {
662 case DataElement::Type::DATA_NULL:
663 break;
664 case DataElement::Type::DATA_VOID:
665 child->element()->get(tmp_pstr_as_string); // returned VOID as string
666// following badgerfish xml->json and xml->ruby convention for attributes..
667 if (nodeName.substr(0, 1) == string("@")) {

Callers

nothing calls this directly

Calls 13

rewindMethod · 0.80
hasAnotherMethod · 0.80
getNextMethod · 0.80
c_strMethod · 0.80
getDataTypeMethod · 0.80
elementMethod · 0.80
SetAttributeMethod · 0.80
LinkEndChildMethod · 0.80
numChildrenMethod · 0.80
getNameMethod · 0.45
lengthMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected