/[svn]/libgig/trunk/src/Serialization.h
ViewVC logotype

Diff of /libgig/trunk/src/Serialization.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3146 by schoenebeck, Wed May 3 19:54:08 2017 UTC revision 3153 by schoenebeck, Sat May 6 13:43:43 2017 UTC
# Line 178  namespace Serialization { Line 178  namespace Serialization {
178      typedef std::vector<UID> UIDChain;      typedef std::vector<UID> UIDChain;
179    
180      // prototyping of private internal friend functions      // prototyping of private internal friend functions
181        static String _encodePrimitiveValue(const Object& obj);
182      static DataType _popDataTypeBlob(const char*& p, const char* end);      static DataType _popDataTypeBlob(const char*& p, const char* end);
183      static Member _popMemberBlob(const char*& p, const char* end);      static Member _popMemberBlob(const char*& p, const char* end);
184      static Object _popObjectBlob(const char*& p, const char* end);      static Object _popObjectBlob(const char*& p, const char* end);
185      static void _popPrimitiveValue(const char*& p, const char* end, Object& obj);      static void _popPrimitiveValue(const char*& p, const char* end, Object& obj);
186        static String _primitiveObjectValueToString(const Object& obj);
187    
188      /** @brief Abstract reflection of a native C++ data type.      /** @brief Abstract reflection of a native C++ data type.
189       *       *
# Line 286  namespace Serialization { Line 288  namespace Serialization {
288          bool m_isPointer;          bool m_isPointer;
289    
290          friend DataType _popDataTypeBlob(const char*& p, const char* end);          friend DataType _popDataTypeBlob(const char*& p, const char* end);
291            friend class Archive;
292      };      };
293    
294      /** @brief Abstract reflection of a native C++ class/struct's member variable.      /** @brief Abstract reflection of a native C++ class/struct's member variable.
# Line 359  namespace Serialization { Line 362  namespace Serialization {
362          std::vector<Member>& members() { return m_members; }          std::vector<Member>& members() { return m_members; }
363          const std::vector<Member>& members() const { return m_members; }          const std::vector<Member>& members() const { return m_members; }
364          Member memberNamed(String name) const;          Member memberNamed(String name) const;
365          void remove(const Member& member);          Member memberByUID(const UID& uid) const;
366          std::vector<Member> membersOfType(const DataType& type) const;          std::vector<Member> membersOfType(const DataType& type) const;
367          int sequenceIndexOf(const Member& member) const;          int sequenceIndexOf(const Member& member) const;
368          bool isValid() const;          bool isValid() const;
# Line 370  namespace Serialization { Line 373  namespace Serialization {
373          bool operator<(const Object& other) const;          bool operator<(const Object& other) const;
374          bool operator>(const Object& other) const;          bool operator>(const Object& other) const;
375    
376        protected:
377            void remove(const Member& member);
378    
379      private:      private:
380          DataType m_type;          DataType m_type;
381          UIDChain m_uid;          UIDChain m_uid;
# Line 378  namespace Serialization { Line 384  namespace Serialization {
384          RawData m_data;          RawData m_data;
385          std::vector<Member> m_members;          std::vector<Member> m_members;
386    
387            friend String _encodePrimitiveValue(const Object& obj);
388          friend Object _popObjectBlob(const char*& p, const char* end);          friend Object _popObjectBlob(const char*& p, const char* end);
389          friend void _popPrimitiveValue(const char*& p, const char* end, Object& obj);          friend void _popPrimitiveValue(const char*& p, const char* end, Object& obj);
390            friend String _primitiveObjectValueToString(const Object& obj);
391            friend class Archive;
392      };      };
393    
394      /** @brief Destination container for serialization, and source container for deserialization.      /** @brief Destination container for serialization, and source container for deserialization.
# Line 533  namespace Serialization { Line 542  namespace Serialization {
542              deserialize(&obj);              deserialize(&obj);
543          }          }
544    
545          const RawData& rawData() const { return m_rawData; }          const RawData& rawData();
546          virtual String rawDataFormat() const;          virtual String rawDataFormat() const;
547    
548          template<typename T_classType, typename T_memberType>          template<typename T_classType, typename T_memberType>
# Line 567  namespace Serialization { Line 576  namespace Serialization {
576          virtual void decode(const RawData& data);          virtual void decode(const RawData& data);
577          virtual void decode(const uint8_t* data, size_t size);          virtual void decode(const uint8_t* data, size_t size);
578          void clear();          void clear();
579            bool isModified() const;
580            void removeMember(Object& parent, const Member& member);
581          void remove(const Object& obj);          void remove(const Object& obj);
582          Object& rootObject();          Object& rootObject();
583          Object& objectByUID(const UID& uid);          Object& objectByUID(const UID& uid);
584            void setAutoValue(Object& object, String value);
585            void setIntValue(Object& object, int64_t value);
586            void setRealValue(Object& object, double value);
587            void setBoolValue(Object& object, bool value);
588            void setEnumValue(Object& object, uint64_t value);
589            String valueAsString(const Object& object);
590    
591      protected:      protected:
592          // UID resolver for non-pointer types          // UID resolver for non-pointer types
# Line 676  namespace Serialization { Line 693  namespace Serialization {
693          operation_t m_operation;          operation_t m_operation;
694          UID m_root;          UID m_root;
695          RawData m_rawData;          RawData m_rawData;
696            bool m_isModified;
697      };      };
698    
699      /**      /**

Legend:
Removed from v.3146  
changed lines
  Added in v.3153

  ViewVC Help
Powered by ViewVC