• ui属性系统(1)VSProperty


    #define VS_NEW new
    #define VS_DELETE delete
    
    class VSProperty
    {
    public:
    enum	//Property Type
    {
      PT_VALUE,
      PT_ENUM,
      PT_DATA,//数据
      PT_ARRAY,//容器
      PT_MAP,//容器
      PT_MAX
    };
    enum	// Flag
    {
      F_NONE = 0X00,
      F_SAVE_LOAD = 0X01,
      F_CLONE = 0X02,
      F_COPY = 0X04,
      F_SAVE_LOAD_CLONE = 0X03,
      F_SAVE_LOAD_COPY = 0X05,
      F_REFLECT_NAME = 0X08,
      F_NO_USE_GC = 0X10,
      F_MAX
    };
    VSProperty()
    {
      m_pRttiOwner = NULL;
      m_pFuntionOwner = NULL;
      m_uiFlag = 0;
      m_uiElementOffset = 0;
    }
    VSProperty(VSRtti & Owner,const VSUsedName & Name,unsigned int uiElementOffset,unsigned int uiFlag)
    :m_pRttiOwner(&Owner)
    {
      m_Name = Name;
      m_uiElementOffset = uiElementOffset;
      m_uiFlag = uiFlag;
      m_pFuntionOwner = NULL;
    }
    VSProperty(VSFunction & Owner, const VSUsedName & Name, unsigned int uiElementOffset, unsigned int uiFlag)
    :m_pFuntionOwner(&Owner)
    {
    m_Name = Name;
    m_uiElementOffset = uiElementOffset;
    m_uiFlag = uiFlag;
    m_pRttiOwner = NULL;
    }
    virtual ~VSProperty()
    {
    	}
    	virtual unsigned int GetPropertyType()const = 0;
    	FORCEINLINE VSRtti * GetRtti()const
    	{
    		return m_pRttiOwner;
    	}
    	FORCEINLINE VSFunction * GetFunction()const
    	{
    		return m_pFuntionOwner;
    	}
    	FORCEINLINE const VSUsedName & GetName()const
    	{
    		return m_Name;
    	}
    	virtual void* GetValueAddress(void* pObj)const
    	{
    		return (void*)(((unsigned char*)pObj) + m_uiElementOffset);
    	}
    	virtual bool Archive(VSStream &Stream,void* pObj) = 0;
    	virtual VSProperty * GetInstance() = 0;
    	virtual void CloneData(void* pSrcObj,void* pDestObj,VSMap<VSObject *,VSObject*>& CloneMap) = 0;
    	virtual void CopyData(void* pSrcObj,void* pDestObj) = 0;
    	virtual void AddEditorElement(void * pSrcObj,VSECollection * pParent,VSString &Name) = 0;
    	virtual bool Clone(VSProperty * p)
    	{
    		if ((p->GetRtti() == GetRtti() && GetRtti()) || (p->GetFunction() == GetFunction() && GetFunction()))
    		{
    			m_Name = p->m_Name;
    			m_uiFlag = p->m_uiFlag;
    			m_uiElementOffset = p->m_uiElementOffset;
    			return true;		
    		}
    		
    		return false;
    	}
    	void SetOwner(VSRtti & Owner)
    	{
    		m_pRttiOwner = &Owner;
    	}
    	void SetOwner(VSFunction & Function)
    	{
    		m_pFuntionOwner = &Function;
    	}
    	unsigned int GetFlag()const
    	{
    		return m_uiFlag;
    	}
    	void SetFlag(unsigned int uiFlag)
    	{
    		m_uiFlag = uiFlag;
    	}
    protected:
    	VSRtti * m_pRttiOwner;
    	VSFunction * m_pFuntionOwner;
    	VSUsedName m_Name;
    	unsigned int m_uiFlag;
    	unsigned int m_uiElementOffset;
    };
     
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
  • 相关阅读:
    【Redis底层解析】链表类型
    C—数据的储存(下)
    umich cv-6-1 循环神经网络基本知识
    第九章 排序【数据结构】【精致版】
    Springboot 实践(21)服务熔断机制
    快速上手Spring Boot整合,开发出优雅可靠的Web应用!
    工业机器人多物料双姿态循环搬运工艺集成
    FastestDet---ncnn及多线程部署
    二叉树相关OJ题
    原生Javascript(数组操作方法总结)-更新
  • 原文地址:https://blog.csdn.net/thefist11cc/article/details/125612607