HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_WebServerUploadedFile.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  * COMMENTS:
7  */
8 
9 #ifndef __HOM_WebServerUploadedFile_h__
10 #define __HOM_WebServerUploadedFile_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_Defines.h"
14 #include "HOM_Errors.h"
15 #include "HOM_Module.h"
16 #include "HOM_BinaryString.h"
18 
19 SWIGOUT(%rename(WebServerUploadedFile) HOM_WebServerUploadedFile;)
20 
22 {
23 public:
26  : myUploadedFile(uploaded_file)
27  , myStream(myUploadedFile)
28  { HOM_CONSTRUCT_OBJECT(this) }
29 
31  { HOM_DESTRUCT_OBJECT(this) }
32 
34 
36  { return myUploadedFile.name().toStdString(); }
37 
38  bool isInMemory()
39  { return myUploadedFile.isInMemory(); }
40 
42  { return myUploadedFile.fileLocation().toStdString(); }
43 
44  void saveToDisk()
45  { myUploadedFile.forceToStorage(); }
46 
48  { return myUploadedFile.size(); }
49 
51  {
52  if (max_size == 0)
53  return "";
54 
56  if (max_size < 0)
57  myStream.read(result);
58  else
59  myStream.readNextChunk(max_size, result);
60 
61  if (result.size() == 0)
62  myUploadedFile.removeTempFile();
63 
64  return result;
65  }
66 
67  SWIGOUT(%ignore myUploadedFile;)
68  NET_HTTPUploadedFile &myUploadedFile;
69  SWIGOUT(%ignore myStream;)
71 };
72 
73 #endif
HOM_BinaryString read(int64 max_size=-1)
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1210
OIIO_API bool rename(string_view from, string_view to, std::string &err)
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:349
#define HOM_API
Definition: HOM_API.h:13
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1209
long long int64
Definition: SYS_Types.h:116
GLsizei const GLchar *const * string
Definition: glew.h:1844
Read data from an uploaded file.
GLuint64EXT * result
Definition: glew.h:14007
HOM_WebServerUploadedFile(NET_HTTPUploadedFile &uploaded_file)