当前位置: 首页>>代码示例>>C++>>正文


C++ AECountItems函数代码示例

本文整理汇总了C++中AECountItems函数的典型用法代码示例。如果您正苦于以下问题:C++ AECountItems函数的具体用法?C++ AECountItems怎么用?C++ AECountItems使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了AECountItems函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WXUNUSED

short wxApp::MacHandleAEPDoc(const WXEVENTREF event , WXEVENTREF WXUNUSED(reply))
{
    AEDescList docList;
    AEKeyword keywd;
    DescType returnedType;
    Size actualSize;
    long itemsInList;
    OSErr err;
    short i;
    err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList);
    if (err != noErr)
        return err;

    err = AECountItems(&docList, &itemsInList);
    if (err != noErr)
        return err;

    ProcessSerialNumber PSN ;
    PSN.highLongOfPSN = 0 ;
    PSN.lowLongOfPSN = kCurrentProcess ;
    SetFrontProcess( &PSN ) ;

    for (i = 1; i <= itemsInList; i++) {
        wxString fName ;

        FSRef theRef ;
        AEGetNthPtr(&docList, i, typeFSRef, &keywd, &returnedType,
        (Ptr) & theRef, sizeof(theRef), &actualSize);
        fName = wxMacFSRefToPath( &theRef ) ;

        MacPrintFile(fName);
    }
    return noErr;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:34,代码来源:app.cpp

示例2: ChooseFile

AliasHandle	ChooseFile()
{
	NavReplyRecord reply;
	
	OSStatus err = NavChooseFile(NULL, &reply, NULL, NULL, NULL, NULL, NULL, NULL);
	if (err == noErr && reply.validRecord) {
		long count;
		err = AECountItems(&(reply.selection), &count);
		if (err == noErr)
		{
			AEKeyword   theKeyword;
			DescType    actualType;
			Size        actualSize;
			FSSpec		fspec;
				
			// Get a pointer to selected file
			err = AEGetNthPtr(&(reply.selection), 1,
								typeFSS, &theKeyword,
								&actualType, &fspec,
								sizeof(FSSpec),
								&actualSize);
			if (err == noErr) {
				AliasHandle ah;
				RequireNoErrString(NewAlias(NULL, &fspec, &ah), "NewAlias failed");
				return ah;
			}
		}
	}
	return NULL;
}
开发者ID:fruitsamples,项目名称:XFramework,代码行数:30,代码来源:XUtility.cpp

示例3: tokenDesc

/*----------------------------------------------------------------------------
	HandleCount 
	
----------------------------------------------------------------------------*/
void AEGenericClass::HandleCount(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
{
	ConstAETokenDesc	tokenDesc(token);
	long 			numberOfObjects = 0;
	DescType		objectClass;
	OSErr		err = noErr;	

	if (!reply->dataHandle)
		return;
	
	// Get the class of object that we will count
	err = GetObjectClassFromAppleEvent(appleEvent, &objectClass);
	ThrowIfOSErr(err);
	
	err = CheckForUnusedParameters(appleEvent);
	ThrowIfOSErr(err);

	if (AEListUtils::TokenContainsTokenList(token))
	{
		err = AECountItems(token, &numberOfObjects);
		ThrowIfOSErr(err);
		
	}
	else
	{
		CountObjects(objectClass, tokenDesc.GetDispatchClass(), token, &numberOfObjects);
	}

	err = AEPutParamPtr(reply, keyAEResult, 
								 typeLongInteger, 
								 (Ptr)&numberOfObjects, 
								 sizeof(long));
	ThrowIfOSErr(err);
}
开发者ID:fortunto2,项目名称:celtx,代码行数:38,代码来源:nsAEGenericClass.cpp

示例4: AELoadCart

short AELoadCart(AppleEvent* aev, AppleEvent* reply, long refCon)
{
short err;
FSSpec cart;
AEDescList docList;
AEKeyword keyWd;
DescType typ;
long items,siz;

	err = AEGetParamDesc(aev,keyDirectObject,typeAEList,&docList);
	if(err==0) {
		err = AECountItems(&docList,&items);
		for(short i=1;i<=items;i++) {
			err = AEGetNthPtr(&docList,i,typeFSS,&keyWd,&typ,(Ptr)&cart,sizeof(FSSpec),&siz);
			if(err==0) {
				if(CheckFileType(&cart,'Cart')) {
					LoadCartridgeFile(&cart);
					AEDisposeDesc(&docList);
					return 0;
				}
			}
		}
		AEDisposeDesc(&docList);
	}
	
	return err;
}
开发者ID:zenmumbler,项目名称:GrayBox,代码行数:27,代码来源:GB_AE.c

示例5: AEOpenFiles

pascal OSErr AEOpenFiles(AppleEvent *theAppleEvent, AppleEvent *theReply,
                         long Refcon)
{
    AEDescList docList;
    AEKeyword keywd;
    DescType returnedType;
    Size actualSize;
    long itemsInList;
    FSSpec theSpec;
    CInfoPBRec pb;
    Str255 name;
    short i;
    
    if (AEGetParamDesc(theAppleEvent, keyDirectObject, typeAEList, &docList) !=
        noErr) return;
    if (AECountItems (&docList, &itemsInList) != noErr) return;
    
    SetSelection (TEXTREC->teLength, TEXTREC->teLength);
    for (i = 1; i <= itemsInList; i++) {
        AEGetNthPtr (&docList, i, typeFSS, &keywd, &returnedType, 
            (Ptr) &theSpec, sizeof(theSpec), &actualSize);
        
        GetFullPath(&theSpec, name);
        P2CStr(name); // was: pstrterm(name);
        if (xlload ((char *)name + 1, 1, 0) == 0) xlabort ("load error");
    }
    macputs ("> ");
    PrepareForInput ();
}
开发者ID:AkiraShirase,项目名称:audacity,代码行数:29,代码来源:MacAE.c

示例6: OpenDocuments

static	OSStatus	OpenDocuments( AEDescList docList )
{
	long				index;
	FSRef				fsRef;
	long				count			= 0;
	OSStatus			status			= AECountItems( &docList, &count );
	require_noerr( status, CantGetCount );

	for( index = 1; index <= count; index++ )
	{
		if ( (status = AEGetNthPtr( &docList, index, typeFSRef, NULL, NULL, &fsRef, sizeof(FSRef), NULL) ) == noErr )
		{
				/* convert the FSRef into a Core Foundation URL */
			CFURLRef parentURLRef = CFURLCreateFromFSRef(NULL, &fsRef);
			if (NULL != parentURLRef)
			{
				GetMovieFromCFURLRef(&parentURLRef, &mCurrentMovie);
			}
		}
	}
	
CantGetName:
CantCreateWindow:
CantGetCount:
	return( status );
}
开发者ID:fruitsamples,项目名称:SimpleAudioExtraction,代码行数:26,代码来源:main.c

示例7: OpenFiles

void	OpenFiles()
{
	NavReplyRecord		reply;
	OSErr				err;
	long				i, n;
	FSSpec				spec;
	AEKeyword			keyWd;
	DescType			typeCd;
	Size				actSz;
	NavDialogOptions	navDialogOptions;
	
	NavGetDefaultDialogOptions( &navDialogOptions );
	navDialogOptions.dialogOptionFlags	|= ( kNavDontResolveAliases + kNavSupportPackages );
	
	err	= NavChooseFile( NULL, &reply, &navDialogOptions, NULL, NULL, NULL, NULL, NULL );
	if ( err != noErr )	goto Bail;
	if ( !reply.validRecord ) { err = userCanceledErr; goto Bail; }

	err = AECountItems( &reply.selection, &n );
	if ( err != noErr )	goto Bail;

	for ( i = 1 ; i <= n; i++ )
	{
		err = AEGetNthPtr( &reply.selection, i, typeFSS, &keyWd, &typeCd, (Ptr) &spec, sizeof(spec), (actSz = sizeof(spec), &actSz) );
		if ( err != noErr ) goto Bail;
		
		//XXX	Do Something with spec
		SysBeep( 0 );
	}

Bail:
	return;
}
开发者ID:fruitsamples,项目名称:WindowFun,代码行数:33,代码来源:WindowFun.c

示例8: AECountItems

/*----------------------------------------------------------------------------
	GetDataFromList 

	
----------------------------------------------------------------------------*/
void AEGenericClass::GetDataFromList(const AEDesc *srcList, AEDesc *desiredTypes, AEDesc *dstList)
{
	OSErr		err;
	long			itemNum;
	long			numItems;
	DescType		keyword;
	StAEDesc		srcItem;
	StAEDesc		dstItem;
		
	err = AECountItems((AEDescList*)srcList, &numItems);
	ThrowIfOSErr(err);
		
	for (itemNum = 1; itemNum <= numItems; itemNum++)
	{
		err = AEGetNthDesc(srcList, itemNum, typeWildCard, &keyword, &srcItem);
		ThrowIfOSErr(err);
		
		if (AEListUtils::TokenContainsTokenList(&srcItem) == false)
		{
			GetDataFromObject(&srcItem, desiredTypes, &dstItem);  // Get data from single item
		}
		else
		{
			ThrowIfOSErr(AECreateList(nil, 0, false, &dstItem));
			GetDataFromList(&srcItem, desiredTypes, &dstItem);
		}
		err = AEPutDesc(dstList, itemNum, &dstItem);
		ThrowIfOSErr(err);
	}
}
开发者ID:fortunto2,项目名称:celtx,代码行数:35,代码来源:nsAEGenericClass.cpp

示例9: SetDataForObject

/*----------------------------------------------------------------------------
	SetDataForList 

	Given a token that contains a list of cWindow tokens,
	walk the list recursively to set the data for each token in the list
	
----------------------------------------------------------------------------*/
void AEGenericClass::SetDataForList(const AEDesc *token, AEDesc *data)
{
	OSErr 			err;
		
	if (AEListUtils::TokenContainsTokenList(token) == false)
	{
		SetDataForObject(token, data);
	}
	else
	{
		long			numItems;
		long			itemNum;
		err = AECountItems((AEDescList*)token, &numItems);
		ThrowIfOSErr(err);
		
		for (itemNum = 1; itemNum <= numItems; itemNum++)
		{
			StAEDesc	  	tempToken;
			AEKeyword	keyword;
			
		 	err = AEGetNthDesc((AEDescList*)token, itemNum, typeWildCard, &keyword, &tempToken);
			ThrowIfOSErr(err);
			
			if (AEListUtils::TokenContainsTokenList(&tempToken) == false)
			{
				SetDataForObject(&tempToken, data);  		// Set data from single item
			}
			else
			{
				SetDataForList(&tempToken, data); 	// Recurse sublist
			}
		}
	}
}
开发者ID:fortunto2,项目名称:celtx,代码行数:41,代码来源:nsAEGenericClass.cpp

示例10: memset

OSStatus	LLFilePicker::doNavChooseDialog(ELoadFilter filter)
{
	OSStatus		error = noErr;
	NavDialogRef	navRef = NULL;
	NavReplyRecord	navReply;

	// if local file browsing is turned off, return without opening dialog
	if ( check_local_file_access_enabled() == false )
	{
		return FALSE;
	}

	memset(&navReply, 0, sizeof(navReply));
	
	// NOTE: we are passing the address of a local variable here.  
	//   This is fine, because the object this call creates will exist for less than the lifetime of this function.
	//   (It is destroyed by NavDialogDispose() below.)
	error = NavCreateChooseFileDialog(&mNavOptions, NULL, NULL, NULL, navOpenFilterProc, (void*)(&filter), &navRef);

	gViewerWindow->getWindow()->beforeDialog();

	if (error == noErr)
		error = NavDialogRun(navRef);

	gViewerWindow->getWindow()->afterDialog();

	if (error == noErr)
		error = NavDialogGetReply(navRef, &navReply);

	if (navRef)
		NavDialogDispose(navRef);

	if (error == noErr && navReply.validRecord)
	{
		SInt32	count = 0;
		SInt32	index;
		
		// AE indexes are 1 based...
		error = AECountItems(&navReply.selection, &count);
		for (index = 1; index <= count; index++)
		{
			FSRef		fsRef;
			AEKeyword	theAEKeyword;
			DescType	typeCode;
			Size		actualSize = 0;
			char		path[MAX_PATH];	/*Flawfinder: ignore*/
			
			memset(&fsRef, 0, sizeof(fsRef));
			error = AEGetNthPtr(&navReply.selection, index, typeFSRef, &theAEKeyword, &typeCode, &fsRef, sizeof(fsRef), &actualSize);
			
			if (error == noErr)
				error = FSRefMakePath(&fsRef, (UInt8*) path, sizeof(path));
			
			if (error == noErr)
				mFiles.push_back(std::string(path));
		}
	}
	
	return error;
}
开发者ID:JohnMcCaffery,项目名称:Armadillo-Phoenix,代码行数:60,代码来源:llfilepicker.cpp

示例11: OpenDocumentsAE

static pascal OSErr OpenDocumentsAE( const AppleEvent * theAppleEvent,
	AppleEvent * reply, SInt32 handlerRefcon) {
    AEDescList  docList;
    FSRef       theFSRef;
    long        index;
    long        count = 0;
    OSErr       err;
    char	buffer[2048];

 fprintf( logfile, "OPEN event received.\n" ); fflush( logfile );
    if ( localsplash )
	start_splash_screen();

    err = AEGetParamDesc(theAppleEvent, keyDirectObject,
                         typeAEList, &docList);
    err = AECountItems(&docList, &count);
    for(index = 1; index <= count; index++) {
        err = AEGetNthPtr(&docList, index, typeFSRef,
                        NULL, NULL, &theFSRef,
                        sizeof(theFSRef), NULL);// 4
	err = FSRefMakePath(&theFSRef,(unsigned char *) buffer,sizeof(buffer));
	ViewPostScriptFont(buffer,0);
 fprintf( logfile, " file: %s\n", buffer );
    }
    system( "DYLD_LIBRARY_PATH=\"\"; osascript -e 'tell application \"X11\" to activate'" );
    AEDisposeDesc(&docList);
 fprintf( logfile, " event processed %d.\n", err ); fflush( logfile );

return( err );
}
开发者ID:MichinariNukazawa,项目名称:fontforge,代码行数:30,代码来源:startui.c

示例12: ExtractSingleItem

/* This function extracts a single FSRef from a NavReplyRecord. */
static OSErr ExtractSingleItem(const NavReplyRecord *reply, FSRef *item)
{
    FSSpec fss;
    SInt32 itemCount;
    DescType junkType;
    AEKeyword junkKeyword;
    Size junkSize;
    OSErr osErr;

    osErr = AECountItems(&reply->selection, &itemCount);
    if( itemCount != 1 )	/* we only work with one object at a time */
        osErr = paramErr;
    if( osErr == noErr )
        osErr = AEGetNthPtr(&reply->selection, 1, typeFSS, &junkKeyword, &junkType, &fss, sizeof(fss), &junkSize);
    if( osErr == noErr )
    {
        mycheck(junkType == typeFSS);
        mycheck(junkSize == sizeof(FSSpec));

        /* We call FSMakeFSSpec because sometimes Nav is braindead		*/
        /* and gives us an invalid FSSpec (where the name is empty).	*/
        /* While FSpMakeFSRef seems to handle that (and the file system	*/
        /* engineers assure me that that will keep working (at least	*/
        /* on traditional Mac OS) because of the potential for breaking	*/
        /* existing applications), I'm still wary of doing this so		*/
        /* I regularise the FSSpec by feeding it through FSMakeFSSpec.	*/

        if( fss.name[0] == 0 )
            osErr = FSMakeFSSpec(fss.vRefNum, fss.parID, fss.name, &fss);
        if( osErr == noErr )
            osErr = FSpMakeFSRef(&fss, item);
    }

    return osErr;
}
开发者ID:fruitsamples,项目名称:FSCopyObject,代码行数:36,代码来源:HelloWorld.c

示例13: IACdrivefilelist

OSErr IACdrivefilelist (tyFScallback handlespecroutine) {
	
	/*
	the opendoc and printdoc required events take a list of filespecs as a 
	parameter. we factor out the common code, and make it a little easier for an
	application to handle these events.
	
	you supply a callback routine that handles a single filespec, you could
	print it or open it, depending on which of the required events is being
	invoked.
	*/

	AEDesc desc;
	long ctfiles;
	DescType actualtype;
	long actualsize;
	AEKeyword actualkeyword;
	FSSpec fs;
	long i;
	OSErr ec;
						
	ec = AEGetKeyDesc (IACglobals.event, keyDirectObject, typeAEList, &desc);
	
	IACglobals.errorcode = ec;
	
	if (ec != noErr) 
		return (ec);
		
	ec = AECountItems (&desc, &ctfiles);
	
	IACglobals.errorcode = ec;
	
	if (ec != noErr) 
		return (ec);
				
	for (i = 1; i <= ctfiles; i ++) {
	
		ec = AEGetNthPtr (
			&desc, i, typeFSS, &actualkeyword, &actualtype, 
			
			(Ptr) &fs, sizeof (fs), &actualsize);
							
		IACglobals.errorcode = ec;
	
		if (ec != noErr) {
		
			AEDisposeDesc (&desc);
			
			return (ec);
			}
			
		if (!(*handlespecroutine) (&fs))
			return (-1);
		} /*for*/
		
	return (noErr);
	} /*IACdrivefilelist*/
开发者ID:dvincent,项目名称:frontier,代码行数:57,代码来源:iacapps.c

示例14: CFMutableArrayCreatePOSIXPathsWithEvent

CFMutableArrayRef CFMutableArrayCreatePOSIXPathsWithEvent(
								  const AppleEvent *ev, AEKeyword theKey, OSErr *errPtr)
{
	CFMutableArrayRef outArray = NULL;
	DescType typeCode;
	Size dataSize;
    AEDescList  aeList = {typeNull, NULL};
	
	*errPtr = AESizeOfParam(ev, theKey, &typeCode, &dataSize);
	if ((*errPtr != noErr) || (typeCode == typeNull)){
		goto bail;
	}
	
	*errPtr = AEGetParamDesc(ev, theKey, typeAEList, &aeList);
	if (*errPtr != noErr) goto bail;
	
    long count = 0;
	*errPtr = AECountItems(&aeList, &count);
	if (*errPtr != noErr) goto bail;
	
	outArray = CFArrayCreateMutable(NULL, count, &kCFTypeArrayCallBacks);
	
	for(long index = 1; index <= count; index++) {
		void *value_ptr = NULL;
		Size data_size;
		*errPtr = AEGetNthPtr(&aeList, index, typeFileURL,
						  NULL, NULL, value_ptr,
						  0, &data_size);
		if (*errPtr == noErr) {
			value_ptr = malloc(data_size);
			*errPtr = AEGetNthPtr(&aeList, index, typeFileURL,
							  NULL, NULL, value_ptr,
							  data_size, NULL);
		}
		if (*errPtr != noErr) {
			fputs("Fail to AEGetNthPtr in CFMutableArrayCreatePOSIXPathsWithEvent", stderr);
			goto bail;
		}
		CFURLRef file_url = CFURLCreateAbsoluteURLWithBytes(
															NULL,
															(const UInt8 *)value_ptr,
															data_size,
															kCFStringEncodingUTF8,
															NULL,
															false);
		CFStringRef path = CFURLCopyFileSystemPath(file_url, kCFURLPOSIXPathStyle);
		CFArrayAppendValue(outArray, path);		
		CFRelease(file_url);
		CFRelease(path);
		free(value_ptr);
    }
bail:
	AEDisposeDesc(&aeList);
	return outArray;
}
开发者ID:tkurita,项目名称:AEUtils,代码行数:55,代码来源:AEUtils.c

示例15: gui_unique_mac_open_documents

/* Handle the kAEOpenDocuments Apple events. This will register
 * an idle source callback for each filename in the event.
 */
static pascal OSErr
gui_unique_mac_open_documents (const AppleEvent *inAppleEvent,
                               AppleEvent       *outAppleEvent,
                               long              handlerRefcon)
{
  OSStatus    status;
  AEDescList  documents;
  gchar       path[MAXPATHLEN];

  status = AEGetParamDesc (inAppleEvent,
                           keyDirectObject, typeAEList,
                           &documents);
  if (status == noErr)
    {
      long count = 0;
      int  i;

      AECountItems (&documents, &count);

      for (i = 0; i < count; i++)
        {
          FSRef    ref;
          gchar    *callback_path;
          GSource  *source;
          GClosure *closure;

          status = AEGetNthPtr (&documents, i + 1, typeFSRef,
                                0, 0, &ref, sizeof (ref),
                                0);
          if (status != noErr)
            continue;

          FSRefMakePath (&ref, (UInt8 *) path, MAXPATHLEN);

          callback_path = g_strdup (path);

          closure = g_cclosure_new (G_CALLBACK (gui_unique_mac_idle_open),
                                    (gpointer) callback_path,
                                    (GClosureNotify) g_free);

          g_object_watch_closure (G_OBJECT (unique_gimp), closure);

          source = g_idle_source_new ();
          g_source_set_priority (source, G_PRIORITY_LOW);
          g_source_set_closure (source, closure);
          g_source_attach (source, NULL);
          g_source_unref (source);
        }
    }

    return status;
}
开发者ID:AnonPower,项目名称:picman,代码行数:55,代码来源:gui-unique.c


注:本文中的AECountItems函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。