Apply shared_ptr to Tuple pointers handled by Tuple & Datbase
[platform/core/context/context-common.git] / include / Tuple.h
index e63caaa..69a90bd 100644 (file)
@@ -17,6 +17,7 @@
 #ifndef __CONTEXT_TUPLE_H__
 #define __CONTEXT_TUPLE_H__
 
+#include <memory>
 #include <vector>
 #include <string>
 #include <ContextTypes.h>
@@ -25,6 +26,7 @@ namespace ctx {
 
        class EXPORT_API Tuple {
        public:
+               Tuple(GVariant* gVar);
                ~Tuple();
 
                unsigned int size();
@@ -34,16 +36,14 @@ namespace ctx {
                bool getAt(unsigned int idx, std::string* val);
                bool getAt(unsigned int idx, const char** val);
 
-               static Tuple* duplicate(Tuple& tuple);
+               static std::shared_ptr<Tuple> duplicate(std::shared_ptr<Tuple> tuple);
 
-               static GVariant* toGVariant(Tuple* tuple);
-               static GVariant* toGVariant(std::vector<Tuple*>& tuples);
+               static GVariant* toGVariant(std::shared_ptr<Tuple> tuple);
+               static GVariant* toGVariant(std::vector<std::shared_ptr<Tuple>>& tuples);
 
-               static std::vector<Tuple*> buildFrom(GVariant* gVar);
+               static std::vector<std::shared_ptr<Tuple>> buildFrom(GVariant* gVar);
 
        private:
-               Tuple(GVariant* gVar);
-
                bool __parse();
                bool __verify(unsigned int idx, const GVariantType* type);
 
@@ -61,7 +61,7 @@ namespace ctx {
                        Builder& add(double val);
                        Builder& add(const std::string& val);
 
-                       Tuple* build();
+                       std::shared_ptr<Tuple> build();
 
                private:
                        bool __init();