Back to index

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

#include <nsImportFieldMap.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIIMPORTFIELDMAP 
nsImportFieldMap ()
virtual ~nsImportFieldMap ()
wstring GetFieldDescription (in long index)
void SetFieldMapSize (in long size)
void DefaultFieldMap (in long size)
long GetFieldMap (in long index)
void SetFieldMap (in long index, in long fieldNum)
void SetFieldMapByDescription (in long index, in wstring fieldDesc)
boolean GetFieldActive (in long index)
void SetFieldActive (in long index, in boolean active)
void SetFieldValue (in nsIAddrDatabase database, in nsIMdbRow row, in long fieldNum, in wstring value)
void SetFieldValueByDescription (in nsIAddrDatabase database, in nsIMdbRow row, in wstring fieldDesc, in wstring value)
wstring GetFieldValue (in nsIAbCard card, in long fieldNum)
wstring GetFieldValueByDescription (in nsIAbCard card, in wstring fieldDesc)

Static Public Member Functions

static NS_METHOD Create (nsISupports *aOuter, REFNSIID aIID, void **aResult)

Public Attributes

attribute boolean skipFirstRecord
readonly attribute long numMozFields
readonly attribute long mapSize

Private Member Functions

nsresult Allocate (PRInt32 newSize)
PRInt32 FindFieldNum (const PRUnichar *pDesc)

Private Attributes

PRInt32 m_numFields
PRInt32m_pFields
PRBoolm_pActive
PRInt32 m_allocated
nsVoidArray m_descriptions
PRInt32 m_mozFieldCount
PRBool m_skipFirstRecord

Detailed Description

Definition at line 51 of file nsImportFieldMap.h.


Constructor & Destructor Documentation

Definition at line 74 of file nsImportFieldMap.cpp.

{ 
       m_numFields = 0;
       m_pFields = nsnull;
       m_pActive = nsnull;
       m_allocated = 0;
       // need to init the description array
       m_mozFieldCount = 0;
    m_skipFirstRecord = false;
       nsIStringBundle *pBundle = nsImportStringBundle::GetStringBundleProxy();

       nsString *pStr;
       for (PRInt32 i = IMPORT_FIELD_DESC_START; i <= IMPORT_FIELD_DESC_END; i++, m_mozFieldCount++) {
              pStr = new nsString();
              if (pBundle) {
                     nsImportStringBundle::GetStringByID( i, *pStr, pBundle);       
              }
              else
                     pStr->AppendInt( i);
              m_descriptions.AppendElement( (void *)pStr);
       }
       
       NS_IF_RELEASE( pBundle);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 99 of file nsImportFieldMap.cpp.

{ 
       if (m_pFields)
              delete [] m_pFields;
       if (m_pActive)
              delete [] m_pActive;

       nsString *    pStr;
       for (PRInt32 i = 0; i < m_mozFieldCount; i++) {
              pStr = (nsString *) m_descriptions.ElementAt( i);
              delete pStr;
       }
       m_descriptions.Clear();
}

Member Function Documentation

Definition at line 556 of file nsImportFieldMap.cpp.

{
       if (newSize <= m_allocated)
              return( NS_OK);

       PRInt32 sz = m_allocated;
       while (sz < newSize)
              sz += 30;

       PRInt32       *pData = new PRInt32[ sz];
       if (!pData)
              return( NS_ERROR_FAILURE);
       PRBool *pActive = new PRBool[sz];
       if (!pActive)
              return( NS_ERROR_FAILURE);


       PRInt32       i;
       for (i = 0; i < sz; i++) {
              pData[i] = -1;
              pActive[i] = PR_TRUE;
       }
       if (m_numFields) {
              for (i = 0; i < m_numFields; i++) {
                     pData[i] = m_pFields[i];
                     pActive[i] = m_pActive[i];
              }
              delete [] m_pFields;
              delete [] m_pActive;
       }
       m_allocated = sz;
       m_pFields = pData;
       m_pActive = pActive;
       return( NS_OK);
}
NS_METHOD nsImportFieldMap::Create ( nsISupports *  aOuter,
REFNSIID  aIID,
void **  aResult 
) [static]

Definition at line 55 of file nsImportFieldMap.cpp.

{
  if (aOuter)
    return NS_ERROR_NO_AGGREGATION;

  nsImportFieldMap *it = new nsImportFieldMap();
  if (it == nsnull)
    return NS_ERROR_OUT_OF_MEMORY;

  NS_ADDREF( it);
  nsresult rv = it->QueryInterface( aIID, aResult);
  NS_RELEASE( it);
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 592 of file nsImportFieldMap.cpp.

{
       nsString *    pStr;
       for (PRInt32 i = 0; i < m_mozFieldCount; i++) {
              pStr = (nsString *)m_descriptions.ElementAt( i);
              if (!pStr->Equals(pDesc))
                     return( i);
       }

       return( -1);
}

Here is the caller graph for this function:

wstring nsIImportFieldMap::GetFieldDescription ( in long  index) [inherited]
long nsIImportFieldMap::GetFieldMap ( in long  index) [inherited]

Here is the caller graph for this function:

wstring nsIImportFieldMap::GetFieldValue ( in nsIAbCard  card,
in long  fieldNum 
) [inherited]
wstring nsIImportFieldMap::GetFieldValueByDescription ( in nsIAbCard  card,
in wstring  fieldDesc 
) [inherited]
void nsIImportFieldMap::SetFieldActive ( in long  index,
in boolean  active 
) [inherited]

Here is the caller graph for this function:

void nsIImportFieldMap::SetFieldMap ( in long  index,
in long  fieldNum 
) [inherited]

Here is the caller graph for this function:

void nsIImportFieldMap::SetFieldMapByDescription ( in long  index,
in wstring  fieldDesc 
) [inherited]

Here is the caller graph for this function:

void nsIImportFieldMap::SetFieldValue ( in nsIAddrDatabase  database,
in nsIMdbRow  row,
in long  fieldNum,
in wstring  value 
) [inherited]

Here is the caller graph for this function:

void nsIImportFieldMap::SetFieldValueByDescription ( in nsIAddrDatabase  database,
in nsIMdbRow  row,
in wstring  fieldDesc,
in wstring  value 
) [inherited]

Member Data Documentation

Definition at line 72 of file nsImportFieldMap.h.

Definition at line 73 of file nsImportFieldMap.h.

Definition at line 74 of file nsImportFieldMap.h.

Definition at line 69 of file nsImportFieldMap.h.

Definition at line 71 of file nsImportFieldMap.h.

Definition at line 70 of file nsImportFieldMap.h.

Definition at line 75 of file nsImportFieldMap.h.

Definition at line 66 of file nsIImportFieldMap.idl.

Definition at line 65 of file nsIImportFieldMap.idl.

Definition at line 63 of file nsIImportFieldMap.idl.


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