X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/ffe5447aa2d71b5296cbdd36c48d5f9d59e249af..d664a4c16bb56138b53e8d6dba92e199bd3ea6c7:/Server/include/plaqui/server/string.h?ds=sidebyside diff --git a/Server/include/plaqui/server/string.h b/Server/include/plaqui/server/string.h index 74c27cd..41e83ac 100644 --- a/Server/include/plaqui/server/string.h +++ b/Server/include/plaqui/server/string.h @@ -29,6 +29,7 @@ #define PLAQUI_STRING_H #include +#include #include namespace PlaQui { @@ -48,6 +49,11 @@ namespace Server { */ virtual ~String(void); + /** + * Constructor. + */ + String(void); + /** * Constructor. * @@ -99,6 +105,29 @@ namespace Server { static String join(const std::vector& v, const std::string& sep); + /** + * Convierte un string a otro tipo. + * + * \param p Parametro del tipo al que se quiere convertir. + */ + template < class T > T& to(T& p) const { + std::stringstream ss(*this); + ss >> p; + return p; + } + + /** + * Convierte un tipo a string. + * + * \param p Parametro del tipo que se quiere convertir a string. + */ + template < class T > String& from(const T& p) { + std::stringstream ss; + ss << p; + ss >> (*this); + return *this; + } + }; }