summaryrefslogtreecommitdiffhomepage
path: root/public/frameworks/CoreFoundation.fwrk/headers/String.h
blob: d82646ee58e476ab1d6a391cd737fef6d2d2712b (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
// 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_STRING_H
#define HEADERS_STRING_H

#include <CoreFoundation.fwrk/headers/Object.h>
#include <CoreFoundation.fwrk/headers/Ref.h>

namespace CF {
class CFString;
class CFStringBuilder;

/// ================================================================================
/// @brief CFString class for string manipulations.
/// ================================================================================
class CFString final CF_OBJECT {
 public:
  CFString() = delete;

  explicit CFString(const SizeT sz);
  explicit CFString(const Char* str);

  ~CFString();

  const char* asBytes() const;

  LIBSYS_COPY_DELETE(CFString);

 private:
  Char* mStr{nullptr};
};

/// ================================================================================
/// @brief CFStringBuilder class for string manipulations.
/// ================================================================================
class CFStringBuilder final {
 public:
  static CFRef<CFString> Construct(const Char*);
  static const Char*     FromBool(const Char*, BOOL);
  static const Char*     Format(const Char*, const Char*);

  static BOOL Equals(const Char, const Char*);
  static BOOL Equals(const Char*, const Char*);
};
}  // namespace CF

#endif