Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsASEApp.h File Reference
#include <Events.h>
#include <Dialogs.h>
#include <Navigation.h>
#include <MacTypes.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  nsASEApp

Defines

#define navLoadErr   128
#define aeInitErr   130
#define rMenuBar   128
#define rMenuApple   128
#define rMenuItemAbout   1
#define rMenuFile   129
#define rMenuItemASEncode   1
#define rMenuItemASDecode   2
#define rMenuItemASEncodeFolder   3
#define rMenuItemASDecodeFolder   4
#define rMenuItemQuit   6
#define rMenuEdit   130
#define rAboutBox   129
#define kASEncoderEventClass   FOUR_CHAR_CODE('ASEn')
#define kAEEncode   FOUR_CHAR_CODE('enco')
#define kAEDecode   FOUR_CHAR_CODE('deco')

Functions

pascal OSErr EncodeEvent (AppleEvent *appEvent, AppleEvent *reply, SInt32 handlerRefCon)
pascal OSErr DecodeEvent (AppleEvent *appEvent, AppleEvent *reply, SInt32 handlerRefCon)
pascal OSErr QuitEvent (AppleEvent *appEvent, AppleEvent *reply, SInt32 handlerRefCon)

Variables

Boolean gDone

Define Documentation

#define aeInitErr   130

Definition at line 96 of file nsASEApp.h.

#define kAEDecode   FOUR_CHAR_CODE('deco')

Definition at line 120 of file nsASEApp.h.

#define kAEEncode   FOUR_CHAR_CODE('enco')

Definition at line 119 of file nsASEApp.h.

#define kASEncoderEventClass   FOUR_CHAR_CODE('ASEn')

Definition at line 118 of file nsASEApp.h.

#define navLoadErr   128

Definition at line 95 of file nsASEApp.h.

#define rAboutBox   129

Definition at line 112 of file nsASEApp.h.

#define rMenuApple   128

Definition at line 102 of file nsASEApp.h.

#define rMenuBar   128

Definition at line 101 of file nsASEApp.h.

#define rMenuEdit   130

Definition at line 110 of file nsASEApp.h.

#define rMenuFile   129

Definition at line 104 of file nsASEApp.h.

Definition at line 103 of file nsASEApp.h.

Definition at line 106 of file nsASEApp.h.

Definition at line 108 of file nsASEApp.h.

Definition at line 105 of file nsASEApp.h.

Definition at line 107 of file nsASEApp.h.

Definition at line 109 of file nsASEApp.h.


Function Documentation

pascal OSErr DecodeEvent ( AppleEvent *  appEvent,
AppleEvent *  reply,
SInt32  handlerRefCon 
)

Definition at line 153 of file nsASEApp.cpp.

{
       OSErr  err = noErr;
       FSSpec param, outFile;
       Boolean       result = false, isDir = false;
       AEDesc fileDesc;
       long   dummy;
       
       // extract FSSpec from params
       err = AEGetParamDesc(appEvent, keyDirectObject, typeFSS, &fileDesc);
       if (err != noErr)
              goto reply;
       BlockMoveData(*fileDesc.dataHandle, &param, sizeof(FSSpec));
       
       // param check
       err = nsASEApp::GotRequiredParams(appEvent);
       if (err != noErr)
              goto reply;
                     
       FSpGetDirectoryID(&param, &dummy, &isDir);
       
       // if folder recursively traverse and encode contents
       if (isDir)
       {
              nsAppleSingleDecoder decoder;
              err = decoder.DecodeFolder(&param);
       }
       else
       {      
              // it's a file not a folder so proceed as usual
              
              // check if given file is in AS format (takes care of existence check)
              if (nsAppleSingleDecoder::IsAppleSingleFile(&param))
              {
                     // decode given file
                     nsAppleSingleDecoder decoder;
                     err = decoder.Decode(&param, &outFile);
              }
       }
       
       // if noErr thus far 
       if (err == noErr)
       {
              // then set result to true
              result = true;
       }
       
reply:
       // package reply
       AEPutParamPtr(reply, keyDirectObject, typeBoolean, &result, sizeof(result));
       
       // boolean takes care of failures
       return noErr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

pascal OSErr EncodeEvent ( AppleEvent *  appEvent,
AppleEvent *  reply,
SInt32  handlerRefCon 
)

Definition at line 97 of file nsASEApp.cpp.

{
       OSErr  err = noErr;
       FSSpec param;
       Boolean       result = false, isDir = false;
       AEDesc fileDesc;
       long   dummy;
       
       // extract FSSpec from params
       err = AEGetParamDesc(appEvent, keyDirectObject, typeFSS, &fileDesc);
       if (err != noErr)
              goto reply;
       BlockMoveData(*fileDesc.dataHandle, &param, sizeof(FSSpec));
       
       // param check
       err = nsASEApp::GotRequiredParams(appEvent);
       if (err != noErr)
              goto reply;
              
       FSpGetDirectoryID(&param, &dummy, &isDir);
       
       // if folder recursively traverse and encode contents
       if (isDir)
       {
              nsAppleSingleEncoder encoder;
              err = encoder.EncodeFolder(&param);
       }
       else
       {
              // it's a file not a folder so proceed as usual
              
              // check if given file has res fork (takes care of existence check)
              if (nsAppleSingleEncoder::HasResourceFork(&param))
              {
                     // encode given file
                     nsAppleSingleEncoder encoder;
                     err = encoder.Encode(&param);
              }
       }
       
       // if noErr thus far 
       if (err == noErr)
       {
              // then set result to true
              result = true;
       }
       
reply:
       // package reply
       AEPutParamPtr(reply, keyDirectObject, typeBoolean, &result, sizeof(result));
       
       // boolean takes care of failures
       return noErr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

pascal OSErr QuitEvent ( AppleEvent *  appEvent,
AppleEvent *  reply,
SInt32  handlerRefCon 
)

Definition at line 209 of file nsASEApp.cpp.

{
       OSErr  err = noErr;
       
       nsASEApp::SetCompletionStatus(true);
       
       return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 75 of file TestFileTransport.cpp.