mirror of
https://github.com/celisej567/source-engine.git
synced 2026-01-05 22:09:59 +03:00
1
This commit is contained in:
83
game/shared/cstrike/bot/shared_util.h
Normal file
83
game/shared/cstrike/bot/shared_util.h
Normal file
@@ -0,0 +1,83 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: dll-agnostic routines (no dll dependencies here)
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
// Author: Matthew D. Campbell (matt@turtlerockstudios.com), 2003
|
||||
|
||||
#ifndef SHARED_UTIL_H
|
||||
#define SHARED_UTIL_H
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Returns the token parsed by SharedParse()
|
||||
*/
|
||||
char *SharedGetToken( void );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the character used to delimit quoted strings. Default is '\"'. Be sure to set it back when done.
|
||||
*/
|
||||
void SharedSetQuoteChar( char c );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Parse a token out of a string
|
||||
*/
|
||||
const char *SharedParse( const char *data );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Returns true if additional data is waiting to be processed on this line
|
||||
*/
|
||||
bool SharedTokenWaiting( const char *buffer );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Simple utility function to allocate memory and duplicate a string
|
||||
*/
|
||||
inline char *CloneString( const char *str )
|
||||
{
|
||||
char *cloneStr = new char [ strlen(str)+1 ];
|
||||
strcpy( cloneStr, str );
|
||||
return cloneStr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* snprintf-alike that allows multiple prints into a buffer
|
||||
*/
|
||||
char * BufPrintf(char *buf, int& len, PRINTF_FORMAT_STRING const char *fmt, ...);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* wide char version of BufPrintf
|
||||
*/
|
||||
wchar_t * BufWPrintf(wchar_t *buf, int& len, PRINTF_FORMAT_STRING const wchar_t *fmt, ...);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* convenience function that prints an int into a static wchar_t*
|
||||
*/
|
||||
const wchar_t * NumAsWString( int val );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* convenience function that prints an int into a static char*
|
||||
*/
|
||||
const char * NumAsString( int val );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* convenience function that composes a string into a static char*
|
||||
*/
|
||||
char * SharedVarArgs(PRINTF_FORMAT_STRING const char *format, ...);
|
||||
|
||||
#include "tier0/memdbgoff.h"
|
||||
|
||||
#endif // SHARED_UTIL_H
|
||||
Reference in New Issue
Block a user