ResXMLTreeNode.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * ResXMLTreeNode.h
  3. *
  4. * Created on: May 26, 2018
  5. * Author: hp
  6. */
  7. #ifndef RESXMLTREENODE_H_
  8. #define RESXMLTREENODE_H_
  9. #include <stdint.h>
  10. #include "android-xml.h"
  11. #include "ResStringPool.h"
  12. #include "ResValue.h"
  13. class XMLNameSpace;
  14. struct ResXMLTreeNodeAttribute {
  15. const char* ns;
  16. const char* name;
  17. const char* rawValue;
  18. ResValue typedValue;
  19. };
  20. class ResXMLTreeNode {
  21. public:
  22. ResXMLTreeNode(bool root = false);
  23. ResXMLTreeNode(const ResStringPool& string_pool, const char* data);
  24. void add_attribute(ResXMLTreeNodeAttribute* attribute);
  25. void add_child(ResXMLTreeNode* child);
  26. uint32_t serialize(ResStringPool& string_pool, char** data);
  27. void dump(const XMLNameSpace* ns, bool ns_declared = true);
  28. virtual ~ResXMLTreeNode();
  29. ResXMLTreeNode* _parent = nullptr;
  30. const char* _name = nullptr;
  31. const char* _ns = nullptr;
  32. ResXMLTreeNodeAttribute** _attributes = nullptr;
  33. uint32_t _num_attributes = 0;
  34. ResXMLTreeNode** _children = nullptr;
  35. uint32_t _num_children = 0;
  36. bool _root = false;
  37. };
  38. #endif /* RESXMLTREENODE_H_ */