mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
feat(libSceJson2): implement sce::Json::Value::clear
This commit is contained in:
@@ -803,9 +803,9 @@ int APS5_VABI _ZN3sce4Json11Initializer10initializeEPKNS0_14InitParameter2E(void
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI _ZN3sce4Json5Value5clearEv(void) {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
void APS5_VABI _ZN3sce4Json5Value5clearEv(Value* self) {
|
||||
if (self == nullptr) return;
|
||||
Clear(NodeOf(*self));
|
||||
}
|
||||
|
||||
int APS5_VABI _ZN3sce4Json12MemAllocator11notifyErrorEimPv(void) {
|
||||
|
||||
@@ -57,6 +57,7 @@ void APS5_VABI _ZN3sce4Json5ValueC1Eb(Value*, bool);
|
||||
void APS5_VABI _ZN3sce4Json5ValueC1Ed(Value*, double);
|
||||
void APS5_VABI _ZN3sce4Json5ValueC1ERKNS0_6ObjectE(Value*, const Object*);
|
||||
void APS5_VABI _ZN3sce4Json5ValueD1Ev(Value*);
|
||||
void APS5_VABI _ZN3sce4Json5Value5clearEv(Value*);
|
||||
int APS5_VABI _ZN3sce4Json5Value3setEl(Value*, std::int64_t);
|
||||
int APS5_VABI _ZN3sce4Json5Value3setEPKc(Value*, const char*);
|
||||
std::int32_t APS5_VABI _ZNK3sce4Json5Value7getTypeEv(const Value*);
|
||||
@@ -351,10 +352,48 @@ static void ValueAccess() {
|
||||
Require(_ZN3sce4Json11InitializerD1Ev(initializer) == 0);
|
||||
}
|
||||
|
||||
static void ValueClear() {
|
||||
Value value{};
|
||||
_ZN3sce4Json5ValueC1Ev(&value);
|
||||
Require(_ZNK3sce4Json5Value7getTypeEv(&value) == TypeNull);
|
||||
_ZN3sce4Json5Value5clearEv(&value);
|
||||
Require(_ZNK3sce4Json5Value7getTypeEv(&value) == TypeNull);
|
||||
|
||||
Require(_ZN3sce4Json5Value3setEl(&value, 12345) == 0);
|
||||
Require(_ZNK3sce4Json5Value7getTypeEv(&value) == TypeInteger);
|
||||
_ZN3sce4Json5Value5clearEv(&value);
|
||||
Require(_ZNK3sce4Json5Value7getTypeEv(&value) == TypeNull);
|
||||
|
||||
Require(_ZN3sce4Json5Value3setEPKc(&value, "test string") == 0);
|
||||
Require(_ZNK3sce4Json5Value7getTypeEv(&value) == TypeString);
|
||||
_ZN3sce4Json5Value5clearEv(&value);
|
||||
Require(_ZNK3sce4Json5Value7getTypeEv(&value) == TypeNull);
|
||||
|
||||
Object obj{};
|
||||
_ZN3sce4Json6ObjectC1Ev(&obj);
|
||||
String key{};
|
||||
_ZN3sce4Json6StringC1EPKc(&key, "prop");
|
||||
Value* item = _ZN3sce4Json6ObjectixERKNS0_6StringE(&obj, &key);
|
||||
_ZN3sce4Json5Value3setEl(item, 999);
|
||||
_ZN3sce4Json5ValueC1ERKNS0_6ObjectE(&value, &obj);
|
||||
Require(_ZNK3sce4Json5Value7getTypeEv(&value) == TypeObject);
|
||||
_ZN3sce4Json5Value5clearEv(&value);
|
||||
Require(_ZNK3sce4Json5Value7getTypeEv(&value) == TypeNull);
|
||||
_ZN3sce4Json6StringD1Ev(&key);
|
||||
_ZN3sce4Json6ObjectD1Ev(&obj);
|
||||
|
||||
Require(_ZN3sce4Json5Value3setEl(&value, 777) == 0);
|
||||
Require(_ZNK3sce4Json5Value7getTypeEv(&value) == TypeInteger);
|
||||
Require(*_ZNK3sce4Json5Value10getIntegerEv(&value) == 777);
|
||||
|
||||
_ZN3sce4Json5ValueD1Ev(&value);
|
||||
}
|
||||
|
||||
int main() {
|
||||
ParseAndRoundTrip();
|
||||
NestingDepth();
|
||||
ObjectsAndArrays();
|
||||
NullAccess();
|
||||
ValueAccess();
|
||||
ValueClear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user