Главная » Просмотр файлов » Wiley.Symbian.OS.C.plus.plus.for.Mobile.Phones.Aug.2007

Wiley.Symbian.OS.C.plus.plus.for.Mobile.Phones.Aug.2007 (779890), страница 59

Файл №779890 Wiley.Symbian.OS.C.plus.plus.for.Mobile.Phones.Aug.2007 (Symbian Books) 59 страницаWiley.Symbian.OS.C.plus.plus.for.Mobile.Phones.Aug.2007 (779890) страница 592018-01-10СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 59)

For example, the following code might workfine on the emulator but fail on target (or the other way around):TResourceReader reader;...MyFunction(reader.ReadXxx(), reader.ReadXxx());The result is dependent on the order in which the two ReadXxx()calls are made, but the order of evaluation of function arguments (left toright or right to left) may differ from compiler to compiler.10.4Miscellaneous ToolsSome additional tools, which can be helpful in debugging, are availablefrom the Symbian. Developer Network website, developer.symbian.com Of particular note is SymScan, the improved successorto LeaveScan.SymScan scans your source code files to find possible problems relatedto the naming conventions and the cleanup stack.

The output is storedin a TXT file that lists misuses and potential defects in the followingcategories:• use of the deprecated literal macromacro, as it is more efficientL; you should use theLIT• correct use of the cleanup stack: are objects that you create forautomatic variables correctly put on the cleanup stack as well asremoved and destroyed again?• the correct opening and closing of R classes (connections to servers)• functions marked as non-leaving that can leave: you may forget toadd a suffix of L to the name of a method that can leave• correct use of descriptors in function calls.The source code and binary files can be downloaded from the Symbian website: developer.symbian.com\main\tools\devtools\code.

Theutility is installed into C:\Program Files\Common Files\ Symbian\Tools\, with documentation in the Start menu under Programs, SymbianOS Tools.To scan a single file:symscan <filename.cpp>SUMMARY309Different options for your scanning target can be specified; the fulloption list can be viewed by using:symscan – HSymScan can also be run from the command line to scan wholedirectories and output to a file. Use the Windows ‘for’ command to scandirectories:for /R %i in (*.cpp) do symscan "%i" >> output.txtThis scans all C++ files in or below the current directory, placingthe result in output.txt. Occurrences of the issues listed above arehighlighted with their line position within the corresponding source file.SummaryIn this chapter, we have considered how to debug Symbian OS programsusing the emulator that is included in SDKs.

We’ve looked at:• how the emulator maps drives and directories• general and debugging-specific emulator keys• emulator settings• how to debug under Carbide.c++ and CodeWarrior• logging and log files• security issues• other debugging tools• on-target debugging.You can now develop a Symbian OS application and debug it if thingsdo not work as you expected.)11The Application FrameworkIn Chapter 1, we built a simple text-mode program that displays ‘HelloWorld’ on the screen. Such programs are valuable for testing, but production programs almost invariably use a GUI. In the next few chapters,we start looking at real graphics and GUI programming in SymbianOS.In this chapter we start with an introduction to the Application Framework subsystem, UIKON, and then build a simple GUI application onboth the S60 and UIQ platforms.11.1 Symbian OS Application FrameworkUIKON, the Application Framework subsystem, is architecturally centralto Symbian OS support for GUI applications.

It provides a flexiblearchitecture which allows a variety of mobile phone platforms to run ontop of the core operating system. The two most widely used of these areS60 and UIQ, both of which are discussed in this chapter.UIKON is itself based on two important frameworks (see Figure 11.1):• CONE, the control environment, is the framework for graphical interaction (see Chapters 17 and 18)• APPARC, the application architecture, is the framework for applications and application data.UIKON provides a library of useful functions in its environmentclass, CEikonEnv,1 which is in turn derived from CCoeEnv, the CONE1If you’re wondering why the classes are prefixed with CEik rather than CUik, thereason is historical.

The original Symbian OS UI framework was called Eikon, in the days312CEikApplicationTHE APPLICATION FRAMEWORKCEikDocumentCEikAppUiCEikonEnvUIKONAPPARCCApaApplicationCONECApaDocumentFigure 11.1CCoeAppUiCCoeControlCCoeEnvFrameworks on which UIKON is builtenvironment. Your application can use these functions directly withoutthe need to write a derived class.UIKON provides a framework enabling you to build applications witha graphical user interface.

The framework encourages the use of theModel–View–Controller (MVC) design pattern, where the applicationis split into separate logical parts that encapsulate the different aspectsof the whole application. Each part in the application has a specificrole.To support the MVC pattern, the application framework providesseparate classes to represent the Model (a document, CEikDocument),the View (an application view, derived from CCoeControl) and theController (an application UI, CEikAppUi). These classes provide thebasic functionality of an application and an application typically definesits own classes to implement the desired behavior.• The application class is the entry point to the application.

It provides afactory for the application document, serves to define the properties ofthe application and provides an interface to the application’s resourcefile. In the simplest case, the only property that you have to define isthe application’s unique identifier (UID).• A document represents the data model for the application.

If theapplication is file-based, the document is responsible for storing andrestoring the application’s data. Even if the application is not filebased, it must have a document class, even though that class doesn’tdo much apart from creating the application user interface.• An application view is a concrete control whose purpose is to displaythe application data on screen and allow you to interact with it. In thesimplest case, an application view provides only the means of drawingto the screen, but most application views also provide functions forhandling input events.• The application UI is entirely invisible.

It creates an applicationview to handle drawing and screen-based interaction. In addition, itwhen Symbian OS itself was known as EPOC. The framework was renamed UIKON in alater release of Symbian OS, when Unicode support was introduced, but the class namesthemselves were not changed.S60 AND UIQ PLATFORM APPLICATION FRAMEWORKS313provides the means of processing commands that may be generated,for example, by menu items.In addition to the four C++ classes, you have to define elements of yourapplication’s GUI–the menu, possibly some shortcut keys, and any stringresources you want to use when localizing the application – in a resourcefile.

Later in this chapter, we’ll briefly describe the simple resource fileused for our example code; for further information about resource files,look at Chapter 13.All versions of Symbian OS support customization of the UI, whichis necessary to tailor the look and feel and to support the hardwarefeatures of the target machine. These features include the size and aspectratio of the screen, support for keyboard or pen-based input and therelative significance of voice-centric or data-centric applications. Thesedifferences are largely implemented by the creation of additional UI layersabove UIKON. This means that every Symbian OS GUI application,regardless of the UI platform on which it is based, uses the UIKONframework architecture.In particular, the major UIs provide their own customization layers, solet’s take a closer look at them.11.2 S60 and UIQ Platform Application FrameworksS60 and UIQ platforms extend the framework by adding libraries toprovide platform-specific controls.

The UIQ-specific library is calledQikon and the S60-specific library is called Avkon; you can view theseas UI layers on top of the core Symbian OS UI. Each contains differentcomponents, appropriate to the platform in question, although, becausethey both have UIKON as a base, their APIs are often similar.When creating a UI application for either platform, you derive frombase classes supplied by the platform-specific libraries (which themselvesusually derive from classes in the Symbian OS framework), and callframework functions specific to the platform.

To do this, you need toinclude the appropriate header files and link against libraries accordingly.For example, for UIQ, you link against qikctrl.lib, while for S60the equivalent is avkon.lib. Likewise for header files; the header filesto include for each of the application framework classes are shown inTable 11.1.Note that the CEik prefix of the generic Symbian OS classes is replacedwith CQik for UIQ classes and CAkn for S60 classes. This conventionis used throughout the UI application framework, for classes, headersand libraries. In general, if a class does not have any prefix, such asCCoeControl, it is part of the generic Symbian OS set.Generic UIKON classCEikApplication(derives fromCApaApplication)CEikDocument(derives fromCApaDocument)CEikAppUiCCoeControlClassApplicationDocumentApplication UIViewTable 11.1 Header files for UIQ and S60CCoeControlCAknAppUiCAknDocumentCAknApplicationS60 (Avkon)coecntrl.haknappui.hakndoc.haknapp.hS60 header fileCQikViewBase(derives fromCCoeControl andMCoeView)CQikAppUiCQikDocumentCQikApplicationUIQ (Qikon)qikviewbase.hqikappui.hqikdocument.hqikapplication.hUIQ header file314THE APPLICATION FRAMEWORKA GRAPHICAL HELLO WORLD31511.3 A Graphical Hello WorldOne of the first questions that many people ask is: ‘Is it possible to writean application that runs on both S60 and UIQ?’ Unfortunately, the answeris ‘No’.

As the previous section described, although each of the platformsis based on the generic Symbian OS UIKON framework, S60 and UIQeach extend it differently. When you write an application for UIQ, youmust use the UIQ-specific classes to achieve the correct look and feelfor the application. The resulting code is different from that of an S60application, which would use a set of classes specific to S60.Class StructureTo appreciate the extent of the differences, let’s have a look at the classstructure of simple graphical versions of the ‘Hello World!’ application inS60 (HelloS60, in Figure 11.2) and UIQ (HelloUIQ, in Figure 11.3).The shaded classes are the UI-platform-specific framework classes.As you can see, the structure is fairly similar, although there are somedifferences; for example the view class of the application on the S60platform accesses the CCoeControl class provided by UIKON directly,where a similar application on UIQ platform chooses to use a specificview base class provided by the UIQ framework that specializes the basiccontrol classes provided by UIKON.The different UI frameworks have the flexibility of using UIKON in thebest way suitable for their specific requirements.CHelloS60ApplicationCHelloS60DocumentCAknApplicationCAknApplicationCHelloS60AppUiCHelloS60AppViewCAknAppUiCAknAppUiBaseCEikS60ApplicationCEikDocumentCEikAppUiCApaApplicationCApaDocumentCCoeAppUiFigure 11.2 Class diagram for HelloS60CCoeControl316THE APPLICATION FRAMEWORKCHelloUIQApplicationCHelloUIQDocumentCHelloUIQAppUiCHelloUIQViewCQikApplicationCQikDocumentCQikAppUiCQikContainerCEikApplicationCEikDocumentCEikAppUiCEikBorderedControlCApaApplicationCApaDocumentCCoeAppUiCCoeControlCQikViewBaseMCoeViewFigure 11.3 Class diagram for HelloUIQGenerating the Example CodeThe HelloS60 and HelloUIQ application example code in this chapter wasgenerated using the Carbide.c++ development environment as follows:1.Start the Carbide.c++ development environment.2.Go to File, New, Project.3.Open the Symbian OS directory and choose C++ application for S60project.4.Press Next.5.Give your project a name, for example, HelloS60, and press Next.6.Choose S60 3.x GUI application and press Next.7.The list of S60 SDKs installed on your computer appears.8.Press Finish to complete the generation of your HelloS60 GUI application.Repeat Steps 2–8 for the UIQ GUI application: choose C++ applicationfor UIQ project in Step 3 and the name HelloUIQ in Step 5.In this section, you learn how to build an application for the UIKONGUI on the S60 and UIQ platforms by using our example programs.

Характеристики

Тип файла
PDF-файл
Размер
6,45 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
А знаете ли Вы, что из года в год задания практически не меняются? Математика, преподаваемая в учебных заведениях, никак не менялась минимум 30 лет. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6418
Авторов
на СтудИзбе
307
Средний доход
с одного платного файла
Обучение Подробнее