Uncrustify maxscale

See script directory for method. The script to run in the top level
MaxScale directory is called maxscale-uncrustify.sh, which uses
another script, list-src, from the same directory (so you need to set
your PATH). The uncrustify version was 0.66.
This commit is contained in:
Niclas Antti
2018-09-09 22:26:19 +03:00
parent fa7ec95069
commit c447e5cf15
849 changed files with 35002 additions and 27238 deletions

View File

@ -40,11 +40,17 @@ bool INIReader::GetBoolean(string section, string name, bool default_value)
// Convert to lower case to make string comparisons case-insensitive
std::transform(valstr.begin(), valstr.end(), valstr.begin(), ::tolower);
if (valstr == "true" || valstr == "yes" || valstr == "on" || valstr == "1")
{
return true;
}
else if (valstr == "false" || valstr == "no" || valstr == "off" || valstr == "0")
{
return false;
}
else
{
return default_value;
}
}
string INIReader::MakeKey(string section, string name)
@ -55,13 +61,17 @@ string INIReader::MakeKey(string section, string name)
return key;
}
int INIReader::ValueHandler(void* user, const char* section, const char* name,
int INIReader::ValueHandler(void* user,
const char* section,
const char* name,
const char* value)
{
INIReader* reader = (INIReader*)user;
string key = MakeKey(section, name);
if (reader->_values[key].size() > 0)
{
reader->_values[key] += "\n";
}
reader->_values[key] += value;
return 1;
}

View File

@ -25,7 +25,8 @@ public:
int ParseError();
// Get a string value from INI file, returning default_value if not found.
std::string Get(std::string section, std::string name,
std::string Get(std::string section,
std::string name,
std::string default_value);
// Get an integer (long) value from INI file, returning default_value if
@ -38,11 +39,13 @@ public:
bool GetBoolean(std::string section, std::string name, bool default_value);
private:
int _error;
int _error;
std::map<std::string, std::string> _values;
static std::string MakeKey(std::string section, std::string name);
static int ValueHandler(void* user, const char* section, const char* name,
const char* value);
static int ValueHandler(void* user,
const char* section,
const char* name,
const char* value);
};
#endif // __INIREADER_H__

View File

@ -7,7 +7,8 @@ int main()
{
INIReader reader("../examples/test.ini");
if (reader.ParseError() < 0) {
if (reader.ParseError() < 0)
{
std::cout << "Can't load 'test.ini'\n";
return 1;
}