TAILIEUCHUNG - Creating Applications with Mozilla-Chapter 8. XPCOM- P5

Tham khảo tài liệu 'creating applications with mozilla-chapter 8. xpcom- p5', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 8. XPCOM- P5 As you can see the xpidl compiler can do a lot of work for you. The code generated in Example 8-11 is a C header file that declares the methods of nsISimple. It provides the class definition macros for using the interface and a template for the class implementation which contains stubbed-out declaratory code that you can paste into your implementation file to quickly get started. . Creating the implementation file The implementation file actually contains the C code that implements the member functions and properties declared in your interface. For nsISimple these members are the yourName attribute and the write and change methods. First you need to generate a new UUID for the new implementation class you ll write. Every XPCOM implementation class must have its own UUID uuidgen 79e9424f-2c4d-4cae-a762-31b334079252 As part of the generated file all the code stubs you need to get started are ready to be copied and pasted into the C source files. You can use those stubs as a guide to implement the component. In a text editor create a new file called and enter the code shown in Example 8-12. To maintain clarity the C implementation class is named nsSimplelmpl where the default class name generated by the xpidl compiler is nsSimple and the header file is shown in Example 8-12. Example 8-12. The component header file include 79e9424f-2c4d-4cae-a762-31b334079252 define NS_SIMPLE_CID 0x79e9424f 0x2c4d 0x4cae 0xa7 0x62 0x31 0xb3 0x34 0x07 0x92 0x52 define NS_SIMPLE_CONTRACTID @ cpp_simple 1 class nsSimpleImpl public nsISimple public nsSimpleImpl virtual nsSimpleImpl nsISupports interface NS_DECL_ISUPPORTS NS_DECL_NSISIMPLE private char mName Example 8-12 includes the ID-generated header file which holds the C declarations for the interface class nsISimple. It then takes the new UUID and breaks it into a class ID struct defined as NS_SIMPLE_CID. Next it defines the .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.