~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/cached_directory.h

Added code necessary for building plugins dynamically.
Merged in changes from lifeless to allow autoreconf to work.
Touching plugin.ini files now triggers a rebuid - so config/autorun.sh is no
longer required to be run after touching those.
Removed the duplicate plugin names - also removed the issue that getting them
different would silently fail weirdly later.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#ifndef MYSYS_CACHED_DIRECTORY_H
29
29
#define MYSYS_CACHED_DIRECTORY_H
30
30
 
 
31
#include <iostream>
31
32
#include <vector>
 
33
#include <set>
32
34
#include <string>
33
35
#include <dirent.h>
34
36
#include <stdlib.h>
43
45
 */
44
46
class CachedDirectory
45
47
{
 
48
  std::string path;
 
49
 
46
50
public:
47
51
  class Entry
48
52
  {
57
61
  int error; ///< Error code stored from various syscalls
58
62
  Entries entries; ///< Entries in the directory
59
63
 
 
64
public:
60
65
  /**
61
 
   * Encapsulate the logic to open the directory.
62
 
   * @param[in] dirPath The path to the directory to open and read.
63
 
   * @retval true Success
64
 
   * @retval false Failure
 
66
   * Emptry Constructor.
 
67
   *
65
68
   */
66
 
  bool open(const std::string &dirPath);
67
 
 
68
 
public:
69
 
  explicit CachedDirectory()
70
 
    : error(0)
71
 
  {}
 
69
  CachedDirectory();
72
70
      
73
71
  /**
74
72
   * Constructor taking full directory path as sole parameter.
75
73
   *
76
74
   * @param[in] Path to the directory to open
 
75
   * @param[in] File extensions to mask against.
77
76
   */
78
 
 CachedDirectory(const std::string &in_path); 
 
77
 CachedDirectory(const std::string& in_path); 
 
78
 CachedDirectory(const std::string& in_path, std::set<std::string>& exts);
 
79
 
79
80
 /**
80
81
  * Destructor.  Cleans up any resources we've taken 
81
82
  */
98
99
    return error;
99
100
  }
100
101
 
 
102
  /** 
 
103
   * Returns the current path for the cached directory
 
104
   */
 
105
  inline const char *getPath() const
 
106
  {
 
107
    return path.c_str();
 
108
  }
 
109
 
101
110
  /**
102
111
   * Return the list of entries read from the directory
103
112
   *
108
117
  {
109
118
    return entries;
110
119
  }
 
120
 
 
121
  /**
 
122
   * Encapsulate the logic to open the directory.
 
123
   * @param[in] dirPath The path to the directory to open and read.
 
124
   * @param[in] File extensions to mask against.
 
125
   * @retval true Success
 
126
   * @retval false Failure
 
127
   */
 
128
  bool open(const std::string &dirPath);
 
129
  bool open(const std::string &in_path, std::set<std::string> exts, bool honor_exts= true);
 
130
 
111
131
};
112
132
 
113
133
#endif /* MYSYS_CACHED_DIRECTORY_H */