diff --git a/package_bgs/ttoolbox.cpp b/package_bgs/ttoolbox.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1246c9d8856ee05d95582fdc253403598fbed112 --- /dev/null +++ b/package_bgs/ttoolbox.cpp @@ -0,0 +1,15 @@ +#include "ttoolbox.h" + +std::string TToolBox::mNzero(int i) +{ + std::ostringstream convert; + convert << i ; + std::string numberString = convert.str(); + std::string newNumberString = std::string(10 - numberString.length(), '0') + numberString; + return newNumberString; +} +std::string TToolBox::getFileName(int i) +{ + std::string fileName = "/data/"+ mNzero(i) + ".jpg"; + return fileName; +} diff --git a/package_bgs/ttoolbox.h b/package_bgs/ttoolbox.h new file mode 100644 index 0000000000000000000000000000000000000000..47d225238232403e6240d50d1da0003bc69e3253 --- /dev/null +++ b/package_bgs/ttoolbox.h @@ -0,0 +1,25 @@ +#ifndef TTOOLBOX_H +#define TTOOLBOX_H + +#include <iostream> +#include <algorithm> +#include <cstdlib> +#include <stdio.h> /* printf, scanf, puts, NULL */ +#include <stdlib.h> /* srand, rand */ +#include <time.h> /* time */ +#include <ctime> +#include <sstream> + +class TToolBox +{ +public: + + //! return the number as string with 10 digits and '0' leading ones + static std::string mNzero(int i); + + //! return string plus data path and jpg suffix + static std::string getFileName(int i); + +}; + +#endif // TTOOLBOX_H