HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FS_Writer.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: FS_Writer.h ( FS Library, C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __FS_Writer__
13 #define __FS_Writer__
14 
15 #include "FS_API.h"
16 #include <UT/UT_NonCopyable.h>
17 #include <UT/UT_String.h>
18 #include <UT/UT_ValArray.h>
19 #include <iosfwd>
20 #include "FS_WriterStream.h"
21 
22 class FS_WriterHelper;
23 
24 /// Class for writing files
26 {
27 public:
28  /// Use this constructor to create a new writer. The specified file is
29  /// created immediately.
30  FS_Writer(const char *dest);
31 
32  virtual ~FS_Writer();
33 
34  /// Get the amount of memory owned by this FS_Writer
35  virtual int64 getMemoryUsage(bool inclusive) const;
36 
37  /// Closes the stream. After calling this function, the getStream()
38  /// function will always return @c NULL.
39  void close();
40 
41  /// This function retrieves the C++ stream object which you can interact
42  /// with in the normal ways. If this function returns @c NULL, the file
43  /// specified in the constructor could not be created.
44  std::ostream *getStream() const;
45 
46  bool removeFile();
47 
48  // Functions for adding and removing helpers.
49  static void addWriterHelper(FS_WriterHelper *helper);
50  static void removeWriterHelper(FS_WriterHelper *helper);
51 
52 private:
53  void createStreamFromDest(const char *dest);
54 
55  static UT_ValArray<FS_WriterHelper *> &getHelpers();
56 
57  FS_WriterStream *myStream;
58 };
59 
60 /// This class provides a plug-in method for adding a custom "file-system"
61 /// @see FS_ReaderHelper, FS_InfoHelper
63 {
64 public:
67  virtual ~FS_WriterHelper()
69 
70  /// Return an FS_WriterStream if the helper is able to open the source
71  /// filename.
72  virtual FS_WriterStream *createStream(const char *source) = 0;
73 };
74 
75 #endif
static void addWriterHelper(FS_WriterHelper *helper)
virtual ~FS_WriterHelper()
Definition: FS_Writer.h:67
static void removeWriterHelper(FS_WriterHelper *helper)
long long int64
Definition: SYS_Types.h:107
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:802
Class for writing files.
Definition: FS_Writer.h:25
virtual void close()
#define FS_API
Definition: FS_API.h:10