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_StringStream.h>
18 #include <UT/UT_UniquePtr.h>
19 #include <UT/UT_Array.h>
20 #include <iosfwd>
21 #include "FS_WriterStream.h"
22 
23 class FS_WriterHelper;
24 
25 /// Class for writing files
27 {
28 public:
29  /// Use this constructor to create a new writer. The specified file is
30  /// created immediately.
31  FS_Writer(const char *dest);
32 
33  virtual ~FS_Writer();
34 
35  /// Get the amount of memory owned by this FS_Writer
36  virtual int64 getMemoryUsage(bool inclusive) const;
37 
38  /// Closes the stream. After calling this function, the getStream()
39  /// function will always return @c NULL.
40  void close();
41 
42  /// This function retrieves the C++ stream object which you can interact
43  /// with in the normal ways. If this function returns @c NULL, the file
44  /// specified in the constructor could not be created.
45  std::ostream *getStream() const;
46 
47  bool removeFile();
48 
49  // Functions for adding and removing helpers.
50  static void addWriterHelper(FS_WriterHelper *helper);
51  static void removeWriterHelper(FS_WriterHelper *helper);
52 
53 private:
54  void createStreamFromDest(const char *dest);
55 
56  static UT_Array<FS_WriterHelper *> &getHelpers();
57 
58  UT_UniquePtr<UT_OStringStream> myStringStream;
60 };
61 
62 /// This class provides a plug-in method for adding a custom "file-system"
63 /// @see FS_ReaderHelper, FS_InfoHelper
65 {
66 public:
69  virtual ~FS_WriterHelper()
71 
72  /// Return an FS_WriterStream if the helper is able to open the source
73  /// filename.
74  virtual FS_WriterStream *createStream(const char *source) = 0;
75 };
76 
77 #endif
static void addWriterHelper(FS_WriterHelper *helper)
GLsizei GLsizei GLchar * source
Definition: glew.h:1832
virtual ~FS_WriterHelper()
Definition: FS_Writer.h:69
static void removeWriterHelper(FS_WriterHelper *helper)
long long int64
Definition: SYS_Types.h:111
Class for writing files.
Definition: FS_Writer.h:26
virtual void close()
#define FS_API
Definition: FS_API.h:10