aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.posix/argv.cc
diff options
context:
space:
mode:
authorLexi Winter <lexi@le-fay.org>2025-06-28 20:40:25 +0100
committerLexi Winter <lexi@le-fay.org>2025-06-28 20:40:25 +0100
commitc54ff48ac3abb62a40eb1a438da8e3e7ef139797 (patch)
tree4a78c556c7cbc6d3d7e364ca0c52c57ac0f5094b /nihil.posix/argv.cc
parenta2d7181700ac64b8e7a4472ec26dfa253b38f188 (diff)
downloadnihil-c54ff48ac3abb62a40eb1a438da8e3e7ef139797.tar.gz
nihil-c54ff48ac3abb62a40eb1a438da8e3e7ef139797.tar.bz2
posix: add tempfile()
Diffstat (limited to 'nihil.posix/argv.cc')
-rw-r--r--nihil.posix/argv.cc65
1 files changed, 0 insertions, 65 deletions
diff --git a/nihil.posix/argv.cc b/nihil.posix/argv.cc
deleted file mode 100644
index e6b1389..0000000
--- a/nihil.posix/argv.cc
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * This source code is released into the public domain.
- */
-
-module;
-
-#include <memory>
-#include <ranges>
-#include <string>
-#include <vector>
-
-module nihil.posix;
-
-namespace nihil {
-
-argv::argv() = default;
-argv::argv(argv &&) noexcept = default;
-auto argv::operator=(this argv &, argv &&) -> argv & = default;
-
-argv::~argv()
-{
- for (auto *arg : m_args)
- delete[] arg;
-}
-
-auto argv::data(this argv const &self) -> char const * const *
-{
- return self.m_args.data();
-}
-
-auto argv::data(this argv &self) -> char * const *
-{
- return self.m_args.data();
-}
-
-auto argv::size(this argv const &self)
-{
- return self.m_args.size();
-}
-
-auto argv::begin(this argv const &self)
-{
- return self.m_args.begin();
-}
-
-auto argv::end(this argv const &self)
-{
- return self.m_args.end();
-}
-
-
-auto argv::add_arg(this argv &self, std::string_view arg) -> void
-{
- // Create a nul-terminated C string.
- auto ptr = std::make_unique<char[]>(arg.size() + 1);
- std::ranges::copy(arg, ptr.get());
- ptr[arg.size()] = '\0';
-
- // Ensure we won't throw when emplacing the pointer.
- self.m_args.reserve(self.m_args.size() + 1);
- self.m_args.emplace_back(ptr.release());
-}
-
-} // namespace nihil
-