Better naming.
This commit is contained in:
parent
7f5d175f61
commit
5a1cf6bc2c
20
src/cgi.cpp
20
src/cgi.cpp
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in New Issue