JString now streams properly.

This commit is contained in:
barant committed 2024-12-11 09:55:40 -08:00
1 parent 0baa44d076
commit 7531c885a7
5 files changed
+57 -122

No files matched your search

+16 -10
View File
@@ -3,10 +3,15 @@
namespace coreutils {
std::ostream &operator<<(std::ostream &os, const JString::Proxy &proxy) {
ZString tempkey = proxy.key;
ZString temp = proxy.jstring.find(tempkey);
os << temp;
return os;
}
JString::JString() : MString("{}") {}
// JString::JString(const char *data) : MString(data) {}
void JString::set(ZString &path, ZString &value) {
reset();
if(locate(path)) {
@@ -46,12 +51,14 @@ namespace coreutils {
reset();
if(locate(path)) {
if(ifNext("\""))
return getTokenExclude("\"");
return getTokenExclude("\"");
// TODO: Handle numbers that are not in double quotes.
if(startsWith("[")) {
std::cout << getContainer() << std::endl;
}
else if(startsWith("["))
return getContainer();
else if(startsWith("{"))
return getContainer();
}
return ZString();
}
@@ -71,11 +78,10 @@ namespace coreutils {
throw coreutils::Exception("Labels must be contained in double quotes.");
if(ifNext(":")) {
if(label == path[0]) {
if(path.getList().size() == 1)
{
if(path.getList().size() == 1) {
// std::cout << "found cursor: " << unparsed() << std::endl;
return true;
}
return true;
}
return locate(path[1]);
}
// std::cout << "+++" << unparsed() << std::endl;