You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TagNode.cpp 1.1KB

1234567891011121314151617181920212223242526272829303132333435
  1. #include "TagNode.h"
  2. TagNode::TagNode() : Node(NodeType::TAG) {
  3. }
  4. // iterator down and extract any src attributes
  5. std::vector<std::string> TagNode::getSourceList() {
  6. std::vector<std::string> returnVec;
  7. auto propIter = properties.find("src");
  8. if (propIter != properties.end()) {
  9. returnVec.push_back(propIter->second);
  10. }
  11. for (std::shared_ptr<Node>& child : children) {
  12. auto childSrcs = child->getSourceList();
  13. returnVec.insert(returnVec.end(),
  14. childSrcs.begin(),
  15. childSrcs.end());
  16. }
  17. return returnVec;
  18. }
  19. std::unique_ptr<std::pair<std::string, std::string>> TagNode::getTagNodeNameValue() {
  20. auto namePropIter = this->properties.find("name");
  21. if (namePropIter == this->properties.end()) {
  22. return nullptr;
  23. }
  24. auto valuePropIter = this->properties.find("value");
  25. if (valuePropIter == this->properties.end()) {
  26. return nullptr;
  27. }
  28. return std::make_unique<std::pair<std::string, std::string>>(namePropIter->second, valuePropIter->second);
  29. }