mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -15,10 +15,8 @@ bool IsTag(string const & str)
|
||||
{
|
||||
// tag consists of a-z or A-Z letters or _ and not empty
|
||||
for (auto const c : str)
|
||||
{
|
||||
if (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') && c != '_')
|
||||
return false;
|
||||
}
|
||||
return !str.empty();
|
||||
}
|
||||
|
||||
@@ -38,14 +36,14 @@ bool ParseSelector(string const & str, SelectorExpression & e)
|
||||
// [tag]
|
||||
|
||||
if (str.empty())
|
||||
return false; // invalid format
|
||||
return false; // invalid format
|
||||
|
||||
// [!tag]
|
||||
if (str[0] == '!')
|
||||
{
|
||||
string tag(str.begin() + 1, str.end());
|
||||
if (!IsTag(tag))
|
||||
return false; // invalid format
|
||||
return false; // invalid format
|
||||
|
||||
e.m_operator = SelectorOperatorIsNotSet;
|
||||
e.m_tag = std::move(tag);
|
||||
@@ -65,7 +63,7 @@ bool ParseSelector(string const & str, SelectorExpression & e)
|
||||
// Find first entrance of >, < or =
|
||||
size_t pos = string::npos;
|
||||
size_t len = 0;
|
||||
char const c[] = { '>', '<', '=', 0 };
|
||||
char const c[] = {'>', '<', '=', 0};
|
||||
for (size_t i = 0; c[i] != 0; ++i)
|
||||
{
|
||||
size_t p = str.find(c[i]);
|
||||
@@ -77,15 +75,15 @@ bool ParseSelector(string const & str, SelectorExpression & e)
|
||||
}
|
||||
|
||||
// If there is no entrance or no space for tag or value then it is invalid format
|
||||
if (pos == 0 || len == 0 || pos == str.size()-1)
|
||||
return false; // invalid format
|
||||
if (pos == 0 || len == 0 || pos == str.size() - 1)
|
||||
return false; // invalid format
|
||||
|
||||
// Dedicate the operator type, real operator position and length
|
||||
SelectorOperatorType op = SelectorOperatorUnknown;
|
||||
if (str[pos] == '>')
|
||||
{
|
||||
op = SelectorOperatorGreater;
|
||||
if (str[pos+1] == '=')
|
||||
if (str[pos + 1] == '=')
|
||||
{
|
||||
++len;
|
||||
op = SelectorOperatorGreaterOrEqual;
|
||||
@@ -94,7 +92,7 @@ bool ParseSelector(string const & str, SelectorExpression & e)
|
||||
else if (str[pos] == '<')
|
||||
{
|
||||
op = SelectorOperatorLess;
|
||||
if (str[pos+1] == '=')
|
||||
if (str[pos + 1] == '=')
|
||||
{
|
||||
++len;
|
||||
op = SelectorOperatorLessOrEqual;
|
||||
@@ -104,7 +102,7 @@ bool ParseSelector(string const & str, SelectorExpression & e)
|
||||
{
|
||||
ASSERT(str[pos] == '=', ());
|
||||
op = SelectorOperatorEqual;
|
||||
if (str[pos-1] == '!')
|
||||
if (str[pos - 1] == '!')
|
||||
{
|
||||
--pos;
|
||||
++len;
|
||||
@@ -114,7 +112,7 @@ bool ParseSelector(string const & str, SelectorExpression & e)
|
||||
|
||||
string tag(str.begin(), str.begin() + pos);
|
||||
if (!IsTag(tag))
|
||||
return false; // invalid format
|
||||
return false; // invalid format
|
||||
|
||||
e.m_operator = op;
|
||||
e.m_tag = std::move(tag);
|
||||
|
||||
Reference in New Issue
Block a user