Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/louisdevie/multiflag
Flag/Bitflag helper
https://github.com/louisdevie/multiflag
Last synced: 21 days ago
JSON representation
Flag/Bitflag helper
- Host: GitHub
- URL: https://github.com/louisdevie/multiflag
- Owner: louisdevie
- License: mit
- Created: 2023-10-01T07:58:45.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-01T17:32:27.000Z (10 months ago)
- Last Synced: 2024-11-09T04:47:57.110Z (about 2 months ago)
- Language: C#
- Size: 90.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Multiflag
Multiflag is a tiny language-agnostic library that makes manipulating bitflags (or any other kind of flag system) easier,
especially if you have flags that depend on each other (for example, if you're managing permissions).- [Multiflag .NET](dotnet/README.md) [![Nuget Package](https://img.shields.io/nuget/v/Multiflag)](https://www.nuget.org/packages/Multiflag)
- [Multiflag JavaScript/TypeScript](node/README.md) [![npm](https://img.shields.io/npm/v/multiflag)](https://https://www.npmjs.com/package/multiflag)## How it works
Multiflag work with two types : flags and flag sets.
A flag set can be any value that can represent a group of boolean properties (integers as bitflags, a list of the enabled flags, ...).
A flag is one of these properties, and can be dependant on other flags. When a flag is added, all of its parent are too. All its parents are also required
for the flag to be considered included in the set. And when it is removed, all of its child flags are removed with it.
There is actually a third type coming into play: the "value adapter". Its job is to bridge the gap between a flag and the value it is based on
by providing the relevant operation on said type.Two kind of flags are supported out of the box : a bitflag implementation for integers and enums, and a list-based (or rather, set-based) implementation, which covers most of the common needs.
But Multiflag is extensible, you can implement an adapter for any custom type of flag representation you want.## Why ?
This library was developed to provide the [Gallium+](https://github.com/galliumplus) server and clients with a reliable way to manage permissions. The primary goal
is thus to support C# and Typescipt, but support for other languages (I'm thinking Python, Go, Rust) may come later.## Licensing
Multiglag is available under the [MIT License](LICENSE). ⓒ 2023 Louis DEVIE.