xot 0.3.4 β†’ 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a26e9fa724bc739101d50ca597db562c45579a6838e58b499500f8fde36fc2cd
4
- data.tar.gz: fda8ebb7d831ea1089a99eddfe804d6b4ed954ecf4b9fd3e1132b8eb89eee9c2
3
+ metadata.gz: b2990bbdfda0d6d33a86bbc3a17541ed0bab27d49fbcaaf28c5f4df12992f280
4
+ data.tar.gz: bfe965639a4592d05a39d73a467328a7c2d3188b85da9e999867ae796484d047
5
5
  SHA512:
6
- metadata.gz: d557d7cb96560fac93a415a4e4c518a3cbea52ca55ea8a915a8119147128996fcd95fe6bf289e058c85335e0a5021ae6f5b08277b9ea51fa4c5c85d0361bdc50
7
- data.tar.gz: 7a42fcd477c066a267074882ca44c8a27c07b656a7a853d7e06efa9c6a0fde5400bfdf7eeb67900939e3b0c557cea69ef80bc4ff314c7fb46564b77c16406e1b
6
+ metadata.gz: b63394e1a1cc9b8bfa1b6c4832ce059b668d023a7e18be341dd9cfb1af9c33d5cbe715651bb3904247de9d5fd4c0ad7f719b43f8a82550800ecc7ad36efa7c1c
7
+ data.tar.gz: 8869fdafed934a52a321204b3874ad9bedac0279b8d8ec5ce3efd605cd72999b1fa51b4ad7858ff00ca2e928f9012f8a36cc708880b743b37065560daedbfc85
@@ -0,0 +1,12 @@
1
+ ## Pull Requests Not Accepted 🚫
2
+
3
+ Thank you for your interest in contributing!
4
+ However, this repository does not accept pull requests directly.
5
+
6
+ ### Where to Contribute?
7
+
8
+ Please submit your changes to the [xord/all](https://github.com/xord/all) monorepo, which serves as the primary repository for all our main libraries.
9
+
10
+ For more details, please refer to our [contribution guidelines](../CONTRIBUTING.md).
11
+
12
+ Thanks for your understanding! πŸ™Œ
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,7 @@
1
+ # Contribution Guide
2
+
3
+ Thank you for your interest in contributing!
4
+ However, this repository does not accept pull requests.
5
+ Instead, please submit your changes to the [xord/all](https://github.com/xord/all) monorepo, which serves as the primary repository for all our main libraries.
6
+
7
+ For any questions, feel free to open an issue.
data/ChangeLog.md CHANGED
@@ -1,6 +1,17 @@
1
1
  # xot ChangeLog
2
2
 
3
3
 
4
+ ## [v0.3.6] - 2025-04-08
5
+
6
+ - Move cfrelease() and CFStringPtr from rays to xot
7
+
8
+
9
+ ## [v0.3.5] - 2025-03-24
10
+
11
+ - Add PULL_REQUEST_TEMPLATE.md
12
+ - Add CONTRIBUTING.md
13
+
14
+
4
15
  ## [v0.3.4] - 2025-03-07
5
16
 
6
17
  - Hookable passes keyword args
data/README.md CHANGED
@@ -1,4 +1,49 @@
1
+ # Xot - Some useful utility classes and functions
1
2
 
2
- # Xot - Some useful utility classes and functions.
3
+ ![License](https://img.shields.io/github/license/xord/xot)
4
+ ![Build Status](https://github.com/xord/xot/actions/workflows/test.yml/badge.svg)
5
+ ![Gem Version](https://badge.fury.io/rb/xot.svg)
3
6
 
4
- by xordog@gmail.com
7
+ ## ⚠️ Notice
8
+
9
+ This repository is a read-only mirror of our monorepo.
10
+ We do not accept pull requests or direct contributions here.
11
+
12
+ ### πŸ”„ Where to Contribute?
13
+
14
+ All development happens in our [xord/all](https://github.com/xord/all) monorepo, which contains all our main libraries.
15
+ If you'd like to contribute, please submit your changes there.
16
+
17
+ For more details, check out our [Contribution Guidelines](./CONTRIBUTING.md).
18
+
19
+ Thanks for your support! πŸ™Œ
20
+
21
+ ## πŸš€ About
22
+
23
+ **Xot** is a small utility library that was extracted for internal use to provide basic helper classes and functions across our own Ruby gems.
24
+
25
+ It’s not intended for general public use, but rather serves as a simple collection of utilities to make our own development process more efficient and consistent.
26
+
27
+ Feel free to explore, but please note that it’s not actively maintained or intended for broad adoption.
28
+
29
+ ## πŸ“¦ Installation
30
+
31
+ Add this line to your Gemfile:
32
+ ```ruby
33
+ $ gem 'xot'
34
+ ```
35
+
36
+ Then, install gem:
37
+ ```bash
38
+ $ bundle install
39
+ ```
40
+
41
+ Or install it directly:
42
+ ```bash
43
+ $ gem install xot
44
+ ```
45
+
46
+ ## πŸ“œ License
47
+
48
+ **Xot** is licensed under the MIT License.
49
+ See the [LICENSE](./LICENSE) file for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
1
+ 0.3.6
data/include/xot/string.h CHANGED
@@ -5,6 +5,7 @@
5
5
 
6
6
 
7
7
  #include <stdarg.h>
8
+ #include <memory>
8
9
  #include <string>
9
10
  #include <vector>
10
11
 
@@ -24,6 +25,11 @@
24
25
  while (false)
25
26
 
26
27
 
28
+ #if defined(OSX) || defined(IOS)
29
+ struct __CFString;
30
+ #endif
31
+
32
+
27
33
  namespace Xot
28
34
  {
29
35
 
@@ -71,6 +77,15 @@ namespace Xot
71
77
  template <typename T> String to_s (const T& val);
72
78
 
73
79
 
80
+ #if defined(OSX) || defined(IOS)
81
+
82
+ typedef std::shared_ptr<const __CFString> CFStringPtr;
83
+
84
+ CFStringPtr cfstring (const char* str);
85
+
86
+ #endif
87
+
88
+
74
89
  }// Xot
75
90
 
76
91
 
data/include/xot/util.h CHANGED
@@ -131,6 +131,13 @@ namespace Xot
131
131
  }
132
132
 
133
133
 
134
+ #if defined(OSX) || defined(IOS)
135
+
136
+ void safe_cfrelease (const void* ref);
137
+
138
+ #endif
139
+
140
+
134
141
  }// Xot
135
142
 
136
143
 
data/lib/xot/rake/util.rb CHANGED
@@ -207,10 +207,10 @@ module Xot
207
207
  s = flags.dup
208
208
  s << warning_opts.map {|s| " -W#{s}"}.join
209
209
  s << " -arch arm64" if RUBY_PLATFORM =~ /arm64-darwin/
210
- s << ' -std=c++20' if gcc?
211
- s << ' -std=c++20 -stdlib=libc++ -mmacosx-version-min=10.7' if clang?
212
- s << ' ' + RbConfig::CONFIG['debugflags'] if debug?
213
- s.gsub!(/-O\d?\w*/, '-O0') if debug?
210
+ s << ' -std=c++20' if gcc?
211
+ s << ' -std=c++20 -stdlib=libc++ -mmacosx-version-min=10.10' if clang?
212
+ s << ' ' + RbConfig::CONFIG['debugflags'] if debug?
213
+ s.gsub!(/-O\d?\w*/, '-O0') if debug?
214
214
  s
215
215
  end
216
216
 
data/src/string.cpp CHANGED
@@ -4,9 +4,12 @@
4
4
  #include <stdio.h>
5
5
  #include <string.h>
6
6
  #include <algorithm>
7
- #include <memory>
8
7
  #include "xot/exception.h"
9
8
 
9
+ #if defined(OSX) || defined(IOS)
10
+ #import <CoreFoundation/CoreFoundation.h>
11
+ #endif
12
+
10
13
 
11
14
  namespace Xot
12
15
  {
@@ -167,5 +170,46 @@ namespace Xot
167
170
  return val;
168
171
  }
169
172
 
173
+ #if defined(OSX) || defined(IOS)
174
+
175
+ template <> String
176
+ to_s<CFStringRef> (const CFStringRef& val)
177
+ {
178
+ if (!val || CFGetTypeID(val) != CFStringGetTypeID())
179
+ return String();
180
+
181
+ CFIndex len = CFStringGetMaximumSizeForEncoding(
182
+ CFStringGetLength(val), kCFStringEncodingUTF8) + 1;
183
+
184
+ std::unique_ptr<char[]> buffer(new char[len]);
185
+ if (!CFStringGetCString(val, buffer.get(), len, kCFStringEncodingUTF8))
186
+ system_error(__FILE__, __LINE__);
187
+
188
+ return buffer.get();
189
+ }
190
+
191
+ template <> String
192
+ to_s<CFStringPtr> (const CFStringPtr& val)
193
+ {
194
+ return to_s((CFStringRef) val.get());
195
+ }
196
+
197
+
198
+ static void
199
+ release_cfstring (CFTypeRef ref)
200
+ {
201
+ if (ref) CFRelease(ref);
202
+ }
203
+
204
+ CFStringPtr
205
+ cfstring (const char* str)
206
+ {
207
+ CFStringRef ref = CFStringCreateWithCString(
208
+ kCFAllocatorDefault, str, kCFStringEncodingUTF8);
209
+ return CFStringPtr(ref, release_cfstring);
210
+ }
211
+
212
+ #endif
213
+
170
214
 
171
215
  }// Xot
data/src/util.cpp CHANGED
@@ -3,6 +3,10 @@
3
3
 
4
4
  #include <stdlib.h>
5
5
 
6
+ #if defined(OSX) || defined(IOS)
7
+ #import <CoreFoundation/CFBase.h>
8
+ #endif
9
+
6
10
 
7
11
  namespace Xot
8
12
  {
@@ -49,4 +53,15 @@ namespace Xot
49
53
  }
50
54
 
51
55
 
56
+ #if defined(OSX) || defined(IOS)
57
+
58
+ void
59
+ safe_cfrelease (const void* ref)
60
+ {
61
+ if (ref) CFRelease(ref);
62
+ }
63
+
64
+ #endif
65
+
66
+
52
67
  }// Xot
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-06 00:00:00.000000000 Z
11
+ date: 2025-04-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This library include some useful utility classes and functions for development
14
14
  with C++.
@@ -18,10 +18,12 @@ extensions:
18
18
  - Rakefile
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - ".github/PULL_REQUEST_TEMPLATE.md"
21
22
  - ".github/workflows/release-gem.yml"
22
23
  - ".github/workflows/tag.yml"
23
24
  - ".github/workflows/test.yml"
24
25
  - ".github/workflows/utils.rb"
26
+ - CONTRIBUTING.md
25
27
  - ChangeLog.md
26
28
  - Gemfile
27
29
  - Gemfile.lock