Validatable

- Added new interface
This commit is contained in:
Tristan B. Velloza Kildaire 2023-11-20 19:56:15 +02:00
parent 09a4907044
commit 4002854c50
1 changed files with 31 additions and 0 deletions

View File

@ -35,6 +35,30 @@ public enum Status
NOT_USER
}
/**
* Support for message validation
* to ensure that it is valid given
* some of its parameters
*/
public interface Validatable
{
/**
* Validates the item returning whether
* this process failed or not
*
* In the case of a failure the ref-based
* argument is updated with the reason
* of failure
*
* Params:
* reason = the reason of failure (if
* any)
* Returns: `true` if the validation
* passes, `false` otherwise
*/
public bool validate(ref string reason);
}
public abstract class Command
{
private byte[] data;
@ -94,6 +118,13 @@ public enum CommandType
SPACER,
NOP_COMMAND,
/**
* Error
*
*
*/
ERROR,
/**
* Unknown command
*