summaryrefslogtreecommitdiff
path: root/tvapi/libtv/tvutils/CFile.h (plain)
blob: bbb5266621d40e41f4a16c0329f0dd937bc46fd5
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
18{
19public:
20 CFile(const char *path);
21 CFile();
22 virtual ~CFile();
23 virtual int openFile(const char *path);
24 virtual int closeFile();
25 virtual int writeFile(const unsigned char *pData, int uLen);
26 virtual int readFile(const unsigned char *pBuf, int uLen);
27 int copyTo(const char *dstPath);
28 static int delFile(const char *path);
29 static int getFileAttrValue(const char *path);
30 static int setFileAttrValue(const char *path, int value);
31 static int getFileAttrStr(const char *path, char *str);
32 static int setFileAttrStr(const char *path, const char *str);
33 int delFile();
34 int flush();
35 int seekTo();
36 int seekToBegin();
37 int seekToEnd();
38 int getLength();
39 int getFd()
40 {
41 return mFd;
42 };
43protected:
44 char mPath[CC_MAX_FILE_PATH_LEN];
45 int mFd;
46};
47#endif
48