From a3c90d9f8b0607c8221cd4ceee92965b15ab9a29 Mon Sep 17 00:00:00 2001 From: mutouyun Date: Tue, 11 Dec 2018 17:08:13 +0800 Subject: [PATCH] use nested class in pimpl --- include/ipc.h | 3 +-- include/shm.h | 3 +-- src/ipc.cpp | 2 +- src/shm.cpp | 8 ++++---- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/include/ipc.h b/include/ipc.h index 4c2e7da..62cee80 100644 --- a/include/ipc.h +++ b/include/ipc.h @@ -16,7 +16,6 @@ IPC_EXPORT void disconnect(handle_t h); IPC_EXPORT bool send(handle_t h, void* data, int size); IPC_EXPORT std::vector recv(handle_t h); -class channel_; class IPC_EXPORT channel { public: channel(void); @@ -29,7 +28,7 @@ public: channel& operator=(channel rhs); private: - friend class channel_; + class channel_; channel_* p_; }; diff --git a/include/shm.h b/include/shm.h index 1bbca4e..3328e37 100644 --- a/include/shm.h +++ b/include/shm.h @@ -15,7 +15,6 @@ IPC_EXPORT void release(handle_t h, std::size_t size); IPC_EXPORT void* open (handle_t h); IPC_EXPORT void close (void* mem); -class handle_; class IPC_EXPORT handle { public: handle(void); @@ -38,7 +37,7 @@ public: void close(void); private: - friend class handle_; + class handle_; handle_* p_; }; diff --git a/src/ipc.cpp b/src/ipc.cpp index a21d7fa..d9636a7 100644 --- a/src/ipc.cpp +++ b/src/ipc.cpp @@ -136,7 +136,7 @@ std::vector recv(handle_t h) { } while(1); } -class channel_ { +class channel::channel_ { public: }; diff --git a/src/shm.cpp b/src/shm.cpp index f60f6ea..e059d0f 100644 --- a/src/shm.cpp +++ b/src/shm.cpp @@ -5,11 +5,11 @@ namespace ipc { namespace shm { -class handle_ { +class handle::handle_ { public: - handle* t_ = nullptr; - handle_t h_ = nullptr; - void* m_ = nullptr; + handle* t_ = nullptr; + handle_t h_ = nullptr; + void* m_ = nullptr; std::string n_; std::size_t s_ = 0;