Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsMsgTagService.cpp File Reference
#include "msgCore.h"
#include "nsMsgTagService.h"
#include "nsMsgBaseCID.h"
#include "nsIPrefService.h"
#include "nsISupportsPrimitives.h"
#include "nsMsgI18N.h"
#include "nsIPrefLocalizedString.h"
#include "nsMsgDBView.h"
#include "nsQuickSort.h"

Go to the source code of this file.

Defines

#define STRLEN(s)   (sizeof(s) - 1)
#define TAG_PREF_VERSION   "version"
#define TAG_PREF_SUFFIX_TAG   ".tag"
#define TAG_PREF_SUFFIX_COLOR   ".color"
#define TAG_PREF_SUFFIX_ORDINAL   ".ordinal"
#define TAG_CMP_LESSER   -1
#define TAG_CMP_EQUAL   0
#define TAG_CMP_GREATER   1

Functions

 CompareMsgTagKeys (const void *aTagPref1, const void *aTagPref2, void *aData)
 CompareMsgTags (const void *aTagPref1, const void *aTagPref2, void *aData)

Variables

static PRBool gMigratingKeys = PR_FALSE

Define Documentation

#define STRLEN (   s)    (sizeof(s) - 1)

Definition at line 50 of file nsMsgTagService.cpp.

Definition at line 57 of file nsMsgTagService.cpp.

Definition at line 58 of file nsMsgTagService.cpp.

Definition at line 56 of file nsMsgTagService.cpp.

#define TAG_PREF_SUFFIX_COLOR   ".color"

Definition at line 54 of file nsMsgTagService.cpp.

#define TAG_PREF_SUFFIX_ORDINAL   ".ordinal"

Definition at line 55 of file nsMsgTagService.cpp.

Definition at line 53 of file nsMsgTagService.cpp.

#define TAG_PREF_VERSION   "version"

Definition at line 52 of file nsMsgTagService.cpp.


Function Documentation

CompareMsgTagKeys ( const void aTagPref1,
const void aTagPref2,
void aData 
)

Definition at line 64 of file nsMsgTagService.cpp.

{
  return strcmp(*NS_STATIC_CAST(const char* const*, aTagPref1),
                *NS_STATIC_CAST(const char* const*, aTagPref2));
}
CompareMsgTags ( const void aTagPref1,
const void aTagPref2,
void aData 
)

Definition at line 71 of file nsMsgTagService.cpp.

{
  // Sort nsMsgTag objects by ascending order, using their ordinal or key.
  // The "smallest" value will be first in the sorted array,
  // thus being the most important element.
  nsMsgTag *element1 = *(nsMsgTag**) aTagPref1;
  nsMsgTag *element2 = *(nsMsgTag**) aTagPref2;

  // if we have only one element, it wins
  if (!element1 && !element2)
    return TAG_CMP_EQUAL;
  if (!element2)
    return TAG_CMP_LESSER;
  if (!element1)
    return TAG_CMP_GREATER;

  // only use the key if the ordinal is not defined or empty
  nsCAutoString value1, value2;
  element1->GetOrdinal(value1);
  if (value1.IsEmpty())
    element1->GetKey(value1);
  element2->GetOrdinal(value2);
  if (value2.IsEmpty())
    element2->GetKey(value2);

  return strcmp(value1.get(), value2.get());
}

Here is the call graph for this function:


Variable Documentation

Definition at line 60 of file nsMsgTagService.cpp.