mirror of
https://github.com/geode-sdk/geode.git
synced 2025-02-18 09:10:17 -05:00
move GEODE_DLL to the structs themselves in JsonValidation
This commit is contained in:
parent
92e9ce09e8
commit
06bc6fda91
1 changed files with 29 additions and 29 deletions
|
@ -77,7 +77,7 @@ namespace geode {
|
||||||
struct JsonMaybeObject;
|
struct JsonMaybeObject;
|
||||||
struct JsonMaybeValue;
|
struct JsonMaybeValue;
|
||||||
|
|
||||||
struct JsonMaybeSomething {
|
struct GEODE_DLL JsonMaybeSomething {
|
||||||
protected:
|
protected:
|
||||||
JsonChecker& m_checker;
|
JsonChecker& m_checker;
|
||||||
json::Value& m_json;
|
json::Value& m_json;
|
||||||
|
@ -87,29 +87,29 @@ namespace geode {
|
||||||
friend struct JsonMaybeObject;
|
friend struct JsonMaybeObject;
|
||||||
friend struct JsonMaybeValue;
|
friend struct JsonMaybeValue;
|
||||||
|
|
||||||
GEODE_DLL void setError(std::string const& error);
|
void setError(std::string const& error);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GEODE_DLL json::Value& json();
|
json::Value& json();
|
||||||
|
|
||||||
GEODE_DLL JsonMaybeSomething(
|
JsonMaybeSomething(
|
||||||
JsonChecker& checker, json::Value& json, std::string const& hierarchy, bool hasValue
|
JsonChecker& checker, json::Value& json, std::string const& hierarchy, bool hasValue
|
||||||
);
|
);
|
||||||
|
|
||||||
GEODE_DLL bool isError() const;
|
bool isError() const;
|
||||||
GEODE_DLL std::string getError() const;
|
std::string getError() const;
|
||||||
|
|
||||||
GEODE_DLL operator bool() const;
|
operator bool() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct JsonMaybeValue : public JsonMaybeSomething {
|
struct GEODE_DLL JsonMaybeValue : public JsonMaybeSomething {
|
||||||
bool m_inferType = true;
|
bool m_inferType = true;
|
||||||
|
|
||||||
GEODE_DLL JsonMaybeValue(
|
JsonMaybeValue(
|
||||||
JsonChecker& checker, json::Value& json, std::string const& hierarchy, bool hasValue
|
JsonChecker& checker, json::Value& json, std::string const& hierarchy, bool hasValue
|
||||||
);
|
);
|
||||||
|
|
||||||
GEODE_DLL JsonMaybeSomething& self();
|
JsonMaybeSomething& self();
|
||||||
|
|
||||||
template <json::Type T>
|
template <json::Type T>
|
||||||
JsonMaybeValue& as() {
|
JsonMaybeValue& as() {
|
||||||
|
@ -124,7 +124,7 @@ namespace geode {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
GEODE_DLL JsonMaybeValue& array();
|
JsonMaybeValue& array();
|
||||||
|
|
||||||
template <json::Type... T>
|
template <json::Type... T>
|
||||||
JsonMaybeValue& asOneOf() {
|
JsonMaybeValue& asOneOf() {
|
||||||
|
@ -231,7 +231,7 @@ namespace geode {
|
||||||
return T();
|
return T();
|
||||||
}
|
}
|
||||||
|
|
||||||
GEODE_DLL JsonMaybeObject obj();
|
JsonMaybeObject obj();
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct Iterator {
|
struct Iterator {
|
||||||
|
@ -257,46 +257,46 @@ namespace geode {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
GEODE_DLL JsonMaybeValue at(size_t i);
|
JsonMaybeValue at(size_t i);
|
||||||
|
|
||||||
GEODE_DLL Iterator<JsonMaybeValue> iterate();
|
Iterator<JsonMaybeValue> iterate();
|
||||||
|
|
||||||
GEODE_DLL Iterator<std::pair<std::string, JsonMaybeValue>> items();
|
Iterator<std::pair<std::string, JsonMaybeValue>> items();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct JsonMaybeObject : JsonMaybeSomething {
|
struct GEODE_DLL JsonMaybeObject : JsonMaybeSomething {
|
||||||
std::set<std::string> m_knownKeys;
|
std::set<std::string> m_knownKeys;
|
||||||
|
|
||||||
GEODE_DLL JsonMaybeObject(
|
JsonMaybeObject(
|
||||||
JsonChecker& checker, json::Value& json, std::string const& hierarchy, bool hasValue
|
JsonChecker& checker, json::Value& json, std::string const& hierarchy, bool hasValue
|
||||||
);
|
);
|
||||||
|
|
||||||
GEODE_DLL JsonMaybeSomething& self();
|
JsonMaybeSomething& self();
|
||||||
|
|
||||||
GEODE_DLL void addKnownKey(std::string const& key);
|
void addKnownKey(std::string const& key);
|
||||||
|
|
||||||
GEODE_DLL json::Value& json();
|
json::Value& json();
|
||||||
|
|
||||||
GEODE_DLL JsonMaybeValue emptyValue();
|
JsonMaybeValue emptyValue();
|
||||||
|
|
||||||
GEODE_DLL JsonMaybeValue has(std::string const& key);
|
JsonMaybeValue has(std::string const& key);
|
||||||
|
|
||||||
GEODE_DLL JsonMaybeValue needs(std::string const& key);
|
JsonMaybeValue needs(std::string const& key);
|
||||||
|
|
||||||
GEODE_DLL void checkUnknownKeys();
|
void checkUnknownKeys();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct JsonChecker {
|
struct GEODE_DLL JsonChecker {
|
||||||
std::variant<std::monostate, std::string> m_result;
|
std::variant<std::monostate, std::string> m_result;
|
||||||
json::Value& m_json;
|
json::Value& m_json;
|
||||||
|
|
||||||
GEODE_DLL JsonChecker(json::Value& json);
|
JsonChecker(json::Value& json);
|
||||||
|
|
||||||
GEODE_DLL bool isError() const;
|
bool isError() const;
|
||||||
|
|
||||||
GEODE_DLL std::string getError() const;
|
std::string getError() const;
|
||||||
|
|
||||||
GEODE_DLL JsonMaybeValue root(std::string const& hierarchy);
|
JsonMaybeValue root(std::string const& hierarchy);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue