Version.h 2.0 KB

1234567891011121314151617181920212223242526272829303132
  1. /******************************************************************************/
  2. namespace Edit{
  3. /******************************************************************************/
  4. struct FileVersion
  5. {
  6. enum FLAG
  7. {
  8. REMOVED =1<<0, // file is removed
  9. COMPRESSED=1<<1, // file is compressed
  10. };
  11. DateTime time ; // time at which version was submitted
  12. UInt user , // ID of the user who submitted the version
  13. revision, // global revision number
  14. flag ; // optional flags
  15. Bool removed ()C {return FlagTest(flag, REMOVED );}
  16. Bool compressed()C {return FlagTest(flag, COMPRESSED);}
  17. FileVersion& zero( ) {T.time.zero(); T.user=0 ; T.revision= 0; T.flag= 0; return T;}
  18. FileVersion& set (C DateTime &time, UInt user, UInt revision, UInt flag=0) {T.time=time ; T.user=user; T.revision=revision; T.flag=flag; return T;}
  19. FileVersion( ) {zero();}
  20. explicit FileVersion(C DateTime &time, UInt user, UInt revision, UInt flag=0) {set (time, user, revision, flag);}
  21. };
  22. /******************************************************************************/
  23. Bool GetVersions( C Str &name, MemPtr<FileVersion> versions);
  24. Bool GetVersion (File &f, C Str &name, C DateTime &time , Bool treat_base_as_latest); // 'treat_base_as_latest'=if treat the base file as the latest version, this way the latest version will always be saved only as the base file, and not in the version folder
  25. Bool AddVersion (File &f, C Str &name, C FileVersion &version , Bool treat_base_as_latest); // 'treat_base_as_latest'=if treat the base file as the latest version, this way the latest version will always be saved only as the base file, and not in the version folder
  26. /******************************************************************************/
  27. } // namespace
  28. /******************************************************************************/