Skip to content

Commit

Permalink
rename vault to primitive
Browse files Browse the repository at this point in the history
  • Loading branch information
alec1o committed May 17, 2024
1 parent 0183b1f commit f513c69
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 35 deletions.
10 changes: 10 additions & 0 deletions src/src/interfance/IPrimitive.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Byter
{
public interface IPrimitive
{
bool IsValid { get; }
byte[] Data { get; }
IPrimitiveAdd Add { get; }
IPrimitiveGet Get { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Byter
{
public interface IVaultAdd
public interface IPrimitiveAdd
{
// 1 byte (3)
void Bool(bool value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Byter
{
public interface IVaultGet
public interface IPrimitiveGet
{
// 1 byte (3)
bool Bool();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Byter
{
internal interface IVaultPrefix
internal interface IPrimitivePrefix
{
// 1 byte (3)
byte Bool { get; }
Expand Down
10 changes: 0 additions & 10 deletions src/src/interfance/IVault.cs

This file was deleted.

20 changes: 10 additions & 10 deletions src/src/partials/Vault.cs → src/src/partials/Primitive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@

namespace Byter
{
public partial class Vault : IVault
public partial class Primitive : IPrimitive
{
private static readonly IVaultPrefix Prefix;
private static readonly IPrimitivePrefix Prefix;
private readonly List<byte> _bytes;
public bool IsValid { get; }
public byte[] Data => _bytes.ToArray();
public IVaultAdd Add { get; }
public IVaultGet Get { get; }
public IPrimitiveAdd Add { get; }
public IPrimitiveGet Get { get; }

static Vault()
static Primitive()
{
Prefix = new VaultPrefix();
Prefix = new PrimitivePrefix();
}

public Vault() : this(null)
public Primitive() : this(null)
{
}

public Vault(byte[] data)
public Primitive(byte[] data)
{
Get = new VaultGet(this);
Add = new VaultAdd(this);
Get = new PrimitiveGet(this);
Add = new PrimitiveAdd(this);

IsValid = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

namespace Byter
{
public partial class Vault
public partial class Primitive
{
private class VaultAdd : IVaultAdd
private class PrimitiveAdd : IPrimitiveAdd
{
private Vault _vault;
public VaultAdd(Vault vault)
private Primitive _primitive;
public PrimitiveAdd(Primitive primitive)
{
_vault = vault;
_primitive = primitive;
}

public void Bool(bool value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

namespace Byter
{
public partial class Vault
public partial class Primitive
{
private class VaultGet : IVaultGet
private class PrimitiveGet : IPrimitiveGet
{
private Vault _vault;
public VaultGet(Vault vault)
private Primitive _primitive;
public PrimitiveGet(Primitive primitive)
{
_vault = vault;
_primitive = primitive;
}

public bool Bool()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace Byter
{
public partial class Vault
public partial class Primitive
{
private sealed class VaultPrefix : IVaultPrefix
private sealed class PrimitivePrefix : IPrimitivePrefix
{
public byte Bool { get; } = 247;
public byte Byte { get; } = 237;
Expand Down

0 comments on commit f513c69

Please sign in to comment.