معرفی کتاب «توسعهٔ چندسکویی در C++» (با عنوان لاتین Cross Platform Development in C++) نوشتهٔ Syd Logan، منتشرشده توسط نشر Addison-Wesley Professional; Addison-Wesley در سال 2007. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.
Cross-Platform Development in C++ is the definitive guide to developing portable C/C++ application code that will run natively on Windows, Macintosh, and Linux/Unix platforms without compromising functionality, usability, or quality. Long-time Mozilla and Netscape developer Syd Logan systematically addresses all the technical and management challenges associated with software portability from planning and design through coding, testing, and deployment. Drawing on his extensive experience with cross-platform development, Logan thoroughly covers issues ranging from the use of native APIs to the latest strategies for portable GUI development. Along the way, he demonstrates how to achieve feature parity while avoiding the problems inherent to traditional cross-platform development approaches. This book will be an indispensable resource for every software professional and technical manager who is building new cross-platform software, porting existing C/C++ software, or planning software that may someday require cross-platform support. Build Cross-Platform Applications without Compromise Throughout the book, Logan illuminates his techniques with realistic scenarios and extensive, downloadable code examples, including a complete cross-platform GUI toolkit based on Mozilla’s XUL that you can download, modify, and learn from. Coverage includes Policies and procedures used by Netscape, enabling them to ship Web browsers to millions of users on Windows, Mac OS, and Linux Delivering functionality and interfaces that are consistent on all platforms Understanding key similarities and differences among leading platform-specific GUI APIs, including Win32/.NET, Cocoa, and Gtk+ Determining when and when not to use native IDEs and how to limit their impact on portability Leveraging standards-based APIs, including POSIX and STL Avoiding hidden portability pitfalls associated with floating point, char types, data serialization, and types in C++ Utilizing platform abstraction libraries such as the Netscape Portable Runtime (NSPR) Establishing an effective cross-platform bug reporting and tracking system Creating builds for multiple platforms and detecting build failures across platforms when they occur Understanding the native runtime environment and its impact on installation Utilizing wxWidgets to create multi-platform GUI applications from a single code base Thoroughly testing application portability Understanding cross-platform GUI toolkit design with Trixul Cross-platform development in C++......Page 1 Contents......Page 8 Foreword......Page 14 Preface......Page 16 Acknowledgments......Page 24 About the Author......Page 26 Introduction......Page 28 Areas That Can Affect Software Portability......Page 30 The Role of Abstraction......Page 37 Item 1: Make All of Your Platforms a Priority......Page 44 Item 2: Code from a Common Codebase......Page 49 Platform Factory Implementations......Page 56 Implementation Classes......Page 58 Platform-Specific ProcessesImpl Classes......Page 59 Creating the Instance Hierarchy......Page 69 Organizing the Project in CVS or SVN......Page 72 Makefiles and Building the Code......Page 76 Item 3: Require Developers to Compile Their Code with Different Compilers......Page 79 Item 4: Require Developers to Build Their Code on Multiple Platforms......Page 83 Item 5: Test Builds on Each Supported Platform......Page 87 Item 6: Pay Attention to Compiler Warnings......Page 88 GNU Flags......Page 89 Microsoft Visual C++......Page 90 2 Build System/Toolchain......Page 92 Item 7: Use Whatever Compiler Makes the Most Sense for a Platform......Page 93 Item 8: Use Native IDEs When Appropriate......Page 94 Item 9: Install and Use Cygwin on Windows......Page 98 Item 10: Use a Cross-Platform Make System......Page 103 Make......Page 104 Building on Windows......Page 108 Autoconf/Automake......Page 114 Installing on Windows......Page 118 Using Imake, an Example......Page 120 Imakefiles......Page 121 Building a Complete Program from Multiple Sources......Page 122 Overriding Defaults with site.def......Page 126 Eliminating #ifdefs in Code......Page 128 Files Used by Imake......Page 134 Building Projects with Subdirectories......Page 135 Building Debug......Page 157 3 Software Configuration Management......Page 158 Item 11: Use a Cross-Platform Bug Reporting and Tracking System......Page 159 Bugzilla......Page 160 Item 12: Set Up a Tinderbox......Page 167 Item 13: Use CVS or Subversion to Manage Source Code......Page 174 Setting Up and Using CVS......Page 179 Item 14: Use Patch......Page 184 An Example......Page 185 Patch Options......Page 188 Dealing with Rejects......Page 189 Patch and Cross-Platform Development......Page 190 Item 15: Provide Support for Native Installers......Page 192 XPInstall......Page 193 Platform Installs......Page 197 5 Operating System Interfaces and Libraries......Page 248 POSIX......Page 249 Support for POSIX, SVID, XPG, and BSD......Page 253 Using Standards Support in GCC......Page 254 Microsoft Runtime Library Support for POSIX......Page 258 Using GCC on Microsoft Windows......Page 261 Deciding Which Standards to Support......Page 267 Why NSPR?......Page 269 NSPR Basics......Page 272 Threads......Page 276 Additional NSPR Functionality......Page 287 6 Miscellaneous Portability Topics......Page 300 Item 18: Take Care When Using Floating Point......Page 301 Don’t Serialize Floating-Point Values as Binary......Page 303 Equality......Page 304 Item 19: Be Explicit Regarding the Sign of Char Types......Page 305 Item 20: Avoid the Serialization of Binary Data......Page 307 Size of Integer Types......Page 320 NSPR and Types......Page 323 Sizes and Efficiency......Page 324 Integer Conversions......Page 325 Struct Alignment and Ordering......Page 326 7 User Interfaces......Page 330 Item 22: Separate the User Interface from the Model......Page 331 Separating the User Interface and Application Logic with Model/View......Page 332 Using Publish/Subscribe to Communicate between the View and the Model......Page 345 Summary......Page 349 Issues Affecting Portable Cross-Platform GUI Development......Page 350 Choosing a GUI Strategy......Page 352 8 wxWidgets......Page 356 wxWidgets......Page 358 Installing wxWidgets......Page 359 A Simple Example: Hello wxWidgets......Page 362 Creating the Application User Interface......Page 364 Building wxWidgets Applications......Page 372 Controls and Events......Page 376 Container Widgets......Page 390 Dialogs......Page 419 Composite Widgets......Page 431 Internationalization and Localization......Page 437 9 Developing a Cross-Platform GUI Toolkit in C++......Page 454 What is XUL?......Page 455 HTML......Page 456 Scripting Language......Page 460 The Document Object Model......Page 461 Style Systems......Page 464 XUL......Page 465 Boxes......Page 466 Toolbars......Page 467 Controls......Page 468 Programming with XUL......Page 469 Adding Logic to the UI with JavaScript......Page 470 Interfacing JavaScript and C/C++ Code with XPCOM and XPConnect......Page 471 Trixul......Page 473 Widget Support in Trixul......Page 474 Basic Operation of Trixul......Page 475 Widgets......Page 476 Implementation Classes......Page 479 Creating Widget Implementation Objects......Page 486 Widget Factories......Page 490 Application Main Loop......Page 493 Steps Taken by Trixul to Create a User Interface......Page 498 Documents, Elements, and the DOM......Page 499 Widget Creation......Page 502 Layout......Page 504 Scrolled Windows and Layout......Page 511 Integration with JavaScript......Page 512 Integrating with C++ Components......Page 523 A......Page 546 B......Page 547 C......Page 548 D......Page 551 E......Page 552 F......Page 553 G......Page 556 I......Page 557 J......Page 558 L......Page 559 M......Page 560 N......Page 562 P......Page 563 S......Page 566 T......Page 569 V......Page 570 W......Page 571 X-Y-Z......Page 574 Cross-platform development in C++ 1 Contents 8 Foreword 14 Preface 16 Acknowledgments 24 About the Author 26 Introduction 28 Areas That Can Affect Software Portability 30 The Role of Abstraction 37 1 Policy and Management 44 Item 1: Make All of Your Platforms a Priority 44 Item 2: Code from a Common Codebase 49 Platform Factory Implementations 56 Implementation Classes 58 Platform-Specific ProcessesImpl Classes 59 Creating the Instance Hierarchy 69 Organizing the Project in CVS or SVN 72 Makefiles and Building the Code 76 Item 3: Require Developers to Compile Their Code with Different Compilers 79 Item 4: Require Developers to Build Their Code on Multiple Platforms 83 Item 5: Test Builds on Each Supported Platform 87 Item 6: Pay Attention to Compiler Warnings 88 GNU Flags 89 Microsoft Visual C++ 90 2 Build System/Toolchain 92 Item 7: Use Whatever Compiler Makes the Most Sense for a Platform 93 Item 8: Use Native IDEs When Appropriate 94 Item 9: Install and Use Cygwin on Windows 98 Item 10: Use a Cross-Platform Make System 103 Make 104 Building on Windows 108 Autoconf/Automake 114 Imake 118 Installing on Mac OS X 118 Installing on Windows 118 Using Imake, an Example 120 Imakefiles 121 Building a Complete Program from Multiple Sources 122 Overriding Defaults with site.def 126 Eliminating #ifdefs in Code 128 Files Used by Imake 134 Building Projects with Subdirectories 135 Building Debug 157 3 Software Configuration Management 158 Item 11: Use a Cross-Platform Bug Reporting and Tracking System 159 Accessibility 160 Ability to Track Platform-Specific Bugs 160 Bugzilla 160 Item 12: Set Up a Tinderbox 167 Item 13: Use CVS or Subversion to Manage Source Code 174 Setting Up and Using CVS 179 Item 14: Use Patch 184 An Example 185 Patch Options 188 Dealing with Rejects 189 Patch and Cross-Platform Development 190 4 Installation and Deployment 192 Item 15: Provide Support for Native Installers 192 XPInstall 193 Platform Installs 197 5 Operating System Interfaces and Libraries 248 Item 16: Use Standards-Based APIs (For Example, POSIX) 249 POSIX 249 Support for POSIX, SVID, XPG, and BSD 253 Using Standards Support in GCC 254 Microsoft Runtime Library Support for POSIX 258 Using GCC on Microsoft Windows 261 Deciding Which Standards to Support 267 Item 17: Consider Using a Platform Abstraction Library Such as NSPR 269 Why NSPR? 269 NSPR Basics 272 Threads 276 Additional NSPR Functionality 287 6 Miscellaneous Portability Topics 300 Item 18: Take Care When Using Floating Point 301 Don’t Serialize Floating-Point Values as Binary 303 Equality 304 Item 19: Be Explicit Regarding the Sign of Char Types 305 Item 20: Avoid the Serialization of Binary Data 307 Item 21: Avoid Problems Related to the Size and Organization of Types 320 Size of Integer Types 320 NSPR and Types 323 Sizes and Efficiency 324 Integer Conversions 325 Struct Alignment and Ordering 326 7 User Interfaces 330 Item 22: Separate the User Interface from the Model 331 Separating the User Interface and Application Logic with Model/View 332 Using Publish/Subscribe to Communicate between the View and the Model 345 Summary 349 Item 23: Develop a Cross-Platform User Interface Strategy 350 Issues Affecting Portable Cross-Platform GUI Development 350 Choosing a GUI Strategy 352 8 wxWidgets 356 wxWidgets 358 Licensing 359 Installing wxWidgets 359 A Simple Example: Hello wxWidgets 362 Creating the Application User Interface 364 Building wxWidgets Applications 372 Controls and Events 376 Container Widgets 390 Dialogs 419 Composite Widgets 431 Internationalization and Localization 437 9 Developing a Cross-Platform GUI Toolkit in C++ 454 What is XUL? 455 DHTML 456 HTML 456 Scripting Language 460 The Document Object Model 461 Style Systems 464 XUL 465 Windows and Dialogs 466 Boxes 466 Toolbars 467 Menus 468 Controls 468 Other Widgets 469 Programming with XUL 469 Adding Logic to the UI with JavaScript 470 Interfacing JavaScript and C/C++ Code with XPCOM and XPConnect 471 Trixul 473 Widget Support in Trixul 474 Basic Operation of Trixul 475 Widgets 476 Implementation Classes 479 Creating Widget Implementation Objects 486 Widget Factories 490 Application Main Loop 493 Steps Taken by Trixul to Create a User Interface 498 Documents, Elements, and the DOM 499 Widget Creation 502 Layout 504 Scrolled Windows and Layout 511 Integration with JavaScript 512 Integrating with C++ Components 523 Index 546 A 546 B 547 C 548 D 551 E 552 F 553 G 556 H 557 I 557 J 558 K 559 L 559 M 560 N 562 O 563 P 563 Q 566 R 566 S 566 T 569 U 570 V 570 W 571 X-Y-Z 574
Cross-Platform Development in C++ is the definitive guide to developing portable C/C++ application code that will run natively on Windows, Macintosh, and Linux/Unix platforms without compromising functionality, usability, or quality.
Long-time Mozilla and Netscape developer Syd Logan systematically addresses all the technical and management challenges associated with software portability from planning and design through coding, testing, and deployment. Drawing on his extensive experience with cross-platform development, Logan thoroughly covers issues ranging from the use of native APIs to the latest strategies for portable GUI development. Along the way, he demonstrates how to achieve feature parity while avoiding the problems inherent to traditional cross-platform development approaches.
This book will be an indispensable resource for every software professional and technical manager who is building new cross-platform software, porting existing C/C++ software, or planning software that may someday require cross-platform support.
Build Cross-Platform Applications without Compromise
Throughout the book, Logan illuminates his techniques with realistic scenarios and extensive, downloadable code examples, including a complete cross-platform GUI toolkit based on Mozilla’s XUL that you can download, modify, and learn from. Coverage includes
- Policies and procedures used by Netscape, enabling them to ship Web browsers to millions of users on Windows, Mac OS, and Linux
- Delivering functionality and interfaces that are consistent on all platforms
- Understanding key similarities and differences among leading platform-specific GUI APIs,including Win32/.NET, Cocoa, and Gtk+
- Determining when and when not to use native IDEs and how to limit their impact on portability
- Leveraging standards-based APIs, including POSIX and STL
- Avoiding hidden portability pitfalls associated with floating point, char types, data serialization, and types in C++
- Utilizing platform abstraction libraries such as the Netscape Portable Runtime (NSPR)
- Establishing an effective cross-platform bug reporting and tracking system
- Creating builds for multiple platforms and detecting build failures across platforms when they occur
- Understanding the native runtime environment and its impact on installation
- Utilizing wxWidgets to create multi-platform GUI applications from a single code base
- Thoroughly testing application portability
- Understanding cross-platform GUI toolkit design with Trixul