API.Util.Data - JuDelCo/Core GitHub Wiki

Namespace: Ju.Data

JNode : IDisposable, IEnumerable< JNode >

JNode Parent;
IEnumerable<JNode> Children;
string Path;

void Reset();
void Subscribe(ILinkHandler handle, Action<JNode, JNodeEvent> action);
int GetSubscriberCount();
void Detach();
JNode Clone();
bool IsDisposed();
string ToString();
string ToString(int maxDepth);

bool IsDict();
bool IsList();
bool IsData();
bool IsRef();
JDict AsDict();
JList AsList();
JData<T> AsData<T>();
JRef AsRef();
Type GetDataType();
object GetRawData();
void SetRawData(object rawData);
IEnumerable<JNode> Select(Func<JNode, bool> predicate, int maxDepth = -1);
void Merge(JNode data, bool clearLists = true);

JData<T> AsDataEnum<T>() where T : Enum;
JData<bool> AsDataBool();
JData<byte> AsDataByte();
JData<sbyte> AsDataSByte();
JData<char> AsDataChar();
JData<float> AsDataSingle();
JData<float> AsDataFloat();
JData<double> AsDataDouble();
JData<double> AsDataFloat64();
JData<decimal> AsDataDecimal();
JData<decimal> AsDataFloat128();
JData<short> AsDataShort();
JData<short> AsDataInt16();
JData<int> AsDataInt();
JData<int> AsDataInt32();
JData<long> AsDataLong();
JData<long> AsDataInt64();
JData<ushort> AsDataUShort();
JData<ushort> AsDataUInt16();
JData<uint> AsDataUInt();
JData<uint> AsDataUInt32();
JData<ulong> AsDataULong();
JData<ulong> AsDataUInt64();
JData<string> AsDataString();
JData<DateTime> AsDataDateTime();
JData<Guid> AsDataGuid();
JData<Color> AsDataColor();
JData<Color32> AsDataColor32();

string ToHjson(int maxDepth = -1);
string ToJson(int maxDepth);
string ToJson(bool compact = false, int maxDepth = -1);
void UpdateFromHjson(string hjson, bool clearLists = true);
void UpdateFromJson(string json, bool clearLists = true);

JDict : JNode, IDictionary< string, JNode >

JDict();
JDict(bool reseteable, bool subscribeToChildren = true);
JDict(bool reseteable, int capacity, bool subscribeToChildren = true);

bool IsReseteable();
bool IsSubscribingToChildren();
void Add<T>(string key, T value);
void Add<T>(string key, T value, T defaultValue);
void Add(IEnumerable<KeyValuePair<string, JNode>> kvps);
string GetKey(JNode node);
bool ContainsKey(string key);
IJDict AsEnumerableDict();
void Move(string oldKey, string newKey);
void Swap(string firstKey, string secondKey);
void Remove(JNode node);
void Clear(bool triggerOnlyOnce = true);
string ToString();
string ToString(int maxDepth);

// Useful when defining your own struct based on JDict
protected T GetDict<T>(string key) where T : JDict, new();
protected JDict GetDict(string key, bool reseteable = false, int capacity = 0, bool subscribeToChildren = true);
protected JDict GetDict(string key, int capacity = 0);
protected JList GetList(string key, bool reseteable = true, int capacity = 0, bool subscribeToChildren = true) where T : JNode;
protected JList GetList(string key, int capacity = 0) where T : JNode;

protected JList<T> GetList<T>(string key, bool reseteable = true, int capacity = 0, bool subscribeToChildren = true);
protected JList<T> GetList<T>(string key, int capacity = 0);

protected JData<T> GetData<T>(string key, T defaultValue = default(T)) where T : struct;
protected JData<T> GetData<T>(string key, T defaultValue, T value = default(T)) where T : struct;
protected JData<T> GetDataClass<T>(string key, Func<T> defaultValueFactory = null) where T : class;
protected JData<T> GetDataClass<T>(string key, Func<T> defaultValueFactory, Func<T> valueFactory = null) where T : class;
protected JData<string> GetDataString(string key);
protected JData<bool> GetDataBool(string key);
protected JData<byte> GetDataByte(string key);
protected JData<sbyte> GetDataSByte(string key);
protected JData<char> GetDataChar(string key);
protected JData<float> GetDataSingle(string key);
protected JData<float> GetDataFloat(string key);
protected JData<double> GetDataDouble(string key);
protected JData<double> GetDataFloat64(string key);
protected JData<decimal> GetDataDecimal(string key);
protected JData<decimal> GetDataFloat128(string key);
protected JData<short> GetDataShort(string key);
protected JData<short> GetDataInt16(string key);
protected JData<int> GetDataInt(string key);
protected JData<int> GetDataInt32(string key);
protected JData<long> GetDataLong(string key);
protected JData<long> GetDataInt64(string key);
protected JData<ushort> GetDataUShort(string key);
protected JData<ushort> GetDataUInt16(string key);
protected JData<uint> GetDataUInt(string key);
protected JData<uint> GetDataUInt32(string key);
protected JData<ulong> GetDataULong(string key);
protected JData<ulong> GetDataUInt64(string key);
protected JData<DateTime> GetDataDateTime(string key);
protected JData<Guid> GetDataGuid(string key);
protected JData<Color> GetDataColor(string key);
protected JData<Color32> GetDataColor32(string key);

JList : JNode, IList< JNode >

JList();
JList(bool reseteable, bool subscribeToChildren = true);
JList(bool reseteable, int capacity, bool subscribeToChildren = true);

bool IsReseteable();
bool IsSubscribingToChildren();
void Add<T>(T value);
void Add<T>(T value, T defaultValue);
void Add<T>(IEnumerable<T> values);
void Add<T>(IEnumerable<T> values, T defaultValue);
void Add(IEnumerable<JNode> nodes);
void Insert<T>(int index, T value);
void Insert<T>(int index, T value, T defaultValue);
bool Contains<T>(T value);
int IndexOf<T>(T value);
void Move(int oldIndex, int newIndex);
void Swap(int firstIndex, int secondIndex);
bool Remove<T>(T value);
void Clear(bool triggerOnlyOnce = true);
void TrimExcess();
string ToString();
string ToString(int maxDepth);

JList< T > : JList, IList< T > where T : JNode

JList();
JList(bool reseteable, bool subscribeToChildren = true);
JList(bool reseteable, int capacity, bool subscribeToChildren = true);

T this[int index];
void Add(T node);
void Add(IEnumerable<T> nodes);
void Insert(int index, T node);
bool Contains(T node);
void CopyTo(T[] array, int arrayIndex);
IEnumerator<T> GetEnumerator();
int IndexOf(T node);
bool Remove(T node);

JData< T > : JNode

JData(T value = default(T));
JData(T value, T defaultValue = default(T));

T DefaultValue;
T Value;
T ValueSilent;

void Subscribe(ILinkHandler handle, Action<JData<T>> action);
Type GetDataType();
object GetRawData();
void SetRawData(object data);
string ToString();
string ToString(int maxDepth);

Action<T> Bind<T>(ILinkHandler handle, Action<JData<T>> action);
Action<TRemote> Bind<T, TRemote>(ILinkHandler handle, Action<JData<T>> action, Func<TRemote, T> converter);

// Extension methods for JData<string> only
T AsEnum<T>(T defaultValue = default(T)) where T : struct, Enum;
bool AsBool(bool defaultValue = default(bool));
byte AsByte(byte defaultValue = default(byte));
sbyte AsSByte(sbyte defaultValue = default(sbyte));
char AsChar(char defaultValue = default(char));
float AsSingle(float defaultValue = default(float));
float AsFloat(float defaultValue = default(float));
double AsDouble(double defaultValue = default(double));
double AsFloat64(double defaultValue = default(double));
decimal AsDecimal(decimal defaultValue = default(decimal));
decimal AsFloat128(decimal defaultValue = default(decimal));
short AsShort(short defaultValue = default(short));
short AsInt16(short defaultValue = default(short));
int AsInt(int defaultValue = default(int));
int AsInt32(int defaultValue = default(int));
long AsLong(long defaultValue = default(long));
long AsInt64(long defaultValue = default(long));
ushort AsUShort(ushort defaultValue = default(ushort));
ushort AsUInt16(ushort defaultValue = default(ushort));
uint AsUInt(uint defaultValue = default(uint));
uint AsUInt32(uint defaultValue = default(uint));
ulong AsULong(ulong defaultValue = default(ulong));
ulong AsUInt64(ulong defaultValue = default(ulong));
DateTime AsDateTimeFromUnixTimeStamp(DateTime defaultValue = default(DateTime));
Guid AsGuid(Guid defaultValue = default(Guid));
Color AsColor(Color defaultValue = default(Color));
Color32 AsColor32(Color32 defaultValue = default(Color32));
void Set<T>(T value) where T : Enum;
void Set(bool value);
void Set(byte value);
void Set(sbyte value);
void Set(char value);
void Set(float value);
void Set(double value);
void Set(decimal value);
void Set(short value);
void Set(int value);
void Set(long value);
void Set(ushort value);
void Set(uint value);
void Set(ulong value;

JRef : JNode

JRef(JNode reference = null, bool subscribeToRef = false);

JNode Reference;

string ToString();
string ToString(int maxDepth);

JNodeHjson (static class)

JNode Parse(string hjson);
JNode Parse(JsonValue data);

JNodeJson (static class)

JNode Parse(string json);
JNode Parse(JsonValue data);
⚠️ **GitHub.com Fallback** ⚠️