libnavajo
web server for static and dynamic pages developement in C++
Field.h
1 // This file is distributed under GPLv3 licence
2 // Author: Gorelov Grigory (gorelov@grigory.info)
3 //
4 // Contacts and other info are on the WEB page: grigory.info/MPFDParser
5 
6 
7 #ifndef _FIELD_H
8 #define _FIELD_H
9 
10 #include "Exception.h"
11 #include <iostream>
12 #include <fstream>
13 #include <stdlib.h>
14 #include <string.h>
15 #include <sstream>
16 #include <vector>
17 
18 namespace MPFD {
19 
20  class Field {
21  public:
22  static const int TextType = 1, FileType = 2;
23 
24  Field();
25  virtual ~Field();
26 
27  void SetType(int type);
28  int GetType();
29 
30  void AcceptSomeData(char *data, long length);
31 
32 
33  // File functions
34  void SetUploadedFilesStorage(int where);
35  void SetTempDir(std::string dir);
36 
37  void SetFileName(std::string name);
38  std::string GetFileName();
39 
40  void SetFileContentType(std::string type);
41  std::string GetFileMimeType();
42 
43  char * GetFileContent();
44  unsigned long GetFileContentSize();
45 
46  std::string GetTempFileName();
47 
48  // Text field operations
49  std::string GetTextTypeContent();
50 
51 
52 
53 
54  private:
55 
56  int WhereToStoreUploadedFiles;
57 
58  std::string TempDir, TempFile;
59  std::string FileContentType, FileName;
60 
61  int type;
62  std::vector<char> FieldContent;
63  std::ofstream file;
64 
65  };
66 }
67 #endif /* _FIELD_H */
68 
Definition: Field.h:20
Definition: Exception.h:15