Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions src/xserial/attribute.d
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module xserial.attribute;
module xserial.attribute;

import std.system : Endian;
import std.traits : isIntegral;
Expand All @@ -14,19 +14,35 @@ enum Exclude;

/**
* Includes this even if it would otherwise be excluded.
* If Exclude (or other UDA(@)) and Include are present value will be included.
* If Exclude (or other UDA(@)) and Include are present the last one is used, except when excluded with `@EncodeOnly` or `@DecodeOnly`.
* Can also be used on @property methods to include them. (Be sure both the setter and getter exist!)
* If used on a value of a base class value will be included.
*/
enum Include;
enum Include;

/**
* Used for advanced addedUDAs
*/
template Excluder(alias UDA_) {
alias UDA = UDA_;
}

/**
* Used for advanced addedUDAs
*/
template Includer(alias UDA_) {
alias UDA = UDA_;
}

/**
* Excludes the field from decoding, encode only.
* Field with be excluded in decoding regardles of any other UDA.
*/
enum EncodeOnly;

/**
* Excludes the field from encoding, decode only.
* Field with be excluded in encoding regardles of any other UDA.
*/
enum DecodeOnly;

Expand Down Expand Up @@ -73,3 +89,5 @@ unittest { // for code coverage
EndianLength!uint(Endian.bigEndian);

}


Loading