?? unfile.h
字號:
/*=============================================================================
UnFile.h: General-purpose file utilities.
Copyright 1997-1999 Epic Games, Inc. All Rights Reserved.
=============================================================================*/
/*-----------------------------------------------------------------------------
Global variables.
-----------------------------------------------------------------------------*/
// Global variables.
CORE_API extern DWORD GCRCTable[];
/*----------------------------------------------------------------------------
Byte order conversion.
----------------------------------------------------------------------------*/
// Bitfields.
#ifndef NEXT_BITFIELD
#if __INTEL_BYTE_ORDER__
#define NEXT_BITFIELD(b) ((b)<<1)
#define FIRST_BITFIELD (1)
#define INTEL_ORDER(x) (x)
#else
#define NEXT_BITFIELD(b) ((b)>>1)
#define FIRST_BITFIELD (0x80000000)
#define INTEL_ORDER(x) (((x)>>24) + (((x)>>8)&0xff00) + (((x)<<8)&0xff0000) + ((x)<<24))
#endif
#endif
/*-----------------------------------------------------------------------------
Stats.
-----------------------------------------------------------------------------*/
#if STATS
#define STAT(x) x
#else
#define STAT(x)
#endif
/*-----------------------------------------------------------------------------
Global init and exit.
-----------------------------------------------------------------------------*/
CORE_API void appInit( const TCHAR* InPackage, const TCHAR* InCmdLine, FMalloc* InMalloc, FOutputDevice* InLog, FOutputDeviceError* InError, FFeedbackContext* InWarn, FFileManager* InFileManager, FConfigCache*(*ConfigFactory)(), UBOOL RequireConfig );
CORE_API void appPreExit();
CORE_API void appExit();
/*-----------------------------------------------------------------------------
Logging and critical errors.
-----------------------------------------------------------------------------*/
CORE_API void appRequestExit( UBOOL Force );
CORE_API void VARARGS appFailAssert( const ANSICHAR* Expr, const ANSICHAR* File, INT Line );
CORE_API void VARARGS appUnwindf( const TCHAR* Fmt, ... );
CORE_API const TCHAR* appGetSystemErrorMessage( INT Error=0 );
#define debugf GLog->Logf
#define appErrorf GError->Logf
#if DO_GUARD_SLOW
#define debugfSlow GLog->Logf
#define appErrorfSlow GError->Logf
#else
#define debugfSlow GNull->Logf
#define appErrorfSlow GNull->Logf
#endif
/*-----------------------------------------------------------------------------
Misc.
-----------------------------------------------------------------------------*/
CORE_API void* appGetDllHandle( const TCHAR* DllName );
CORE_API void appFreeDllHandle( void* DllHandle );
CORE_API void* appGetDllExport( void* DllHandle, const TCHAR* ExportName );
CORE_API void appLaunchURL( const TCHAR* URL, const TCHAR* Parms=NULL, FString* Error=NULL );
CORE_API void appCreateProc( const TCHAR* URL, const TCHAR* Parms );
CORE_API void appEnableFastMath( UBOOL Enable );
CORE_API class FGuid appCreateGuid();
CORE_API void appCreateTempFilename( const TCHAR* Path, TCHAR* Result256 );
CORE_API void appCleanFileCache();
CORE_API UBOOL appFindPackageFile( const TCHAR* In, const FGuid* Guid, TCHAR* Out );
/*-----------------------------------------------------------------------------
Clipboard.
-----------------------------------------------------------------------------*/
CORE_API void appClipboardCopy( const TCHAR* Str );
CORE_API FString appClipboardPaste();
/*-----------------------------------------------------------------------------
Guard macros for call stack display.
-----------------------------------------------------------------------------*/
//
// guard/unguardf/unguard macros.
// For showing calling stack when errors occur in major functions.
// Meant to be enabled in release builds.
//
#if defined(_DEBUG) || !DO_GUARD
#define guard(func) {static const TCHAR __FUNC_NAME__[]=TEXT(#func);
#define unguard }
#define unguardf(msg) }
#else
#define guard(func) {static const TCHAR __FUNC_NAME__[]=TEXT(#func); try{
#define unguard }catch(TCHAR*Err){throw Err;}catch(...){appUnwindf(TEXT("%s"),__FUNC_NAME__); throw;}}
#define unguardf(msg) }catch(TCHAR*Err){throw Err;}catch(...){appUnwindf(TEXT("%s"),__FUNC_NAME__); appUnwindf msg; throw;}}
#endif
//
// guardSlow/unguardfSlow/unguardSlow macros.
// For showing calling stack when errors occur in performance-critical functions.
// Meant to be disabled in release builds.
//
#if defined(_DEBUG) || !DO_GUARD || !DO_GUARD_SLOW
#define guardSlow(func) {
#define unguardfSlow(msg) }
#define unguardSlow }
#define unguardfSlow(msg) }
#else
#define guardSlow(func) guard(func)
#define unguardSlow unguard
#define unguardfSlow(msg) unguardf(msg)
#endif
//
// For throwing string-exceptions which safely propagate through guard/unguard.
//
CORE_API void VARARGS appThrowf( const TCHAR* Fmt, ... );
/*-----------------------------------------------------------------------------
Check macros for assertions.
-----------------------------------------------------------------------------*/
//
// "check" expressions are only evaluated if enabled.
// "verify" expressions are always evaluated, but only cause an error if enabled.
//
#if DO_CHECK
#define check(expr) {if(!(expr)) appFailAssert( #expr, __FILE__, __LINE__ );}
#define verify(expr) {if(!(expr)) appFailAssert( #expr, __FILE__, __LINE__ );}
#else
#define check(expr)
#define verify(expr) expr
#endif
//
// Check for development only.
//
#if DO_GUARD_SLOW
#define checkSlow(expr) {if(!(expr)) appFailAssert( #expr, __FILE__, __LINE__ );}
#define verifySlow(expr) {if(!(expr)) appFailAssert( #expr, __FILE__, __LINE__ );}
#else
#define checkSlow(expr)
#define verifySlow(expr) if(expr){}
#endif
/*-----------------------------------------------------------------------------
Timing macros.
-----------------------------------------------------------------------------*/
//
// Normal timing.
//
#define clock(Timer) {Timer -= appCycles();}
#define unclock(Timer) {Timer += appCycles()-34;}
//
// Performance critical timing.
//
#if DO_CLOCK_SLOW
#define clockSlow(Timer) {Timer-=appCycles();}
#define unclockSlow(Timer) {Timer+=appCycles();}
#else
#define clockSlow(Timer)
#define unclockSlow(Timer)
#endif
/*-----------------------------------------------------------------------------
Text format.
-----------------------------------------------------------------------------*/
CORE_API FString appFormat( FString Src, const TMap<FString,FString>& Map );
/*-----------------------------------------------------------------------------
Localization.
-----------------------------------------------------------------------------*/
CORE_API const TCHAR* Localize( const TCHAR* Section, const TCHAR* Key, const TCHAR* Package=GPackage, const TCHAR* LangExt=NULL, UBOOL Optional=0 );
CORE_API const TCHAR* LocalizeError( const TCHAR* Key, const TCHAR* Package=GPackage, const TCHAR* LangExt=NULL );
CORE_API const TCHAR* LocalizeProgress( const TCHAR* Key, const TCHAR* Package=GPackage, const TCHAR* LangExt=NULL );
CORE_API const TCHAR* LocalizeQuery( const TCHAR* Key, const TCHAR* Package=GPackage, const TCHAR* LangExt=NULL );
CORE_API const TCHAR* LocalizeGeneral( const TCHAR* Key, const TCHAR* Package=GPackage, const TCHAR* LangExt=NULL );
#if UNICODE
CORE_API const TCHAR* Localize( const ANSICHAR* Section, const ANSICHAR* Key, const TCHAR* Package=GPackage, const TCHAR* LangExt=NULL, UBOOL Optional=0 );
CORE_API const TCHAR* LocalizeError( const ANSICHAR* Key, const TCHAR* Package=GPackage, const TCHAR* LangExt=NULL );
CORE_API const TCHAR* LocalizeProgress( const ANSICHAR* Key, const TCHAR* Package=GPackage, const TCHAR* LangExt=NULL );
CORE_API const TCHAR* LocalizeQuery( const ANSICHAR* Key, const TCHAR* Package=GPackage, const TCHAR* LangExt=NULL );
CORE_API const TCHAR* LocalizeGeneral( const ANSICHAR* Key, const TCHAR* Package=GPackage, const TCHAR* LangExt=NULL );
#endif
/*-----------------------------------------------------------------------------
File functions.
-----------------------------------------------------------------------------*/
// File utilities.
CORE_API const TCHAR* appFExt( const TCHAR* Filename );
CORE_API UBOOL appUpdateFileModTime( TCHAR* Filename );
CORE_API TCHAR* appGetGMTRef();
/*-----------------------------------------------------------------------------
OS functions.
-----------------------------------------------------------------------------*/
CORE_API const TCHAR* appCmdLine();
CORE_API const TCHAR* appBaseDir();
CORE_API const TCHAR* appPackage();
CORE_API const TCHAR* appComputerName();
CORE_API const TCHAR* appUserName();
/*-----------------------------------------------------------------------------
Timing functions.
-----------------------------------------------------------------------------*/
#if !DEFINED_appCycles
CORE_API DWORD appCycles();
#endif
#if !DEFINED_appSeconds
CORE_API DOUBLE appSeconds();
#endif
CORE_API void appSystemTime( INT& Year, INT& Month, INT& DayOfWeek, INT& Day, INT& Hour, INT& Min, INT& Sec, INT& MSec );
CORE_API const TCHAR* appTimestamp();
CORE_API DOUBLE appSecondsSlow();
CORE_API void appSleep( FLOAT Seconds );
/*-----------------------------------------------------------------------------
Character type functions.
-----------------------------------------------------------------------------*/
inline TCHAR appToUpper( TCHAR c )
{
return (c<'a' || c>'z') ? (c) : (c+'A'-'a');
}
inline TCHAR appToLower( TCHAR c )
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -