summaryrefslogtreecommitdiff
path: root/tvapi/libtv/tvutils/CFile.h (plain)
blob: 0429278661c3bd9bed22694fbdcadb81f4a658f0
1/*
2 * showbo
3*/
4#ifndef C_FILE_H
5#define C_FILE_H
6
7#include <sys/types.h>
8#include <sys/stat.h>
9#include <fcntl.h>
10#include <stdio.h>
11#include <errno.h>
12
13#define CC_MAX_FILE_PATH_LEN (256)
14
15#define BUFFER_SIZE 1024
16
17class CFile {
18public:
19 CFile(const char *path);
20 CFile();
21 virtual ~CFile();
22 virtual int openFile(const char *path);
23 virtual int closeFile();
24 virtual int writeFile(const unsigned char *pData, int uLen);
25 virtual int readFile(const unsigned char *pBuf, int uLen);
26 int copyTo(const char *dstPath);
27 static int delFile(const char *path);
28 static int getFileAttrValue(const char *path);
29 static int setFileAttrValue(const char *path, int value);
30 static int getFileAttrStr(const char *path, char *str);
31 static int setFileAttrStr(const char *path, const char *str);
32 int delFile();
33 int flush();
34 int seekTo();
35 int seekToBegin();
36 int seekToEnd();
37 int getLength();
38 int getFd()
39 {
40 return mFd;
41 };
42protected:
43 char mPath[CC_MAX_FILE_PATH_LEN];
44 int mFd;
45};
46#endif
47