Skip to content

Commit

Permalink
change naming style
Browse files Browse the repository at this point in the history
  • Loading branch information
matekelemen committed Sep 2, 2024
1 parent 78486bb commit 1c6e212
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 139 deletions.
8 changes: 4 additions & 4 deletions include/mtx2img/mtx2img.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ enum class Aggregation
}; // enum class Aggregation


std::vector<unsigned char> convert(std::istream& r_stream,
std::size_t& r_imageWidth,
std::size_t& r_imageHeight,
std::vector<unsigned char> convert(std::istream& rStream,
std::size_t& rImageWidth,
std::size_t& rImageHeight,
const Aggregation aggregation,
const std::string& r_colormapName);
const std::string& rColormapName);


#define MTX2IMG_DEFINE_EXCEPTION(exceptionName) \
Expand Down
20 changes: 10 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ std::optional<Arguments> parseArguments(int argc, char const* const* argv)

// Validate aggregation method
{
const auto& r_aggregation = argMap["-a"];
if (r_aggregation == "count") {
const auto& rAggregation = argMap["-a"];
if (rAggregation == "count") {
arguments.aggregation = mtx2img::Aggregation::Count;
} else if (r_aggregation == "sum") {
} else if (rAggregation == "sum") {
arguments.aggregation = mtx2img::Aggregation::Sum;
} else if (r_aggregation == "max") {
} else if (rAggregation == "max") {
arguments.aggregation = mtx2img::Aggregation::Max;
} else {
throw std::invalid_argument(std::format(
Expand All @@ -216,18 +216,18 @@ std::optional<Arguments> parseArguments(int argc, char const* const* argv)

// Convert and validate resolution
char* itEnd = nullptr;
const std::string& r_resolutionString = argMap["-r"];
const long long resolution = std::strtoll(r_resolutionString.data(), &itEnd, 0);
if (itEnd < r_resolutionString.data() ||
static_cast<std::size_t>(std::distance(r_resolutionString.data(), static_cast<const char*>(itEnd))) != r_resolutionString.size()) {
const std::string& rResolutionString = argMap["-r"];
const long long resolution = std::strtoll(rResolutionString.data(), &itEnd, 0);
if (itEnd < rResolutionString.data() ||
static_cast<std::size_t>(std::distance(rResolutionString.data(), static_cast<const char*>(itEnd))) != rResolutionString.size()) {
throw std::invalid_argument(std::format(
"Error: invalid output image resolution: {}\n",
r_resolutionString
rResolutionString
));
} else if (resolution < 0) {
throw std::invalid_argument(std::format(
"Error: negative output image resolution: {}\n",
r_resolutionString
rResolutionString
));
} else {
arguments.resolution = static_cast<std::size_t>(resolution);
Expand Down
Loading

0 comments on commit 1c6e212

Please sign in to comment.