MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / substr

Method substr

common/SmallString.cpp:767–789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

765}
766
767std::string_view SmallStringBase::substr(s32 offset, s32 count) const
768{
769 // calc real offset
770 u32 real_offset;
771 if (offset < 0)
772 real_offset = static_cast<u32>(std::max<s32>(0, static_cast<s32>(m_length + offset)));
773 else
774 real_offset = std::min((u32)offset, m_length);
775
776 // calc real count
777 u32 real_count;
778 if (count < 0)
779 {
780 real_count =
781 std::min(m_length - real_offset, static_cast<u32>(std::max<s32>(0, static_cast<s32>(m_length) + count)));
782 }
783 else
784 {
785 real_count = std::min(m_length - real_offset, static_cast<u32>(count));
786 }
787
788 return (real_count > 0) ? std::string_view(m_buffer + real_offset, real_count) : std::string_view();
789}
790
791void SmallStringBase::erase(s32 offset, s32 count)
792{

Callers 15

ParseRegStringMethod · 0.80
TokenizeMethod · 0.80
IsZeroUint64StringMethod · 0.80
SetMnemonicFromFormMethod · 0.80
extract_file_nameFunction · 0.80
member_functions_to_astFunction · 0.80
check_member_functionFunction · 0.80
MatchAndExplainMethod · 0.80
MatchAndExplainMethod · 0.80

Calls 1

minFunction · 0.50

Tested by 7

RemoveExtensionMethod · 0.64
SplitStringFunction · 0.64
SplitEscapedStringFunction · 0.64
FormatDeathTestOutputFunction · 0.64
GetTypeNameFunction · 0.64