Back to index

lightning-sunbird  0.9+nobinonly
nsMacTSMMessagePump.cpp File Reference
#include "nscore.h"
#include "nsMacEventHandler.h"
#include "nsMacTSMMessagePump.h"
#include "nsString.h"
#include <Script.h>
#include <TextServices.h>
#include <AEDataModel.h>
#include "nsCarbonHelpers.h"

Go to the source code of this file.


static OSErr GetAppleEventTSMData (const AppleEvent *inAE, nsMacEventHandler **outEventHandler, AEDesc *outText)
static OSErr AETextToString (AEDesc &aAEDesc, nsString &aOutString, Size &text_size)

Function Documentation

static OSErr AETextToString ( AEDesc &  aAEDesc,
nsString aOutString,
Size &  text_size 
) [static]

Definition at line 276 of file nsMacTSMMessagePump.cpp.

  OSErr err = noErr;
  PRUnichar* unicodeTextPtr;
  text_size = 0;

  text_size = ::AEGetDescDataSize(&aAEDesc) / 2;
  if (!EnsureStringLength(aOutString, text_size + 1))
    return memFullErr;
  unicodeTextPtr = aOutString.BeginWriting();
  err = AEGetDescData(&aAEDesc, (void *) unicodeTextPtr, text_size * 2);
  if (err!=noErr) 
    return err;

  unicodeTextPtr[text_size ] = PRUnichar('\0'); // null terminate it.
  return noErr;

Here is the call graph for this function:

Here is the caller graph for this function:

static OSErr GetAppleEventTSMData ( const AppleEvent *  inAE,
nsMacEventHandler **  outEventHandler,
AEDesc *  outText 
) [static]

Definition at line 252 of file nsMacTSMMessagePump.cpp.

  *outEventHandler = nsnull;
  //*outText = nsnull;

  // refcon stores the nsMacEventHandler
  DescType returnedType;
  Size actualSize;
  OSErr err = ::AEGetParamPtr(inAE, keyAETSMDocumentRefcon, typeLongInteger, &returnedType,
                              outEventHandler, sizeof(nsMacEventHandler *), &actualSize);
  NS_ASSERTION(err==noErr, "nsMacTSMMessagePump::GetAppleEventTSMData: AEGetParamPtr[TSMRefcon] failed.");
  if (err)
    return err;
  // get text
  err = ::AEGetParamDesc(inAE, keyAETheData, typeUnicodeText, outText);
  NS_ASSERTION(err==noErr, "nsMacTSMMessagePump::GetAppleEventTSMData: AEGetParamDesc[Text] failed.");
  return err;

Here is the caller graph for this function: