1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 18:05:07 +00:00

AK: Add out() and warn() streams that forward to stdout and stderr

Our C++ code generator tools have been relying on host-side dbg() being
forwarded to stdout until now. Now they use out() instead.

Hopefully this will make it easier and more enticing to use streams in
userspace programs as well. :^)
This commit is contained in:
Andreas Kling 2020-04-06 10:12:10 +02:00
parent 63b11e094d
commit 0d48fb9a87
6 changed files with 219 additions and 176 deletions

View file

@ -58,21 +58,21 @@ int main(int argc, char** argv)
auto json = JsonValue::from_string(file->read_all());
ASSERT(json.is_object());
dbg() << "#pragma once";
dbg() << "#include <AK/StringView.h>";
dbg() << "#include <AK/Traits.h>";
out() << "#pragma once";
out() << "#include <AK/StringView.h>";
out() << "#include <AK/Traits.h>";
dbg() << "namespace Web {";
dbg() << "namespace CSS {";
dbg() << "enum class PropertyID {";
dbg() << " Invalid,";
out() << "namespace Web {";
out() << "namespace CSS {";
out() << "enum class PropertyID {";
out() << " Invalid,";
json.as_object().for_each_member([&](auto& name, auto& value) {
ASSERT(value.is_object());
dbg() << " " << title_casify(name) << ",";
out() << " " << title_casify(name) << ",";
});
dbg() << "};\n\
out() << "};\n\
PropertyID property_id_from_string(const StringView&);\n\
const char* string_from_property_id(PropertyID);\n\
}\n\