PhoenixFileParser  2.0.2
Set of tools to ease file parsing
Loading...
Searching...
No Matches
directory_replace_placeholder.h File Reference
#include <map>
#include "PPath.h"
Include dependency graph for directory_replace_placeholder.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool directory_replace_placeholder (const PPath &outputDir, const PPath &inputConfigDir, const PMapString &mapReplacePlaceholder)
 Replace placeholder in a directory and its content by respect to the given map of value for all place holder.

Function Documentation

◆ directory_replace_placeholder()

bool directory_replace_placeholder ( const PPath & outputDir,
const PPath & inputConfigDir,
const PMapString & mapReplacePlaceholder )

Replace placeholder in a directory and its content by respect to the given map of value for all place holder.

Parameters
outputDir: output directory
inputConfigDir: input configuration directory
mapReplacePlaceholder: map of placeholders and values to be replaced with
Returns
true on success, false otherwise

Definition at line 85 of file directory_replace_placeholder.cpp.

85 {
86 if(!outputDir.createDirectory()){
87 std::cerr << "directory_replace_placeholder : cannot create dir '"<<outputDir<<"'" << std::endl;
88 return false;
89 }
90 //Let's get content of inputConfigDir
91 PVecPath vecDirInputDir = inputConfigDir.getAllDirectoryInDir();
92 bool b(true);
93 for(PVecPath::iterator itDir(vecDirInputDir.begin()); itDir != vecDirInputDir.end(); ++itDir){
94 PPath relativeDir = itDir->replace(mapReplacePlaceholder);
95 PPath fullInputDir = inputConfigDir / *itDir;
96 PPath fullOutputDir = outputDir / relativeDir;
97 b &= fullOutputDir.createDirectory();
98
99 b &= directory_replace_placeholderFile(fullOutputDir, fullInputDir, mapReplacePlaceholder);
100 b &= directory_replace_placeholder(fullOutputDir, fullInputDir, mapReplacePlaceholder);
101 }
102 b &= directory_replace_placeholderFile(outputDir, inputConfigDir, mapReplacePlaceholder);
103 if(!b){
104 std::cerr << "directory_replace_placeholder : cannot create output directories architecture" << std::endl;
105 std::cerr << "\tinputConfigDir = '"<<inputConfigDir<<"'" << std::endl;
106 std::cerr << "\toutputDir = '"<<outputDir<<"'" << std::endl;
107 return false;
108 }
109 return b;
110}
bool directory_replace_placeholder(const PPath &outputDir, const PPath &inputConfigDir, const PMapString &mapReplacePlaceholder)
Replace placeholder in a directory and its content by respect to the given map of value for all place...
bool directory_replace_placeholderFile(const PPath &outputDir, const PPath &inputConfigDir, const PMapString &mapReplacePlaceholder)
Replace placeholder in a directory and its content by respect to the given map of value for all place...

References directory_replace_placeholder(), and directory_replace_placeholderFile().

Referenced by directory_replace_placeholder().

Here is the call graph for this function:
Here is the caller graph for this function: