MCPcopy Create free account
hub / github.com/KiCad/kicad-source-mirror / WildCompareString

Function WildCompareString

common/string_utils.cpp:910–971  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

908
909
910bool WildCompareString( const wxString& pattern, const wxString& string_to_tst,
911 bool case_sensitive )
912{
913 const wxChar* cp = nullptr;
914 const wxChar* mp = nullptr;
915 const wxChar* wild = nullptr;
916 const wxChar* str = nullptr;
917 wxString _pattern, _string_to_tst;
918
919 if( case_sensitive )
920 {
921 wild = pattern.GetData();
922 str = string_to_tst.GetData();
923 }
924 else
925 {
926 _pattern = pattern;
927 _pattern.MakeUpper();
928 _string_to_tst = string_to_tst;
929 _string_to_tst.MakeUpper();
930 wild = _pattern.GetData();
931 str = _string_to_tst.GetData();
932 }
933
934 while( ( *str ) && ( *wild != '*' ) )
935 {
936 if( ( *wild != *str ) && ( *wild != '?' ) )
937 return false;
938
939 wild++;
940 str++;
941 }
942
943 while( *str )
944 {
945 if( *wild == '*' )
946 {
947 if( !*++wild )
948 return true;
949
950 mp = wild;
951 cp = str + 1;
952 }
953 else if( ( *wild == *str ) || ( *wild == '?' ) )
954 {
955 wild++;
956 str++;
957 }
958 else
959 {
960 wild = mp;
961 str = cp++;
962 }
963 }
964
965 while( *wild == '*' )
966 {
967 wild++;

Callers 12

EqualToMethod · 0.85
RefreshNetNavigatorMethod · 0.85
RebuildRowsMethod · 0.85
visitItemMethod · 0.85
isMatchMethod · 0.85
EqualToMethod · 0.85
NotEqualToMethod · 0.85
EqualToMethod · 0.85
NotEqualToMethod · 0.85
cacheFromToPathsMethod · 0.85
visitItemMethod · 0.85
isMatchMethod · 0.85

Calls 1

GetDataMethod · 0.45

Tested by

no test coverage detected