Lucene++ - a full-featured, c++ search engine
API Documentation


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FileSwitchDirectory.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6 
7 #ifndef FILESWITCHDIRECTORY_H
8 #define FILESWITCHDIRECTORY_H
9 
10 #include "Directory.h"
11 
12 namespace Lucene
13 {
21  class LPPAPI FileSwitchDirectory : public Directory
22  {
23  public:
24  FileSwitchDirectory(HashSet<String> primaryExtensions, DirectoryPtr primaryDir, DirectoryPtr secondaryDir, bool doClose);
25  virtual ~FileSwitchDirectory();
26 
28 
29  protected:
30  HashSet<String> primaryExtensions;
33  bool doClose;
34 
35  public:
37  DirectoryPtr getPrimaryDir();
38 
40  DirectoryPtr getSecondaryDir();
41 
43  virtual void close();
44 
46  virtual HashSet<String> listAll();
47 
49  static String getExtension(const String& name);
50 
52  virtual bool fileExists(const String& name);
53 
55  virtual uint64_t fileModified(const String& name);
56 
58  virtual void touchFile(const String& name);
59 
61  virtual void deleteFile(const String& name);
62 
64  virtual int64_t fileLength(const String& name);
65 
68  virtual IndexOutputPtr createOutput(const String& name);
69 
73  virtual void sync(const String& name);
74 
78  virtual IndexInputPtr openInput(const String& name);
79 
80  protected:
81  DirectoryPtr getDirectory(const String& name);
82  };
83 }
84 
85 #endif

clucene.sourceforge.net