mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 07:29:07 +08:00
[vcpkg_Parse] Add missing const
This commit is contained in:
parent
95eadb8ddd
commit
c15c80e802
@ -26,7 +26,7 @@ namespace vcpkg::Parse
|
||||
ParagraphParser(RawParagraph&& fields) : fields(std::move(fields)) {}
|
||||
|
||||
void required_field(const std::string& fieldname, std::string& out);
|
||||
std::string optional_field(const std::string& fieldname);
|
||||
std::string optional_field(const std::string& fieldname) const;
|
||||
std::unique_ptr<ParseControlErrorInfo> error_info(const std::string& name) const;
|
||||
|
||||
private:
|
||||
|
@ -23,12 +23,12 @@ namespace vcpkg::Parse
|
||||
void ParagraphParser::required_field(const std::string& fieldname, std::string& out)
|
||||
{
|
||||
auto maybe_field = remove_field(&fields, fieldname);
|
||||
if (auto field = maybe_field.get())
|
||||
if (const auto field = maybe_field.get())
|
||||
out = std::move(*field);
|
||||
else
|
||||
missing_fields.push_back(fieldname);
|
||||
}
|
||||
std::string ParagraphParser::optional_field(const std::string& fieldname)
|
||||
std::string ParagraphParser::optional_field(const std::string& fieldname) const
|
||||
{
|
||||
return remove_field(&fields, fieldname).value_or(Strings::EMPTY);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user