Skip to content

Header only, lightweight and cross platform C++ library for copy and paste text from clipboard.

License

Notifications You must be signed in to change notification settings

blueicesir/ClipboardXX

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ClipboardXX

Header only lightweight library to copy and paste text from clipboard
Copyright (C) 2020 Arian Rezazadeh

Example

#include "clipboard.hpp"
#include <string>

int main() {
    clipboardxx::clipboard clipboard;

    // copy
    clipboard << "text you wanna copy";

    // paste
    std::string paste_text;
    clipboard >> paste_text;
}

Setup

Windows

Nothing specially need to do, just copy clipboard.hpp under include folder to your include path.

Linux

in linux based operating systems, clipboardxx requires xcb and pthread to work, Link them manually or use CMake.

MacOS

There is currently no support for MacOS, Any contribute would be much appreciated.

CMake

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)

Error handling

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.

About

Header only, lightweight and cross platform C++ library for copy and paste text from clipboard.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 97.0%
  • CMake 3.0%