@@ -46,7 +46,7 @@ static_assert(n_private_fields <= 64,
4646
4747union TupleVal {
4848 String str;
49- int x;
49+ int64_t x;
5050
5151 // dummy constructor and destructor
5252 TupleVal () {}
@@ -85,6 +85,7 @@ struct TupleData
8585 TupleVal * lookup (int field, bool add, bool remove);
8686 void set_int (int field, int x);
8787 void set_str (int field, const char * str);
88+ void set_int64 (int field, int64_t x);
8889 void set_subtunes (short nsubs, const short * subs);
8990
9091 static TupleData * ref (TupleData * tuple);
@@ -153,6 +154,9 @@ static const struct
153154
154155 {" formatted-title" , Tuple::String, -1 },
155156
157+ {" file-created" , Tuple::DateTime, -1 },
158+ {" file-modified" , Tuple::DateTime, -1 },
159+
156160 /* fallbacks */
157161 {nullptr , Tuple::String, -1 },
158162 {nullptr , Tuple::String, -1 },
@@ -184,7 +188,9 @@ static const FieldDictEntry field_dict[] = {
184188 {" date" , Tuple::Date},
185189 {" description" , Tuple::Description},
186190 {" disc-number" , Tuple::Disc},
191+ {" file-created" , Tuple::FileCreated},
187192 {" file-ext" , Tuple::Suffix},
193+ {" file-modified" , Tuple::FileModified},
188194 {" file-name" , Tuple::Basename},
189195 {" file-path" , Tuple::Path},
190196 {" formatted-title" , Tuple::FormattedTitle},
@@ -296,6 +302,12 @@ void TupleData::set_str(int field, const char * str)
296302 new (&val->str ) String (str);
297303}
298304
305+ void TupleData::set_int64 (int field, int64_t x)
306+ {
307+ TupleVal * val = lookup (field, true , false );
308+ val->x = x;
309+ }
310+
299311void TupleData::set_subtunes (short nsubs, const short * subs)
300312{
301313 nsubtunes = nsubs;
@@ -473,6 +485,14 @@ EXPORT int Tuple::get_int(Field field) const
473485 return val ? val->x : -1 ;
474486}
475487
488+ EXPORT int64_t Tuple::get_int64 (Field field) const
489+ {
490+ assert (is_valid_field (field) && (field_info[field].type == Int || field_info[field].type == DateTime));
491+
492+ TupleVal * val = data ? data->lookup (field, false , false ) : nullptr ;
493+ return val ? val->x : -1 ;
494+ }
495+
476496EXPORT String Tuple::get_str (Field field) const
477497{
478498 assert (is_valid_field (field) && field_info[field].type == String);
@@ -489,6 +509,14 @@ EXPORT void Tuple::set_int(Field field, int x)
489509 data->set_int (field, x);
490510}
491511
512+ EXPORT void Tuple::set_int64 (Field field, int64_t x)
513+ {
514+ assert (is_valid_field (field) && (field_info[field].type == Int || field_info[field].type == DateTime));
515+
516+ data = TupleData::copy_on_write (data);
517+ data->set_int64 (field, x);
518+ }
519+
492520EXPORT void Tuple::set_str (Field field, const char * str)
493521{
494522 assert (is_valid_field (field) && field_info[field].type == String);
0 commit comments