Apply clang-format to code base

This commit is contained in:
clang-format-bot 2022-09-22 21:26:05 +03:00 committed by ζeh Matt
parent f37d0be806
commit ddb0522bbf
No known key found for this signature in database
GPG key ID: 18CE582C71A225B0
2199 changed files with 118692 additions and 114392 deletions

View file

@ -8,9 +8,9 @@ namespace Fallback
{
std::map<std::string, std::string, std::less<>> Map::mFallbackMap;
void Map::init(const std::map<std::string,std::string>& fallback)
void Map::init(const std::map<std::string, std::string>& fallback)
{
for(const auto& entry : fallback)
for (const auto& entry : fallback)
mFallbackMap.insert(entry);
}
@ -71,18 +71,21 @@ namespace Fallback
unsigned int j = 0;
for (unsigned int i = 0; i < sum.length(); ++i)
{
if(sum[i]==',') j++;
else if (sum[i] != ' ') ret[j]+=sum[i];
if (sum[i] == ',')
j++;
else if (sum[i] != ' ')
ret[j] += sum[i];
}
return osg::Vec4f(std::stoi(ret[0])/255.f,std::stoi(ret[1])/255.f,std::stoi(ret[2])/255.f, 1.f);
return osg::Vec4f(std::stoi(ret[0]) / 255.f, std::stoi(ret[1]) / 255.f, std::stoi(ret[2]) / 255.f, 1.f);
}
catch (const std::invalid_argument&)
{
Log(Debug::Error) << "Error: '" << fall << "' setting value (" << sum << ") is not a valid color, using middle gray as a fallback";
Log(Debug::Error) << "Error: '" << fall << "' setting value (" << sum
<< ") is not a valid color, using middle gray as a fallback";
}
}
return osg::Vec4f(0.5f,0.5f,0.5f,1.f);
return osg::Vec4f(0.5f, 0.5f, 0.5f, 1.f);
}
}

View file

@ -12,15 +12,16 @@ namespace Fallback
/// @brief contains settings imported from the Morrowind INI file.
class Map
{
static std::map<std::string, std::string, std::less<>> mFallbackMap;
public:
static void init(const std::map<std::string,std::string>& fallback);
static std::map<std::string, std::string, std::less<>> mFallbackMap;
static std::string_view getString(std::string_view fall);
static float getFloat(std::string_view fall);
static int getInt(std::string_view fall);
static bool getBool(std::string_view fall);
static osg::Vec4f getColour(std::string_view fall);
public:
static void init(const std::map<std::string, std::string>& fallback);
static std::string_view getString(std::string_view fall);
static float getFloat(std::string_view fall);
static int getInt(std::string_view fall);
static bool getBool(std::string_view fall);
static osg::Vec4f getColour(std::string_view fall);
};
}
#endif

View file

@ -10,13 +10,14 @@ void Fallback::validate(boost::any& v, std::vector<std::string> const& tokens, F
v = boost::any(FallbackMap());
}
FallbackMap *map = boost::any_cast<FallbackMap>(&v);
FallbackMap* map = boost::any_cast<FallbackMap>(&v);
for (const auto& token : tokens)
{
size_t sep = token.find(',');
if (sep < 1 || sep == token.length() - 1 || sep == std::string::npos)
throw boost::program_options::validation_error(boost::program_options::validation_error::invalid_option_value);
throw boost::program_options::validation_error(
boost::program_options::validation_error::invalid_option_value);
std::string key(token.substr(0, sep));
std::string value(token.substr(sep + 1));

View file

@ -17,11 +17,12 @@ namespace boost
namespace Fallback
{
struct FallbackMap {
struct FallbackMap
{
std::map<std::string, std::string> mMap;
};
void validate(boost::any &v, std::vector<std::string> const &tokens, FallbackMap*, int);
void validate(boost::any& v, std::vector<std::string> const& tokens, FallbackMap*, int);
}
#endif