Back to index

lightning-sunbird  0.9+nobinonly
Defines | Typedefs | Functions
nsStringSupport.h File Reference
#include "nsStringAPI.h"
#include "nsMemory.h"
#include "prprf.h"
#include "plstr.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define kNotFound   -1

Typedefs

typedef nsCString nsCAutoString
typedef nsString nsAutoString
typedef nsCString nsXPIDLCString
typedef nsString nsXPIDLString

Functions

void AppendIntToString (nsCString &str, PRInt32 value)
PRInt32 FindCharInString (nsCString &str, char c, PRUint32 offset=0)
PRInt32 FindCharInString (nsString &str, PRUnichar c, PRUint32 offset=0)
PRInt32 FindInString (nsCString &str, const char *needle, PRBool ignoreCase=PR_FALSE)
void NS_CopyUnicodeToNative (const nsAString &input, nsACString &output)
void NS_CopyNativeToUnicode (const nsACString &input, nsAString &output)
 thread-safe conversion routines that do not depend on uconv libraries.
void CopyUTF16toUTF8 (const nsAString &input, nsACString &output)

Define Documentation

#define kNotFound   -1

Definition at line 49 of file nsStringSupport.h.


Typedef Documentation

Definition at line 112 of file nsStringSupport.h.

Definition at line 111 of file nsStringSupport.h.

Definition at line 113 of file nsStringSupport.h.

Definition at line 114 of file nsStringSupport.h.


Function Documentation

void AppendIntToString ( nsCString str,
PRInt32  value 
) [inline]

Definition at line 53 of file nsStringSupport.h.

{
  char buf[32];
  PR_snprintf(buf, sizeof(buf), "%d", value);
  str.Append(buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CopyUTF16toUTF8 ( const nsAString &  input,
nsACString &  output 
) [inline]

Definition at line 106 of file nsStringSupport.h.

{
  NS_UTF16ToCString(input, NS_CSTRING_ENCODING_UTF8, output);
}

Here is the call graph for this function:

PRInt32 FindCharInString ( nsCString str,
char  c,
PRUint32  offset = 0 
) [inline]

Definition at line 61 of file nsStringSupport.h.

{
  NS_ASSERTION(offset <= str.Length(), "invalid offset");
  const char *data = str.get();
  for (const char *p = data + offset; *p; ++p)
    if (*p == c)
      return p - data;
  return kNotFound;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 FindCharInString ( nsString str,
PRUnichar  c,
PRUint32  offset = 0 
) [inline]

Definition at line 72 of file nsStringSupport.h.

{
  NS_ASSERTION(offset <= str.Length(), "invalid offset");
  const PRUnichar *data = str.get();
  for (const PRUnichar *p = data + offset; *p; ++p)
    if (*p == c)
      return p - data;
  return kNotFound;
}

Here is the call graph for this function:

PRInt32 FindInString ( nsCString str,
const char *  needle,
PRBool  ignoreCase = PR_FALSE 
) [inline]

Definition at line 83 of file nsStringSupport.h.

{
  const char *data = str.get(), *p;
  if (ignoreCase)
    p = PL_strcasestr(data, needle);
  else
    p = PL_strstr(data, needle);
  return p ? p - data : kNotFound;
}

Here is the call graph for this function:

void NS_CopyNativeToUnicode ( const nsACString &  input,
nsAString &  output 
) [inline]

thread-safe conversion routines that do not depend on uconv libraries.

Definition at line 100 of file nsStringSupport.h.

{
  NS_CStringToUTF16(input, NS_CSTRING_ENCODING_NATIVE_FILESYSTEM, output);
}

Here is the call graph for this function:

void NS_CopyUnicodeToNative ( const nsAString &  input,
nsACString &  output 
) [inline]

Definition at line 94 of file nsStringSupport.h.

{
  NS_UTF16ToCString(input, NS_CSTRING_ENCODING_NATIVE_FILESYSTEM, output);
}

Here is the call graph for this function: