]> Creatis software - bbtk.git/blob - packages/std/src/bbstdSplitFilePathVector.cxx
#2808, #2807, #2806, #2805, #2804 BBTK Feature New Normal Add new functionality MathO...
[bbtk.git] / packages / std / src / bbstdSplitFilePathVector.cxx
1 //===== 
2 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
3 //===== 
4 #include "bbstdSplitFilePathVector.h"
5 #include "bbstdPackage.h"
6 namespace bbstd
7 {
8
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,SplitFilePathVector)
10 BBTK_BLACK_BOX_IMPLEMENTATION(SplitFilePathVector,bbtk::AtomicBlackBox);
11 //===== 
12 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
13 //===== 
14 void SplitFilePathVector::Process()
15 {
16
17 // THE MAIN PROCESSING METHOD BODY
18 //   Here we simply set the input 'In' value to the output 'Out'
19 //   And print out the output value
20 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
21 //    void bbSet{Input|Output}NAME(const TYPE&)
22 //    const TYPE& bbGet{Input|Output}NAME() const 
23 //    Where :
24 //    * NAME is the name of the input/output
25 //      (the one provided in the attribute 'name' of the tag 'input')
26 //    * TYPE is the C++ type of the input/output
27 //      (the one provided in the attribute 'type' of the tag 'input')
28
29 //    bbSetOutputOut( bbGetInputIn() );nt
30 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
31   
32         std::size_t found;
33         std::string filename;
34         
35         std::vector<std::string> LstPath;
36         std::vector<std::string> LstFileName;
37         std::vector<std::string> LstBaseName;
38         std::vector<std::string> LstExtention;
39
40         unsigned int i, size=bbGetInputIn().size();
41         for (i=0;i<size;i++)
42         {
43                 found                                   =       bbGetInputIn()[i].find_last_of("/\\");
44                 LstPath.push_back( bbGetInputIn()[i].substr(0,found+1) );
45                 filename                                = bbGetInputIn()[i].substr(found+1);
46                 LstFileName.push_back( filename );
47                 found                                   =       filename.find_last_of(".");
48                 LstBaseName.push_back( filename.substr(0,found) );
49                 LstExtention.push_back( filename.substr(found+1) );
50         }
51
52         bbSetOutputPath( LstPath );
53         bbSetOutputBaseName( LstBaseName );
54         bbSetOutputExt( LstExtention );
55         bbSetOutputFileName( LstFileName );
56
57 #ifdef _WIN32
58                 bbSetOutputSlash("\\");
59 #else
60                 bbSetOutputSlash("/");
61 #endif
62
63         
64 }
65 //===== 
66 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
67 //===== 
68 void SplitFilePathVector::bbUserSetDefaultValues()
69 {
70
71 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
72 //    Here we initialize the input 'In' to 0
73 //   bbSetInputIn(0);
74   
75 }
76 //===== 
77 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
78 //===== 
79 void SplitFilePathVector::bbUserInitializeProcessing()
80 {
81
82 //  THE INITIALIZATION METHOD BODY :
83 //    Here does nothing 
84 //    but this is where you should allocate the internal/output pointers 
85 //    if any 
86
87   
88 }
89 //===== 
90 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
91 //===== 
92 void SplitFilePathVector::bbUserFinalizeProcessing()
93 {
94
95 //  THE FINALIZATION METHOD BODY :
96 //    Here does nothing 
97 //    but this is where you should desallocate the internal/output pointers 
98 //    if any
99   
100 }
101 }
102 // EO namespace bbstd
103
104