Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
nsWinRegItem Class Reference

#include <nsWinRegItem.h>

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

List of all members.

Public Member Functions

 nsWinRegItem (nsWinReg *regObj, PRInt32 root, PRInt32 action, const nsAString &sub, const nsAString &valname, const nsAString &val, PRInt32 *aReturn)
 nsWinRegItem (nsWinReg *regObj, PRInt32 root, PRInt32 action, const nsAString &sub, const nsAString &valname, PRInt32 val, PRInt32 *aReturn)
virtual ~nsWinRegItem ()
PRInt32 Prepare (void)
PRInt32 Complete ()
char * toString ()
void Abort ()
PRBool CanUninstall ()
PRBool RegisterPackageNode ()

Protected Attributes

nsInstallmInstall

Private Member Functions

nsStringkeystr (PRInt32 root, nsString *subkey, nsString *name)
char * itoa (PRInt32 n)
void reverseString (char *s)

Private Attributes

nsWinRegmReg
PRInt32 mRootkey
PRInt32 mCommand
nsStringmSubkey
nsStringmName
voidmValue

Detailed Description

Definition at line 49 of file nsWinRegItem.h.


Constructor & Destructor Documentation

nsWinRegItem::nsWinRegItem ( nsWinReg regObj,
PRInt32  root,
PRInt32  action,
const nsAString &  sub,
const nsAString &  valname,
const nsAString &  val,
PRInt32 aReturn 
)

Definition at line 50 of file nsWinRegItem.cpp.

: nsInstallObject(regObj->InstallObject())
{
    MOZ_COUNT_CTOR(nsWinRegItem);

    mReg     = regObj;
       mCommand = action;
       mRootkey = root;

  *aReturn = nsInstall::SUCCESS;

  /* I'm assuming we need to copy these */
       mSubkey  = new nsString(sub);
       mName    = new nsString(valname);
       mValue   = new nsString(val);

  if((mSubkey == nsnull) ||
     (mName   == nsnull) ||
     (mValue  == nsnull))
  {
    *aReturn = nsInstall::OUT_OF_MEMORY;
  }
}

Here is the call graph for this function:

nsWinRegItem::nsWinRegItem ( nsWinReg regObj,
PRInt32  root,
PRInt32  action,
const nsAString &  sub,
const nsAString &  valname,
PRInt32  val,
PRInt32 aReturn 
)

Definition at line 74 of file nsWinRegItem.cpp.

: nsInstallObject(regObj->InstallObject())
{
    MOZ_COUNT_CTOR(nsWinRegItem);

       mReg     = regObj;
       mCommand = action;
       mRootkey = root;

  *aReturn = nsInstall::SUCCESS;

  /* I'm assuming we need to copy these */
       mSubkey  = new nsString(sub);
       mName    = new nsString(valname);
       mValue   = new PRInt32(val);

  if((mSubkey == nsnull) ||
     (mName   == nsnull) ||
     (mValue  == nsnull))
  {
    *aReturn = nsInstall::OUT_OF_MEMORY;
  }
}

Here is the call graph for this function:

Definition at line 98 of file nsWinRegItem.cpp.

{
  if (mSubkey)  delete mSubkey;
  if (mName)    delete mName;
  if (mValue)   delete mValue;
  MOZ_COUNT_DTOR(nsWinRegItem);
}

Member Function Documentation

void nsWinRegItem::Abort ( ) [virtual]

Implements nsInstallObject.

Definition at line 254 of file nsWinRegItem.cpp.

{
}

Implements nsInstallObject.

Definition at line 357 of file nsWinRegItem.cpp.

{
    return PR_FALSE;
}

Implements nsInstallObject.

Definition at line 106 of file nsWinRegItem.cpp.

{
  PRInt32 aReturn = NS_OK;
  
  if (mReg == nsnull)
      return nsInstall::OUT_OF_MEMORY;

  switch (mCommand)
  {
    case NS_WIN_REG_CREATE:
        mReg->FinalCreateKey(mRootkey, *mSubkey, *mName, &aReturn);
        break;
    
    case NS_WIN_REG_DELETE:
        mReg->FinalDeleteKey(mRootkey, *mSubkey, &aReturn);
        break;
    
    case NS_WIN_REG_DELETE_VAL:
        mReg->FinalDeleteValue(mRootkey, *mSubkey, *mName, &aReturn);
        break;
    
    case NS_WIN_REG_SET_VAL_STRING:
        mReg->FinalSetValueString(mRootkey, *mSubkey, *mName, *(nsString*)mValue, &aReturn);
        break;

    case NS_WIN_REG_SET_VAL_NUMBER:
        mReg->FinalSetValueNumber(mRootkey, *mSubkey, *mName, *(PRInt32*)mValue, &aReturn);
        break;
    
    case NS_WIN_REG_SET_VAL:
        mReg->FinalSetValue(mRootkey, *mSubkey, *mName, (nsWinRegValue*)mValue, &aReturn);
        break;
  }
       return aReturn;
}

Here is the call graph for this function:

char * nsWinRegItem::itoa ( PRInt32  n) [private]

Definition at line 313 of file nsWinRegItem.cpp.

{
       char* s;
       int i, sign;
       if((sign = n) < 0)
              n = -n;
       i = 0;
       
       s = (char*)PR_CALLOC(sizeof(char));

       do
              {
              s = (char*)PR_REALLOC(s, (i+1)*sizeof(char));
              s[i++] = n%10 + '0';
              s[i] = '\0';
              } while ((n/=10) > 0);
              
       if(sign < 0)
       {
              s = (char*)PR_REALLOC(s, (i+1)*sizeof(char));
              s[i++] = '-';
       }
       s[i]  = '\0';
       reverseString(s);
       return s;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsString * nsWinRegItem::keystr ( PRInt32  root,
nsString subkey,
nsString name 
) [private]

Definition at line 260 of file nsWinRegItem.cpp.

{
       nsString  rootstr;
       nsString* finalstr = nsnull;
  char*     istr     = nsnull;

       switch(root)
       {
         case nsWinReg::NS_HKEY_CLASSES_ROOT:
                rootstr.AssignLiteral("HKEY_CLASSES_ROOT\\");
                break;

         case nsWinReg::NS_HKEY_CURRENT_USER:
                rootstr.AssignLiteral("HKEY_CURRENT_USER\\");
                break;

         case nsWinReg::NS_HKEY_LOCAL_MACHINE:
                rootstr.AssignLiteral("HKEY_LOCAL_MACHINE\\");
                break;

         case nsWinReg::NS_HKEY_USERS:
                rootstr.AssignLiteral("HKEY_USERS\\");
                break;

    default:
      istr = itoa(root);
      if (istr)
      {
        rootstr.AssignLiteral("#");
        rootstr.AppendWithConversion(istr);
        rootstr.AppendLiteral("\\");
        
        PR_DELETE(istr);
      }
      break;
       }

  finalstr = new nsString(rootstr);
       if(finalstr != nsnull)
       {
    finalstr->Append(*mSubkey);
    finalstr->AppendLiteral(" [");

    if(mName != nsnull)
      finalstr->Append(*mName);

    finalstr->AppendLiteral("]");
       }

  return finalstr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsInstallObject.

Definition at line 215 of file nsWinRegItem.cpp.

{
  PRInt32 aReturn = NS_OK;
  
  if (mReg == nsnull)
      return nsInstall::OUT_OF_MEMORY;

  switch (mCommand)
  {
    case NS_WIN_REG_CREATE:
        mReg->PrepareCreateKey(mRootkey, *mSubkey, &aReturn);
        break;
    
    case NS_WIN_REG_DELETE:
        mReg->PrepareDeleteKey(mRootkey, *mSubkey, &aReturn);
        break;
    
    case NS_WIN_REG_DELETE_VAL:
        mReg->PrepareDeleteValue(mRootkey, *mSubkey, *mName, &aReturn);
        break;
    
    case NS_WIN_REG_SET_VAL_STRING:
        mReg->PrepareSetValueString(mRootkey, *mSubkey, &aReturn);
        break;

    case NS_WIN_REG_SET_VAL_NUMBER:
        mReg->PrepareSetValueNumber(mRootkey, *mSubkey, &aReturn);
        break;
    
    case NS_WIN_REG_SET_VAL:
        mReg->PrepareSetValue(mRootkey, *mSubkey, &aReturn);
        break;

    default:
        break;
  }
       return aReturn;
}

Here is the call graph for this function:

Implements nsInstallObject.

Definition at line 367 of file nsWinRegItem.cpp.

{
    return PR_TRUE;
}
void nsWinRegItem::reverseString ( char *  s) [private]

Definition at line 340 of file nsWinRegItem.cpp.

{
       int c, i, j;
       
       for(i=0, j=strlen(s)-1; i<j; i++, j--)
              {
              c = s[i];
              s[i] = s[j];
              s[j] = c;
              }
}

Here is the caller graph for this function:

char * nsWinRegItem::toString ( ) [virtual]

Implements nsInstallObject.

Definition at line 150 of file nsWinRegItem.cpp.

{
       nsString*  keyString     = nsnull;
       nsString*  result        = nsnull;
  char*      resultCString = nsnull;

       switch(mCommand)
       {
    case NS_WIN_REG_CREATE:
      keyString = keystr(mRootkey, mSubkey, nsnull);
      result    = new nsString;
      result->AssignWithConversion(kCRK);
      break;

    case NS_WIN_REG_DELETE:
      keyString = keystr(mRootkey, mSubkey, nsnull);
      result    = new nsString;
      result->AssignWithConversion(kDRK);
      break;

    case NS_WIN_REG_DELETE_VAL:
      keyString = keystr(mRootkey, mSubkey, mName);
      result    = new nsString;
      result->AssignWithConversion(kDRV);
     break;

    case NS_WIN_REG_SET_VAL_STRING:
      keyString = keystr(mRootkey, mSubkey, mName);
      result    = new nsString;
      result->AssignWithConversion(kSRVS);
      break;

    case NS_WIN_REG_SET_VAL_NUMBER:
      keyString = keystr(mRootkey, mSubkey, mName);
      result    = new nsString;
      result->AssignWithConversion(kSRVN);
      break;

    case NS_WIN_REG_SET_VAL:
      keyString = keystr(mRootkey, mSubkey, mName);
      result    = new nsString;
      result->AssignWithConversion(kSRV);
      break;

    default:
      keyString = keystr(mRootkey, mSubkey, mName);
      result    = new nsString;
      result->AssignWithConversion(kUNK);
      break;
       }
    
  if (result)
  {
      result->Append(*keyString);
      resultCString = new char[result->Length() + 1];
      if(resultCString != nsnull)
          result->ToCString(resultCString, result->Length() + 1);
  }
  
  if (keyString) delete keyString;
  if (result)    delete result;
  
  return resultCString;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 92 of file nsWinRegItem.h.

nsInstall* nsInstallObject::mInstall [protected, inherited]

Definition at line 69 of file nsInstallObject.h.

Definition at line 94 of file nsWinRegItem.h.

Definition at line 90 of file nsWinRegItem.h.

Definition at line 91 of file nsWinRegItem.h.

Definition at line 93 of file nsWinRegItem.h.

Definition at line 95 of file nsWinRegItem.h.


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