]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Server/include/plaqui/server/string.h
Luca, si podes lleva esto, no creo que termine nada mas hoy
[z.facultad/75.42/plaqui.git] / Server / include / plaqui / server / string.h
index 292055fd92895dbff668158ecb18b22009e8a9a7..ecd253a8bc53e251aadcb34ab35fbee9112dbe4c 100644 (file)
 #define PLAQUI_STRING_H
 
 #include <string>
+#include <vector>
 
-namespace Plaqui {
+namespace PlaQui {
+
+namespace Server {
 
        /// Conexión.
        class String: public std::string {
@@ -43,7 +46,12 @@ namespace Plaqui {
                        /**
                         * Destructor.
                         */
-                       virtual ~String(void) {}
+                       virtual ~String(void);
+
+                       /**
+                        * Constructor.
+                        */
+                       String(void);
 
                        /**
                         * Constructor.
@@ -52,6 +60,17 @@ namespace Plaqui {
                         */
                        String(const std::string& str);
 
+                       /**
+                        * Constructor a partir de un vector.
+                        * Convierte el vector en string uniendo sus componentes a traves
+                        * del separador.
+                        *
+                        * \param v   Vector.
+                        * \param sep Separador.
+                        */
+                       String(const std::vector<std::string>& v,
+                                       const std::string& sep);
+
                        /**
                         * Elmina caracteres al inicio y fin de un string.
                         *
@@ -69,8 +88,26 @@ namespace Plaqui {
                         */
                        String& to_lower(void);
 
+                       /**
+                        * Fracciona una cadena convirtiendola en un vector.
+                        *
+                        * \param sep Caracter usado como separador.
+                        */
+                       std::vector<std::string> split(char sep) const;
+
+                       /**
+                        * Concatena los elementos de un vector.
+                        *
+                        * \param v   Vector.
+                        * \param sep Separador.
+                        */
+                       static String join(const std::vector<std::string>& v,
+                                       const std::string& sep);
+
        };
 
 }
 
+}
+
 #endif // PLAQUI_STRING_H