summaryrefslogtreecommitdiffhomepage
path: root/CFKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-06 09:14:11 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-06 09:14:11 +0100
commit5339d016c07bf717ee388f4feb73544087324af0 (patch)
tree94be6f67ed626091f24aee24ec3b3be03d01e4e7 /CFKit
git: port from mercurial repo.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'CFKit')
-rw-r--r--CFKit/GUIDWizard.hpp25
-rw-r--r--CFKit/GUIDWrapper.hpp59
-rw-r--r--CFKit/Property.hpp46
-rw-r--r--CFKit/URL.hpp35
-rw-r--r--CFKit/compile_flags.txt5
5 files changed, 170 insertions, 0 deletions
diff --git a/CFKit/GUIDWizard.hpp b/CFKit/GUIDWizard.hpp
new file mode 100644
index 00000000..8ad2a02a
--- /dev/null
+++ b/CFKit/GUIDWizard.hpp
@@ -0,0 +1,25 @@
+/*
+ * ========================================================
+ *
+ * hCore
+ * Copyright Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#pragma once
+
+#include <CFKit/GUIDWrapper.hpp>
+#include <NewKit/Array.hpp>
+#include <NewKit/ArrayList.hpp>
+#include <NewKit/ErrorOr.hpp>
+#include <NewKit/Defines.hpp>
+#include <NewKit/Ref.hpp>
+#include <NewKit/Stream.hpp>
+#include <NewKit/String.hpp>
+
+namespace hCore::XRN::Version1
+{
+ Ref<GUIDSequence*> make_sequence(const ArrayList<UShort>& seq);
+ ErrorOr<Ref<hCore::StringView>> try_guid_to_string(Ref<GUIDSequence*>& guid);
+} // namespace hCore::XRN::Version1
diff --git a/CFKit/GUIDWrapper.hpp b/CFKit/GUIDWrapper.hpp
new file mode 100644
index 00000000..ab8e116b
--- /dev/null
+++ b/CFKit/GUIDWrapper.hpp
@@ -0,0 +1,59 @@
+/*
+ * ========================================================
+ *
+ * hCore
+ * Copyright Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#pragma once
+
+#include <NewKit/Defines.hpp>
+#include <NewKit/Ref.hpp>
+#include <NewKit/Stream.hpp>
+
+/* GUID for C++ Components */
+
+#define NULL_GUID "XRN:{........-....-M...-N...-............}"
+
+// eXtensible Resource Information
+namespace hCore::XRN
+{
+ union GUIDSequence
+ {
+ alignas(8) UShort u8[16];
+ alignas(8) UShort u16[8];
+ alignas(8) UInt u32[4];
+ alignas(8) ULong u64[2];
+
+ struct
+ {
+ alignas(8) UInt m_Ms1;
+ UShort m_Ms2;
+ UShort m_Ms3;
+ UChar m_Ms4[8];
+ };
+ };
+
+ class GUID final
+ {
+ public:
+ explicit GUID() = default;
+ ~GUID() = default;
+
+ public:
+ GUID &operator=(const GUID &) = default;
+ GUID(const GUID &) = default;
+
+ public:
+ GUIDSequence &operator->()
+ {
+ return m_UUID;
+ }
+
+ private:
+ GUIDSequence m_UUID;
+
+ };
+} // namespace hCore::XRN
diff --git a/CFKit/Property.hpp b/CFKit/Property.hpp
new file mode 100644
index 00000000..855f5469
--- /dev/null
+++ b/CFKit/Property.hpp
@@ -0,0 +1,46 @@
+/*
+ * ========================================================
+ *
+ * hCore
+ * Copyright Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#ifndef _INC_PLIST_HPP__
+#define _INC_PLIST_HPP__
+
+#include <NewKit/Array.hpp>
+#include <NewKit/Defines.hpp>
+#include <NewKit/Function.hpp>
+#include <NewKit/String.hpp>
+
+namespace hCore
+{
+ using PropertyId = Int;
+
+ class Property
+ {
+ public:
+ explicit Property(const StringView &sw)
+ : m_sName(sw) {}
+
+ virtual ~Property() = default;
+
+ public:
+ Property &operator=(const Property &) = default;
+ Property(const Property &) = default;
+
+ bool StringEquals(StringView &name);
+ const PropertyId &GetPropertyById();
+
+ private:
+ Ref<StringView> m_sName;
+ PropertyId m_Action;
+
+ };
+
+ template<SSizeT N> using PropertyArray = Array<Property, N>;
+} // namespace hCore
+
+#endif // !_INC_PLIST_HPP__
diff --git a/CFKit/URL.hpp b/CFKit/URL.hpp
new file mode 100644
index 00000000..1a1abf88
--- /dev/null
+++ b/CFKit/URL.hpp
@@ -0,0 +1,35 @@
+/*
+ * ========================================================
+ *
+ * hCore
+ * Copyright Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#ifndef _INC_URL_HPP__
+#define _INC_URL_HPP__
+
+#include <NewKit/Defines.hpp>
+#include <NewKit/String.hpp>
+
+namespace hCore
+{
+ class Url final
+ {
+ public:
+ explicit Url(StringView &strUrl);
+ ~Url();
+
+ public:
+ Ref<ErrorOr<StringView>> Location() noexcept;
+ Ref<ErrorOr<StringView>> Protocol() noexcept;
+
+ private:
+ Ref<StringView> m_urlView;
+
+ };
+
+} // namespace hCore
+
+#endif /* ifndef _INC_URL_HPP__ */ \ No newline at end of file
diff --git a/CFKit/compile_flags.txt b/CFKit/compile_flags.txt
new file mode 100644
index 00000000..a37ae6bf
--- /dev/null
+++ b/CFKit/compile_flags.txt
@@ -0,0 +1,5 @@
+-nostdlib
+-ffreestanding
+-std=c++20
+-I./
+-I../