{"id":23681443,"url":"https://github.com/codecat/scratch","last_synced_at":"2025-09-02T10:31:33.070Z","repository":{"id":6658931,"uuid":"7903501","full_name":"codecat/Scratch","owner":"codecat","description":":tophat: Scratch, a general-purpose header-only core classes library for C++.","archived":false,"fork":false,"pushed_at":"2017-08-15T21:46:17.000Z","size":280,"stargazers_count":7,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-12T05:02:35.223Z","etag":null,"topics":["c-plus-plus","header-only","stream","string","threading"],"latest_commit_sha":null,"homepage":"","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/codecat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-29T23:18:41.000Z","updated_at":"2022-05-03T22:54:12.000Z","dependencies_parsed_at":"2022-08-22T13:21:15.261Z","dependency_job_id":null,"html_url":"https://github.com/codecat/Scratch","commit_stats":null,"previous_names":[],"tags_count":2,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecat%2FScratch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecat%2FScratch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecat%2FScratch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecat%2FScratch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codecat","download_url":"https://codeload.github.com/codecat/Scratch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231774744,"owners_count":18424669,"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":["c-plus-plus","header-only","stream","string","threading"],"created_at":"2024-12-29T18:38:48.212Z","updated_at":"2024-12-29T18:38:48.881Z","avatar_url":"https://github.com/codecat.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Scratch [![Build Status](https://travis-ci.org/angelog/Scratch.svg?branch=master)](https://travis-ci.org/angelog/Scratch)\n\n**NOTE:** This library is being replaced by its successor: [scratch2](https://github.com/codecat/scratch2).\n\nScratch, a header-only core library. Thread-safe by default. Currently includes the following classes:\n\n* Strings:\n  * `String`\n  * `Filename`\n* Containers:\n\t* `Array` (a much faster alternative than StackArray)\n  * `StackArray`\n  * `Dictionary`\n* Streams:\n  * `Stream`\n  * `FileStream`\n  * `NetworkStream`\n  * `MemoryStream`\n* Control flow:\n  * `Exception`\n  * `Mutex`\n  * `Assert`\n  * `Function`\n\n## Usage\nInclude Scratch.hpp in at least 1 implementation file while `SCRATCH_IMPL` is defined.\n\n```C++\n#define SCRATCH_IMPL\n#include \u003cScratch.hpp\u003e\n\n#include \u003cstdio.h\u003e\n\nint main()\n{\n  Scratch::String foo = \"Hello\";\n  foo += \" world!\";\n  printf(\"foo = '%s'\\n\", (const char*)foo);\n  return 0;\n}\n```\n\nIf you want to rename the Scratch namespace, you can do that by defining `SCRATCH_NAMESPACE` before including Scratch.hpp:\n\n```C++\n#define SCRATCH_IMPL\n#define SCRATCH_NAMESPACE s\n#include \u003cScratch.hpp\u003e\n```\n\nNote that if you choose to rename the namespace, you have to define `SCRATCH_NAMESPACE` for both the implementation and everywhere else you're including Scratch.\n\n*Note:* At the moment of writing, on Linux, you will be required to link your application against pthreads.\n\n## Options\nThere are a few specific precompiler definitions you can use during implementation compilation (SCRATCH_IMPL) that modify the behavior of the library.\n\n* `SCRATCH_NO_UTF8`: Disable utf8 support.\n* `SCRATCH_NO_THREADSAFE`: Don't enable mutex locking in classes.\n* `SCRATCH_NO_EXCEPTIONS`: Don't throw any exceptions, silently fail instead.\n* `SCRATCH_NO_ASSERT`: Don't define a custom ASSERT().\n\n## License\nScratch is licensed under the permissive MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecat%2Fscratch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodecat%2Fscratch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecat%2Fscratch/lists"}