File: File.h

package info (click to toggle)
moagg 0.18-6
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 1,924 kB
  • ctags: 4,059
  • sloc: cpp: 23,814; sh: 2,652; makefile: 283
file content (45 lines) | stat: -rw-r--r-- 999 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef FILE_H
#define FILE_H

#include <stdint.h>
#include <string>

#include "Tools.h"

//----------------------------------------------------------------------------
class File
{
  public:
    File(const char *name, const char *mode = "r");
    ~File();

    const char *getName() const;

    bool isEOF() const;

    void seek(long offset);
    long tell() const;

    uint8_t readUint8();
    void writeUint8(uint8_t value);
    uint16_t readUint16();
    void writeUint16(uint16_t value);

    size_t read(void *buffer, size_t len);
    size_t write(const void *buffer, size_t len);

    int puts(const char *s);
    int puts(const std::string &s);

    void readline(char *buffer, size_t len);

    //------------------------------------------------------------------------
    static void unlink(const char *name);

    static void copy(const char *src, const char *dst);

    //------------------------------------------------------------------------
    DECLARE_PIMPL;
};

#endif //FILE_H