{"id":22455504,"url":"https://github.com/ahmedalaa14/classgenerator--bash","last_synced_at":"2026-04-20T03:32:11.154Z","repository":{"id":206540349,"uuid":"717125825","full_name":"ahmedalaa14/ClassGenerator--Bash","owner":"ahmedalaa14","description":"Bash script to create a simple C++ template class with its respective constructor, getters, and setters.","archived":false,"fork":false,"pushed_at":"2023-11-28T15:09:29.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T17:43:01.119Z","etag":null,"topics":["bash-script","cpp"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahmedalaa14.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-11-10T16:05:02.000Z","updated_at":"2024-02-16T23:46:02.000Z","dependencies_parsed_at":"2025-02-01T17:40:54.234Z","dependency_job_id":"a2c50d06-2dae-4ab5-969b-31ee6c1f6b9a","html_url":"https://github.com/ahmedalaa14/ClassGenerator--Bash","commit_stats":null,"previous_names":["ahmedalaa14/classgenerator--bash"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmedalaa14%2FClassGenerator--Bash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmedalaa14%2FClassGenerator--Bash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmedalaa14%2FClassGenerator--Bash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmedalaa14%2FClassGenerator--Bash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahmedalaa14","download_url":"https://codeload.github.com/ahmedalaa14/ClassGenerator--Bash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245850360,"owners_count":20682647,"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":["bash-script","cpp"],"created_at":"2024-12-06T07:12:03.825Z","updated_at":"2026-04-20T03:32:06.098Z","avatar_url":"https://github.com/ahmedalaa14.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":" # Class Template Generator\n\nBash script to create a simple C++ template class with its respective constructor, getters, and setters.\n\n## Usage\n\nTo use this script, you need to provide arguments to it via the CLI. \n\n### Positional arguments in order:\n* The first argument represents the class name. You don't need to provide the extension, it will be written as a .h file.\n* The next arguments will represent the type and name of the attribute, respectively. \n\n`$ ./createClass.sh \u003cclass_name\u003e \u003ctype\u003e \u003cname\u003e ...`\n\n## Example\n\nSuppose you want to create a class called Person, with an int attribute for age and a string attribute for name. You need to run the script like this:\n\n`$ ./createClass.sh Person int age string name`\n\nWhich will produce the following output in the file Person.h:\n\n    #ifndef Person_h\n    #define Person_h\n    #include \u003ciostream\u003e\n    using namespace std;\n \n    // Class definition \n    class Person {\n \n    // Private attributes \n        private: \n            int age;\n            string name;\n \n    // Public methods \n        public: \n    // Constructor \n          Person::Person(); \n    //Getters \n          int get_age(); \n          string get_name(); \n    //Setters \n          void set_age(int); \n          void set_name(string); \n    // ToString Method \n          void toString(); \n    }; \n     \n     // Constructor initializes attributes to 0 by default \n     Person::Person() {\n        age= 0; \n        name= 0;\n    }\n    \n    // Getters \n    int Person::get_age() { return age; }\n    string Person::get_name() { return name; }\n \n    //Setters \n    void Person::set_age(int new_age) { age= new_age; }\n    void Person::set_name(string new_name) { name= new_name; }\n  \n    //ToString \n    void Person::toString() {\n      cout \u003c\u003c \"age\" \u003c\u003c age \u003c\u003c endl; \n      cout \u003c\u003c \"name\" \u003c\u003c name \u003c\u003c endl; \n    }\n   \n    #endif\n    \n\nYou can have a class with as many attributes as you want, but first write its type and then its name.\n\n**NOTE: if you are using a computer with a non-UNIX environment (like Windows), you might need to do some extra leg work ro run the bash script in case you haven't installed it. Here's a StackOverflow [answer](https://stackoverflow.com/questions/6413377/is-there-a-way-to-run-bash-scripts-on-windows) that can help you.**\n\n\n## About collaborating\nFeel free to collaborate to this project if you'd like to. Any additional feature or code refactoring is welcome. Happy hacking!\n### Some ideas\n* Developing another script that creates a `main.cpp` file that instantiates the class created.\n* Modularizing the code to make it cleaner.\n* Adding a destructor to the class.\n* Change code notation to camel case.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmedalaa14%2Fclassgenerator--bash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmedalaa14%2Fclassgenerator--bash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmedalaa14%2Fclassgenerator--bash/lists"}