Back to index

lightning-sunbird  0.9+nobinonly
Static Public Member Functions | Static Private Attributes
OS2Uni Class Reference

#include <nsOS2Uni.h>

Collaboration diagram for OS2Uni:
Collaboration graph
[legend]

List of all members.

Static Public Member Functions

static nsISupports * GetUconvObject (int CodePage, ConverterRequest aReq)
static void FreeUconvObjects ()

Static Private Attributes

static nsICharsetConverterManagergCharsetManager = nsnull

Detailed Description

Definition at line 52 of file nsOS2Uni.h.


Member Function Documentation

Definition at line 128 of file nsOS2Uni.cpp.

Here is the caller graph for this function:

nsISupports * OS2Uni::GetUconvObject ( int  CodePage,
ConverterRequest  aReq 
) [static]

Definition at line 81 of file nsOS2Uni.cpp.

{
  if (gCharsetManager == nsnull) {
    CallGetService(kCharsetConverterManagerCID, &gCharsetManager);
  }

  nsresult rv;
  nsISupports* uco = nsnull;
  for (int i = 0; i < eCONVERTER_COUNT; i++) {
    if (aCodePage == gConverterInfo[i].mCodePage) {
      if (gConverterInfo[i].mEncoder == nsnull) {
        const char* convname;
        nsCAutoString charset;
        if (aCodePage == 0) {
          nsCOMPtr<nsIPlatformCharset>
                      plat(do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv));
          if (NS_SUCCEEDED(rv)) {
            plat->GetCharset(kPlatformCharsetSel_FileName, charset);
          } else {
            // default to IBM850 if this should fail
            charset = "IBM850";
          }
          convname = charset.get();
        } else {
          convname = gConverterInfo[i].mConvName;
        }
        rv = gCharsetManager->GetUnicodeEncoderRaw(convname,
                                                   &gConverterInfo[i].mEncoder);
        gConverterInfo[i].mEncoder->
                    SetOutputErrorBehavior(nsIUnicodeEncoder::kOnError_Replace,
                                           nsnull, '?');
        gCharsetManager->GetUnicodeDecoderRaw(convname,
                                              &gConverterInfo[i].mDecoder);
        NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to get converter");
      }
      if (aReq == eConv_Encoder) {
        uco = gConverterInfo[i].mEncoder;
      } else {
        uco = gConverterInfo[i].mDecoder;
      }
      break;
    }
  }

  return uco;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 57 of file nsOS2Uni.h.


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