MDriveMap.h
1 /*****************************************************************************
2  **
3  ** Header file for Muster API Drivemap object
4  **
5  ** Name : MDriveMap.h
6  ** Author : Leonardo Bernardini
7 ** Version : Alpha 9.0 Wed May 17th 2017
8  **
9  ** Copyright 2000-2017, Virtual Vertex
10  ** All Rights Reserved.
11  **
12  ** This file contains UNPUBLISHED PROPRIETARY SOURCE CODE.
13  ** The contents of this file may not be disclosed to third parties, copied
14  ** or duplicated in any form, in whole or in part, without the prior written
15  ** permission of the author.
16  **
17  *****************************************************************************/
18 #ifndef MDRIVEMAP_H
19 #define MDRIVEMAP_H
20 
21 
22 #ifdef WIN32
23 // Windows definitions
24 #ifdef MCLIENTLIB_EXPORTS
25 #define MCLIENTLIB_API __declspec(dllexport)
26 #else
27 #define MCLIENTLIB_API __declspec(dllimport)
28 #endif
29 #else
30 
31 #ifndef MCLIENTLIB_EXPORTS
32 #ifdef LINUX
33 #define MCLIENTLIB_API
34 #else
35 #define MCLIENTLIB_API
36 #endif
37 #else
38 #define MCLIENTLIB_API
39 #endif
40 #endif
41 
42 #if defined(_WIN32)
43 #pragma warning(disable: 4251)
44 #endif // _WIN32
45 
46 #include <string>
47 #include <vector>
48 #include <map>
49 
50 namespace MClientLib {
51 
62  class MCLIENTLIB_API MDriveMap {
63  public:
68  kOnJobStartup
69  };
70 
76  kOnNever
77  };
78 
79  private:
80  std::string drive;
81  std::string path;
82  int connectionPolicy;
83  int disconnectionPolicy;
84 
85  public:
86  #ifndef SWIG
87  MDriveMap& operator=( const MDriveMap& src );
88  MDriveMap(const MDriveMap &src);
89  #endif
90  MDriveMap();
91  std::string getDrive();
92  std::string getPath();
93  int getDisconnectionPolicy();
94  int getConnectionPolicy();
95  void setDrive(const std::string&);
96  void setPath(const std::string&);
97  void setDisconnectionPolicy(int);
98  void setConnectionPolicy(int);
99 
100  static std::vector<MDriveMap> Unmarshall(const std::string& );
101  static std::string Marshall(const std::vector<MDriveMap>& list);
102  };
103 
106  class _Win32MappedDrive {
107 
108  public:
109  _Win32MappedDrive() {
110  refCount = 0; staticSource = true; status = true; deallocable = true;
111  connectionPolicy = 0; disconnectionPolicy = 0;
112  }
113  std::string drive;
114  std::string netpath;
115  int refCount;
116  bool staticSource; // If it comes from a static mapping or from a dynamic mapping
117  bool status; // Drives has been mapped successfully ?
118  int connectionPolicy, disconnectionPolicy;
119  bool deallocable;
120  };
121  typedef std::map <std::string, _Win32MappedDrive*> networkMaps;
122 
126 }
127 
128 #endif
Class holding a Windows static drive mapping entry.
Definition: MDriveMap.h:62