diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/nde/osx/FilenameField.cpp | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/nde/osx/FilenameField.cpp')
-rw-r--r-- | Src/nde/osx/FilenameField.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Src/nde/osx/FilenameField.cpp b/Src/nde/osx/FilenameField.cpp new file mode 100644 index 00000000..7cb50f49 --- /dev/null +++ b/Src/nde/osx/FilenameField.cpp @@ -0,0 +1,45 @@ +#include "FilenameField.h" +#include "nde.h" + +/* +Mac OS X implementation of FilenameField + only the equals operator will be case-sensitive. substring search, ends, starts, etc. will be case-insensitive, + to make things like "filename ends .mp3" easier + +TODO: it'd be massive overhead, but it'd be more correct to check if the file system is actually case sensitive (for the path being searched) +*/ + +//--------------------------------------------------------------------------- +FilenameField::FilenameField(CFStringRef Str) : StringField(Str) +{ + Type = FIELD_FILENAME; +} + +//--------------------------------------------------------------------------- +FilenameField::FilenameField() +{ + Type = FIELD_FILENAME; +} + +//--------------------------------------------------------------------------- +int FilenameField::Compare(Field *Entry) +{ + if (!Entry) return -1; + if (Entry->GetType() != GetType()) return 0; + + CFStringRef compareString = ((StringField*)Entry)->GetString(); + if (!String && !compareString) return 0; + if (!String && compareString) return 1; + if (!compareString) return -1; + + return CFStringCompare(String, compareString, 0); +} + +Field *FilenameField::Clone(Table *pTable) +{ + FilenameField *clone = new FilenameField(String); + clone->Pos = FIELD_CLONE; + clone->ID = ID; + clone->MaxSizeOnDisk = GetDataSize(); + return clone; +} |