⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xcode_main.h

📁 P2P应用 : Peercast的源代码
💻 H
字号:
/* *  main.h *  PeerCast * *  Created by mode7 on Mon Jun 14 2004. *  Copyright (c) 2002-2004 peercast.org. All rights reserved. * */ // ------------------------------------------------// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.// ------------------------------------------------#ifndef _MAIN_H#define _MAIN_H#include <Carbon/Carbon.h>class CAppPathInfo{public:	enum EPathErr	{		 kPE_NoMainBundle		,kPE_NoBundleURL		,kPE_NoFSRef		,kPE_CantGetPath	};		explicit CAppPathInfo()	{		initDefaultPath();			CFBundleRef appBundle = CFBundleGetMainBundle();				if( appBundle == NULL )			throw kPE_NoMainBundle;					CFURLRef appUrlBundle = CFBundleCopyBundleURL( appBundle );			if( appUrlBundle == NULL )		{			CFRelease( appBundle );						throw kPE_NoBundleURL;		}				FSRef appBundleRef;		Boolean success = CFURLGetFSRef( appUrlBundle, &appBundleRef );		if( success != true )		{			throw kPE_NoFSRef;		}						OSStatus err	 = FSRefMakePath( &appBundleRef, mPathString, PATH_MAX);		bool     gotPath = false;				if( err == noErr )		{			const int length = strlen( mPathString );					if( length > 0 )			{				// remove any file name info in path string				char* cap = mPathString+length-1;							while( cap && *cap != '/' )				{					*cap = 0;					--cap;				}								gotPath = true;			}		}				CFRelease( appUrlBundle );		//CFRelease( appBundle );					if( !gotPath )		{			throw kPE_CantGetPath;		}	}		const char* getPath() const { return &mPathString[0]; }private:	void initDefaultPath() { strcpy(mPathString, "./"); }		char mPathString[PATH_MAX];};#endif // _MAIN_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -