Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
nsInstallVersion Class Reference

#include <nsInstallVersion.h>

Inheritance diagram for nsInstallVersion:
Inheritance graph
[legend]
Collaboration diagram for nsInstallVersion:
Collaboration graph
[legend]

List of all members.

Public Types

enum  {
  EQUAL = 0, BLD_DIFF = 1, BLD_DIFF_MINUS = -1, REL_DIFF = 2,
  REL_DIFF_MINUS = -2, MINOR_DIFF = 3, MINOR_DIFF_MINUS = -3, MAJOR_DIFF = 4,
  MAJOR_DIFF_MINUS = -4
}

Public Member Functions

 nsInstallVersion ()
virtual ~nsInstallVersion ()
NS_DECL_ISUPPORTS NS_IMETHOD GetScriptObject (nsIScriptContext *aContext, void **aScriptObject)
NS_IMETHOD SetScriptObject (void *aScriptObject)
NS_IMETHOD Init (PRInt32 aMajor, PRInt32 aMinor, PRInt32 aRelease, PRInt32 aBuild)
NS_IMETHOD Init (const nsString &aVersionString)
NS_IMETHOD GetMajor (PRInt32 *aMajor)
NS_IMETHOD SetMajor (PRInt32 aMajor)
NS_IMETHOD GetMinor (PRInt32 *aMinor)
NS_IMETHOD SetMinor (PRInt32 aMinor)
NS_IMETHOD GetRelease (PRInt32 *aRelease)
NS_IMETHOD SetRelease (PRInt32 aRelease)
NS_IMETHOD GetBuild (PRInt32 *aBuild)
NS_IMETHOD SetBuild (PRInt32 aBuild)
NS_IMETHOD ToString (nsString &aReturn)
NS_IMETHOD CompareTo (nsIDOMInstallVersion *aVersion, PRInt32 *aReturn)
NS_IMETHOD CompareTo (const nsString &aString, PRInt32 *aReturn)
NS_IMETHOD CompareTo (PRInt32 aMajor, PRInt32 aMinor, PRInt32 aRelease, PRInt32 aBuild, PRInt32 *aReturn)

Static Public Member Functions

static const nsIIDIID ()

Private Attributes

voidmScriptObject
PRInt32 mMajor
PRInt32 mMinor
PRInt32 mRelease
PRInt32 mBuild

Detailed Description

Definition at line 15 of file nsInstallVersion.h.


Member Enumeration Documentation

anonymous enum [inherited]
Enumerator:
EQUAL 
BLD_DIFF 
BLD_DIFF_MINUS 
REL_DIFF 
REL_DIFF_MINUS 
MINOR_DIFF 
MINOR_DIFF_MINUS 
MAJOR_DIFF 
MAJOR_DIFF_MINUS 

Definition at line 55 of file nsIDOMInstallVersion.h.


Constructor & Destructor Documentation

Definition at line 58 of file nsInstallVersion.cpp.

Definition at line 63 of file nsInstallVersion.cpp.

{
}

Member Function Documentation

NS_IMETHODIMP nsInstallVersion::CompareTo ( nsIDOMInstallVersion aVersion,
PRInt32 aReturn 
) [virtual]

Implements nsIDOMInstallVersion.

Definition at line 215 of file nsInstallVersion.cpp.

{
    PRInt32 aMajor, aMinor, aRelease, aBuild;

    aVersion->GetMajor(&aMajor);
    aVersion->GetMinor(&aMinor);
    aVersion->GetRelease(&aRelease);
    aVersion->GetBuild(&aBuild);

    CompareTo(aMajor, aMinor, aRelease, aBuild, aReturn);

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsInstallVersion::CompareTo ( const nsString aString,
PRInt32 aReturn 
) [virtual]

Implements nsIDOMInstallVersion.

Definition at line 231 of file nsInstallVersion.cpp.

{
    nsInstallVersion inVersion;
    inVersion.Init(aString);

    return CompareTo(&inVersion, aReturn);
}

Here is the call graph for this function:

NS_IMETHODIMP nsInstallVersion::CompareTo ( PRInt32  aMajor,
PRInt32  aMinor,
PRInt32  aRelease,
PRInt32  aBuild,
PRInt32 aReturn 
) [virtual]

Implements nsIDOMInstallVersion.

Definition at line 240 of file nsInstallVersion.cpp.

{
    int diff;

    if ( mMajor == aMajor )
    {
        if ( mMinor == aMinor )
        {
            if ( mRelease == aRelease )
            {
                if ( mBuild == aBuild )
                    diff = EQUAL;
                else if ( mBuild > aBuild )
                    diff = BLD_DIFF;
                else
                    diff = BLD_DIFF_MINUS;
            }
            else if ( mRelease > aRelease )
                diff = REL_DIFF;
            else
                diff = REL_DIFF_MINUS;
        }
        else if (  mMinor > aMinor )
            diff = MINOR_DIFF;
        else
            diff = MINOR_DIFF_MINUS;
    }
    else if ( mMajor > aMajor )
        diff = MAJOR_DIFF;
    else
        diff = MAJOR_DIFF_MINUS;

    *aReturn = diff;

    return NS_OK;
}

Here is the call graph for this function:

Implements nsIDOMInstallVersion.

Definition at line 200 of file nsInstallVersion.cpp.

{
    *aBuild = mBuild;
    return NS_OK;
}

Implements nsIDOMInstallVersion.

Definition at line 158 of file nsInstallVersion.cpp.

{
    *aMajor = mMajor;
    return NS_OK;
}

Implements nsIDOMInstallVersion.

Definition at line 172 of file nsInstallVersion.cpp.

{
    *aMinor = mMinor;
    return NS_OK;
}

Implements nsIDOMInstallVersion.

Definition at line 186 of file nsInstallVersion.cpp.

{
    *aRelease = mRelease;
    return NS_OK;
}
NS_IMETHODIMP nsInstallVersion::GetScriptObject ( nsIScriptContext aContext,
void **  aScriptObject 
)

Definition at line 107 of file nsInstallVersion.cpp.

{
    NS_PRECONDITION(nsnull != aScriptObject, "null arg");
    nsresult res = NS_OK;

    if (!mScriptObject)
    {
        res = NS_NewScriptInstallVersion(aContext,
                                         (nsISupports *)(nsIDOMInstallVersion*)this,
                                         nsnull,
                                         &mScriptObject);
    }


    *aScriptObject = mScriptObject;
    return res;
}

Here is the call graph for this function:

static const nsIID& nsInstallVersion::IID ( ) [inline, static]

Definition at line 18 of file nsInstallVersion.h.

NS_IMETHODIMP nsInstallVersion::Init ( PRInt32  aMajor,
PRInt32  aMinor,
PRInt32  aRelease,
PRInt32  aBuild 
)

Definition at line 134 of file nsInstallVersion.cpp.

{
    mMajor   = aMajor;
    mMinor   = aMinor;
    mRelease = aRelease;
    mBuild   = aBuild;

    return NS_OK;
}

Here is the caller graph for this function:

NS_IMETHODIMP nsInstallVersion::Init ( const nsString aVersionString) [virtual]

Implements nsIDOMInstallVersion.

Definition at line 145 of file nsInstallVersion.cpp.

{
    mMajor = mMinor = mRelease = mBuild = 0;

    // nsString is a flat string
    if (PR_sscanf(NS_ConvertUTF16toUTF8(version).get(),"%d.%d.%d.%d",&mMajor,&mMinor,&mRelease,&mBuild) < 1)
        return NS_ERROR_UNEXPECTED;

    return NS_OK;
}

Here is the call graph for this function:

Implements nsIDOMInstallVersion.

Definition at line 207 of file nsInstallVersion.cpp.

{
    mBuild = aBuild;
    return NS_OK;
}

Implements nsIDOMInstallVersion.

Definition at line 165 of file nsInstallVersion.cpp.

{
    mMajor = aMajor;
    return NS_OK;
}

Implements nsIDOMInstallVersion.

Definition at line 179 of file nsInstallVersion.cpp.

{
    mMinor = aMinor;
    return NS_OK;
}

Implements nsIDOMInstallVersion.

Definition at line 193 of file nsInstallVersion.cpp.

{
    mRelease = aRelease;
    return NS_OK;
}

Definition at line 126 of file nsInstallVersion.cpp.

{
  mScriptObject = aScriptObject;
  return NS_OK;
}

Implements nsIDOMInstallVersion.

Definition at line 278 of file nsInstallVersion.cpp.

{
    char buf[128];
    PRUint32 len;

    len=PR_snprintf(buf, sizeof(buf), "%d.%d.%d.%d", mMajor, mMinor, mRelease, mBuild);
    aReturn.AssignASCII(buf,len);

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 53 of file nsInstallVersion.h.

Definition at line 50 of file nsInstallVersion.h.

Definition at line 51 of file nsInstallVersion.h.

Definition at line 52 of file nsInstallVersion.h.

Definition at line 49 of file nsInstallVersion.h.


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