diff options
| author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
| commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
| tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/xml/XMLNode.h | |
| parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
| parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
| download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz | |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/xml/XMLNode.h')
| -rw-r--r-- | Src/xml/XMLNode.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Src/xml/XMLNode.h b/Src/xml/XMLNode.h new file mode 100644 index 00000000..33779a74 --- /dev/null +++ b/Src/xml/XMLNode.h @@ -0,0 +1,45 @@ +#pragma once + +#include <windows.h> +#include "../nu/Alias.h" +#include <vector> +#include <map> +class MapUnicodeComp +{ +public: + + // CSTR_LESS_THAN 1 // string 1 less than string 2 + // CSTR_EQUAL 2 // string 1 equal to string 2 + // CSTR_GREATER_THAN 3 // string 1 greater than string 2 + bool operator()(const wchar_t* str1, const wchar_t* str2) const + { + return (CompareStringW(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT), 0, str1, -1, str2, -1)-2) == CSTR_LESS_THAN; + } +}; + +class XMLNode +{ +public: + typedef std::map<const wchar_t *, wchar_t*, MapUnicodeComp> PropMap; + typedef std::vector<XMLNode*> NodeList; + typedef std::map<const wchar_t *, NodeList*, MapUnicodeComp> NodeMap; + + XMLNode(); + ~XMLNode(); + const XMLNode *Get(const wchar_t *) const; + const NodeList *GetList(const wchar_t *) const; + const bool Present(const wchar_t *) const; + void SetProperty(const wchar_t *prop, const wchar_t *value); + const wchar_t *GetProperty(const wchar_t *prop) const; + const wchar_t *GetContent() const; + void SetContent_Own(wchar_t *new_content); + void AppendContent(wchar_t *append); + void AddNode(const wchar_t *name, XMLNode *new_node); + XMLNode *parent; + +private: + PropMap properties; + wchar_t *content; + size_t content_len; // number of characters in curtext, not including null terminator + NodeMap nodes; +};
\ No newline at end of file |
