From 3b36f093d9f130c3e869611be2fcf13a290d62b9 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Sun, 31 May 2009 16:34:13 +0000 Subject: [PATCH] group wxPlatformInfo functions for easier browsing; add more descriptions; link the related function group git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60841 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/doxygen/groups/funcmacro_networkuseros.h | 2 +- interface/wx/platinfo.h | 234 +++++++++++------- 2 files changed, 143 insertions(+), 93 deletions(-) diff --git a/docs/doxygen/groups/funcmacro_networkuseros.h b/docs/doxygen/groups/funcmacro_networkuseros.h index 281de56b6e..85e149b029 100644 --- a/docs/doxygen/groups/funcmacro_networkuseros.h +++ b/docs/doxygen/groups/funcmacro_networkuseros.h @@ -14,7 +14,7 @@ The functions in this section are used to retrieve information about the current computer and/or user characteristics. -Related class group: @ref group_class_net. +Related class group: @ref group_class_net, wxPlatformInfo. */ diff --git a/interface/wx/platinfo.h b/interface/wx/platinfo.h index 06eff6cb08..88b6a68d86 100644 --- a/interface/wx/platinfo.h +++ b/interface/wx/platinfo.h @@ -87,7 +87,7 @@ enum wxArchitecture wxARCH_INVALID = -1, //!< returned on error wxARCH_32, //!< 32 bit - wxARCH_64, + wxARCH_64, //!< 64 bit wxARCH_MAX }; @@ -111,15 +111,20 @@ enum wxEndianness /** @class wxPlatformInfo - This class holds informations about the operating system and the toolkit that - the application is running under and some basic architecture info of the machine - where it's running. + This class holds informations about the operating system, the toolkit and the + basic architecture of the machine where the application is currently running. + + This class does not only have @e getters for the informations above, it also has + @e setters. This allows you to e.g. save the current platform informations in a + data file (maybe in string form) so that when you later load it, you can easily + retrieve (see the static getters for string->enum conversion functions) the + signature of the system which generated it. @library{wxbase} @category{cfg} @see ::wxGetOsVersion(), wxIsPlatformLittleEndian(), wxIsPlatform64Bit(), - wxAppTraits + wxAppTraits, @ref group_funcmacro_networkuseros */ class wxPlatformInfo : public wxObject { @@ -164,34 +169,47 @@ public: GetToolkitMinorVersion(), CheckOSVersion() */ bool CheckToolkitVersion(int major, int minor) const; + /** - Returns the global wxPlatformInfo object, initialized with the values - for the currently running platform. + Returns @true if this instance is fully initialized with valid values. */ - static const wxPlatformInfo& Get(); + bool IsOk() const; /** - Converts the given string to a wxArchitecture enum value or to - @c wxARCH_INVALID if the given string is not a valid architecture string - (i.e. does not contain nor @c 32 nor @c 64 strings). + Returns @true if this wxPlatformInfo describes wxUniversal build. */ - static wxArchitecture GetArch(const wxString& arch); + bool IsUsingUniversalWidgets() const; /** - Returns the name for the given wxArchitecture enumeration value. + Inequality operator. Tests all class' internal variables. */ - static wxString GetArchName(wxArchitecture arch); + bool operator!=(const wxPlatformInfo& t) const; /** - Returns the name for the architecture of this wxPlatformInfo instance. + Equality operator. Tests all class' internal variables. */ - wxString GetArchName() const; + bool operator==(const wxPlatformInfo& t) const; + + /** + Returns the global wxPlatformInfo object, initialized with the values + for the currently running platform. + */ + static const wxPlatformInfo& Get(); + + /** + @name Static enum getters + + These getters allow for easy string-to-enumeration-value conversion. + */ + //@{ /** - Returns the architecture ID of this wxPlatformInfo instance. + Converts the given string to a wxArchitecture enum value or to + @c wxARCH_INVALID if the given string is not a valid architecture string + (i.e. does not contain nor @c 32 nor @c 64 strings). */ - wxArchitecture GetArchitecture() const; + static wxArchitecture GetArch(const wxString& arch); /** Converts the given string to a wxEndianness enum value or to @@ -201,36 +219,38 @@ public: static wxEndianness GetEndianness(const wxString& end); /** - Returns the endianness ID of this wxPlatformInfo instance. + Converts the given string to a wxOperatingSystemId enum value or to @c + wxOS_UNKNOWN if the given string is not a valid operating system name. */ - wxEndianness GetEndianness() const; + static wxOperatingSystemId GetOperatingSystemId(const wxString& name); /** - Returns name for the given wxEndianness enumeration value. + Converts the given string to a wxWidgets port ID value or to @c wxPORT_UNKNOWN + if the given string does not match any of the wxWidgets canonical name ports + ("wxGTK", "wxMSW", etc) nor any of the short wxWidgets name ports ("gtk", "msw", etc). */ - static wxString GetEndiannessName(wxEndianness end); - + static wxPortId GetPortId(const wxString& portname); + + //@} + + /** - Returns the name for the endianness of this wxPlatformInfo instance. + @name Static string-form getters + + These getters allow for easy enumeration-value-to-string conversion. */ - wxString GetEndiannessName() const; + //@{ /** - Returns the run-time major version of the OS associated with this - wxPlatformInfo instance. - - @see ::wxGetOsVersion(), CheckOSVersion() + Returns the name for the given wxArchitecture enumeration value. */ - int GetOSMajorVersion() const; + static wxString GetArchName(wxArchitecture arch); /** - Returns the run-time minor version of the OS associated with this - wxPlatformInfo instance. - - @see ::wxGetOsVersion(), CheckOSVersion() + Returns name for the given wxEndianness enumeration value. */ - int GetOSMinorVersion() const; - + static wxString GetEndiannessName(wxEndianness end); + /** Returns the operating system family name for the given wxOperatingSystemId enumeration value: @c Unix for @c wxOS_UNIX, @c Macintosh for @c wxOS_MAC, @@ -239,79 +259,75 @@ public: static wxString GetOperatingSystemFamilyName(wxOperatingSystemId os); /** - Returns the operating system family name of the OS associated with this - wxPlatformInfo instance. - */ - wxString GetOperatingSystemFamilyName() const; + Returns the name for the given operating system ID value. - /** - Converts the given string to a wxOperatingSystemId enum value or to @c - wxOS_UNKNOWN if the given string is not a valid operating system name. + This can be a long name (e.g. Microsoft Windows NT); + use GetOperatingSystemFamilyName() to retrieve a short, generic name. */ - static wxOperatingSystemId GetOperatingSystemId(const wxString& name); + static wxString GetOperatingSystemIdName(wxOperatingSystemId os); /** - Returns the operating system ID of this wxPlatformInfo instance. + Returns the name of the given wxWidgets port ID value. + The @a usingUniversal argument specifies whether the port is in its native + or wxUniversal variant. + + The returned string always starts with the "wx" prefix and is a mixed-case string. */ - wxOperatingSystemId GetOperatingSystemId() const; + static wxString GetPortIdName(wxPortId port, bool usingUniversal); /** - Returns the name for the given operating system ID value. + Returns the short name of the given wxWidgets port ID value. + The @a usingUniversal argument specifies whether the port is in its native + or wxUniversal variant. - This can be a long name (e.g. Microsoft Windows NT); - use GetOperatingSystemFamilyName() to retrieve a short, generic name. + The returned string does not start with the "wx" prefix and is always lower case. */ - static wxString GetOperatingSystemIdName(wxOperatingSystemId os); + static wxString GetPortIdShortName(wxPortId port, + bool usingUniversal); + //@} + + /** - Returns the operating system name of the OS associated with this wxPlatformInfo - instance. + @name Getters */ - wxString GetOperatingSystemIdName() const; - + //@{ /** - Converts the given string to a wxWidgets port ID value or to @c wxPORT_UNKNOWN - if the given string does not match any of the wxWidgets canonical name ports - ("wxGTK", "wxMSW", etc) nor any of the short wxWidgets name ports ("gtk", "msw", etc). + Returns the architecture ID of this wxPlatformInfo instance. */ - static wxPortId GetPortId(const wxString& portname); + wxArchitecture GetArchitecture() const; /** - Returns the wxWidgets port ID associated with this wxPlatformInfo instance. + Returns the endianness ID of this wxPlatformInfo instance. */ - wxPortId GetPortId() const; + wxEndianness GetEndianness() const; /** - Returns the name of the given wxWidgets port ID value. - The @a usingUniversal argument specifies whether the port is in its native - or wxUniversal variant. + Returns the run-time major version of the OS associated with this + wxPlatformInfo instance. - The returned string always starts with the "wx" prefix and is a mixed-case string. + @see ::wxGetOsVersion(), CheckOSVersion() */ - static wxString GetPortIdName(wxPortId port, bool usingUniversal); + int GetOSMajorVersion() const; /** - Returns the name of the wxWidgets port ID associated with this wxPlatformInfo - instance. + Returns the run-time minor version of the OS associated with this + wxPlatformInfo instance. + + @see ::wxGetOsVersion(), CheckOSVersion() */ - wxString GetPortIdName() const; + int GetOSMinorVersion() const; /** - Returns the short name of the given wxWidgets port ID value. - The @a usingUniversal argument specifies whether the port is in its native - or wxUniversal variant. - - The returned string does not start with the "wx" prefix and is always lower case. + Returns the operating system ID of this wxPlatformInfo instance. */ - static wxString GetPortIdShortName(wxPortId port, - bool usingUniversal); + wxOperatingSystemId GetOperatingSystemId() const; /** - Returns the short name of the wxWidgets port ID associated with this - wxPlatformInfo instance. + Returns the wxWidgets port ID associated with this wxPlatformInfo instance. */ - wxString GetPortIdShortName() const; + wxPortId GetPortId() const; /** Returns the run-time major version of the toolkit associated with this @@ -338,17 +354,58 @@ public: @see CheckToolkitVersion() */ int GetToolkitMinorVersion() const; + + //@} + /** - Returns @true if this instance is fully initialized with valid values. + @name String-form getters */ - bool IsOk() const; + //@{ /** - Returns @true if this wxPlatformInfo describes wxUniversal build. + Returns the name for the architecture of this wxPlatformInfo instance. */ - bool IsUsingUniversalWidgets() const; + wxString GetArchName() const; + + /** + Returns the name for the endianness of this wxPlatformInfo instance. + */ + wxString GetEndiannessName() const; + /** + Returns the operating system family name of the OS associated with this + wxPlatformInfo instance. + */ + wxString GetOperatingSystemFamilyName() const; + + /** + Returns the operating system name of the OS associated with this wxPlatformInfo + instance. + */ + wxString GetOperatingSystemIdName() const; + + /** + Returns the name of the wxWidgets port ID associated with this wxPlatformInfo + instance. + */ + wxString GetPortIdName() const; + + /** + Returns the short name of the wxWidgets port ID associated with this + wxPlatformInfo instance. + */ + wxString GetPortIdShortName() const; + + //@} + + + + /** + @name Setters + */ + //@{ + /** Sets the architecture enum value associated with this wxPlatformInfo instance. */ @@ -379,15 +436,8 @@ public: Sets the version of the toolkit associated with this wxPlatformInfo instance. */ void SetToolkitVersion(int major, int minor); - - /** - Inequality operator. Tests all class' internal variables. - */ - bool operator!=(const wxPlatformInfo& t) const; - - /** - Equality operator. Tests all class' internal variables. - */ - bool operator==(const wxPlatformInfo& t) const; + + //@} + }; -- 2.45.2