{"id":13730473,"url":"https://github.com/timkerchmar/tstype","last_synced_at":"2025-05-08T03:30:41.236Z","repository":{"id":216133619,"uuid":"131071213","full_name":"timkerchmar/tstype","owner":"timkerchmar","description":"Lightweight C++ RTTI library","archived":false,"fork":false,"pushed_at":"2018-04-28T11:59:30.000Z","size":17,"stargazers_count":47,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-04T02:09:36.040Z","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/timkerchmar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2018-04-25T22:40:48.000Z","updated_at":"2024-04-27T10:01:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"a48781c3-f950-4025-ad8a-dcbda00d3847","html_url":"https://github.com/timkerchmar/tstype","commit_stats":null,"previous_names":["timkerchmar/tstype"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkerchmar%2Ftstype","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkerchmar%2Ftstype/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkerchmar%2Ftstype/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkerchmar%2Ftstype/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timkerchmar","download_url":"https://codeload.github.com/timkerchmar/tstype/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224695515,"owners_count":17354424,"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-08-03T02:01:15.316Z","updated_at":"2024-11-14T21:31:02.968Z","avatar_url":"https://github.com/timkerchmar.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# TSType\n\n## What is it?\n\nA lightweight RTTI lib for C++ that doesn't require C++'s RTTI or boost. It enables real reflection and is useful for inspecting 3rd party structs and classes without modifying 3rd party source files.\n\n## How do I use it?\n\nAdd the cpp and h source files to your project.\n\n### Header Changes\n\nAdd TSType declarations after the classes declarations you want to inspect:\n```cpp\nTSDeclareType(SomeKindOfClass, SomeBaseClassType);\n```\n\nIf there is no base class:\n```cpp\nTSDeclareType(SomeKindOfClass, TSEmpty);\n```\n\nIf the class is abstract:\n```cpp\nTSDeclareAbstractType(SomeKindOfClass, SomeBaseClassType);\n```\n\n### Source Changes\n\nImplement the class in a c++ file:\n```cpp\nTSImplementType(SomeKindOfClass, \"complexity manager\");\n```\n\nIf the class is abstract:\n```cpp\nTSImplementAbstractType(SomeKindOfClass, \"complexity manager\");\n```\n\nDescribe each public field in the C++ source and add a default value:\n```cpp\nTSField(TSString, SomeKindOfClass, fileName, \"user.prefs\");\n```\n\n## Sample\n\n```cpp\n#include \"TSType.h\"\n\nclass MostWanted \n{\npublic:\n    std::vector\u003c std::string \u003e names;\n};\nTSDeclareType(MostWanted, TSEmpty); \n```\n\n```cpp\n#include \"MostWanted.h\"\n\nTSImplementType(MostWanted, \"persons of interest\");\nTSField(TSStringArray, MostWanted, names, std::vector\u003c std::string \u003e());\n\nvoid testTSType()\r\n{\n    printf(\"All known types:\\n\");\n    TSType::print();\n    \n    printf(\"\\nPrinting a description of the TSStringType object:\\n\");\n    PrintObjectHierarchy(TSTypeType, TSStringType);\n\t\n    MostWanted* foo = MostWantedType-\u003ecreate();\n    foo-\u003enames.push_back(\"Bob\");\n\n    printf(\"\\nPrinting a description of the MostWanted object:\\n\");\n    PrintObjectHierarchy(MostWantedType, foo);\n\n    MostWantedType-\u003edestroy(foo);\n}\n```\n\nOutput:\n\n```\nAll known types:\n    Type \n        MostWanted ( names )\n        TSObject ( type )\n            ContainerBase \n                GenericContainer \n            GenericReference ( id )\n        TSType ( fields name description )\n        Array \n            MostWantedArray \n            MostWantedPtrArray \n            TSObjectArray \n            TSObjectPtrArray \n            TSTypePtrArray \n                TSTypefields \n            ContainerBaseArray \n            ContainerBasePtrArray \n            GenericContainerArray \n            GenericContainerPtrArray \n            GenericReferenceArray \n            GenericReferencePtrArray \n            TSStringArray \n                MostWantednames \n            TSStringPtrArray \n        Pointer \n            MostWantedPtr \n            MostWantedArrayPtr \n            MostWantedPtrArrayPtr \n            TSObjectPtr \n            TSObjectArrayPtr \n            TSObjectPtrArrayPtr \n            TSTypePtr \n                TSObjecttype \n            TSTypePtrArrayPtr \n            ContainerBasePtr \n            ContainerBaseArrayPtr \n            ContainerBasePtrArrayPtr \n            GenericContainerPtr \n            GenericContainerArrayPtr \n            GenericContainerPtrArrayPtr \n            GenericReferencePtr \n            GenericReferenceArrayPtr \n            GenericReferencePtrArrayPtr \n            TSStringPtr \n            TSStringArrayPtr \n            TSStringPtrArrayPtr \n        TSString \n            TSTypename \n            TSTypedescription \n            GenericReferenceid \n\nPrinting a description of the TSStringType object:\ntype instance\n    fields\n    name = \"TSString\"\n    description = \"text\"\n\nPrinting a description of the MostWanted object:\npersons of interest\n    names\n        text = \"Bob\"\n```\n\n## Notes\n\nMissing API for enumerating the methods of an object.\n\nDefault values are not evaluated until they are requested by calling field type class's setDefaultValue on the object instance.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimkerchmar%2Ftstype","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimkerchmar%2Ftstype","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimkerchmar%2Ftstype/lists"}