Documentation for OpenFLUID 2.2.0
WareSrcMigrator.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 WareSrcMigrator.hpp
35 
36  @author Jean-Christophe Fabre <jean-christophe.fabre@inrae.fr>
37 */
38 
39 
40 #ifndef __OPENFLUID_WARESDEV_WARESRCMIGRATOR_HPP__
41 #define __OPENFLUID_WARESDEV_WARESRCMIGRATOR_HPP__
42 
43 
46 #include <openfluid/ware/TypeDefs.hpp>
48 #include <openfluid/dllexport.hpp>
49 
50 
51 namespace openfluid { namespace waresdev {
52 
53 
54 /**
55  Class to manage migration of wares source code
56 */
58 {
59  private:
60 
61  struct WareMigrationInfo
62  {
64 
65  openfluid::tools::Path SignatureFile;
66  std::string SignatureContent;
68 
69  openfluid::tools::Path UISignatureFile;
70  std::string UISignatureContent;
71 
72  openfluid::tools::Path DocFile;
73  std::string DocContent;
74 
75  std::string CMakeDefaultWareVar;
76  std::string CMakeWareSuffix;
77  };
78 
79 
80  openfluid::tools::Path m_SrcPathObj;
81 
82  openfluid::tools::Path m_DestPathObj;
83 
84  openfluid::tools::Path m_WorkPathObj;
85 
86  const bool m_InPlace;
87 
88  WareSrcMigratorListener* mp_Listener;
89 
90 
91  void processSignature(const WareSrcMigrator::WareMigrationInfo& Info,
92  const openfluid::tools::Path& WorkPathObj) const;
93 
94  void dispatchExistingFiles(const WareSrcMigrator::WareMigrationInfo& Info) const;
95 
96  std::pair<openfluid::tools::TemplateProcessor::Data,std::string>
97  processCMakeFiles(const WareSrcMigrator::WareMigrationInfo& Info) const;
98 
99  WareMigrationInfo prepareMigration();
100 
101  void processSources(const WareMigrationInfo& Info) const;
102 
103  void processDoc(const WareMigrationInfo& Info) const;
104 
105 
106  public:
107 
108  /**
109  Constructs a migrator
110  @param[in] SrcPath The path to the sources to migrate
111  @param[in] Listener The Listener for the migration process (must not be nullptr)
112  @param[in] DestPath The path to the migrated sources (optional). Il not given or empty,
113  the sources are migrated in the original sources path
114  */
115  WareSrcMigrator(const std::string& SrcPath, WareSrcMigratorListener* Listener,
116  const std::string& DestPath = "");
117 
118  /**
119  Performs the migration process
120  */
122 };
123 
124 
125 } } // namespaces
126 
127 
128 #endif /* __OPENFLUID_WARESDEV_WARESRCMIGRATOR_HPP__ */
Definition: FilesystemPath.hpp:62
std::map< std::string, std::string > Data
Definition: TemplateProcessor.hpp:96
Definition: WareSrcMigratorListener.hpp:51
Definition: WareSrcMigrator.hpp:58
WareSrcMigrator(const std::string &SrcPath, WareSrcMigratorListener *Listener, const std::string &DestPath="")
#define OPENFLUID_API
Definition: dllexport.hpp:86
WareType
Definition: TypeDefs.hpp:61
Definition: ApplicationException.hpp:47