9 #include "chi/Support/json.hpp" 11 #include <boost/container/flat_map.hpp> 100 void addEntry(
const char* ec,
const char* overview, nlohmann::json data);
137 explicit operator bool()
const {
return success(); }
149 std::string
dump()
const;
158 boost::container::flat_map<int, nlohmann::json> mContexts;
197 #endif // CHI_RESULT_HPP std::string dump() const
Dump to a pretty-printed error message.
void addEntry(const char *ec, const char *overview, nlohmann::json data)
Add a entry to the result, either a warning or an error.
~ScopedContext()
Destructor–does the magic of remving itsself from the result.
nlohmann::json contextJson() const
Get the JSON associated with the context that's been added.
bool mSuccess
If it's successful.
nlohmann::json result_json
The result JSON.
const int contextId
The ID for this context.
Result & result
The result object.
ScopedContext(Result &res, int ctxId)
Create a scoped context object.
ScopedContext addScopedContext(const nlohmann::json &data)
Add a context with a scope Example usage: chi::Result res; res.contextJson(); // returns {} { aut...
Result operator+(const Result &lhs, const Result &rhs)
Append two Result objects.
int addContext(const nlohmann::json &data)
Add some json that will ALWAYS be merged with entries that are added and when results are added to th...
bool success() const
Success test.
std::ostream & operator<<(std::ostream &lhs, const Result &rhs)
Stream operator.
A helper object for contexts that should be removed at the end of a scope.
Result & operator+=(Result &lhs, const Result &rhs)
Append one result to an existing one.
The namespace where chigraph lives.
bool operator!() const
!Success test
Result()
Default constructor; defaults to success.
The result object, used for identifiying errors with good diagnostics.
void removeContext(int id)
Removes a previously added context.