--- /dev/null
+//=====
+// 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)
+//=====
+#include "bbstdReplaceCleanString.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,ReplaceCleanString)
+BBTK_BLACK_BOX_IMPLEMENTATION(ReplaceCleanString,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+void ReplaceCleanString::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (the one provided in the attribute 'name' of the tag 'input')
+// * TYPE is the C++ type of the input/output
+// (the one provided in the attribute 'type' of the tag 'input')
+
+// bbSetOutputOut( bbGetInputIn() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+ std::string subjectIn = bbGetInputIn();
+ if (bbGetInputSearch().length()!=0)
+ {
+ size_t pos = 0;
+ while((pos = subjectIn.find(bbGetInputSearch(), pos)) != std::string::npos)
+ {
+ subjectIn.replace(pos, bbGetInputSearch().length(), bbGetInputReplace());
+ pos += bbGetInputReplace().length();
+ } // while
+ }
+ bbSetOutputOut( subjectIn );
+}
+//=====
+// 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)
+//=====
+void ReplaceCleanString::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputReplace("");
+ bbSetInputSearch("");
+
+
+
+}
+//=====
+// 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)
+//=====
+void ReplaceCleanString::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+
+}
+//=====
+// 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)
+//=====
+void ReplaceCleanString::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbstd
+
+
--- /dev/null
+//=====
+// 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)
+//=====
+#ifndef __bbstdReplaceCleanString_h_INCLUDED__
+#define __bbstdReplaceCleanString_h_INCLUDED__
+
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT ReplaceCleanString
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(ReplaceCleanString,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+ BBTK_DECLARE_INPUT(In,std::string);
+ BBTK_DECLARE_INPUT(Replace,std::string);
+ BBTK_DECLARE_INPUT(Search,std::string);
+ BBTK_DECLARE_OUTPUT(Out,std::string);
+ BBTK_PROCESS(Process);
+ void Process();
+//=====
+// 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)
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(ReplaceCleanString,bbtk::AtomicBlackBox);
+ BBTK_NAME("ReplaceCleanString");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(ReplaceCleanString,In,"Input string",std::string,"");
+ BBTK_INPUT(ReplaceCleanString,Replace,"New string to be put",std::string,"");
+ BBTK_INPUT(ReplaceCleanString,Search,"String to be replaced",std::string,"");
+ BBTK_OUTPUT(ReplaceCleanString,Out,"Output string",std::string,"");
+BBTK_END_DESCRIBE_BLACK_BOX(ReplaceCleanString);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbstd
+
+#endif // __bbstdReplaceCleanString_h_INCLUDED__
+
for ( i=0 ; i<size ; i++ )
{
subjectInVec = bbGetInputIn()[i];
- size_t pos = 0;
- while((pos = subjectInVec.find(bbGetInputSearch(), pos)) != std::string::npos)
+ if (bbGetInputSearch().length()!=0)
{
- subjectInVec.replace(pos, bbGetInputSearch().length(), bbGetInputReplace());
- pos += bbGetInputReplace().length();
- } // while
+ size_t pos = 0;
+ while((pos = subjectInVec.find(bbGetInputSearch(), pos)) != std::string::npos)
+ {
+ subjectInVec.replace(pos, bbGetInputSearch().length(), bbGetInputReplace());
+ pos += bbGetInputReplace().length();
+ } // while
+ } // if
tmpLst.push_back( subjectInVec );
} // for