summaryrefslogtreecommitdiffhomepage
path: root/public/frameworks/CoreFoundation.fwrk/headers/Property.h
blob: f3c4a937156219012216e11b1b0ad0179f29e657 (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 _PROPS_H
#define _PROPS_H

#include <CoreFoundation.fwrk/headers/Ref.h>
#include <libSystem/SystemKit/System.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