{"id":20286347,"url":"https://github.com/poseidon-code/datastream","last_synced_at":"2025-10-30T01:09:29.621Z","repository":{"id":262141054,"uuid":"879904190","full_name":"poseidon-code/DataStream","owner":"poseidon-code","description":"A C++ 23 binary data serializer like Qt's `QDataStream` class, but with less functions and simple.","archived":false,"fork":false,"pushed_at":"2025-07-30T17:15:40.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-30T20:15:50.562Z","etag":null,"topics":["binary","cpp","cpp23","serializer"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/poseidon-code.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-28T18:49:31.000Z","updated_at":"2025-07-30T17:15:44.000Z","dependencies_parsed_at":"2024-11-10T19:44:52.460Z","dependency_job_id":"4d91f716-8b40-4f17-8df2-818c0b620f12","html_url":"https://github.com/poseidon-code/DataStream","commit_stats":null,"previous_names":["poseidon-code/datastream"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/poseidon-code/DataStream","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poseidon-code%2FDataStream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poseidon-code%2FDataStream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poseidon-code%2FDataStream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poseidon-code%2FDataStream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/poseidon-code","download_url":"https://codeload.github.com/poseidon-code/DataStream/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poseidon-code%2FDataStream/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268051921,"owners_count":24187795,"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","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["binary","cpp","cpp23","serializer"],"created_at":"2024-11-14T14:33:39.454Z","updated_at":"2025-10-30T01:09:24.571Z","avatar_url":"https://github.com/poseidon-code.png","language":"C++","readme":"# DataStream\n\nA modern binary data serializer in C++ 23 standard, almost like Qt's `QDataStream` class but with less functions and simple.\n\n## Usage\n\n```cpp\n#include \u003ccstdint\u003e\n#include \u003cfstream\u003e\n#include \u003cstdfloat\u003e\n#include \u003cvector\u003e\n\n#include \"DataStream/DataStream.hpp\"\n#include \"DataStream/FixedPointQuantizer.hpp\"\n\n\nint main() {\n    auto a = DataStream::byteswap(static_cast\u003cuint16_t\u003e(1));\n\n    // using with containers\n    std::vector\u003cuint8_t\u003e b(20,0);\n    DataStream::Stream\u003cDataStream::Mode::Output\u003e bos(b);\n    uint16_t bo = 1;\n    bos \u003c\u003c bo; // 0x01 0x00\n    cis.set(bo, 0); // 0x01 0x00\n    DataStream::Stream bis(b);\n    uint16_t bi = 0;\n    bis \u003e\u003e bi; // 0x01 0x00 = 1\n    cos.get(bi, 0); // 0x01 0x00 = 1\n\n\n    // using with raw arrays\n    uint8_t c[20] = {0};\n    DataStream::Stream\u003cDataStream::Mode::Output, std::endian::big\u003e cos(c);\n    uint16_t co = 1;\n    cos \u003c\u003c co; // 0x00 0x01\n    cos.set(co, 0); // 0x00 0x01\n    DataStream::Stream\u003cDataStream::Mode::Input, std::endian::little\u003e cis(c);\n    uint16_t ci = 0;\n    cis \u003e\u003e ci; // 0x01 0x00 = 256\n    cis.get(ci, 0); // 0x01 0x00 = 256\n\n\n    // using with fstream\n    std::fstream e(\"./test.bin\", std::ios::in | std::ios::out | std::ios::trunc | std::ios::binary);\n    DataStream::Stream\u003cDataStream::Mode::Output, std::endian::big\u003e eos(e);\n    uint16_t eo = 1;\n    eos \u003c\u003c eo; // 0x00 0x01\n    e.seekg(std::ios::beg);\n    DataStream::Stream\u003cDataStream::Mode::Input, std::endian::little\u003e eis(e);\n    uint16_t ei = 0;\n    eis \u003e\u003e ei; // 0x01 0x00 = 256\n    e.close();\n\n\n    // using fixed point quantizer\n    std::float64_t value = 67.9834672;\n    DataStream::FixedPointQuantizer\u003cstd::float64_t\u003e quantizer(-90.0, 90.0); // low precision on low number of bits\n    auto quantized_value = quantizer.to_fpq(value); // quantized value to 64bit signed integer\n    std::cout \u003c\u003c quantized_value \u003c\u003c std::endl;\n    std::cout \u003c\u003c quantizer.from_fpq(quantized_value) \u003c\u003c std::endl; // switched back to floating point value\n\n\n    return 0;\n}\n```\n\n# [GPL v3 License](./LICENSE)\n\nDataStream : A modern binary data serializer in C++ 23 standard.\nCopyright (C) 2024  Pritam Halder\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the\nGNU General Public License as published by the Free Software Foundation, either version 3 of the\nLicense, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\nwithout even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with this program.\nIf not, see \u003chttps://www.gnu.org/licenses/\u003e.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposeidon-code%2Fdatastream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposeidon-code%2Fdatastream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposeidon-code%2Fdatastream/lists"}