Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsTextTransformer.cpp File Reference
#include <ctype.h>
#include "nsCOMPtr.h"
#include "nsTextTransformer.h"
#include "nsContentUtils.h"
#include "nsIContent.h"
#include "nsIFrame.h"
#include "nsITextContent.h"
#include "nsStyleConsts.h"
#include "nsILineBreaker.h"
#include "nsIWordBreaker.h"
#include "nsIServiceManager.h"
#include "nsUnicharUtilCIID.h"
#include "nsUnicharUtils.h"
#include "nsICaseConversion.h"
#include "prenv.h"

Go to the source code of this file.

Defines

#define MAX_UNIBYTE   127
#define kSzlig   0x00DF

Functions

static NS_DEFINE_CID (kUnicharUtilCID, NS_UNICHARUTIL_CID)
static nsresult EnsureCaseConv ()
static void AsciiToLowerCase (unsigned char *aText, PRInt32 aWordLen)
static void AsciiToUpperCase (unsigned char *aText, PRInt32 aWordLen)
static PRInt32 CountGermanSzlig (const PRUnichar *aText, PRInt32 len)
static void ReplaceGermanSzligToSS (PRUnichar *aText, PRInt32 len, PRInt32 szCnt)

Variables

static const char kWordSelectEatSpaceAfterPref [] = "layout.word_select.eat_space_to_next_word"
static const char kWordSelectStopAtPunctuationPref [] = "layout.word_select.stop_at_punctuation"
static nsICaseConversiongCaseConv = nsnull

Define Documentation

#define kSzlig   0x00DF

Definition at line 777 of file nsTextTransformer.cpp.

#define MAX_UNIBYTE   127

Definition at line 165 of file nsTextTransformer.cpp.


Function Documentation

static void AsciiToLowerCase ( unsigned char *  aText,
PRInt32  aWordLen 
) [static]

Definition at line 760 of file nsTextTransformer.cpp.

{
  while (aWordLen-- > 0) {
    *aText = tolower(*aText);
    aText++;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void AsciiToUpperCase ( unsigned char *  aText,
PRInt32  aWordLen 
) [static]

Definition at line 769 of file nsTextTransformer.cpp.

{
  while (aWordLen-- > 0) {
    *aText = toupper(*aText);
    aText++;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRInt32 CountGermanSzlig ( const PRUnichar aText,
PRInt32  len 
) [static]

Definition at line 778 of file nsTextTransformer.cpp.

{
  PRInt32 i,cnt;
  for(i=0,cnt=0; i<len; i++, aText++)
  {
     if(kSzlig == *aText)
         cnt++;
  }
  return cnt;
}

Here is the caller graph for this function:

static nsresult EnsureCaseConv ( ) [static]

Definition at line 142 of file nsTextTransformer.cpp.

{
  nsresult res = NS_OK;
  if (!gCaseConv) {
    res = CallGetService(kUnicharUtilCID, &gCaseConv);
    NS_ASSERTION( NS_SUCCEEDED(res), "cannot get UnicharUtil");
    NS_ASSERTION( gCaseConv != NULL, "cannot get UnicharUtil");
  }
  return res;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_CID ( kUnicharUtilCID  ,
NS_UNICHARUTIL_CID   
) [static]
static void ReplaceGermanSzligToSS ( PRUnichar aText,
PRInt32  len,
PRInt32  szCnt 
) [static]

Definition at line 788 of file nsTextTransformer.cpp.

{
  PRUnichar *src, *dest;
  src = aText + len - 1;
  dest = src + szCnt;
  while( (src!=dest) && (src >= aText) )
  {
      if(kSzlig == *src )
      {     
        *dest-- = PRUnichar('S');
        *dest-- = PRUnichar('S');
        src--;
      } else {
        *dest-- = *src--;
      }
  }
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 120 of file nsTextTransformer.cpp.

const char kWordSelectEatSpaceAfterPref[] = "layout.word_select.eat_space_to_next_word" [static]

Definition at line 61 of file nsTextTransformer.cpp.

const char kWordSelectStopAtPunctuationPref[] = "layout.word_select.stop_at_punctuation" [static]

Definition at line 62 of file nsTextTransformer.cpp.