blob: 7cb50f49177033e86ad52d3e124ec325286b4502 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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;
}
|