{"id":23436341,"url":"https://github.com/gammasoft71/properties","last_synced_at":"2025-09-05T16:32:50.269Z","repository":{"id":111159316,"uuid":"144401827","full_name":"gammasoft71/properties","owner":"gammasoft71","description":"another c#-like property accessor for C++11 and above.","archived":false,"fork":false,"pushed_at":"2024-11-09T10:08:50.000Z","size":1318,"stargazers_count":20,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-26T21:11:21.254Z","etag":null,"topics":["cpp","cpp-library","cpp11","cpp14","cpp17","multi-platform","properties","property","property-accessors"],"latest_commit_sha":null,"homepage":"https://gammasoft71.wixsite.com/properties","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/gammasoft71.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,"publiccode":null,"codemeta":null}},"created_at":"2018-08-11T16:39:07.000Z","updated_at":"2024-11-09T10:08:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"d9b2d4c1-c2e4-4a2a-aad3-c49bb1b0c07b","html_url":"https://github.com/gammasoft71/properties","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gammasoft71%2Fproperties","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gammasoft71%2Fproperties/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gammasoft71%2Fproperties/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gammasoft71%2Fproperties/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gammasoft71","download_url":"https://codeload.github.com/gammasoft71/properties/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248661722,"owners_count":21141451,"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":["cpp","cpp-library","cpp11","cpp14","cpp17","multi-platform","properties","property","property-accessors"],"created_at":"2024-12-23T13:18:48.509Z","updated_at":"2025-04-13T04:12:53.882Z","avatar_url":"https://github.com/gammasoft71.png","language":"C++","readme":"# properties\n\n**another c#-like property accessor for C++11 and above.**\n\n[![properties](docs/pictures/properties_header.png)](https://gammasoft71.wixsite.com/properties)\n\n## Continuous Integration build status\n\n| Operating system | Status                                                                                                                                               |\n|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Windows          | [![Build status](https://ci.appveyor.com/api/projects/status/r3w9ojjiecp4vf8f?svg=true)](https://ci.appveyor.com/project/gammasoft71/xtd-properties) |\n| macOS            | [![Build Status](https://travis-ci.org/gammasoft71/xtd_properties.svg?branch=master)](https://travis-ci.org/gammasoft71/xtd_properties)              |\n| Linux            | [![Build Status](https://travis-ci.org/gammasoft71/xtd_properties.svg?branch=master)](https://travis-ci.org/gammasoft71/xtd_properties)              |\n\n## Download the latest stable tunit version\n\n[![Download properties](https://img.shields.io/sourceforge/dt/properties.svg)](https://sourceforge.net/projects/properties/files/latest/download)\n\n## Features\n\n* **properties** add c#-like property accessor to your c++ class.\n* **properties** is distributed as a single header file.\n\n## What is it ?\n\nA property is a member that provides a flexible mechanism to read, write, or compute the value of a private field. Properties can be used as if they are public data members, but they are actually special methods called accessors. This enables data to be accessed easily and still helps promote the safety and flexibility of methods.\n\n### For more information see\n* [website](https://gammasoft71.wixsite.com/properties) \n* [markdown documentations](docs/home.md)\n* [sources](https://github.com/gammasoft71/properties)\n* [Reference Guide](https://codedocs.xyz/gammasoft71/properties/)\n* [Try it online](https://wandbox.org/permlink/yJY2t1qX5wV9FAcl)\n\n## There are three types of properties :\n\n### readwrite :\n\nThe property accessor can be read and write.\n\n```c++\nclass Foo {\npublic:\n  //...\n  \n  property_\u003cint\u003e Number {\n    get_ {return this-\u003enumber;},\n    set_ {this-\u003enumber = value;}\n  };\n  \n  //...\n  \nprivate:\n  int number = 0;\n};\n```\n\n### readonly :\n\nThe property accessor can be read only.\n\n```c++\nclass Foo {\npublic:\n  //...\n  \n  property_\u003cint, readonly_\u003e Number {\n    get_ {return this-\u003enumber;}\n  };\n  \n  //...\n  \nprivate:\n  int number = 0;\n};\n```\n\n### writeonly :\n\nThe property accessor can be write only.\n\n```c++\nclass Foo {\npublic:\n  //...\n  \n  property_\u003cint, writeonly_\u003e Number {\n    set_ {this-\u003enumber = value;}\n  };\n  \n  //...\n  \nprivate:\n  int number = 0;\n};\n```\n\n## Read and write properties full example\n\nperson.cpp:\n\n```c++\n#include \u003cxtd/properties\u003e\n#include \u003ciostream\u003e\n#include \u003cstring\u003e\n\nclass person {\npublic:\n  person() noexcept = default;\n  person(person \u0026\u0026) noexcept = default;\n\n  // Must be specified because the copy contructor of property class is deleted.\n  // The implicit or default copy constructor is not sufficient.\n  person(const person\u0026 other) noexcept : name_(other.name_), age_(other.age_) {}\n\n  person\u0026 operator=(person\u0026\u0026) noexcept = default;\n  person\u0026 operator=(const person\u0026) noexcept = default;\n  \n  // Declare a name property of type std::string:\n  property_\u003cstd::string\u003e name {\n    get_ {return name_;},\n    set_ {name_ = value;}\n  };\n  \n  // Declare an age property of type int:\n  property_\u003cint\u003e age {\n    get_ {return age_;},\n    set_ {age_ = value;}\n  };\n  \n  friend std::ostream\u0026 operator\u003c\u003c(std::ostream\u0026 os, const person\u0026 value) {return os \u003c\u003c \"[name = \" \u003c\u003c value.name \u003c\u003c \", age = \" \u003c\u003c value.age \u003c\u003c \"]\";}\n   \nprivate:\n  std::string name_ = \"N/A\";\n  int age_ = 0;\n};\n\nint main(int argc, char* argv[]) {\n  std::cout \u003c\u003c \"Simple Properties\" \u003c\u003c std::endl;\n    \n  // Create a new person object:\n  person p;\n  \n  // Print out the name and the age associated with the pers:\n  std::cout \u003c\u003c \"person details - \" \u003c\u003c p \u003c\u003c std::endl;\n\n  // Set some values on the pers object:\n  p.name = \"Joe\";\n  p.age = 99;\n  std::cout \u003c\u003c \"person details - \" \u003c\u003c p \u003c\u003c std::endl;\n\n  // Increment the age property:\n  p.age += 1;\n  std::cout \u003c\u003c \"person details - \" \u003c\u003c p \u003c\u003c std::endl;\n}\n```\n\nConsole output:\n\n```\nSimple Properties\nperson details - [name = N/A, age = 0]\nperson details - [name = Joe, age = 99]\nperson details - [name = Joe, age = 100]\n```\n\n## Getting Started\n\n* [Installation](docs/downloads.md) provides download and install documentation.\n* [Portability](docs/portability.md) provides information about C++, libraries dependency, Operating System suported, Compilators and Devepment Environment tools.\n* [Examples](docs/examples.md) provides some examples.\n\n______________________________________________________________________________________________\n\n© 2021 Gammasoft.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgammasoft71%2Fproperties","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgammasoft71%2Fproperties","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgammasoft71%2Fproperties/lists"}