SLRegistryKey.sleela
lib/registry/SLRegistryKey.sleela · 116 line(s) · sleela
<< lib/registry/SLRegistryKey.sleela
SLeeLa Standard Library Definition.
Definition: Defines SLRegistryKey — the OOD equivalent of a native registry
key (a node in the HKEY-style path tree). A key is named by its full path
("A/B/C"), holds a bounded set of SLRegistryValue entries (settings and
feature flags), and may carry one SLRegistryProvenance record. The surface
has no arrays, so the value set is numbered fields (the SLVM binding-table
convention).
Mirrors: the native RegKey (path + values + optional provenance).
Family: registry. Composes SLRegistryValue, SLRegistryProvenance; held by
SLRegistry. >>
#sleela 3.0
material;
class SLRegistryKey {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
or catalog can read and (where appropriate) override this record.
Values are faithful to the subject's real origin where publicly known. >>
String metaVersion = "1.0.0";
int metaId = 11096;
String metaAuthor = "Kiro Agent";
String metaDate = "2026-10-16";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | International | Galactic >
String metaOrigin = "International";
String metaBirthDate = "2026-10-14";
< metaScienceRating: maturity/robustness on a 1..10 scale >
int metaScienceRating = 9;
< metaNationalSchedule: a real, citable instrument or "none" >
String metaNationalSchedule = "none";
String getMetaVersion() { return metaVersion; }
void setMetaVersion(String v) { metaVersion = v; }
int getMetaId() { return metaId; }
void setMetaId(int v) { metaId = v; }
String getAuthor() { return metaAuthor; }
void setAuthor(String v) { metaAuthor = v; }
String getDate() { return metaDate; }
void setDate(String v) { metaDate = v; }
String getCopyright() { return metaCopyright; }
void setCopyright(String v) { metaCopyright = v; }
String getTrademark() { return metaTrademark; }
void setTrademark(String v) { metaTrademark = v; }
String getCorporation() { return metaCorporation; }
void setCorporation(String v) { metaCorporation = v; }
String getOrigin() { return metaOrigin; }
void setOrigin(String v) { metaOrigin = v; }
String getBirthDate() { return metaBirthDate; }
void setBirthDate(String v) { metaBirthDate = v; }
int getScienceRating() { return metaScienceRating; }
void setScienceRating(int v) { metaScienceRating = v; }
String getNationalSchedule() { return metaNationalSchedule; }
void setNationalSchedule(String v) { metaNationalSchedule = v; }
< Eight object references remain as the legacy display window. >
< A growable string list indexes all names for native record resolution. >
static final int LEGACY_OBJECT_WINDOW = 8;
< full key path, e.g. "Settings" >
String path;
< live values >
int count;
SLList valueNames;
SLRegistryValue v0; SLRegistryValue v1; SLRegistryValue v2; SLRegistryValue v3;
SLRegistryValue v4; SLRegistryValue v5; SLRegistryValue v6; SLRegistryValue v7;
int hasProvenance;
SLRegistryProvenance provenance;
void configure(String keyPath) {
path = keyPath;
count = 0;
valueNames = new SLList();
hasProvenance = 0;
}
< append a value (numbered-field store in place of an array) >
boolean add(SLRegistryValue val) {
if (val == null) { return false; }
valueNames.add(val.name);
if (count == 0) { v0 = val; } else if (count == 1) { v1 = val; }
else if (count == 2) { v2 = val; } else if (count == 3) { v3 = val; }
else if (count == 4) { v4 = val; } else if (count == 5) { v5 = val; }
else if (count == 6) { v6 = val; } else if (count == 7) { v7 = val; }
count = count + 1;
return true;
}
String valueNameAt(int idx) { return valueNames.get(idx); }
SLRegistryValue valueAt(int idx) {
if (idx < 0 || idx >= count || idx >= LEGACY_OBJECT_WINDOW) { return null; }
if (idx == 0) { return v0; } if (idx == 1) { return v1; }
if (idx == 2) { return v2; } if (idx == 3) { return v3; }
if (idx == 4) { return v4; } if (idx == 5) { return v5; }
if (idx == 6) { return v6; } return v7;
}
void attachProvenance(SLRegistryProvenance p) { provenance = p; hasProvenance = 1; }
boolean tracked() { return hasProvenance == 1; }
void show() {
print("[" + (path == "" ? "(root)" : path) + "]");
int i = 0;
while (i < count) {
SLRegistryValue vv = valueAt(i);
if (vv != null) { print(" " + vv.render()); }
else { print(" " + valueNameAt(i) + " (native record-backed value)"); }
i = i + 1;
}
if (hasProvenance == 1) { print(" " + provenance.render()); }
}
}