Skip to content

Commit 23eb3fc

Browse files
BufferWriter: remove C string write overloads, use const void MemSpan.
1 parent 734be78 commit 23eb3fc

File tree

3 files changed

+14
-23
lines changed

3 files changed

+14
-23
lines changed

code/include/swoc/BufferWriter.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,6 @@ class BufferWriter {
5353
*/
5454
virtual BufferWriter &write(void const *data, size_t length);
5555

56-
/** Write C-string.
57-
*
58-
* @param s String pointer.
59-
* @return @a this
60-
*
61-
* @a s is presumed to ba nul terminated.
62-
*/
63-
BufferWriter & write(char const *s) { return this->write(s, strlen(s)); }
64-
65-
/** Write C-string.
66-
*
67-
* @param s String pointer.
68-
* @return @a this
69-
*
70-
* @a s is presumed to ba nul terminated.
71-
*/
72-
BufferWriter & write(char *s) { return this->write(s, strlen(s)); }
73-
7456
/** Write data to the buffer.
7557
*
7658
* @param span Data source.

code/include/swoc/TextView.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,8 +788,8 @@ class TextView : public std::string_view {
788788
* @param count Number of bytes in the view.
789789
* @return The view starting at @a pos for @a count bytes.
790790
*
791-
* The returned view is clipped by @a this. @a count is reduced such that it covers only data
792-
* in @a this.
791+
* The returned view is clipped by @a this - that is, it will not extend beyond the original view.
792+
* @a count is reduced such that it covers only data in @a this.
793793
*
794794
* @note This is provided primarily for co-variance, i.e. the returned view is a @c TextView
795795
* instead of a @c std::string_view.

code/include/swoc/bwf_base.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,12 @@ template <typename F> class NameMap {
301301
*/
302302
self_type &assign(std::string_view const &name, Generator const &generator);
303303

304-
bool contains(std::string_view name) {
305-
return _map.end() != _map.find(name);
306-
}
304+
/** Check if a specific name is contained in this mapping.
305+
*
306+
* @param name Name to check.
307+
* @return @c true if present, @c false if not.
308+
*/
309+
bool contains(std::string_view name);
307310

308311
protected:
309312
/// Copy @a name in to local storage and return a view of it.
@@ -558,6 +561,12 @@ template <typename F> NameMap<F>::NameMap(std::initializer_list<std::tuple<std::
558561
}
559562
}
560563

564+
template <typename F>
565+
bool
566+
NameMap<F>::contains(std::string_view name) {
567+
return _map.end() != _map.find(name);
568+
}
569+
561570
template <typename F>
562571
std::string_view
563572
NameMap<F>::localize(std::string_view const &name) {

0 commit comments

Comments
 (0)