messing around with jstring.

This commit is contained in:
barant committed 2024-12-10 17:10:49 -08:00
1 parent c644d8346f
commit 0baa44d076
6 files changed
+148 -74

No files matched your search

+18 -27
View File
@@ -33,7 +33,7 @@ namespace coreutils {
public:
JString();
JString(const char *data);
// JString(const char *data);
void set(ZString &path, ZString &value);
@@ -44,40 +44,31 @@ namespace coreutils {
///
ZString find(ZString &path);
private:
bool locate(ZString &path);
bool notfirst;
ZString path;
class Proxy {
public:
Proxy(JString &jstring, ZString key) : jstring(jstring), key(key) {}
operator coreutils::ZString () {
return jstring.find(key);
}
Proxy& operator=(coreutils::ZString value) {
jstring.set(key, value);
return *this;
}
private:
JString &jstring;
ZString key;
};
ZString keyx;
public:
Proxy operator[](coreutils::ZString key) {
return Proxy(*this, key);
operator ZString () {
std::cout << "operator0" << std::endl;
return find(keyx);
}
JString &operator[](coreutils::ZString key) {
std::cout << "operator[" << key << "]" << std::endl;
keyx = key;
return *this;
}
// JString & operator=(coreutils:: ZString value) {
// }
JString & operator=(coreutils:: ZString value) {
std::cout << "should set key [" << keyx << "] operator=" << value << std::endl;
set(keyx, value);
return *this;
}
};