Header only lightweight library to copy and paste text from clipboard
Copyright (C) 2020 Arian Rezazadeh
#include "clipboard.hpp"
#include <string>
int main() {
clipboardxx::clipboard clipboard;
// copy
clipboard << "text you wanna copy";
// paste
std::string paste_text;
clipboard >> paste_text;
}
Nothing specially need to do, just copy clipboard.hpp
under include folder to your include path.
in linux based operating systems, clipboardxx requires xcb and pthread to work, Link them manually or use CMake.
There is currently no support for MacOS, Any contribute would be much appreciated.
By using CMake, there is no need to manually change include path or link dependencies, Just put clipboardxx folder in your project subdirectoy and use add_subdirectory
function to create ClipboardXX
library and then link library to your target.
add_subdirectory(ClipboardXX)
target_link_libraries(your_target ClipboardXX)
In certain situations such as:
- cannot open clipboard in windows
- cannot empty clipboard in windows
- cannot allocate memory for copying data in windows
clipboardxx will throw an execption of type clipboardxx::exception
you can handle it by your own way.