Back to index

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

#include <MapiApi.h>

List of all members.

Public Member Functions

 CMapiFolderList ()
 ~CMapiFolderList ()
void AddItem (CMapiFolder *pFolder)
CMapiFolderGetItem (int index)
void ClearAll (void)
void DumpList (void)
voidGetAt (int index)
int GetSize (void)

Protected Member Functions

void EnsureUniqueName (CMapiFolder *pFolder)
void GenerateFilePath (CMapiFolder *pFolder)
void ChangeName (nsString &name)

Private Attributes

nsVoidArray m_array

Detailed Description

Definition at line 196 of file MapiApi.h.


Constructor & Destructor Documentation

Definition at line 1479 of file MapiApi.cpp.

{
}

Definition at line 1483 of file MapiApi.cpp.

{
       ClearAll();
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 1488 of file MapiApi.cpp.

{
       EnsureUniqueName( pFolder);
       GenerateFilePath( pFolder);
       m_array.AppendElement( pFolder);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CMapiFolderList::ChangeName ( nsString name) [protected]

Definition at line 1495 of file MapiApi.cpp.

{
       if (name.IsEmpty()) {
              name.AssignLiteral("1");
              return;
       }
       PRUnichar lastC = name.Last();
       if ((lastC >= '0') && (lastC <= '9')) {
              lastC++;
              if (lastC > '9') {
                     lastC = '1';
                     name.SetCharAt( lastC, name.Length() - 1);
                     name.AppendLiteral("0");
              }
              else {
                     name.SetCharAt( lastC, name.Length() - 1);
              }
       }
       else {
              name.AppendLiteral(" 2");
       }
}

Here is the caller graph for this function:

Definition at line 1579 of file MapiApi.cpp.

{
       CMapiFolder *pFolder;
       for (int i = 0; i < m_array.Count(); i++) {
              pFolder = (CMapiFolder *)GetAt( i);
              delete pFolder;
       }
       m_array.Clear();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1589 of file MapiApi.cpp.

{
       CMapiFolder *pFolder;
       nsString      str;
       int                  depth;
       char          prefix[256];

       MAPI_TRACE0( "Folder List ---------------------------------\n");
       for (int i = 0; i < m_array.Count(); i++) {
              pFolder = (CMapiFolder *)GetAt( i);
              depth = pFolder->GetDepth();
              pFolder->GetDisplayName( str);
              depth *= 2;
              if (depth > 255)
                     depth = 255;
              memset( prefix, ' ', depth);
              prefix[depth] = 0;
#ifdef MAPI_DEBUG
        char *ansiStr = ToNewCString(str);
              MAPI_TRACE2( "%s%s: ", prefix, ansiStr);
              nsCRT::free(ansiStr);
#endif
              pFolder->GetFilePath( str);
#ifdef MAPI_DEBUG
        ansiStr = ToNewCString(str);
              MAPI_TRACE2( "depth=%d, filePath=%s\n", pFolder->GetDepth(), ansiStr);
              nsCRT::free(ansiStr);
#endif
       }
       MAPI_TRACE0( "---------------------------------------------\n");
}

Here is the call graph for this function:

Definition at line 1518 of file MapiApi.cpp.

{
       // For everybody in the array before me with the SAME
       // depth, my name must be unique
       CMapiFolder * pCurrent;
       int                         i;
       BOOL                 done;
       nsString             name;
       nsString             cName;

       pFolder->GetDisplayName( name);
       do {
              done = TRUE;
              i = m_array.Count() - 1;
              while (i >= 0) {
                     pCurrent = (CMapiFolder *)GetAt(i);
                     if (pCurrent->GetDepth() == pFolder->GetDepth()) {
                            pCurrent->GetDisplayName(cName);
                            if (cName.Equals(name, nsCaseInsensitiveStringComparator())) {
                                   ChangeName(name);
                                   pFolder->SetDisplayName(name.get());
                                   done = FALSE;
                                   break;
                            }
                     }
                     else if (pCurrent->GetDepth() < pFolder->GetDepth())
                            break;
                     i--;
              }
       } while (!done);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1550 of file MapiApi.cpp.

{
       // A file path, includes all of my parent's path, plus mine
       nsString             name;
       nsString             path;
       if (!pFolder->GetDepth()) {
              pFolder->GetDisplayName( name);
              pFolder->SetFilePath(name.get());
              return;
       }

       CMapiFolder * pCurrent;
       int                         i = m_array.Count() - 1;
       while (i >= 0) {
              pCurrent = (CMapiFolder *) GetAt( i);
              if (pCurrent->GetDepth() == (pFolder->GetDepth() - 1)) {
                     pCurrent->GetFilePath( path);
                     path.AppendLiteral(".sbd\\");
                     pFolder->GetDisplayName( name);
                     path += name;
                     pFolder->SetFilePath(path.get());
                     return;
              }
              i--;
       }
       pFolder->GetDisplayName( name);
       pFolder->SetFilePath(name.get());
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* CMapiFolderList::GetAt ( int  index) [inline]

Definition at line 208 of file MapiApi.h.

{ return( m_array.ElementAt( index));}

Here is the caller graph for this function:

Definition at line 202 of file MapiApi.h.

{ if ((index >= 0) && (index < m_array.Count())) return( (CMapiFolder *)GetAt( index)); else return( NULL);}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 209 of file MapiApi.h.

{ return( m_array.Count());}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 217 of file MapiApi.h.


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