plugins/consoles/rcons/server/win32/Misc.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // Misc.h
       
     2 // 
       
     3 // Copyright (c) 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "Eclipse Public License v1.0"
       
     6 // which accompanies this distribution, and is available
       
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 // 
       
     9 // Initial Contributors:
       
    10 // Accenture - Initial contribution
       
    11 //
       
    12 #ifndef __MISC_H__
       
    13 #define __MISC_H__
       
    14 
       
    15 #define UNICODE
       
    16 
       
    17 #include <memory>
       
    18 #include "stdafx.h"
       
    19 
       
    20 enum TException
       
    21 	{
       
    22 	KExceptionNoMemory,
       
    23 	KExceptionWindowClassRegistrationFailed,
       
    24 	KExceptionWindowConstructFailed,
       
    25 	KExceptionConsoleWindowConstructFailed,
       
    26 	KExceptionWinSockStartupFailed,
       
    27 	KExceptionWinSockVersionInvalid,
       
    28 	KExceptionSocketConstructFailed,
       
    29 	KExceptionSocketBindFailed,
       
    30 	KExceptionSocketSelectFailed,
       
    31 	KExceptionSocketListenFailed,
       
    32 	KExceptionSocketAcceptFailed,
       
    33 	KExceptionSocketReadFailed,
       
    34 	KExceptionInvalidClientVersion,
       
    35 	KExceptionFailedToFindPrefsFileName,
       
    36 	KExceptionFailedToReadPrefsFile,
       
    37 	KExceptionFailedToWritePrefsFile,
       
    38 	KExceptionFailedToCreateCaptureFile,
       
    39 	KExceptionFailedToWriteToCaptureFile,
       
    40 	KExceptionFailedToDeleteExistingCaptureFile,
       
    41 	KExceptionUnknown
       
    42 	};
       
    43 
       
    44 enum TThrow { EThrow = 0 };
       
    45 void* operator new(size_t n, TThrow);
       
    46 void operator delete(void* const p, TThrow);
       
    47 
       
    48 void* operator new[](size_t, TThrow);
       
    49 void operator delete[](void* const p, TThrow);
       
    50 
       
    51 #ifdef _DEBUG
       
    52 #define ASSERT(x) if (!(x)) Panic()
       
    53 #else
       
    54 #define ASSERT(x)
       
    55 #endif
       
    56 
       
    57 void Panic();
       
    58 void DebugLog(LPCTSTR aFormat, ...);
       
    59 bool FileExists(LPCTSTR aFileName);
       
    60 void ConvertNarrowToWide(const char* aNarrow, int aLength, WCHAR* aWide);
       
    61 void ConvertNarrowToWideAlloc(const char* aNarrow, int aLength, WCHAR*& aWide);
       
    62 void ConvertWideToNarrow(const WCHAR* aWide, int aLength, char* aNarrow);
       
    63 void ConvertWideToNarrowAlloc(const WCHAR* aWide, int aLength, char*& aNarrow);
       
    64 
       
    65 #endif