Working flat JString sorta
This commit is contained in:
1 parent
7b333a3984
commit
74ab316e64
7 files changed
+65
-95
No files matched your search
+6
-31
@@ -7,7 +7,7 @@ namespace coreutils {
|
||||
|
||||
JString::JString(const char *data) : MString(data) {}
|
||||
|
||||
void JString::set(ZString path, const char *value) {
|
||||
void JString::set(ZString &path, ZString &value) {
|
||||
reset();
|
||||
if(locate(path)) {
|
||||
push();
|
||||
@@ -32,46 +32,21 @@ namespace coreutils {
|
||||
}
|
||||
}
|
||||
|
||||
ZString JString::find(ZString path) {
|
||||
ZString JString::find(ZString &path) {
|
||||
reset();
|
||||
if(locate(path)) {
|
||||
if(ifNext("\""))
|
||||
return getTokenExclude("\"");
|
||||
// TODO: Handle numbers that are not in double quotes.
|
||||
|
||||
if(startsWith("[")) {
|
||||
ZString temp = getContainer();
|
||||
std::cout << temp << std::endl;
|
||||
std::cout << getContainer() << std::endl;
|
||||
}
|
||||
}
|
||||
return ZString();
|
||||
}
|
||||
|
||||
void JString::operator=(ZString &value) {
|
||||
std::cout << "operator=(ZString &)" << value << "\n";
|
||||
}
|
||||
|
||||
JString& JString::operator=(const char *value) {
|
||||
std::cout << "operator=" << value << "\n";
|
||||
set(path, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ZString JString::operator[](const char *path) {
|
||||
// std::cout << "operator[" << path << "]\n";
|
||||
// this->path = path;
|
||||
// reset();
|
||||
// return find(path);
|
||||
// }
|
||||
|
||||
JString& JString::operator[](const char *path) {
|
||||
std::cout << "operator[" << path << "]\n";
|
||||
reset();
|
||||
this->path = path;
|
||||
find(path);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool JString::locate(ZString path) {
|
||||
bool JString::locate(ZString &path) {
|
||||
path.split(".", 1);
|
||||
notfirst = false;
|
||||
if(ifNext("{")) {
|
||||
@@ -122,5 +97,5 @@ namespace coreutils {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user