|
//====================================================================
// Although great care has gone into developing this software,
// it is provided without any guarantee of reliability, accuracy
// of information, or correctness of operation. I am not responsible
// for any damages that may occur as a result of using this software.
// Use this software entirely at your own risk.
// Copyright 2003, Chris Richardson
//
// Description: Source level token.
//
//====================================================================
#include "stdafx.h"
#include "Token.h"
//////////////////////////////////////////////////////////////////////
// CToken Implementation.
//////////////////////////////////////////////////////////////////////
CToken::CToken() :
c_eType( TOKEN_NONE ),
c_ulPos( 0 ),
c_ulFlags( 0 )
{
memset( c_szID, 0, sizeof( c_szID ) );
}
//
// ------------------------------------------------------------------
//
CToken::~CToken()
{
}
//
// ------------------------------------------------------------------
//
void CToken::Reset()
{
c_szID[0] = _T('\0');
c_eType = TOKEN_NONE;
}
//
// ------------------------------------------------------------------
//
void CToken::Set( const TCHAR * p_pszID, unsigned long p_ulPos, ParseTokens p_eType )
{
int a_iLen = _tcslen( p_pszID );
if( a_iLen+1 > MAX_TOKEN )
{
// We must truncate it.
_tcsncpy( c_szID, p_pszID, MAX_TOKEN-1 );
c_szID[MAX_TOKEN-1] = _T('\0');
}
else
_tcscpy( c_szID, p_pszID );
c_ulPos = p_ulPos;
c_eType = p_eType;
}
//
// ------------------------------------------------------------------
//
void CToken::Set( const TCHAR p_cC, unsigned long p_ulPos, ParseTokens p_eType )
{
c_szID[0] = p_cC;
c_szID[1] = _T('\0');
c_eType = p_eType;
c_ulPos = p_ulPos;
}
//
// ------------------------------------------------------------------
//
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.