Cleanup: Use functional cast for std::string_view

See https://wiki.blender.org/wiki/Style_Guide/C_Cpp#C.2B.2B_Type_Cast
This commit is contained in:
Hans Goudey
2023-06-12 15:38:16 -04:00
parent 0ec8599de7
commit 3db0c59ec1
3 changed files with 16 additions and 16 deletions

View File

@@ -405,8 +405,8 @@ std::string AssetCatalogDropTarget::drop_tooltip_asset_catalog(const wmDrag &dra
const AssetCatalog *src_catalog = get_drag_catalog(drag, get_asset_library());
return fmt::format(TIP_("Move catalog {} into {}"),
(std::string_view)src_catalog->path.name(),
(std::string_view)catalog_item_.get_name());
std::string_view(src_catalog->path.name()),
std::string_view(catalog_item_.get_name()));
}
std::string AssetCatalogDropTarget::drop_tooltip_asset_list(const wmDrag &drag) const
@@ -620,7 +620,7 @@ std::string AssetCatalogTreeViewAllItem::DropTarget::drop_tooltip(const wmDrag &
drag, *get_view<AssetCatalogTreeView>().asset_library_);
return fmt::format(TIP_("Move catalog {} to the top level of the tree"),
(std::string_view)drag_catalog->path.name());
std::string_view(drag_catalog->path.name()));
}
bool AssetCatalogTreeViewAllItem::DropTarget::on_drop(bContext * /*C*/, const wmDrag &drag) const

View File

@@ -42,11 +42,11 @@ void FileBuffer::close_file()
void FileBuffer::write_header_element(StringRef name, int count)
{
write_fstring("element {} {}\n", (std::string_view)name, count);
write_fstring("element {} {}\n", std::string_view(name), count);
}
void FileBuffer::write_header_scalar_property(StringRef dataType, StringRef name)
{
write_fstring("property {} {}\n", (std::string_view)dataType, (std::string_view)name);
write_fstring("property {} {}\n", std::string_view(dataType), std::string_view(name));
}
void FileBuffer::write_header_list_property(StringRef countType,
@@ -54,14 +54,14 @@ void FileBuffer::write_header_list_property(StringRef countType,
StringRef name)
{
write_fstring("property list {} {} {}\n",
(std::string_view)countType,
(std::string_view)dataType,
(std::string_view)name);
std::string_view(countType),
std::string_view(dataType),
std::string_view(name));
}
void FileBuffer::write_string(StringRef s)
{
write_fstring("{}\n", (std::string_view)s);
write_fstring("{}\n", std::string_view(s));
}
void FileBuffer::write_newline()

View File

@@ -109,11 +109,11 @@ class FormatHandler : NonCopyable, NonMovable {
}
void write_obj_usemtl(StringRef s)
{
write_impl("usemtl {}\n", (std::string_view)s);
write_impl("usemtl {}\n", std::string_view(s));
}
void write_obj_mtllib(StringRef s)
{
write_impl("mtllib {}\n", (std::string_view)s);
write_impl("mtllib {}\n", std::string_view(s));
}
void write_obj_smooth(int s)
{
@@ -121,11 +121,11 @@ class FormatHandler : NonCopyable, NonMovable {
}
void write_obj_group(StringRef s)
{
write_impl("g {}\n", (std::string_view)s);
write_impl("g {}\n", std::string_view(s));
}
void write_obj_object(StringRef s)
{
write_impl("o {}\n", (std::string_view)s);
write_impl("o {}\n", std::string_view(s));
}
void write_obj_edge(int a, int b)
{
@@ -170,7 +170,7 @@ class FormatHandler : NonCopyable, NonMovable {
void write_mtl_newmtl(StringRef s)
{
write_impl("newmtl {}\n", (std::string_view)s);
write_impl("newmtl {}\n", std::string_view(s));
}
void write_mtl_float(const char *type, float v)
{
@@ -187,12 +187,12 @@ class FormatHandler : NonCopyable, NonMovable {
/* NOTE: options, if present, will have its own leading space. */
void write_mtl_map(const char *type, StringRef options, StringRef value)
{
write_impl("{}{} {}\n", type, (std::string_view)options, (std::string_view)value);
write_impl("{}{} {}\n", type, std::string_view(options), std::string_view(value));
}
void write_string(StringRef s)
{
write_impl("{}\n", (std::string_view)s);
write_impl("{}\n", std::string_view(s));
}
private: