Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
nsUnicharUtils.h File Reference
#include "nsAString.h"
#include "nsReadableUtils.h"
#include "nsCharTraits.h"

Go to the source code of this file.

Classes

class  nsCaseInsensitiveStringComparator

Defines

#define IS_CJ_CHAR(u)

Functions

void ToLowerCase (nsAString &)
void ToUpperCase (nsAString &)
void ToLowerCase (nsString &)
void ToUpperCase (nsString &)
void ToLowerCase (const nsAString &aSource, nsAString &aDest)
void ToUpperCase (const nsAString &aSource, nsAString &aDest)
PRBool CaseInsensitiveFindInReadable (const nsAString &aPattern, nsAString::const_iterator &aSearchStart, nsAString::const_iterator &aSearchEnd)
PRBool CaseInsensitiveFindInReadable (const nsAString &aPattern, const nsAString &aHay)
PRUnichar ToUpperCase (PRUnichar)
PRUnichar ToLowerCase (PRUnichar)
PRBool IsUpperCase (PRUnichar c)
PRBool IsLowerCase (PRUnichar c)

Define Documentation

#define IS_CJ_CHAR (   u)
Value:
((0x2e80u <= (u) && (u) <= 0x312fu) || \
          (0x3190u <= (u) && (u) <= 0xabffu) || \
          (0xf900u <= (u) && (u) <= 0xfaffu) || \
          (0xff00u <= (u) && (u) <= 0xffefu) )

Definition at line 100 of file nsUnicharUtils.h.


Function Documentation

PRBool CaseInsensitiveFindInReadable ( const nsAString &  aPattern,
nsAString::const_iterator &  aSearchStart,
nsAString::const_iterator &  aSearchEnd 
) [inline]

Definition at line 71 of file nsUnicharUtils.h.

                                                                                   {
  return FindInReadable(aPattern, aSearchStart, aSearchEnd,
                        nsCaseInsensitiveStringComparator());
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool CaseInsensitiveFindInReadable ( const nsAString &  aPattern,
const nsAString &  aHay 
) [inline]

Definition at line 78 of file nsUnicharUtils.h.

                                                                     {
  nsAString::const_iterator searchBegin, searchEnd;
  return FindInReadable(aPattern, 
                        aHay.BeginReading(searchBegin),
                        aHay.EndReading(searchEnd),
                        nsCaseInsensitiveStringComparator());
}

Here is the call graph for this function:

PRBool IsLowerCase ( PRUnichar  c) [inline]

Definition at line 94 of file nsUnicharUtils.h.

                                       {
    return ToUpperCase(c) != c;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool IsUpperCase ( PRUnichar  c) [inline]

Definition at line 90 of file nsUnicharUtils.h.

                                       {
    return ToLowerCase(c) != c;
}

Here is the call graph for this function:

void ToLowerCase ( nsAString &  )

Definition at line 125 of file nsUnicharUtils.cpp.

  {
    ConvertToLowerCase converter;
    PRUnichar* start;
    converter.write(aString.BeginWriting(start), aString.Length());
  }

Here is the call graph for this function:

Definition at line 133 of file nsUnicharUtils.cpp.

  {
    ConvertToLowerCase converter;
    PRUnichar* start;
    converter.write(aString.BeginWriting(start), aString.Length());
  }

Here is the call graph for this function:

void ToLowerCase ( const nsAString &  aSource,
nsAString &  aDest 
)

Definition at line 170 of file nsUnicharUtils.cpp.

  {
    nsAString::const_iterator fromBegin, fromEnd;
    nsAString::iterator toBegin;
    // FIXME: need way to return error
    if (!EnsureStringLength(aDest, aSource.Length())) {
      aDest.Truncate();
      return; // out of memory
    }
    CopyToLowerCase converter(aDest.BeginWriting(toBegin));
    copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
  }

Here is the call graph for this function:

Definition at line 314 of file nsUnicharUtils.cpp.

{
    PRUnichar result;
    if (NS_FAILED(NS_InitCaseConversion()))
        return aChar;

    if (gCaseConv)
        gCaseConv->ToLower(aChar, &result);
    else {
        NS_WARNING("No case converter: no conversion done");
        if (aChar < 256)
            result = tolower(char(aChar));
        else
            result = aChar;
    }
    return result;
}

Here is the call graph for this function:

void ToUpperCase ( nsAString &  )

Definition at line 215 of file nsUnicharUtils.cpp.

  {
    ConvertToUpperCase converter;
    PRUnichar* start;
    converter.write(aString.BeginWriting(start), aString.Length());
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 223 of file nsUnicharUtils.cpp.

  {
    ConvertToUpperCase converter;
    PRUnichar* start;
    converter.write(aString.BeginWriting(start), aString.Length());
  }

Here is the call graph for this function:

void ToUpperCase ( const nsAString &  aSource,
nsAString &  aDest 
)

Definition at line 260 of file nsUnicharUtils.cpp.

  {
    nsAString::const_iterator fromBegin, fromEnd;
    nsAString::iterator toBegin;
    // FIXME: need way to return error
    if (!EnsureStringLength(aDest, aSource.Length())) {
      aDest.Truncate();
      return; // out of memory
    }
    CopyToUpperCase converter(aDest.BeginWriting(toBegin));
    copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
  }

Here is the call graph for this function:

Definition at line 333 of file nsUnicharUtils.cpp.

{
    PRUnichar result;
    if (NS_FAILED(NS_InitCaseConversion()))
        return aChar;

    if (gCaseConv)
        gCaseConv->ToUpper(aChar, &result);
    else {
        NS_WARNING("No case converter: no conversion done");
        if (aChar < 256)
            result = toupper(char(aChar));
        else
            result = aChar;
    }
    return result;
}

Here is the call graph for this function: