{"id":16837795,"url":"https://github.com/zhreshold/zulib","last_synced_at":"2025-03-18T03:42:35.793Z","repository":{"id":30584815,"uuid":"34139901","full_name":"zhreshold/ZULib","owner":"zhreshold","description":"Z's Utility Library","archived":false,"fork":false,"pushed_at":"2015-05-04T22:06:30.000Z","size":180,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-24T10:48:00.529Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhreshold.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-17T21:00:15.000Z","updated_at":"2021-12-29T12:20:16.000Z","dependencies_parsed_at":"2022-09-08T11:03:36.091Z","dependency_job_id":null,"html_url":"https://github.com/zhreshold/ZULib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhreshold%2FZULib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhreshold%2FZULib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhreshold%2FZULib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhreshold%2FZULib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhreshold","download_url":"https://codeload.github.com/zhreshold/ZULib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244153308,"owners_count":20406995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T12:18:51.376Z","updated_at":"2025-03-18T03:42:35.765Z","avatar_url":"https://github.com/zhreshold.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"ZULib - Z's Utility Library\n====================================\n\nPersonal C++ Util libraries.\nCross-Platform.\nMainly focus on system independent I/O operations. \n\n## License\nMIT License.\n\n## Usage\n+ include \"zuLib.hpp\" in source code\n\n## Compatibility\n+ C++03 compatible with MSVC/GCC/Clang\n+ Windows XP/Server 2003? or newer\n+ Mainstream linux\n+ Mac OS X\n+ Some POSIX compiant platform\n\n## Examples\n+ Print message (Currently use Macro to hack chain input in order to support pre-c++11 compilers.)\n```\nPrint(\"print to std::cout\" \u003c\u003c \"U can chain input various types\" \u003c\u003c \", e.g. int: \" \u003c\u003c 5 \u003c\u003c \" or double: \" \u003c\u003c 3.1415926);\nPrintln(\"this will automatically start new line at end. Print will not, otherwise same functionality.\");\nWarning(\"print to std::cerr with not fatal error, will continue running\");\nError(\"Will print error msg to std::cerr and exit\");\n```\n+ Open text file\n```\n// open a text file \"test.txt\"\nzz::TextFile tf(\"test.txt\");\n// count number of lines in the text file, cautious: may take a while for extremely large files\nPrintln(tf.count_lines()); \n// jump to line 20\nint ret = tf.goto_line(20);\nPrintln(\"jumped to line: \" \u003c\u003c ret);\n// print lines\nString line;\nwhile ( tf.next_line(line) \u003e= 0)\n{\n\tPrintln(line);\n}\n```\n+ Time benchmark\n```\n// use Timer class\nPrintln(\"Testing Timer\");\nzz:Timer t;\nfor (int i = 0; i \u003c 1000; i++)\n{\n    execute_some_function();\n}\nPrintln(\"Time elapsed: \" \u003c\u003c t.get_elapsed_time_ms() \u003c\u003c \"ms\");\n// also a asynchronus waitkey function provided\n// wait 1000 ms key strok\nint key = waitkey(1000);\n```\n+ Directory handling\n```\n// Path utility\nzz::Path path(\"../../cache/test.jpg\");\n// detect if exist\nPrintln(\"Exist? \" \u003c\u003c path.exist());\n// detect if is a directory or file\nPrintln(\"Is dir? \" \u003c\u003c path.dir());\n// get basename w/o directory or extension\nPrintln(\"Basename: \" \u003c\u003c path.get_basename());\n// get root directory\nPrintln(\"Directory: \" \u003c\u003c path.get_dir());\n// get extension\nPrintln(\"Extension: \" \u003c\u003c path.get_extension());\n// get absolute path from relative path\nPrintln(\"Absolute path: \" \u003c\u003c zz::Path::get_real_path(path.str());\n// get current working directory\nPrintln(\"CWD: \" \u003c\u003c zz::Path::get_cwd());\n//----------------------------------------//\n// Directory\nzz::Dir dir(\"../../\", RECURSIVE, SHOW_HIDDEN);\n// list all files\nVecstr list = dir.list_files();\nfor (size_t i = 0; i \u003c list.size(); i++)\n{\n    Println(list[i]);\n}\n```\n\n## Capability\n\n+ TBD\n\n## What's under Construction...\n\n+ More TBD\n\n## Acknowledgement\n\n+ Pending\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhreshold%2Fzulib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhreshold%2Fzulib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhreshold%2Fzulib/lists"}