WareSrcManager.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30  */
31 
32 
33 /**
34  @file WareSrcManager.hpp
35  @brief Header of ...
36 
37  @author Aline LIBRES <aline.libres@gmail.com>
38  @author Jean-Christophe Fabre <jean-christophe.fabre@supagro.inra.fr>
39 */
40 
41 
42 #ifndef __OPENFLUID_WARESDEV_WARESRCMANAGER_HPP__
43 #define __OPENFLUID_WARESDEV_WARESRCMANAGER_HPP__
44 
45 
46 #include <QString>
47 #include <QMap>
48 
49 #include <openfluid/dllexport.hpp>
52 
53 
54 namespace openfluid { namespace waresdev {
55 
56 
58 {
59 
61 
62 
63  public:
64 
65  struct PathInfo
66  {
67  QString m_AbsolutePath;
68 
70 
72 
73  QString m_WareName;
74 
75  bool m_isAWare;
76 
78 
80 
82 
83  QString m_FileName;
84 
86  m_AbsolutePath(""), m_IsInCurrentWorkspace(false), m_WareType(openfluid::ware::WareType::UNDEFINED),
87  m_WareName(""),
88  m_isAWare(false), m_isAWareFile(false), m_RelativePathToWareDir(""), m_AbsolutePathOfWare(""),
89  m_FileName("")
90  { }
91  };
92 
93 
94  private:
95 
96  QString m_WaresdevDirName;
97 
98  QString m_WorkspacePath;
99 
100  QString m_WaresdevPath;
101 
102  /**
103  * Absolute paths of each ware type sub-directory in the current workspace
104  */
105  QMap<openfluid::ware::WareType, QString> m_WareTypePathByWareType;
106 
107  WareSrcManager();
108 
109  ~WareSrcManager();
110 
111 
112  public:
113 
114  /**
115  Set default internal paths (workspace and waresdev sub dirs) and create them if they don't exist.
116  @param NewAbsoluteWorkspacePath
117  @throws openfluid::base::FrameworkException if a path can not be created
118  */
119  void switchWorkspace(const QString& NewAbsoluteWorkspacePath);
120 
121  QString getWareTypePath(openfluid::ware::WareType WareSrcType);
122 
123  QString getWarePath(const QString& WareID, openfluid::ware::WareType OFWareType, QString& ErrMsg);
124 
125  /**
126  Make Path absolute then splits it to retrieve PathInfo attributes.
127  @param Path
128  @return A new PathInfo
129  */
130  PathInfo getPathInfo(const QString& Path);
131 
132  QString getWaresdevPath() const;
133 
134  QString getWorkspacePath() const;
135 
136 };
137 
138 
139 } } // namespaces
140 
141 
142 #endif /* __OPENFLUID_WARESDEV_WARESRCMANAGER_HPP__ */
bool m_IsInCurrentWorkspace
Definition: WareSrcManager.hpp:69
QString m_AbsolutePath
Definition: WareSrcManager.hpp:67
QString m_WareName
Definition: WareSrcManager.hpp:73
QString m_AbsolutePathOfWare
Definition: WareSrcManager.hpp:81
QString m_RelativePathToWareDir
Definition: WareSrcManager.hpp:79
QString m_FileName
Definition: WareSrcManager.hpp:83
#define OPENFLUID_SINGLETON_DEFINITION(T)
Definition: SingletonMacros.hpp:78
openfluid::ware::WareType m_WareType
Definition: WareSrcManager.hpp:71
Definition: ApplicationException.hpp:47
bool m_isAWareFile
Definition: WareSrcManager.hpp:77
Definition: WareSrcManager.hpp:57
WareType
Definition: TypeDefs.hpp:62
#define OPENFLUID_API
Definition: dllexport.hpp:87
PathInfo()
Definition: WareSrcManager.hpp:85
Definition: WareSrcManager.hpp:65
bool m_isAWare
Definition: WareSrcManager.hpp:75