summaryrefslogtreecommitdiff
path: root/tvapi/libtv/tvutils/CFile.h (plain)
blob: a19cb615f31cd3e36ab467457159bf1c110beed1
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 <string.h>
12#include <errno.h>
13
14#define CC_MAX_FILE_PATH_LEN (256)
15
16#define BUFFER_SIZE 1024
17
18class CFile {
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(void *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