Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
nsASEApp.cpp File Reference
#include "nsASEApp.h"
#include <AppleEvents.h>
#include <Balloons.h>
#include <MacTypes.h>
#include "nsEventHandler.h"
#include "nsAppleSingleEncoder.h"
#include "nsAppleSingleDecoder.h"
#include "MoreFilesExtras.h"

Go to the source code of this file.

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)
int main (void)
 main()

Variables

Boolean gDone

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:

int main ( void  )

main()

Definition at line 324 of file nsASEApp.cpp.

{
       nsASEApp app;
       
       app.Run();
       
       return 0;
}

Here is the call 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 54 of file nsASEApp.cpp.