summaryrefslogtreecommitdiffhomepage
path: root/src/kernel/CFKit/Property.h
blob: 1dab7b719f5674d65e75a2a8655a80f12b71df3a (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
/* ========================================

  Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.

======================================== */

#ifndef CFKIT_PROPS_H
#define CFKIT_PROPS_H

#include <CFKit/GUIDWrapper.h>
#include <NeKit/Array.h>
#include <NeKit/Config.h>
#include <NeKit/Function.h>
#include <NeKit/KString.h>

#define kMaxPropLen (256U)

namespace Kernel::CF {
/// @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(KBasicString<>& name);
  PropertyId&     GetValue();
  KBasicString<>& GetKey();

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

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

namespace Kernel {
using namespace Kernel::CF;
}

#endif  // !CFKIT_PROPS_H