docs(api): migrate consumers to CamelCase
All checks were successful
Linux unit tests / unit-tests (push) Successful in 30s

This commit is contained in:
2026-06-18 19:40:23 -05:00
parent a0f930c333
commit 80c6bfce90
8 changed files with 105 additions and 105 deletions

View File

@@ -42,23 +42,23 @@ target_link_libraries(your_target PRIVATE iZo::izo)
Include individual feature headers or the complete API: Include individual feature headers or the complete API:
```cpp ```cpp
#include <izo/izo.hpp> #include <izo/iZo.hpp>
izo::dialog_options options; izo::DialogOptions options;
options.title = "Choose an image"; options.title = "Choose an image";
options.filters = {{"Images", {"*.png", "*.jpg"}}}; options.filters = {{"Images", {"*.png", "*.jpg"}}};
if (auto selection = izo::open_file(options)) { if (auto selection = izo::OpenFile(options)) {
izo::reveal_in_file_manager(selection.paths.front()); izo::RevealInFileManager(selection.paths.front());
} }
auto config = izo::get_known_path(izo::known_path::config); auto config = izo::GetKnownPath(izo::KnownPath::Config);
izo::process_options process; izo::ProcessOptions process;
process.executable = "tool"; process.executable = "tool";
process.arguments = {"--input", "asset.png"}; process.arguments = {"--input", "asset.png"};
if (auto launched = izo::launch_process(process)) { if (auto launched = izo::LaunchProcess(process)) {
// launched.process_id identifies the new process. // launched.processId identifies the new process.
} }
``` ```
@@ -66,16 +66,16 @@ Resource-owning APIs are move-only and clean themselves up:
```cpp ```cpp
std::string error; std::string error;
auto library = izo::load_dynamic_library("plugin.dll", &error); auto library = izo::LoadDynamicLibrary("plugin.dll", &error);
if (library) { if (library) {
void* entry = library.symbol("initialize_plugin", &error); void* entry = library.Symbol("initialize_plugin", &error);
} }
auto watcher = izo::watch_directory( auto watcher = izo::WatchDirectory(
{{"assets"}, true}, {{"assets"}, true},
[](const izo::file_event& event) { [](const izo::FileEvent& event) {
// Handle added, removed, modified, or renamed files. // Handle added, removed, modified, or renamed files.
// Rename events provide the old path in event.previous_path. // Rename events provide the old path in event.previousPath.
}, },
&error); &error);
``` ```

View File

@@ -1,22 +1,22 @@
#include <izo/dialogs.hpp> #include <izo/Dialogs.hpp>
#include <iostream> #include <iostream>
int main() { int main() {
izo::dialog_options options; izo::DialogOptions options;
options.title = "Choose an image"; options.title = "Choose an image";
options.filters = { options.filters = {
{"Images", {"*.png", "*.jpg", "*.jpeg"}}, {"Images", {"*.png", "*.jpg", "*.jpeg"}},
{"All files", {"*"}}, {"All files", {"*"}},
}; };
const auto result = izo::open_file(options); const auto result = izo::OpenFile(options);
if (result) { if (result) {
std::cout << result.paths.front().string() << '\n'; std::cout << result.paths.front().string() << '\n';
return 0; return 0;
} }
if (result.status == izo::dialog_status::error) { if (result.status == izo::DialogStatus::Error) {
std::cerr << result.error_message << '\n'; std::cerr << result.errorMessage << '\n';
return 1; return 1;
} }
return 0; return 0;

View File

@@ -1,6 +1,6 @@
#include "test_support.hpp" #include "test_support.hpp"
#include <izo/directory_watcher.hpp> #include <izo/DirectoryWatcher.hpp>
#include <algorithm> #include <algorithm>
#include <fstream> #include <fstream>
@@ -9,22 +9,22 @@
int main() { int main() {
std::string error; std::string error;
CHECK(!izo::watch_directory({"/izo/missing", false}, [](const auto&) {}, &error)); CHECK(!izo::WatchDirectory({"/izo/missing", false}, [](const auto&) {}, &error));
CHECK(!error.empty()); CHECK(!error.empty());
error.clear(); error.clear();
const auto directory = test_directory("watcher"); const auto directory = test_directory("watcher");
CHECK(!izo::watch_directory({directory, false}, {}, &error)); CHECK(!izo::WatchDirectory({directory, false}, {}, &error));
CHECK(!error.empty()); CHECK(!error.empty());
error.clear(); error.clear();
CHECK(!izo::watch_directory({directory, false, std::chrono::milliseconds(0)}, CHECK(!izo::WatchDirectory({directory, false, std::chrono::milliseconds(0)},
[](const auto&) {}, &error)); [](const auto&) {}, &error));
std::mutex mutex; std::mutex mutex;
std::vector<izo::file_event> events; std::vector<izo::FileEvent> events;
auto watcher = izo::watch_directory( auto watcher = izo::WatchDirectory(
{directory, true, std::chrono::milliseconds(10)}, {directory, true, std::chrono::milliseconds(10)},
[&](const izo::file_event& event) { [&](const izo::FileEvent& event) {
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
events.push_back(event); events.push_back(event);
}, &error); }, &error);
@@ -37,7 +37,7 @@ int main() {
CHECK(wait_until([&] { CHECK(wait_until([&] {
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
return std::any_of(events.begin(), events.end(), [&](const auto& event) { return std::any_of(events.begin(), events.end(), [&](const auto& event) {
return event.change == izo::file_change::added && event.path == original; return event.change == izo::FileChange::Added && event.path == original;
}); });
})); }));
@@ -45,7 +45,7 @@ int main() {
CHECK(wait_until([&] { CHECK(wait_until([&] {
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
return std::any_of(events.begin(), events.end(), [&](const auto& event) { return std::any_of(events.begin(), events.end(), [&](const auto& event) {
return event.change == izo::file_change::modified && event.path == original; return event.change == izo::FileChange::Modified && event.path == original;
}); });
})); }));
@@ -53,8 +53,8 @@ int main() {
CHECK(wait_until([&] { CHECK(wait_until([&] {
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
return std::any_of(events.begin(), events.end(), [&](const auto& event) { return std::any_of(events.begin(), events.end(), [&](const auto& event) {
return event.change == izo::file_change::renamed && event.path == renamed && return event.change == izo::FileChange::Renamed && event.path == renamed &&
event.previous_path == original; event.previousPath == original;
}); });
})); }));
@@ -62,10 +62,10 @@ int main() {
CHECK(wait_until([&] { CHECK(wait_until([&] {
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
return std::any_of(events.begin(), events.end(), [&](const auto& event) { return std::any_of(events.begin(), events.end(), [&](const auto& event) {
return event.change == izo::file_change::removed && event.path == renamed; return event.change == izo::FileChange::Removed && event.path == renamed;
}); });
})); }));
watcher.stop(); watcher.Stop();
CHECK(!watcher); CHECK(!watcher);
std::filesystem::remove_all(directory); std::filesystem::remove_all(directory);
} }

View File

@@ -1,29 +1,29 @@
#include "test_support.hpp" #include "test_support.hpp"
#include <izo/dynamic_library.hpp> #include <izo/DynamicLibrary.hpp>
#include <utility> #include <utility>
int main() { int main() {
std::string error; std::string error;
auto missing = izo::load_dynamic_library("/izo/does/not/exist.so", &error); auto missing = izo::LoadDynamicLibrary("/izo/does/not/exist.so", &error);
CHECK(!missing); CHECK(!missing);
CHECK(!error.empty()); CHECK(!error.empty());
error.clear(); error.clear();
auto library = izo::load_dynamic_library("libc.so.6", &error); auto library = izo::LoadDynamicLibrary("libc.so.6", &error);
CHECK(library); CHECK(library);
CHECK(library.symbol("getpid", &error) != nullptr); CHECK(library.Symbol("getpid", &error) != nullptr);
error.clear(); error.clear();
CHECK(library.symbol("izo_missing_symbol", &error) == nullptr); CHECK(library.Symbol("izo_missing_symbol", &error) == nullptr);
CHECK(!error.empty()); CHECK(!error.empty());
auto moved = std::move(library); auto moved = std::move(library);
CHECK(!library); CHECK(!library);
CHECK(moved); CHECK(moved);
moved.reset(); moved.Reset();
CHECK(!moved); CHECK(!moved);
error.clear(); error.clear();
CHECK(moved.symbol("getpid", &error) == nullptr); CHECK(moved.Symbol("getpid", &error) == nullptr);
CHECK(!error.empty()); CHECK(!error.empty());
} }

View File

@@ -1,39 +1,39 @@
#include "test_support.hpp" #include "test_support.hpp"
#include <izo/environment.hpp> #include <izo/Environment.hpp>
#include <izo/paths.hpp> #include <izo/Paths.hpp>
#include <array> #include <array>
int main() { int main() {
std::string error; std::string error;
CHECK(izo::set_environment_variable("IZO_TEST_VALUE", "hello-utf8-å", &error)); CHECK(izo::SetEnvVar("IZO_TEST_VALUE", "hello-utf8-å", &error));
CHECK(izo::get_environment_variable("IZO_TEST_VALUE") == "hello-utf8-å"); CHECK(izo::GetEnvVar("IZO_TEST_VALUE") == "hello-utf8-å");
CHECK(izo::set_environment_variable("IZO_TEST_VALUE", "", &error)); CHECK(izo::SetEnvVar("IZO_TEST_VALUE", "", &error));
CHECK(izo::get_environment_variable("IZO_TEST_VALUE") == ""); CHECK(izo::GetEnvVar("IZO_TEST_VALUE") == "");
CHECK(izo::unset_environment_variable("IZO_TEST_VALUE", &error)); CHECK(izo::UnsetEnvVar("IZO_TEST_VALUE", &error));
CHECK(!izo::get_environment_variable("IZO_TEST_VALUE")); CHECK(!izo::GetEnvVar("IZO_TEST_VALUE"));
const auto root = test_directory("paths"); const auto root = test_directory("paths");
CHECK(izo::set_environment_variable("HOME", root.string(), &error)); CHECK(izo::SetEnvVar("HOME", root.string(), &error));
CHECK(izo::unset_environment_variable("XDG_DATA_HOME", &error)); CHECK(izo::UnsetEnvVar("XDG_DATA_HOME", &error));
CHECK(izo::unset_environment_variable("XDG_CONFIG_HOME", &error)); CHECK(izo::UnsetEnvVar("XDG_CONFIG_HOME", &error));
CHECK(izo::unset_environment_variable("XDG_CACHE_HOME", &error)); CHECK(izo::UnsetEnvVar("XDG_CACHE_HOME", &error));
CHECK(izo::unset_environment_variable("TMPDIR", &error)); CHECK(izo::UnsetEnvVar("TMPDIR", &error));
CHECK(izo::get_known_path(izo::known_path::app_data) == root / ".local/share"); CHECK(izo::GetKnownPath(izo::KnownPath::AppData) == root / ".local/share");
CHECK(izo::get_known_path(izo::known_path::local_app_data) == root / ".local/share"); CHECK(izo::GetKnownPath(izo::KnownPath::LocalAppData) == root / ".local/share");
CHECK(izo::get_known_path(izo::known_path::config) == root / ".config"); CHECK(izo::GetKnownPath(izo::KnownPath::Config) == root / ".config");
CHECK(izo::get_known_path(izo::known_path::cache) == root / ".cache"); CHECK(izo::GetKnownPath(izo::KnownPath::Cache) == root / ".cache");
CHECK(izo::get_known_path(izo::known_path::documents) == root / "Documents"); CHECK(izo::GetKnownPath(izo::KnownPath::Documents) == root / "Documents");
CHECK(izo::get_known_path(izo::known_path::downloads) == root / "Downloads"); CHECK(izo::GetKnownPath(izo::KnownPath::Downloads) == root / "Downloads");
CHECK(izo::get_known_path(izo::known_path::desktop) == root / "Desktop"); CHECK(izo::GetKnownPath(izo::KnownPath::Desktop) == root / "Desktop");
CHECK(izo::get_known_path(izo::known_path::temporary) == "/tmp"); CHECK(izo::GetKnownPath(izo::KnownPath::Temporary) == "/tmp");
CHECK(!izo::get_known_path(izo::known_path::executable_directory, &error).empty()); CHECK(!izo::GetKnownPath(izo::KnownPath::ExecutableDirectory, &error).empty());
CHECK(izo::get_known_path(izo::known_path::current_directory, &error) == CHECK(izo::GetKnownPath(izo::KnownPath::CurrentDirectory, &error) ==
std::filesystem::current_path()); std::filesystem::current_path());
CHECK(izo::set_environment_variable("XDG_CONFIG_HOME", (root / "custom-config").string(), &error)); CHECK(izo::SetEnvVar("XDG_CONFIG_HOME", (root / "custom-config").string(), &error));
CHECK(izo::get_known_path(izo::known_path::config) == root / "custom-config"); CHECK(izo::GetKnownPath(izo::KnownPath::Config) == root / "custom-config");
std::filesystem::remove_all(root); std::filesystem::remove_all(root);
} }

View File

@@ -1,36 +1,36 @@
#include "test_support.hpp" #include "test_support.hpp"
#include <izo/clipboard.hpp> #include <izo/Clipboard.hpp>
#include <izo/dialogs.hpp> #include <izo/Dialogs.hpp>
#include <izo/environment.hpp> #include <izo/Environment.hpp>
#include <izo/message_box.hpp> #include <izo/MessageBox.hpp>
int main() { int main() {
std::string error; std::string error;
CHECK(izo::set_environment_variable("PATH", "", &error)); CHECK(izo::SetEnvVar("PATH", "", &error));
auto dialog = izo::open_file(); auto dialog = izo::OpenFile();
CHECK(dialog.status == izo::dialog_status::error); CHECK(dialog.status == izo::DialogStatus::Error);
CHECK(!dialog.error_message.empty()); CHECK(!dialog.errorMessage.empty());
dialog = izo::save_file(); dialog = izo::SaveFile();
CHECK(dialog.status == izo::dialog_status::error); CHECK(dialog.status == izo::DialogStatus::Error);
dialog = izo::pick_folder(); dialog = izo::PickFolder();
CHECK(dialog.status == izo::dialog_status::error); CHECK(dialog.status == izo::DialogStatus::Error);
error.clear(); error.clear();
CHECK(!izo::open_path("/tmp", &error)); CHECK(!izo::OpenPath("/tmp", &error));
CHECK(!error.empty()); CHECK(!error.empty());
error.clear(); error.clear();
CHECK(!izo::reveal_in_file_manager("/tmp/file", &error)); CHECK(!izo::RevealInFileManager("/tmp/file", &error));
CHECK(!error.empty()); CHECK(!error.empty());
error.clear(); error.clear();
CHECK(izo::show_message_box({"title", "message"}, &error) == izo::message_response::error); CHECK(izo::ShowMessageBox({"title", "message"}, &error) == izo::MessageResponse::Error);
CHECK(!error.empty()); CHECK(!error.empty());
error.clear(); error.clear();
CHECK(!izo::set_clipboard_text({}, &error)); CHECK(!izo::SetClipboardText({}, &error));
CHECK(!error.empty()); CHECK(!error.empty());
error.clear(); error.clear();
CHECK(!izo::get_clipboard_text(&error)); CHECK(!izo::GetClipboardText(&error));
CHECK(!error.empty()); CHECK(!error.empty());
} }

View File

@@ -1,29 +1,29 @@
#include "test_support.hpp" #include "test_support.hpp"
#include <izo/process.hpp> #include <izo/Process.hpp>
#include <fstream> #include <fstream>
int main() { int main() {
std::string marker; std::string marker;
auto result = izo::launch_process({}); auto result = izo::LaunchProcess({});
CHECK(!result); CHECK(!result);
CHECK(!result.error_message.empty()); CHECK(!result.errorMessage.empty());
result = izo::launch_process({"/izo/missing-executable", {}, {}, false}); result = izo::LaunchProcess({"/izo/missing-executable", {}, {}, false});
CHECK(!result); CHECK(!result);
CHECK(!result.error_message.empty()); CHECK(!result.errorMessage.empty());
const auto directory = test_directory("process"); const auto directory = test_directory("process");
result = izo::launch_process({"/bin/sh", {"-c", "printf launched > marker.txt"}, directory, false}); result = izo::LaunchProcess({"/bin/sh", {"-c", "printf launched > marker.txt"}, directory, false});
CHECK(result); CHECK(result);
CHECK(result.process_id > 0); CHECK(result.processId > 0);
CHECK(wait_until([&] { return std::filesystem::exists(directory / "marker.txt"); })); CHECK(wait_until([&] { return std::filesystem::exists(directory / "marker.txt"); }));
std::ifstream(directory / "marker.txt") >> marker; std::ifstream(directory / "marker.txt") >> marker;
CHECK(marker == "launched"); CHECK(marker == "launched");
result = izo::launch_process({"/bin/true", {}, directory / "missing", false}); result = izo::LaunchProcess({"/bin/true", {}, directory / "missing", false});
CHECK(!result); CHECK(!result);
CHECK(!result.error_message.empty()); CHECK(!result.errorMessage.empty());
std::filesystem::remove_all(directory); std::filesystem::remove_all(directory);
} }

View File

@@ -1,23 +1,23 @@
#include "test_support.hpp" #include "test_support.hpp"
#include <izo/debug.hpp> #include <izo/Debug.hpp>
#include <izo/system.hpp> #include <izo/System.hpp>
#include <izo/time.hpp> #include <izo/Time.hpp>
int main() { int main() {
const auto info = izo::get_system_info(); const auto info = izo::GetSystemInfo();
CHECK(info.logical_cpu_count > 0); CHECK(info.logicalCpuCount > 0);
CHECK(info.total_memory_bytes > 0); CHECK(info.totalMemoryBytes > 0);
CHECK(info.available_memory_bytes <= info.total_memory_bytes); CHECK(info.availableMemoryBytes <= info.totalMemoryBytes);
CHECK(info.os_name == "Linux"); CHECK(info.osName == "Linux");
CHECK(!info.os_version.empty()); CHECK(!info.osVersion.empty());
const auto before = izo::monotonic_now(); const auto before = izo::MonotonicNow();
izo::sleep_for(std::chrono::milliseconds(5)); izo::SleepFor(std::chrono::milliseconds(5));
CHECK(izo::monotonic_now() > before); CHECK(izo::MonotonicNow() > before);
izo::sleep_for(std::chrono::nanoseconds(-1)); izo::SleepFor(std::chrono::nanoseconds(-1));
(void)izo::is_debugger_attached(); (void)izo::IsDebuggerAttached();
izo::debug_output("iZo debug output test\n"); izo::DebugOutput("iZo debug output test\n");
izo::install_crash_handler(nullptr); izo::InstallCrashHandler(nullptr);
} }