Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions
nsSystemInfo Class Reference

#include <nsSystemInfo.h>

List of all members.

Public Member Functions

 nsSystemInfo ()
nsresult Init ()

Private Member Functions

 ~nsSystemInfo ()

Detailed Description

Definition at line 44 of file nsSystemInfo.h.


Constructor & Destructor Documentation

Definition at line 48 of file nsSystemInfo.cpp.

{
}

Definition at line 52 of file nsSystemInfo.cpp.

{
}

Member Function Documentation

Definition at line 57 of file nsSystemInfo.cpp.

{
    nsresult rv = nsHashPropertyBag::Init();
    NS_ENSURE_SUCCESS(rv, rv);

    static const struct {
      PRSysInfo cmd;
      const char *name;
    } items[] = {
      { PR_SI_SYSNAME, "name" },
      { PR_SI_HOSTNAME, "host" },
      { PR_SI_ARCHITECTURE, "arch" },
      { PR_SI_RELEASE, "version" }
    };

    for (PRUint32 i = 0; i < (sizeof(items) / sizeof(items[0])); i++) {
      char buf[SYS_INFO_BUFFER_LENGTH];
      if (PR_GetSystemInfo(items[i].cmd, buf, sizeof(buf)) == PR_SUCCESS) {
        rv = SetPropertyAsACString(NS_ConvertASCIItoUTF16(items[i].name),
                                   nsDependentCString(buf));
        NS_ENSURE_SUCCESS(rv,rv);
      }
      else
        NS_WARNING("PR_GetSystemInfo failed");
    }

#ifdef MOZ_WIDGET_GTK2
    // This must be done here because NSPR can only separate OS's when compiled, not libraries.
    char* gtkver = PR_smprintf("GTK %u.%u.%u", gtk_major_version, gtk_minor_version, gtk_micro_version);
    if (gtkver) {
      rv = SetPropertyAsACString(NS_ConvertASCIItoUTF16("secondaryLibrary"),
                                 nsDependentCString(gtkver));
      PR_smprintf_free(gtkver);
      NS_ENSURE_SUCCESS(rv, rv);
    }
#endif
   
    return NS_OK;
}

The documentation for this class was generated from the following files: