Symbian Getting Started Series: Document Object analysis

Source: Internet
Author: User

Document Analysis "Inheritance relationships"

—————————————————————————— cakndocument-> ceikdocument-> capadocument —————————————————————————— "main role"

1) is the app's data model.2 in file-based Apps, document provides access to files (store/restore)

3 is responsible for creating APPUI, which can provide the basis for modifying the document, Createappuil () is responsible for creating application Appui objects.

In fact, the document acts as an intermediate layer (intermediate layer). Be responsible for establishing links between Appui and app model (engine) and file.

"appui"

-----------------------"Document"

|" model"<->"file"

Management of "document"

1) Openfilel ()

This function is closely related to the Tbuf segment (segment) in the app's resource file.

RESOURCE tbuf r_default_document_name {buf= "";} This segment determines the file name associated with the application. The filename here, along with the path, is passed as a parameter to the Openfilel () function. This allows the application to invoke the default file when it is started, and if the segment is empty, the default document name is the same as application's basename. Note here that SERIES60 only allows a default file. The return value of this function is cfilestore*, which is the pointer returned to the application framework to facilitate application The framework passes it to other functions.

Note

Note Openfilel () requires three parameters, where the filename (tdesc& afilename) and the file server session parameter (rfs& aFs) should be created automatically by the application framework. This article comes from the programming portal. But how is another parameter determined?

2) Newdocumentl ()

This function is invoked by the application framework to initialize a default document file." Note? 」

Is this function invoked if the resource file does not have a filename? If so, then this function should be in Openfilel ()

Before being called?

Explain

I overloaded the function newdocumentl () and Openfilel () in the document function, and added breakpoint tracking debugging respectively. Discovery: (#) If there is no filename in the resource file, neither of these functions is executed.

(#) If there is a filename in the resource file, then the Openfilel () function is first executed, but at this time the AOpen parameter value is 0, indicating that the file does not exist or that the file is not open. Then call Newdocumentl (), which is responsible for creating a new document file. The Storel () function of the document class is then invoked.

(#) After the above steps in the evening, rerun the app, then invoke the Openfilel () function at startup, when the AOpen parameter value is 1, indicating that the file exists, then call the Restorel () function to read and write the file.

"Management of related file"

The document class provides two functions for mode access and modification of a file. Appfilemode () and Setappfilemode ().

"Access to related file"

The document class provides the following functions to access file: Savel (); Storel (); Restorel (); Externalizel (); Printl (); Savel () is invoked when the app exits. Used to save app-related data to file.

Savel ()--> Storel (), and Restorel () is called at the time of app startup, and is responsible for keeping the file information in document-related model (engine).

"The structure of the concrete ui/engine after a careful study of @@facesymbol@@"

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.