Skip to content

Commit 5a039b5

Browse files
committed
chore(rix): bump rix-io submodule to v1.0.0
1 parent 716edd4 commit 5a039b5

9 files changed

Lines changed: 346 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Changelog
2+
3+
All notable changes to **Rix (umbrella)** will be documented in this file.
4+
5+
This project follows **Semantic Versioning** (SemVer).
6+
7+
📘 **README**: https://github.com/rixcpp/rix/blob/v0.2.0/README.md
8+
9+
---
10+
11+
## [v0.2.0] — 2025-12-27
12+
13+
### 🔄 Changed
14+
15+
- Updated `modules/rix-io` submodule to **v1.0.0** (first stable release of rix-io).
16+
- Stabilized IO API (File/Buffer/reader/writer/util)
17+
- Adopted collision-free naming conventions (STL-safe)
18+
- Added/updated canonical examples and aligned tests
19+
20+
### 📦 Submodules
21+
22+
- `rix-io`: v1.0.0
23+
24+
---
25+
26+
## [v0.1.2] — (previous)
27+
28+
## [v0.1.1] — (previous)
29+
30+
## [v0.1.0] — (previous)

examples/rix-io/append_text.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#include <exception>
2+
#include <filesystem>
3+
#include <iostream>
4+
#include <string>
5+
6+
#include "rix/io/reader.hpp"
7+
#include "rix/io/util.hpp"
8+
#include "rix/io/writer.hpp"
9+
10+
using namespace rix::io;
11+
12+
static int run_example()
13+
{
14+
const auto path = temp_path("rix_io_append");
15+
16+
std::cout << "[rix-io] File: " << path << "\n";
17+
18+
write_file_text(path, "Line A\n", WriteMode::append);
19+
write_file_text(path, "Line B\n", WriteMode::append);
20+
write_file_text(path, "Line C\n", WriteMode::append);
21+
22+
const auto loaded = read_file_text(path);
23+
24+
std::cout << "[rix-io] Loaded:\n";
25+
std::cout << "----------------\n";
26+
std::cout << loaded;
27+
28+
std::error_code ec;
29+
std::filesystem::remove(path, ec);
30+
return 0;
31+
}
32+
33+
int main()
34+
{
35+
try
36+
{
37+
return run_example();
38+
}
39+
catch (const std::exception &ex)
40+
{
41+
std::cerr << "[rix-io] Example failed: " << ex.what() << "\n";
42+
return 1;
43+
}
44+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#include <cassert>
2+
#include <cstddef>
3+
#include <exception>
4+
#include <filesystem>
5+
#include <iostream>
6+
#include <span>
7+
#include <vector>
8+
9+
#include "rix/io/reader.hpp"
10+
#include "rix/io/util.hpp"
11+
#include "rix/io/writer.hpp"
12+
13+
using namespace rix::io;
14+
15+
static std::vector<std::byte> make_bytes()
16+
{
17+
std::vector<std::byte> out;
18+
out.reserve(16);
19+
20+
for (int i = 0; i < 16; ++i)
21+
out.push_back(static_cast<std::byte>(i));
22+
23+
return out;
24+
}
25+
26+
static int run_example()
27+
{
28+
const auto path = temp_path("rix_io_bin");
29+
30+
std::cout << "[rix-io] Binary file: " << path << "\n";
31+
32+
const auto bytes = make_bytes();
33+
write_file_binary(path, std::span<const std::byte>(bytes.data(), bytes.size()));
34+
35+
const auto loaded = read_file_binary(path);
36+
37+
assert(loaded.size() == bytes.size());
38+
for (std::size_t i = 0; i < bytes.size(); ++i)
39+
assert(loaded[i] == bytes[i]);
40+
41+
std::cout << "[rix-io] OK: read_file_binary == written bytes (" << loaded.size() << " bytes)\n";
42+
43+
std::error_code ec;
44+
std::filesystem::remove(path, ec);
45+
return 0;
46+
}
47+
48+
int main()
49+
{
50+
try
51+
{
52+
return run_example();
53+
}
54+
catch (const std::exception &ex)
55+
{
56+
std::cerr << "[rix-io] Example failed: " << ex.what() << "\n";
57+
return 1;
58+
}
59+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include <cassert>
2+
#include <exception>
3+
#include <iostream>
4+
#include <string>
5+
6+
#include "rix/io/buffer.hpp"
7+
8+
using namespace rix::io;
9+
10+
static int run_example()
11+
{
12+
const std::string text = "Hello from rix::io::Buffer ✅\nLine2\n";
13+
14+
Buffer buf(text);
15+
assert(buf.size() == text.size());
16+
assert(!buf.empty());
17+
18+
const std::string out = buf.to_string();
19+
assert(out == text);
20+
21+
std::cout << "[rix-io] Buffer roundtrip OK\n";
22+
std::cout << out;
23+
return 0;
24+
}
25+
26+
int main()
27+
{
28+
try
29+
{
30+
return run_example();
31+
}
32+
catch (const std::exception &ex)
33+
{
34+
std::cerr << "[rix-io] Example failed: " << ex.what() << "\n";
35+
return 1;
36+
}
37+
}

examples/rix-io/file_copy.cpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <cassert>
2+
#include <filesystem>
3+
#include <iostream>
4+
#include <span>
5+
#include <string>
6+
#include <vector>
7+
8+
#include "rix/io/reader.hpp"
9+
#include "rix/io/util.hpp"
10+
#include "rix/io/writer.hpp"
11+
12+
using namespace rix::io;
13+
14+
static int run_example()
15+
{
16+
const auto src = temp_path("rix_io_copy_src");
17+
const auto dst = temp_path("rix_io_copy_dst");
18+
19+
std::cout << "[rix-io] src: " << src << "\n";
20+
std::cout << "[rix-io] dst: " << dst << "\n";
21+
22+
const std::string content =
23+
"Rix IO copy example\n"
24+
"This file will be copied as bytes.\n";
25+
26+
write_file_text(src, content);
27+
28+
const std::vector<std::byte> bytes = read_file_binary(src);
29+
write_file_binary(dst, std::span<const std::byte>(bytes.data(), bytes.size()));
30+
31+
const auto out = read_file_text(dst);
32+
assert(out == content);
33+
34+
std::cout << "[rix-io] Copy OK\n";
35+
36+
std::error_code ec;
37+
std::filesystem::remove(src, ec);
38+
std::filesystem::remove(dst, ec);
39+
return 0;
40+
}
41+
42+
int main()
43+
{
44+
try
45+
{
46+
return run_example();
47+
}
48+
catch (const std::exception &ex)
49+
{
50+
std::cerr << "[rix-io] Example failed: " << ex.what() << "\n";
51+
return 1;
52+
}
53+
}

examples/rix-io/read_write.cpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#include <filesystem>
2+
#include <iostream>
3+
#include <string>
4+
5+
#include "rix/io/reader.hpp"
6+
#include "rix/io/util.hpp"
7+
#include "rix/io/writer.hpp"
8+
9+
using namespace rix::io;
10+
11+
static int run_example()
12+
{
13+
const auto path = temp_path("rix_io_example");
14+
15+
std::cout << "[rix-io] Example file: " << path << "\n";
16+
17+
const std::string content =
18+
"Rix IO example\n"
19+
"--------------\n"
20+
"This file was created by rix::io.\n";
21+
22+
write_file_text(path, content);
23+
24+
const auto loaded = read_file_text(path);
25+
26+
std::cout << "[rix-io] Loaded content:\n";
27+
std::cout << "------------------------\n";
28+
std::cout << loaded << "\n";
29+
30+
// cleanup best-effort
31+
std::error_code ec;
32+
std::filesystem::remove(path, ec);
33+
34+
return 0;
35+
}
36+
37+
int main()
38+
{
39+
try
40+
{
41+
return run_example();
42+
}
43+
catch (const std::exception &ex)
44+
{
45+
std::cerr << "[rix-io] Example failed: " << ex.what() << "\n";
46+
return 1;
47+
}
48+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include <filesystem>
2+
#include <iostream>
3+
4+
#include "rix/io/reader.hpp"
5+
6+
using namespace rix::io;
7+
8+
static int run_example()
9+
{
10+
const std::filesystem::path missing =
11+
"/tmp/rix_io_this_file_should_not_exist_123456789.txt";
12+
13+
const auto txt = try_read_file_text(missing);
14+
if (!txt)
15+
std::cout << "[rix-io] try_read_file_text: OK (nullopt for missing file)\n";
16+
else
17+
std::cout << "[rix-io] Unexpected: file exists?\n";
18+
19+
const auto bin = try_read_file_binary(missing);
20+
if (!bin)
21+
std::cout << "[rix-io] try_read_file_binary: OK (nullopt for missing file)\n";
22+
else
23+
std::cout << "[rix-io] Unexpected: file exists?\n";
24+
25+
return 0;
26+
}
27+
28+
int main()
29+
{
30+
try
31+
{
32+
return run_example();
33+
}
34+
catch (const std::exception &ex)
35+
{
36+
std::cerr << "[rix-io] Example failed: " << ex.what() << "\n";
37+
return 1;
38+
}
39+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include <filesystem>
2+
#include <iostream>
3+
4+
#include "rix/io/util.hpp"
5+
#include "rix/io/writer.hpp"
6+
7+
static int run_example()
8+
{
9+
const auto path = rix::io::temp_path("rix_io_size");
10+
11+
std::cout << "[rix-io] Path: " << path << "\n";
12+
std::cout << "[rix-io] exists(before) = " << (rix::io::path_exists(path) ? "true" : "false") << "\n";
13+
14+
rix::io::write_file_text(path, "1234567890\n");
15+
16+
std::cout << "[rix-io] exists(after) = " << (rix::io::path_exists(path) ? "true" : "false") << "\n";
17+
std::cout << "[rix-io] path_size = " << rix::io::path_size(path) << " bytes\n";
18+
19+
std::error_code ec;
20+
std::filesystem::remove(path, ec);
21+
return 0;
22+
}
23+
24+
int main()
25+
{
26+
try
27+
{
28+
return run_example();
29+
}
30+
catch (const std::exception &ex)
31+
{
32+
std::cerr << "[rix-io] Example failed: " << ex.what() << "\n";
33+
return 1;
34+
}
35+
}

modules/rix-io

0 commit comments

Comments
 (0)