dcbasictypes.pas 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. {
  2. Double commander
  3. -------------------------------------------------------------------------
  4. Definitions of basic types.
  5. Copyright (C) 2012 Przemyslaw Nagay ([email protected])
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. }
  18. unit DCBasicTypes;
  19. {$mode objfpc}{$H+}
  20. {$modeswitch advancedrecords}
  21. interface
  22. type
  23. TDynamicStringArray = array of String;
  24. TCharSet = set of Char;
  25. TFileAttrs = Cardinal; // file attributes type regardless of system
  26. TWinFileTime = QWord; // NTFS time (UTC) (2 x DWORD)
  27. TDosFileTime = LongInt; // MS-DOS time (local)
  28. TUnixFileTime = Int64; // UNIX time (UTC)
  29. {$IFDEF MSWINDOWS}
  30. TFileTime = TWinFileTime;
  31. TFileTimeEx = TFileTime;
  32. {$ELSE}
  33. TFileTime = TUnixFileTime;
  34. TFileTimeEx = record
  35. public
  36. sec: int64;
  37. nanosec: int64;
  38. public
  39. constructor create( aSec:int64; aNanosec:int64=0 );
  40. class operator =(l,r : TFileTimeEx): Boolean;
  41. end;
  42. {$ENDIF}
  43. PFileTime = ^TFileTime;
  44. PWinFileTime = ^TWinFileTime;
  45. const
  46. TFileTimeExNull: TFileTimeEx = {$IFDEF MSWINDOWS} 0 {$ELSE} (sec:0; nanosec:-1) {$ENDIF};
  47. implementation
  48. {$IF not DEFINED(MSWINDOWS)}
  49. constructor TFileTimeEx.create( aSec:int64; aNanosec:int64 );
  50. begin
  51. self.sec:= aSec;
  52. self.nanosec:= aNanosec;
  53. end;
  54. class operator TFileTimeEx.=(l,r : TFileTimeEx): Boolean;
  55. begin
  56. Result:= (l.sec=r.sec) and (l.nanosec=r.nanosec);
  57. end;
  58. {$ENDIF}
  59. end.