1/* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef SYNCML_Log_H 18#define SYNCML_Log_H 19 20#ifndef __cplusplus 21#error "This is a C++ header file; it requires C++ to compile." 22#endif 23 24/*================================================================================================== 25 26 Header Name: SyncML_Log.H 27 28 General Description: This file contains the declaration for the SyncML_Log class. 29==================================================================================================*/ 30 31#include "syncml_dm_data_types.h" 32#include "dmMemory.h" 33#include "SyncML_DM_FileHandle.H" 34 35/*================================================================================================== 36CLASS DECLARATION 37==================================================================================================*/ 38class SyncML_Log 39{ 40 public: 41 /* Class constructor */ 42 SyncML_Log(); 43 44 /* Class destructor */ 45 virtual ~SyncML_Log(); 46 47 // Open log file and create one if the file doesn't exist 48 virtual SYNCML_DM_RET_STATUS_T InitLog(CPCHAR logFileName); 49 50 // Uninitialize log 51 virtual SYNCML_DM_RET_STATUS_T UnInitLog(); 52 53 /* Take each entry in the log file and play it on the tree (by passing to 54 * the tree and node manager) according to logic based on flags in the log entry 55 */ 56 virtual SYNCML_DM_RET_STATUS_T playLog() = 0; 57 virtual SYNCML_DM_RET_STATUS_T playLog(CPCHAR logFileName); 58 59 virtual SYNCML_DM_RET_STATUS_T RemoveLog(); 60 61 virtual SYNCML_DM_RET_STATUS_T CloseLog(); 62 63 /* Accessors for the file handle associated with this log */ 64 virtual DMFileHandler* getLogFileHandle(); 65 virtual SYNCML_DM_RET_STATUS_T setLogFileHandle(DMFileHandler *fileHandle); 66 67 inline void* operator new(size_t sz) 68 { 69 return (DmAllocMem(sz)); 70 } 71 72 inline void operator delete(void* buf) 73 { 74 DmFreeMem(buf); 75 } 76 77 protected: 78 DMFileHandler *fileHandle; 79 80}; 81 82#endif /* SYNCML_Log_H */ 83