Documentation work

This commit is contained in:
Vinnie Falco
2017-06-09 18:07:20 -07:00
parent d4ec693a61
commit 9d5d4d56a4
46 changed files with 1264 additions and 153 deletions
+32
View File
@@ -225,6 +225,16 @@ public:
iterator
find(string_view name) const;
/** Returns an iterator to the case-insensitive matching field.
If more than one field with the specified name exists, the
first field defined by insertion order is returned.
@param name The field to find.
*/
iterator
find(field name) const;
/** Returns the value for a case-insensitive matching header, or `""`.
If more than one field with the specified name exists, the
@@ -233,6 +243,16 @@ public:
string_view const
operator[](string_view name) const;
/** Returns the value for a field, or `""` if it does not exist.
If more than one field with the specified name exists, the
first field defined by insertion order is returned.
@param name The field to retrieve.
*/
string_view const
operator[](field name) const;
/// Clear the contents of the basic_fields.
void
clear() noexcept;
@@ -319,6 +339,18 @@ public:
void
replace(string_view name, string_view value);
/** Replace a field value.
First removes any values with matching field names, then
inserts the new field value.
@param name The field to replace.
@param value A string holding the value of the field.
*/
void
replace(field name, string_view value);
/** Replace a field value.
First removes any values with matching field names, then
+34
View File
@@ -467,6 +467,19 @@ find(string_view name) const ->
return list_.iterator_to(*it);
}
template<class Allocator>
auto
basic_fields<Allocator>::
find(field name) const ->
iterator
{
auto const it = set_.find(
to_string(name), less{});
if(it == set_.end())
return list_.end();
return list_.iterator_to(*it);
}
template<class Allocator>
string_view const
basic_fields<Allocator>::
@@ -478,6 +491,17 @@ operator[](string_view name) const
return it->value();
}
template<class Allocator>
string_view const
basic_fields<Allocator>::
operator[](field name) const
{
auto const it = find(name);
if(it == end())
return {};
return it->value();
}
template<class Allocator>
void
basic_fields<Allocator>::
@@ -547,6 +571,16 @@ replace(string_view name, string_view value)
insert(name, value);
}
template<class Allocator>
void
basic_fields<Allocator>::
replace(field name, string_view value)
{
value = detail::trim(value);
erase(name);
insert(name, value);
}
//------------------------------------------------------------------------------
// Fields