aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/bfc/parse/hierarchyparser.h
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/bfc/parse/hierarchyparser.h
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Wasabi/bfc/parse/hierarchyparser.h')
-rw-r--r--Src/Wasabi/bfc/parse/hierarchyparser.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/Src/Wasabi/bfc/parse/hierarchyparser.h b/Src/Wasabi/bfc/parse/hierarchyparser.h
new file mode 100644
index 00000000..286b3706
--- /dev/null
+++ b/Src/Wasabi/bfc/parse/hierarchyparser.h
@@ -0,0 +1,55 @@
+#ifndef __PARAMPARSE_H
+#define __PARAMPARSE_H
+
+#include <bfc/parse/pathparse.h>
+#include <bfc/node.h>
+#include <bfc/string/StringW.h>
+
+
+// typedef NodeC<String> HPNode // OH YAH, YOU CAN'T FWD REF TYPEDEFS. STOOOOOOPID.
+class HPNode : public NodeC<StringW> {
+public:
+ HPNode( const StringW & myPayload, NodeC<StringW> * myParent = NULL ) : NodeC<StringW>(myPayload, myParent) {}
+};
+
+class HierarchyParser {
+public:
+ HierarchyParser(const wchar_t *str = NULL, const wchar_t *_sibling=L";", const wchar_t *_escape=L"\\", const wchar_t *_parent_open=L"(", const wchar_t *_parent_close=L")") ;
+ ~HierarchyParser();
+
+ HPNode *findGuid(GUID g);
+ HPNode *findString(const wchar_t *str);
+
+ int hasGuid(GUID g) { return findGuid(g) != NULL; }
+ int hasString(const wchar_t *str) { return findString(str) != NULL; }
+
+ HPNode *rootNode() { return rootnode; }
+
+private:
+ HPNode *rootnode;
+ int myalloc;
+
+ StringW sibling;
+ StringW escape;
+ StringW parent_open;
+ StringW parent_close;
+
+ HierarchyParser(HPNode *_rootnode, const wchar_t *_sibling=L";", const wchar_t *_escape=L"\\", const wchar_t *_parent_open=L"(", const wchar_t *_parent_close=L")");
+ void processSibling(const wchar_t *sibling);
+
+
+ inline int isSibling(wchar_t c) {
+ return sibling.lFindChar(c) != -1;
+ }
+ inline int isEscape(wchar_t c) {
+ return escape.lFindChar(c) != -1;
+ }
+ inline int isParentOpen(wchar_t c) {
+ return parent_open.lFindChar(c) != -1;
+ }
+ inline int isParentClose(wchar_t c) {
+ return parent_close.lFindChar(c) != -1;
+ }
+};
+
+#endif