| 38 | const char* mName; |
| 39 | |
| 40 | bool matchesPattern( const char* pattern ) |
| 41 | { |
| 42 | U32 indexInName = 0; |
| 43 | U32 indexInPattern = 0; |
| 44 | |
| 45 | while( mName[ indexInName ] != '\0' ) |
| 46 | { |
| 47 | if( pattern[ indexInPattern ] == '\0' ) |
| 48 | break; |
| 49 | else if( dToupper( mName[ indexInName ] ) == dToupper( pattern[ indexInPattern ] ) ) |
| 50 | { |
| 51 | indexInName ++; |
| 52 | indexInPattern ++; |
| 53 | } |
| 54 | else if( pattern[ indexInPattern ] == '*' ) |
| 55 | { |
| 56 | // Handle senseless concatenation of wildcards. |
| 57 | while( pattern[ indexInPattern ] == '*' ) |
| 58 | indexInPattern ++; |
| 59 | |
| 60 | // Skip to next slash in name. |
| 61 | while( mName[ indexInName ] && mName[ indexInName ] != '/' ) |
| 62 | indexInName ++; |
| 63 | } |
| 64 | else |
| 65 | return false; |
| 66 | } |
| 67 | |
| 68 | return ( pattern[ indexInPattern ] == '\0' |
| 69 | || ( indexInPattern > 0 && pattern[ indexInPattern ] == '*' ) ); |
| 70 | } |
| 71 | }; |
| 72 | |
| 73 | /// A sampler backend is responsible for storing the actual sampling data. |