summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/CFKit/Property.h
blob: effd4739314cb15b4ef2927b634c8a1bd682e089 (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
54
55
56
/* -------------------------------------------

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

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

#ifndef CFKIT_PROPS_H
#define CFKIT_PROPS_H

#include <NewKit/Array.h>
#include <NewKit/Defines.h>
#include <NewKit/Function.h>
#include <NewKit/KString.h>
#include <CFKit/GUIDWrapper.h>

#define kMaxPropLen (256U)

namespace CF
{
	using namespace Kernel;

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

	/// @brief Kernel property class.
	/// @example /prop/smp_max or /prop/kern_ver
	class Property
	{
	public:
		Property();
		virtual ~Property();

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

		BOOL		StringEquals(KString& name);
		PropertyId& GetValue();
		KString&	GetKey();

	private:
		KString		   fName{kMaxPropLen};
		PropertyId	   fValue{0UL};
		Ref<XRN::GUID> fGUID{};
	};

	template <SizeT N>
	using PropertyArray = Array<Property, N>;
} // namespace CF

namespace Kernel
{
	using namespace CF;
}

#endif // !CFKIT_PROPS_H