|
| 1 | +# Cpp-Examples |
| 2 | + |
| 3 | +- [Simplified Chinese](README.md) |
| 4 | +- [English](README.en.md) |
| 5 | + |
| 6 | +## Code structure |
| 7 | + |
| 8 | +1. [Algorithm](/Algorithm/) |
| 9 | + 1. [Search](/Algorithm/Search/search.hpp)——Implementation of various search algorithms, as well as unit testing and performance testing based on Google benchmark; |
| 10 | + 1. [std_search_examples](/Algorithm/Search/std_search_examples.cc)——Examples of search algorithms in stl; |
| 11 | + 2. [Sort](/Algorithm/Sort/sort.hpp)——Implementation of various sorting algorithms, as well as unit testing and performance testing based on Google benchmark; |
| 12 | + 1. [std_sort_examples](/Algorithm/Sort/std_sort_examples.cc)——Examples of sorting algorithms in stl; |
| 13 | +2. [BinaryTree](/BinaryTree/binarytree.hpp)——Binary tree related operations, including insertion, removal, search, and printing; |
| 14 | +3. [Breakpad](/Breakpad/breakpad.hpp)——Simple encapsulation of google breakpad; |
| 15 | +4. [Exchange Order](/ByteOrder/byteorder.hpp)——Determine the byte order of the system; |
| 16 | +5. [Client](/Client/client.cpp)——A simple Linux select socket client; |
| 17 | +6. [CountDownLatch](/CountDownLatch/countdownlatch.hpp)——A simple countdown latch implemented using std::mutex and std::condition_variable (std::latch c++20); |
| 18 | +7. [Crashpad](/Crashpad/crashpad.hpp)——Simple encapsulation of google crashpad; |
| 19 | +8. [Curl](/Curl/)——Simple use of curl; |
| 20 | +9. [TcpClient](/Curl/tcpclient.hpp)——Simple tcp client implemented using curl; |
| 21 | +10. [HttpClient](/Curl/httpclient.hpp)——Simple http synchronization client implemented using curl; |
| 22 | +11. [HttpClientAsync](/Curl/httpclient_async.hpp)——Simple http asynchronous client implemented using curl; |
| 23 | +12. [Design patterns](/DesignPattern)——Some examples of design patterns; |
| 24 | +13. [Factory](/DesignPattern/Factory/factory.hpp)——Factory mode; |
| 25 | +14. [MVC](/DesignPattern/MVC/model.hpp)——mvc mode; |
| 26 | +15. [Observer](/DesignPattern/Observer/observer.hpp)——Observer mode; |
| 27 | +16. [Singleton](/DesignPattern/Singleton/singleton.hpp)——Single case mode; |
| 28 | +17. [GlobMatch](/GlobMatch/globmatcher.hpp)——glob模式匹配的简单实现; |
| 29 | +18. [Hawthorn](/Glog/main.cc)——Google glog example; |
| 30 | +19. [Icmp](/Icmp/icmp.hpp)——Simple encapsulation of linux icmp protocol; |
| 31 | +20. [LinkedList](/LinkedList/linkedlist.hpp)——Related operations of linked lists, including insertion, removal, reversal, and printing; |
| 32 | +21. [Memcpy](/Memcpy/memcpy.hpp)——`memcpy`function implementation; |
| 33 | +22. [MonitorDir](/MonitorDir/monitordir.hpp)——windows(`ReadDirectoryChangesW`),macos(`FSEvents`) and linux(`fanotify`和`inotify`) Simple example of directory monitoring; |
| 34 | + 1. `fanotify`used in`global`mode, in`fanotify_mark`Join in`FAN_MARK_FILESYSTEM`(need`CAP_SYS_ADMIN`ability, that is, root permissions) this`flag`, all events on the specified file system will be monitored, and then the required events can be filtered according to the specified monitored folder directory. This function is better than`inotify`more powerful; |
| 35 | + 1. To obtain the upper-level path where the event file is located, use`open_by_handle_at`This method will appear under ordinary users`Operation not permitted`Error, also needed`CAP_SYS_ADMIN`Ability, i.e. root authority; |
| 36 | + 2. It is recommended to run with root privileges. If you must run it under an ordinary user, it is still recommended to use`inotify`instead of`fanotify`, anyway, opening a monitoring file descriptor (`fd`), it is impossible to achieve`subtree`monitor; |
| 37 | +23. [MonitorDir_EFSW](/MonitorDir_EFSW/main.cc)——A simple example of directory monitoring using efsw; |
| 38 | +24. [Mutex](/Mutex/mutex.hpp)——Simple mutex lock and spin lock implemented using std::atomic_flag; |
| 39 | +25. [OpenSSL](/OpenSSL)——Some examples of openssl; |
| 40 | + 1. [aes](/OpenSSL/openssl_aes.cc)——AES encryption and decryption examples; |
| 41 | + 2. [base64](/OpenSSL/openssl_base64.cc)——Examples of base64 encoding and decoding; |
| 42 | + 3. [hash](/OpenSSL/openssl_hash.cc)——Example of sha256; |
| 43 | + 4. [hmac](/OpenSSL/openssl_hmac.cc)——Example of hmac; |
| 44 | + 5. [pem](/OpenSSL/openssl_pem.cc)——Example of pem format; |
| 45 | + 6. [rsa](/OpenSSL/openssl_rsa.cc)——Examples of rsa encryption and decryption; |
| 46 | + 7. [sm4](/OpenSSL/openssl_sm4.cc)——Examples of sm4 encryption and decryption; |
| 47 | + 8. [Kskh09](/OpenSSL/openssl_x509.cc)——Example of x509 certificate; |
| 48 | + 9. [bash](/OpenSSL/openssl_bash.sh)——openssl command line example; |
| 49 | +26. [Server](/Server)——Some examples of linux server; |
| 50 | + 1. [server_epoll](/Server/server_epoll.cc)——epoll example; |
| 51 | + 2. [server_poll](/Server/server_poll.cc)——Poll example; |
| 52 | + 3. [server_select](/Server/server_select.cc)——Example of select; |
| 53 | +27. [Thread](/Thread/)——Thread class implemented based on std::thread, including thread pool; |
| 54 | + 1. [Thread](/Thread/thread.hpp)——Thread class; |
| 55 | + 2. [ThreadPool](/Thread/threadpool.hpp)——Thread pool; |
0 commit comments