summaryrefslogtreecommitdiffhomepage
path: root/public/frameworks/CoreFoundation.fwrk/headers/Property.h
blob: 878c02175345460e7e3d7c3019ef879732e6b1d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* -------------------------------------------

	Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.

------------------------------------------- */

#ifndef _PROPS_H
#define _PROPS_H

#include <user/SystemCalls.h>
#include <CoreFoundation.fwrk/headers/Ref.h>

#define kMaxPropLen (256U)

namespace CF
{
	class CFString;
	class CFProperty;
	class CFGUID;

	template <typename Cls, SizeT N>
	class CFArray;

	/// @brief handle to anything (number, ptr, string...)
	using CFPropertyId = UIntPtr;

	/// @brief User property class.
	/// @example /prop/foo or /prop/bar
	class CFProperty final CF_OBJECT
	{
	public:
		CFProperty();
		virtual ~CFProperty();

	public:
		CFProperty& operator=(const CFProperty&) = default;
		CFProperty(const CFProperty&)			 = default;

		Bool		  StringEquals(CFString& name);
		CFPropertyId& GetValue();
		CFString&	  GetKey();

	private:
		CFString*	 fName{nullptr};
		CFPropertyId fValue{0UL};
		Ref<CFGUID>	 fGUID{};
	};

	template <SizeT N>
	using CFPropertyArray = CFArray<CFProperty, N>;
} // namespace CF

#endif // !CFKIT_PROPS_H