1 #if !defined(_UTILS_H_)
37 #include <boost/bind.hpp>
38 #include <boost/date_time.hpp>
39 #include <boost/filesystem.hpp>
40 #include <boost/function.hpp>
45 template<
typename T,
typename TDesti>
class Te_Operador_Insercio;
46 template<
typename T,
typename TOrigen>
class Te_Operador_Extraccio;
91 template<
typename T> std::string
to_string(
const T & obj,
95 std::ostringstream ss;
123 std::istringstream ss(s);
135 template<
typename Str>
const typename Str::value_type
final(
const Str & s) {
136 assert( s.size() > 0 );
163 std::string
lpad(
const std::string & s,
size_t mida,
char f =
' ');
171 std::string
rpad(
const std::string & s,
size_t mida,
char f =
' ');
190 std::string
formata_data(
const boost::posix_time::ptime & t,
const std::string & fmt);
199 std::string
formata_data(
const std::time_t t,
const std::string & fmt);
208 template<
typename Iterador,
typename Separador = std::
string>
210 Iterador ini, Iterador fi,
211 const Separador & sep)
213 while (ini != (fi-1)) {
239 template<
typename Iterador,
typename Separador = std::
string>
241 Iterador ini, Iterador fi,
242 const Separador & sep =
"\n") {
264 template<
typename Iterador,
typename Separador = std::
string>
267 return boost::bind<std::ostream&>(&impl::each_shl<Iterador>, _1, ini, fi, sep);
294 template<
typename Conten
idor,
typename Separador = std::
string>
296 return each_shl(c.begin(), c.end(), sep);
312 return formata_data(boost::posix_time::second_clock::universal_time(), fmt);
347 const std::string first = t.first;
348 const std::string second = t.second;
398 template<
typename T,
typename TDesti = std::ostream>
424 template<
typename T,
typename TOrigen = std::istream>