File: Directory.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 (55 lines) | stat: -rw-r--r-- 1,650 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
46
47
48
49
50
51
52
53
54
55
#ifndef DIRECTORY_H
#define DIRECTORY_H

#include <sys/types.h>
#include <vector>
#include <string>

#include "Tools.h"

//----------------------------------------------------------------------------
class Directory
{
  public:
    //------------------------------------------------------------------------
    typedef std::vector<std::string> FileList;

    //------------------------------------------------------------------------
    Directory();
    Directory(const char *name);
    ~Directory();

    //------------------------------------------------------------------------
    void read(const char *name);

    //------------------------------------------------------------------------
    const char *getName() const;

    //------------------------------------------------------------------------
    bool hasDirectory(const char *name) const;
    bool hasFile(const char *name) const;

    //------------------------------------------------------------------------
    void getFilesWithSuffix(const char* suffix, FileList &list) const;

    //------------------------------------------------------------------------
    static bool hasDirectoryInCwd(const char *name);

    static bool hasFileInCwd(const char *name);

    static void chdir(const char *name);

    static void mkdir(const char *name,
                      mode_t mode = 0755,
                      bool recursive = false);

    static void rmdir(const char *name, bool recursive = false);

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


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

#endif //DIRECTORY_H