summaryrefslogtreecommitdiffstatshomepage
path: root/include
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-06-12 17:49:43 +0200
committerEgor Tensin <egor@tensin.name>2026-06-12 22:39:06 +0200
commit6a335fcca28693aa9039ad4e8a13ff71e9d2f9cd (patch)
treeda2c0a81932306c52d192425743e5c9efe4ae88a /include
parentminor fixes (diff)
downloadwinapi-common-6a335fcca28693aa9039ad4e8a13ff71e9d2f9cd.tar.gz
winapi-common-6a335fcca28693aa9039ad4e8a13ff71e9d2f9cd.zip
unify my .clang-format files
Diffstat (limited to 'include')
-rw-r--r--include/winapi/buffer.hpp4
-rw-r--r--include/winapi/cmd_line.hpp20
-rw-r--r--include/winapi/error.hpp4
-rw-r--r--include/winapi/handle.hpp17
-rw-r--r--include/winapi/path.hpp9
-rw-r--r--include/winapi/pipe.hpp16
-rw-r--r--include/winapi/process.hpp9
-rw-r--r--include/winapi/resource.hpp4
-rw-r--r--include/winapi/shmem.hpp25
-rw-r--r--include/winapi/sid.hpp18
10 files changed, 96 insertions, 30 deletions
diff --git a/include/winapi/buffer.hpp b/include/winapi/buffer.hpp
index 1009ebb..17b7e9c 100644
--- a/include/winapi/buffer.hpp
+++ b/include/winapi/buffer.hpp
@@ -41,7 +41,9 @@ public:
}
/** Construct a buffer from a memory region. */
- Buffer(const void* src, std::size_t nb) { set(src, nb); }
+ Buffer(const void* src, std::size_t nb) {
+ set(src, nb);
+ }
/** Replace the buffer's contents with the data from a string view. */
template <typename CharT>
diff --git a/include/winapi/cmd_line.hpp b/include/winapi/cmd_line.hpp
index af83cac..97ca50f 100644
--- a/include/winapi/cmd_line.hpp
+++ b/include/winapi/cmd_line.hpp
@@ -85,16 +85,22 @@ public:
* Get argv[0] for this command line.
* @return UTF-8 string.
*/
- std::string get_argv0() const { return m_argv0; }
+ std::string get_argv0() const {
+ return m_argv0;
+ }
/** Test if this command line has any additional arguments besides argv[0]. */
- bool has_args() const { return !get_args().empty(); }
+ bool has_args() const {
+ return !get_args().empty();
+ }
/**
* Get list of arguments for this command line beyond argv[0].
* @return List of UTF-8 strings.
*/
- const std::vector<std::string>& get_args() const { return m_args; }
+ const std::vector<std::string>& get_args() const {
+ return m_args;
+ }
/**
* Get list of arguments for this command line.
@@ -103,9 +109,13 @@ public:
std::vector<std::string> get_argv() const;
private:
- static constexpr char token_sep() { return ' '; }
+ static constexpr char token_sep() {
+ return ' ';
+ }
- std::string escape_argv0() const { return escape(get_argv0()); }
+ std::string escape_argv0() const {
+ return escape(get_argv0());
+ }
std::vector<std::string> escape_args() const;
diff --git a/include/winapi/error.hpp b/include/winapi/error.hpp
index 259c18b..89e7c4c 100644
--- a/include/winapi/error.hpp
+++ b/include/winapi/error.hpp
@@ -24,7 +24,9 @@ class CategoryWindows : public std::error_category {
public:
CategoryWindows() = default;
- const char* name() const noexcept { return "Windows"; }
+ const char* name() const noexcept {
+ return "Windows";
+ }
std::string message(int32_t) const;
};
diff --git a/include/winapi/handle.hpp b/include/winapi/handle.hpp
index 23e5a3c..c0f85f4 100644
--- a/include/winapi/handle.hpp
+++ b/include/winapi/handle.hpp
@@ -27,10 +27,17 @@ public:
Handle() = default;
explicit Handle(HANDLE);
- HANDLE get() const { return m_impl.get(); }
- HANDLE ptr() const { return get(); }
+ HANDLE get() const {
+ return m_impl.get();
+ }
- explicit operator HANDLE() const { return ptr(); }
+ HANDLE ptr() const {
+ return get();
+ }
+
+ explicit operator HANDLE() const {
+ return ptr();
+ }
bool is_valid() const;
static bool is_valid(HANDLE);
@@ -89,7 +96,9 @@ public:
}
void inherit(bool yes = true) const;
- void dont_inherit() const { inherit(false); }
+ void dont_inherit() const {
+ inherit(false);
+ }
private:
struct Close {
diff --git a/include/winapi/path.hpp b/include/winapi/path.hpp
index 8de2559..1c9ccd7 100644
--- a/include/winapi/path.hpp
+++ b/include/winapi/path.hpp
@@ -17,8 +17,13 @@ public:
explicit CanonicalPath(std::string_view);
- std::string get() const { return m_path; }
- std::string path() const { return get(); }
+ std::string get() const {
+ return m_path;
+ }
+
+ std::string path() const {
+ return get();
+ }
private:
std::string m_path;
diff --git a/include/winapi/pipe.hpp b/include/winapi/pipe.hpp
index e4f8624..70d5e81 100644
--- a/include/winapi/pipe.hpp
+++ b/include/winapi/pipe.hpp
@@ -18,13 +18,21 @@ public:
Pipe();
/** Get the read end of the pipe. */
- Handle& read_end() { return m_read_end; }
+ Handle& read_end() {
+ return m_read_end;
+ }
/** @overload */
- const Handle& read_end() const { return m_read_end; }
+ const Handle& read_end() const {
+ return m_read_end;
+ }
/** Get the write end of the pipe. */
- Handle& write_end() { return m_write_end; }
+ Handle& write_end() {
+ return m_write_end;
+ }
/** @overload */
- const Handle& write_end() const { return m_write_end; }
+ const Handle& write_end() const {
+ return m_write_end;
+ }
private:
Handle m_read_end;
diff --git a/include/winapi/process.hpp b/include/winapi/process.hpp
index 4d9ca28..f1f47f1 100644
--- a/include/winapi/process.hpp
+++ b/include/winapi/process.hpp
@@ -83,9 +83,14 @@ public:
static DWORD read_permissions();
/** Get this process's ID. */
- ID get_id() const { return m_id; }
+ ID get_id() const {
+ return m_id;
+ }
+
/** Get this process's handle. */
- const Handle& get_handle() const { return m_handle; }
+ const Handle& get_handle() const {
+ return m_handle;
+ }
/** Check if this process is running (i.e. not terminated). */
bool is_running() const;
diff --git a/include/winapi/resource.hpp b/include/winapi/resource.hpp
index 8b6e41b..276dedf 100644
--- a/include/winapi/resource.hpp
+++ b/include/winapi/resource.hpp
@@ -20,7 +20,9 @@ struct Resource {
Resource(const void* data, std::size_t nb) : data{data}, nb{nb} {}
/** Extract resource data into a Buffer instance. */
- Buffer copy() const { return {data, nb}; }
+ Buffer copy() const {
+ return {data, nb};
+ }
const void* data = nullptr;
std::size_t nb = 0;
diff --git a/include/winapi/shmem.hpp b/include/winapi/shmem.hpp
index aecae85..c240d49 100644
--- a/include/winapi/shmem.hpp
+++ b/include/winapi/shmem.hpp
@@ -31,9 +31,13 @@ public:
static SharedMemory open(std::string_view name);
/** Get pointer to the data. */
- void* get() const { return m_addr.get(); }
+ void* get() const {
+ return m_addr.get();
+ }
/** @overload */
- void* ptr() const { return get(); }
+ void* ptr() const {
+ return get();
+ }
private:
struct Unmap {
@@ -87,12 +91,21 @@ public:
}
/** Get pointer to the object. */
- T* ptr() const { return reinterpret_cast<T*>(m_shmem.ptr()); }
+ T* ptr() const {
+ return reinterpret_cast<T*>(m_shmem.ptr());
+ }
/** Get reference to the object. */
- T& get() const { return *ptr(); }
+ T& get() const {
+ return *ptr();
+ }
- T* operator->() const { return ptr(); }
- T& operator*() const { return get(); }
+ T* operator->() const {
+ return ptr();
+ }
+
+ T& operator*() const {
+ return get();
+ }
private:
explicit SharedObject(SharedMemory&& shmem) : m_shmem{std::move(shmem)} {}
diff --git a/include/winapi/sid.hpp b/include/winapi/sid.hpp
index af4251b..008d250 100644
--- a/include/winapi/sid.hpp
+++ b/include/winapi/sid.hpp
@@ -26,14 +26,24 @@ public:
explicit Sid(const Buffer& buffer) : m_buffer{buffer} {}
- explicit operator SID&() { return get_impl(); }
- explicit operator const SID&() const { return get_impl(); }
+ explicit operator SID&() {
+ return get_impl();
+ }
+
+ explicit operator const SID&() const {
+ return get_impl();
+ }
std::string to_string() const;
private:
- Impl& get_impl() { return *reinterpret_cast<SID*>(m_buffer.data()); }
- const Impl& get_impl() const { return *reinterpret_cast<const SID*>(m_buffer.data()); }
+ Impl& get_impl() {
+ return *reinterpret_cast<SID*>(m_buffer.data());
+ }
+
+ const Impl& get_impl() const {
+ return *reinterpret_cast<const SID*>(m_buffer.data());
+ }
Buffer m_buffer;
};