您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ AECountItems函数代码示例

51自学网 2021-06-01 19:33:54
  C++
这篇教程C++ AECountItems函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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 OSErrgui_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,


示例16: __rbosa_elementlist_count

static long__rbosa_elementlist_count (AEDescList *list){    OSErr   error;    long    count;    error = AECountItems (list, &count);    if (error != noErr)        rb_raise (rb_eRuntimeError, "Cannot count items : %s (%d)",                   error_code_to_string (error), error);    return count;}
开发者ID:bmorton,项目名称:rubyosa,代码行数:13,


示例17: PyList_New

static PyObject *BuildTerminologyList(AEDesc *theDesc, DescType requiredType) {	AEDesc item;	long size, i;	AEKeyword key;	PyObject *itemObj, *result;	OSErr err;		result = PyList_New(0);	if (!result) return NULL;	if (theDesc->descriptorType == typeAEList) {		err = AECountItems(theDesc, &size);		if (err) {			Py_DECREF(result);			return AE_MacOSError(err);		}		for (i = 1; i <= size; i++) {						err = AEGetNthDesc(theDesc, i, requiredType, &key, &item);			if (!err) {				itemObj = AE_AEDesc_New(&item);				if (!itemObj) {					AEDisposeDesc(&item);					Py_DECREF(result);					return NULL;				}				err = PyList_Append(result, itemObj);				if (err) {					Py_DECREF(itemObj);					Py_DECREF(result);					return NULL;				}			} else if (err != errAECoercionFail) {				Py_DECREF(result);				return AE_MacOSError(err);			}		}	} else {		itemObj = AE_AEDesc_New(theDesc);		if (!itemObj) {			AEDisposeDesc(theDesc);			Py_DECREF(result);			return NULL;		}		err = PyList_Append(result, itemObj);		if (err) {			Py_DECREF(itemObj);			Py_DECREF(result);			return NULL;		}	}	return result;}
开发者ID:AdminCNP,项目名称:appscript,代码行数:51,


示例18: AEOpenFiles

pascal OSErr AEOpenFiles(const AppleEvent * theAppleEvent,                         AppleEvent * theReply, long Refcon){    AEDescList docList;    AEKeyword keywd;    DescType returnedType;    Size actualSize;    long itemsInList;    FSSpec theSpec;    CInfoPBRec pb;    Handle nameh;    short namelen;    OSErr err;    short i;    err =        AEGetParamDesc(theAppleEvent, keyDirectObject, typeAEList,                       &docList);    if (err != noErr)        return err;    err = AECountItems(&docList, &itemsInList);    if (err != noErr)        return err;    for (i = 1; i <= itemsInList; i++) {        AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType,                    (Ptr) & theSpec, sizeof(theSpec), &actualSize);        if (noErr == FSpGetFullPath(&theSpec, &namelen, &nameh)) {            HLock(nameh);            char *str = new char[namelen + 1];            memcpy(str, (char *) *nameh, namelen);            str[namelen] = 0;            HUnlock(nameh);            DisposeHandle(nameh);            AudacityProject *project = GetActiveProject();            if (project == NULL || !project->GetTracks()->IsEmpty()) {                project = CreateNewAudacityProject(gParentWindow);            }            project->OpenFile(str);            delete[]str;        }    }    return noErr;}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:50,


示例19: AECountItems

static PyObject *AEDesc_AECountItems(AEDescObject *_self, PyObject *_args){	PyObject *_res = NULL;	OSErr _err;	long theCount;	if (!PyArg_ParseTuple(_args, ""))		return NULL;	_err = AECountItems(&_self->ob_itself,	                    &theCount);	if (_err != noErr) return AE_MacOSError(_err);	_res = Py_BuildValue("l",	                     theCount);	return _res;}
开发者ID:AdminCNP,项目名称:appscript,代码行数:15,


示例20: QTApp_HandleOpenDocumentAppleEvent

PASCAL_RTN OSErr QTApp_HandleOpenDocumentAppleEvent (const AppleEvent *theMessage, AppleEvent *theReply, long theRefcon)			{#pragma unused(theReply, theRefcon)	long			myIndex;	long			myItemsInList;	AEKeyword		myKeyWd;	AEDescList 	 	myDocList;	long			myActualSize;	DescType		myTypeCode;	FSSpec			myFSSpec;	OSErr			myIgnoreErr = noErr;	OSErr			myErr = noErr;		// get the direct parameter and put it into myDocList	myDocList.dataHandle = NULL;	myErr = AEGetParamDesc(theMessage, keyDirectObject, typeAEList, &myDocList);		// count the descriptor records in the list	if (myErr == noErr)		myErr = AECountItems(&myDocList, &myItemsInList);	else		myItemsInList = 0;		// open each specified file	for (myIndex = 1; myIndex <= myItemsInList; myIndex++)		if (myErr == noErr) {			myErr = AEGetNthPtr(&myDocList, myIndex, typeFSS, &myKeyWd, &myTypeCode, (Ptr)&myFSSpec, sizeof(myFSSpec), &myActualSize);			if (myErr == noErr) {				FInfo		myFinderInfo;							// verify that the file type is MovieFileType; to do this, get the Finder information				myErr = FSpGetFInfo(&myFSSpec, &myFinderInfo);					if (myErr == noErr) {					if (myFinderInfo.fdType == MovieFileType)						// we've got a movie file; just open it						QTFrame_OpenMovieInWindow(NULL, &myFSSpec);				}			}		}	if (myDocList.dataHandle)		myIgnoreErr = AEDisposeDesc(&myDocList);		// make sure we open the document in the foreground			gAppInForeground = true;	return(myErr);}
开发者ID:fruitsamples,项目名称:qtgraphics.win,代码行数:48,


示例21: ObjectTraverse

void ObjectTraverse(const AEDescList *object){	static int recurse=0;	long count;	AEKeyword keyword;	DescType data_desc;	MacSize data_size;	char buffer[1024];	OSStatus err;	if (noErr == AECountItems(object, &count))	{		for (int i = 1; i <= count; i++)	// AERecord starts at index 1		{			err = AESizeOfNthItem(object, i, &data_desc, &data_size);			if (noErr == err)			{				err = AEGetNthPtr(object, i, data_desc, &keyword, &data_desc, buffer, 1024, &data_size);				if (logfile)				{					long r;					for (r = 0; r < recurse; r++)						fprintf(logfile,"  ");					fprintf(logfile,"key:'%c%c%c%c' desc:'%c%c%c%c' size: %ld", FCC_TO_CHARS(keyword), FCC_TO_CHARS(data_desc), data_size);					if (err == noErr) {						if (data_size == 4) {							int val = *((int*) buffer);							if ((data_desc == typeSInt32) || (data_desc == typeUInt32))								fprintf(logfile," value: %d", val);							if ((data_desc == typeSInt32) || (data_desc == typeUInt32))								fprintf(logfile," value:'%c%c%c%c'", FCC_TO_CHARS(val));						}					}					fprintf(logfile,"/r");				}				if ((err == noErr) && ((data_desc == cObjectSpecifier) || (data_desc == cAEList) || (data_desc == typeAERecord))) {					AEDesc obj2;					err = AEGetNthDesc(object, i, data_desc, &keyword, &obj2);					if (err == noErr) {						recurse++;						ObjectTraverse(&obj2);						recurse--;					}				}			}		}	}}
开发者ID:prestocore,项目名称:browser,代码行数:48,


示例22: getFloatArray

OSErr getFloatArray(const AppleEvent *ev, AEKeyword theKey,  CFMutableArrayRef *outArray){	OSErr err;	DescType typeCode;	Size dataSize;    AEDescList aeList = {typeNull, NULL};		err = AESizeOfParam(ev, theKey, &typeCode, &dataSize);	if ((err != noErr) || (typeCode == typeNull)){		fputs("Failed to AESizeOfParam in getFloatArray", stderr);		goto bail;	}		err = AEGetParamDesc(ev, theKey, typeAEList, &aeList);	if (err != noErr) {		fputs("Failed to AEGetParamDesc in getFloatArray", stderr);		goto bail;	}    long count = 0;	err = AECountItems(&aeList, &count);	if (err != noErr) {		fputs("Failed to AECountItems in getFloatArray", stderr);		goto bail;	}	*outArray = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);	    for(long index = 1; index <= count; index++) {		float value;		err = AEGetNthPtr(&aeList, index, typeIEEE32BitFloatingPoint,						  NULL, NULL, &value,						  sizeof(value), NULL);		if (err != noErr) {			fputs("Fail to AEGetNthPtr in getFloatArray", stderr);			goto bail;		}		CFNumberRef cfnum = CFNumberCreate(NULL, kCFNumberFloat32Type, &value);		CFArrayAppendValue(*outArray, cfnum);		CFRelease(cfnum);    }bail:	AEDisposeDesc(&aeList);#if useLog	CFShow(*outArray);	fputs("end of getFloatArray", stderr);#endif		return err;}
开发者ID:tkurita,项目名称:AEUtils,代码行数:47,


示例23: MyNavEventCallBack

static voidMyNavEventCallBack(NavEventCallbackMessage callBackSelector, NavCBRecPtr callBackParms, void *callBackUD){    #pragma unused(callBackUD)        NavDialogRef dialog;    NavReplyRecord reply;    AEDescList selection;    AEKeyword keyword;    DescType type;    FSRef folder;    Size size;    long count;    OSStatus err;            assert(callBackParms != NULL);                if (callBackSelector == kNavCBUserAction) {            dialog = callBackParms->context;                switch (callBackParms->userAction) {            case kNavUserActionChoose:                            err = NavDialogGetReply(dialog, &reply);                assert(err == noErr);                                selection = reply.selection;                err = AECountItems(&selection, &count);                assert(err == noErr && count == 1);     // only one folder should be selected.                                err = AEGetNthPtr(&selection, 1, typeFSRef, &keyword, &type, &folder, sizeof(folder), &size);                assert(err == noErr);                                NavDialogDispose(dialog);                MyBurnFolder(folder);                break;                            case kNavUserActionCancel:                               NavDialogDispose(dialog);                DisposeNavEventUPP(gNavEventUPP);                 QuitApplicationEventLoop();                break;        }    }}
开发者ID:arnelh,项目名称:Examples,代码行数:47,


示例24: handle_open_doc_ae

static pascal OSErr handle_open_doc_ae(const AppleEvent *theAppleEvent, AppleEvent *reply, SRefCon handlerRefcon){  AEDescList docList;  long index;  long count = 0;  int i;  char *myFileName;  Size actualSize;  DescType returnedType;  AEKeyword keywd;  FSRef theRef;  VS("LOADER: handle_open_doc_ae called./n");  OSErr err = AEGetParamDesc(theAppleEvent, keyDirectObject, typeAEList, &docList);  if (err != noErr) return err;  err = AECountItems(&docList, &count);  if (err != noErr) return err;  for (index = 1; index <= count; index++)  {     err = AEGetNthPtr(&docList, index, typeFSRef, &keywd, &returnedType, &theRef, sizeof(theRef), &actualSize);     CFURLRef fullURLRef;     fullURLRef = CFURLCreateFromFSRef(NULL, &theRef);     CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, kCFURLPOSIXPathStyle);     CFRelease(fullURLRef);     CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, cfString);     CFRelease(cfString);     CFStringNormalize(cfMutableString, kCFStringNormalizationFormC);     int len = CFStringGetLength(cfMutableString);     const int bufferSize = (len+1)*6;  // in theory up to six bytes per Unicode code point, for UTF-8.     char* buffer = (char*)malloc(bufferSize);     CFStringGetCString(cfMutableString, buffer, bufferSize, kCFStringEncodingUTF8);     argv_pyi = (char**)realloc(argv_pyi,(argc_pyi+2)*sizeof(char*));     argv_pyi[argc_pyi++] = strdup(buffer);     argv_pyi[argc_pyi] = NULL;     free(buffer);  }  err = AEDisposeDesc(&docList);  return (err);}
开发者ID:Active8-BV,项目名称:cryptobox_app,代码行数:47,


示例25: CountFiles

// Counts how many files are in the apple eventshort CountFiles(AppleEvent *message){	AEDesc		fileListDesc;	long		numFiles;	OSErr		err;		/* extract the list of aliases into fileListDesc */	err = AEGetKeyDesc(message, keyDirectObject, typeAEList, &fileListDesc);	if (err!=noErr)		return 0;			/* count the list elements */	err = AECountItems(&fileListDesc, &numFiles);	AEDisposeDesc(&fileListDesc);		return	err ? 0 : numFiles; }
开发者ID:MaddTheSane,项目名称:tntbasic,代码行数:19,


示例26: ForEachFileDo

// Extracts all the files from a Finder print or open apple event and call the routine specified// on each of themOSErr ForEachFileDo(const AppleEvent *message,AEFileProc theirProc){	OSErr		err = noErr;	AEDesc		fileListDesc;	long		numFiles;	DescType	actualType;	long		actualSize;	AEKeyword	actualKeyword;	FSSpec		oneFile;	long		index;								/* extract the list of aliases into fileListDesc */	err = AEGetKeyDesc(message, keyDirectObject, typeAEList, &fileListDesc);	if (err!=noErr)		return err;			/* count the list elements */	err = AECountItems(&fileListDesc, &numFiles);	if (err != noErr)	{		AEDisposeDesc(&fileListDesc);		return err;	}		/* get each from list and process it */			for (index = 1; index <= numFiles; index ++)	{		err = AEGetNthPtr(&fileListDesc, index, typeFSS, &actualKeyword,							&actualType, (Ptr)&oneFile, sizeof(oneFile), &actualSize);		if (err != noErr)		{			AEDisposeDesc(&fileListDesc);			return err;		}				/* oneFile contains FSSpec of file in question */		err=theirProc(&oneFile);		if (err)			break;	}		AEDisposeDesc(&fileListDesc);	return err;}
开发者ID:MaddTheSane,项目名称:tntbasic,代码行数:46,


示例27: AEGetParamDesc

OSErr GHOST_SystemCarbon::sAEHandlerOpenDocs(const AppleEvent *event, AppleEvent *reply, SInt32 refCon){	//GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) refCon;	AEDescList docs;	SInt32 ndocs;	OSErr err;	err = AEGetParamDesc(event, keyDirectObject, typeAEList, &docs);	if (err != noErr) return err;	err = AECountItems(&docs, &ndocs);	if (err == noErr) {		int i;			for (i = 0; i < ndocs; i++) {			FSSpec fss;			AEKeyword kwd;			DescType actType;			Size actSize;					err = AEGetNthPtr(&docs, i + 1, typeFSS, &kwd, &actType, &fss, sizeof(fss), &actSize);			if (err != noErr)				break;					if (i == 0) {				FSRef fsref;								if (FSpMakeFSRef(&fss, &fsref) != noErr)					break;				if (FSRefMakePath(&fsref, (UInt8 *) g_firstFileBuf, sizeof(g_firstFileBuf)) != noErr)					break;				g_hasFirstFile = true;			}		}	}		AEDisposeDesc(&docs);		return err;}
开发者ID:danielmarg,项目名称:blender-main,代码行数:41,


示例28: odocHandler

static pascal OSErr odocHandler(const AppleEvent* inEvent, AppleEvent*                                /*reply*/, long refCon){    AEDescList documentList;    OSErr err = AEGetParamDesc(inEvent, keyDirectObject, typeAEList,                               &documentList);    if (err == noErr) {        err = checkAppleEventForMissingParams(*inEvent);        if (err == noErr) {            long documentCount;            err = AECountItems(&documentList, &documentCount);            for (long documentIndex = 1; err == noErr && documentIndex <=                 documentCount; documentIndex++) {                // What kind of document is it?                DescType returnedType;                Size actualSize;                err = AESizeOfNthItem(&documentList, documentIndex, &returnedType,                                      &actualSize);                if (err == noErr) {                    // It is just a normal document file                    AEKeyword keyword;                    FSRef ref;                    err = AEGetNthPtr(&documentList, documentIndex, typeFSRef,                                      &keyword, &returnedType, (Ptr)&ref, sizeof(FSRef), &actualSize);                    if (err == noErr) {                        char buf[1024];                        err = FSRefMakePath(&ref, reinterpret_cast<UInt8*>(buf), 1024);                        if ( err == noErr )                            reinterpret_cast<mainForm*>(refCon)->fileOpen(QString::fromUtf8(buf));                    }                }            }        }        AEDisposeDesc(&documentList);    }    return err;}
开发者ID:mmankarious,项目名称:sqlitebrowser,代码行数:41,


示例29: mac_openlist

static OSErr mac_openlist(AEDesc docs){    OSErr err;    long ndocs, i;    FSSpec fss;    AEKeyword keywd;    DescType type;    Size size;    err = AECountItems(&docs, &ndocs);    if (err != noErr) return err;    for (i = 0; i < ndocs; i++) {	err = AEGetNthPtr(&docs, i + 1, typeFSS,			  &keywd, &type, &fss, sizeof(fss), &size);	if (err != noErr) return err;;	err = mac_opensessionfrom(&fss);	if (err != noErr) return err;    }    return noErr;}
开发者ID:LapsedAcademicsInc,项目名称:putty,代码行数:21,



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


C++ AECreateDesc函数代码示例
C++ ADVANCE_DMA函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。