Add clang-format (#1086)

Co-authored-by: mwilsnd <mwilsnd@gmail.com>
This commit is contained in:
Bart Louwers
2023-05-01 16:57:37 +02:00
committed by GitHub
parent 403a12bd1b
commit 71f6da2722
1018 changed files with 27876 additions and 25862 deletions

View File

@@ -33,11 +33,9 @@ std::unique_ptr<style::Image> createStyleImage(const std::string& id,
srcX + width > static_cast<int32_t>(image.size.width) ||
srcY + height > static_cast<int32_t>(image.size.height)) {
std::ostringstream ss;
ss << "Can't create image with invalid metrics: "
<< width << "x" << height << "@" << srcX << "," << srcY
<< " in " << image.size.width << "x" << image.size.height
<< "@" << util::toString(ratio) << "x"
<< " sprite";
ss << "Can't create image with invalid metrics: " << width << "x" << height << "@" << srcX << "," << srcY
<< " in " << image.size.width << "x" << image.size.height << "@" << util::toString(ratio) << "x"
<< " sprite";
Log::Error(Event::Sprite, ss.str());
return nullptr;
}
@@ -66,7 +64,8 @@ uint16_t getUInt16(const JSValue& value, const char* property, const char* name,
return v.GetUint();
} else {
Log::Warning(Event::Sprite,
std::string("Invalid sprite image '") + name + "': value of '" + property + "' must be an integer between 0 and 65535");
std::string("Invalid sprite image '") + name + "': value of '" + property +
"' must be an integer between 0 and 65535");
}
}
@@ -79,7 +78,9 @@ double getDouble(const JSValue& value, const char* property, const char* name, c
if (v.IsNumber()) {
return v.GetDouble();
} else {
Log::Warning(Event::Sprite, std::string("Invalid sprite image '") + name + "': value of '" + property + "' must be a number");
Log::Warning(
Event::Sprite,
std::string("Invalid sprite image '") + name + "': value of '" + property + "' must be a number");
}
}
@@ -92,7 +93,9 @@ bool getBoolean(const JSValue& value, const char* property, const char* name, co
if (v.IsBool()) {
return v.GetBool();
} else {
Log::Warning(Event::Sprite, std::string("Invalid sprite image '") + name + "': value of '" + property + "' must be a boolean");
Log::Warning(
Event::Sprite,
std::string("Invalid sprite image '") + name + "': value of '" + property + "' must be a boolean");
}
}
@@ -113,11 +116,14 @@ style::ImageStretches getStretches(const JSValue& value, const char* property, c
stretch[rapidjson::SizeType(1)].GetFloat()});
} else {
Log::Warning(Event::Sprite,
"Invalid sprite image '" + std::string(name) + "': members of '" + property + "' must be an array of two numbers");
"Invalid sprite image '" + std::string(name) + "': members of '" + property +
"' must be an array of two numbers");
}
}
} else {
Log::Warning(Event::Sprite, "Invalid sprite image '" + std::string(name) + "': value of '" + property + "' must be an array");
Log::Warning(
Event::Sprite,
"Invalid sprite image '" + std::string(name) + "': value of '" + property + "' must be an array");
}
}
@@ -136,7 +142,8 @@ std::optional<style::ImageContent> getContent(const JSValue& value, const char*
content[rapidjson::SizeType(3)].GetFloat()};
} else {
Log::Warning(Event::Sprite,
"Invalid sprite image '" + std::string(name) + "': value of '" + property + "' must be an array of four numbers");
"Invalid sprite image '" + std::string(name) + "': value of '" + property +
"' must be an array of four numbers");
}
}