summaryrefslogtreecommitdiffhomepage
path: root/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h
blob: 5ddffac3bbc916003eba2129e8ab8e8385b158ce (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// SPDX-License-Identifier: Apache-2.0
// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org)
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
#ifndef HEADERS_FOUNDATION_H
#define HEADERS_FOUNDATION_H

#include <libSystem/SystemKit/System.h>

namespace CF {
class CFString;
union CFGuid;
class CFProperty;
class CFObject;

template <class T>
class CFRef;
class CFFont;
struct CFPoint;
struct CFRect;
struct CFColor;

#ifndef __CF_64BIT__
typedef SInt32 CFInteger;
typedef float  CFReal;
#else
typedef SInt64 CFInteger;
typedef double CFReal;
#endif

typedef SInt32 CFInteger32;
typedef SInt64 CFInteger64;

typedef Char     CFChar8;
typedef char16_t CFChar16;

struct CFPoint {
  CFInteger64 x_1{0UL};
  CFInteger64 y_1{0UL};

  CFInteger64 x_2{0UL};
  CFInteger64 y_2{0UL};
  CFReal      ang{0UL};

  explicit operator bool();

  /// @brief Check if point is within the current CFPoint.
  /// @param point the current point to check.
  /// @retval true if point is within this point.
  /// @retval validations failed.
  bool IsWithin(CFPoint& point);
};

struct CFColor final {
  CFInteger64 r, g, b, a{0};
};

struct CFRect final {
  CFInteger64 x{0UL};
  CFInteger64 y{0UL};

  CFInteger64 width{0UL};
  CFInteger64 height{0UL};

  explicit operator bool();

  BOOL SizeMatches(CFRect& rect);
  BOOL PositionMatches(CFRect& rect);
};

union CFGuid final {
  alignas(8) UInt16 fU8[16];
  alignas(8) UInt16 fU16[8];
  alignas(8) UInt32 fU32[4];
  alignas(8) UInt64 fU64[2];

  struct {
    alignas(8) UInt32 fMs1;
    UInt16 fMs2;
    UInt16 fMs3;
    UInt8  fMs4[8];
  } fUuid;
};
}  // namespace CF

#endif