Accept Emitter::operator<<(std::string_view). ABI remains C++11 compatible by exposing new method Emitter::Write(const char*, size_t). All affected calls optimized to pass std::string values as pointer + size tuple into appropriate routines.
18 lines
537 B
C++
18 lines
537 B
C++
#include "yaml-cpp/null.h"
|
|
#include <cstring>
|
|
|
|
namespace YAML {
|
|
_Null Null;
|
|
|
|
template <std::size_t N>
|
|
static bool same(const char* str, std::size_t size, const char (&literal)[N]) {
|
|
constexpr int literalSize = N - 1; // minus null terminator
|
|
return size == literalSize && std::strncmp(str, literal, literalSize) == 0;
|
|
}
|
|
|
|
bool IsNullString(const char* str, std::size_t size) {
|
|
return size == 0 || same(str, size, "~") || same(str, size, "null") ||
|
|
same(str, size, "Null") || same(str, size, "NULL");
|
|
}
|
|
} // namespace YAML
|