Better naming.

This commit is contained in:
tastytea 2020-06-29 07:05:04 +02:00
parent 7f5d175f61
commit 5a1cf6bc2c
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 12 additions and 12 deletions

View File

@ -37,14 +37,14 @@ using std::vector;
entry_type parse_formdata()
{
entry_type answer;
entry_type entry;
try
{
cgicc::Cgicc cgi;
answer.instance = cgi("instance");
answer.tags = string_to_array(cgi("tags"));
answer.receipts = string_to_array(cgi("receipts"));
answer.description = cgi("description");
entry.instance = cgi("instance");
entry.tags = string_to_vector(cgi("tags"));
entry.receipts = string_to_vector(cgi("receipts"));
entry.description = cgi("description");
}
catch (const exception &e)
{
@ -52,12 +52,12 @@ entry_type parse_formdata()
// TODO: Error handling.
}
return answer;
return entry;
}
vector<string> string_to_array(const string_view str)
vector<string> string_to_vector(const string_view str)
{
vector<string> output;
vector<string> vec;
try
{
@ -66,7 +66,7 @@ vector<string> string_to_array(const string_view str)
while (getline(input, element, ','))
{
output.push_back(element);
vec.push_back(element);
}
}
catch (const exception &e)
@ -74,7 +74,7 @@ vector<string> string_to_array(const string_view str)
cerr << e.what() << '\n';
}
return output;
return vec;
}
} // namespace FediBlock

View File

@ -40,7 +40,7 @@ struct entry_type
[[nodiscard]] entry_type parse_formdata();
// Split a string at commas, return a vector.
[[nodiscard]] vector<string> string_to_array(string_view str);
[[nodiscard]] vector<string> string_to_vector(string_view str);
} // namespace FediBlock

View File

@ -26,7 +26,7 @@ namespace FediBlock
using std::string;
// Convert our object into a JSON string.
// Convert an entry_type into a JSON string.
[[nodiscard]] string to_json(const entry_type &entry);
} // namespace FediBlock