Overall Structure Analysis of the metadata system (part 3)

Source: Internet
Author: User

meta-Object System Structure Analysis ( continued 3 )

Program architecture is rewritten again. This time, it should be used as the final architecture model for this test. It will take several days to work overtime. However, the source code analysis will not change. It has been stuck for two weeks and I will go slowly towards my two-year plan!

Now, let's start today's exploration:

Coming again Corelib/kernel/qmetaobject. h File. Let's take a look at it today. Qmetaenum Class, which provides Keytovalue And Valuetokey .

Const char * qmetaenum: Key (INT index) const

{

If (! Mobj)

Return 0;

Int COUNT = mobj-> D. Data [Handle + 2];

Int DATA = mobj-> D. Data [Handle + 3];

If (index> = 0& Index <count)

Return mobj-> D. stringdata + mobj-> D. Data [Data + 2 * Index];

Return 0;

}

This is the implementation of a method in this class. It can be seen that these methods qmetaobject simple reference of classes, providing method encapsulation. In this way, we get a new encapsulation method, which can be used to classify large class methods and reduce coupling.

Using the same method, Qt Set Qmetamethod , Qmetaproperty , Qmetaclassinfo Class slave Qmetaobject For classification management.

As we can see, Qmetaobject The class definition and implementation location are respectively in Qobjectdefs. h And Qobject. cpp Medium, Qt This class is included Object Type, while Qmetaobject The separated methods are placed in the metadata system. The entire metadata system, Qmetaobject The main implementation mechanism of signals and slots is provided, while other classes are encapsulated with auxiliary data processing methods.

Here, the simple Qmetaobject Class analysis is complete. Qt In this section, the relationship between classes and some simple mechanisms. As for its deeper encoding, I still cannot understand it at the moment and need to continue Qt After other studies, perform a detailed analysis. Next, we should Qt In what part of the march? I will try again tomorrow Qapplication Class, which provides Qt How is the event mechanism implemented to take over messages from the system and deliver them? Let's wait and see.

 

2009 Year 10 Month 25 Sunday 23 : 25

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.