--------------------------------------------------------------------------- saving messages to file
| 8 | //--------------------------------------------------------------------------- |
| 9 | // saving messages to file |
| 10 | class TStorageFile |
| 11 | { |
| 12 | public: |
| 13 | int number; // file number to link from TMessProcess::SaveFile |
| 14 | String file; // file name |
| 15 | |
| 16 | // *** LogRotate *** |
| 17 | int rotation_type; // file rotation: 0-disable, 1-by size, 2-by date [0] |
| 18 | // rotation by size |
| 19 | int rotation_size; // > 0 [10] |
| 20 | int rotation_mult; // 0,1,2 (KBs,MBs,GBs) [MBs] |
| 21 | // rotation by date |
| 22 | int rotation_moment; // 0,1,2,3 (Day,Week,Month,Year) [Week] |
| 23 | int rotation_hour; // 0..23 [0] |
| 24 | // file name after rotation |
| 25 | int rotation_renaming; // 0-file+number[rotation_count] 1-rename file to rotation_name |
| 26 | String rotation_name; // new file name after rotation {dd-mm-yyyy hh} |
| 27 | int rotation_count; // total number of rotated files >= 1 [10] |
| 28 | |
| 29 | private: |
| 30 | TFile out; // file write object |
| 31 | |
| 32 | public: |
| 33 | ULONGLONG file_size; // for log rotatition by size |
| 34 | int last_date; // for log rotatition by date |
| 35 | |
| 36 | public: |
| 37 | TStorageFile(); |
| 38 | TStorageFile(TStorageFile * p); |
| 39 | void operator = (TStorageFile * p); |
| 40 | // save data to file |
| 41 | bool Save(AnsiString s); |
| 42 | |
| 43 | String GetDescription(void); |
| 44 | String GetFileName(void); |
| 45 | void SetFileName(String f); |
| 46 | |
| 47 | void Save(XMLElementEx * p); |
| 48 | void Load(XMLElementEx * p); |
| 49 | |
| 50 | // *** LogRotate *** |
| 51 | void RotateFile(void); |
| 52 | |
| 53 | String GetFileNameToRotate(int num); // for rotation_renaming==0 |
| 54 | String GetNewRotationName(void); // for rotation_renaming==1 |
| 55 | |
| 56 | bool IsRotationEnable(void); |
| 57 | bool IsNeedRenameAfterRotate(void); |
| 58 | |
| 59 | String GetRotationDescription(void); |
| 60 | |
| 61 | // *** Rotation names log *** |
| 62 | // (It used to view file with buttons "View prev" "view next") |
| 63 | String RotationLogFormatFileName(void); |
| 64 | // fn - log file name |
| 65 | void RotationLogAddItem(String fn, String & file_to_delete); |
| 66 | // num: 0-GetFileName() >=1-read rotation name from file |
| 67 | String RotationLogGetItem(int num); |
nothing calls this directly
no outgoing calls
no test coverage detected