当前位置: 首页>>代码示例>>C++>>正文


C++ TpsAssert函数代码示例

本文整理汇总了C++中TpsAssert函数的典型用法代码示例。如果您正苦于以下问题:C++ TpsAssert函数的具体用法?C++ TpsAssert怎么用?C++ TpsAssert使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TpsAssert函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: atoi

// ****************************************************************************
//
//  Function Name:	RNumberDialog::GetSmartNumberSuffix
//
//  Description:		Return internationally correct suffix for given string
//							embedded number
//
//  Returns:			suffix
//
//  Exceptions:		None
//
// ****************************************************************************
RMBCString RNumberDialog::GetSmartNumberSuffix( const RMBCString& rNumber )
{
    int nNumber = atoi( (LPCSZ)rNumber );
    TpsAssert( nNumber >= 0 , "Number string invalid. Negative numbers not supported." );
    TpsAssert( nNumber <= kMaxNumber, "Number string invalid. Too large.");
    TpsAssert( rNumber.GetStringLength() <= kMaxNumNumbers, "Number string too long" );
    if( nNumber == 0 && rNumber.GetStringLength() > 1 )
    {
        TpsAssertAlways( "Invalid number string." );
    }

    //
    // Only interested in the last two digits of number (ie. Suffix for 12 is the
    // same as suffix for 112)
    int nMeaningfulDigits = atoi( (LPCSZ)rNumber );
    if( rNumber.GetStringLength() > 2 )
    {
        // If the number is three digits or greater, just get the last two digits..
        char sDigitConvert[3];
        //strncpy( sDigitConvert, (LPCSZ)rNumber[ rNumber.GetStringLength() - 2 ], 2 );
        sDigitConvert[ 0 ] = rNumber[ rNumber.GetStringLength() - 2 ];
        sDigitConvert[ 1 ] = rNumber[ rNumber.GetStringLength() - 1 ];
        sDigitConvert[ 2 ] = 0;
        nMeaningfulDigits = atoi( sDigitConvert );
    }
    //
    // To be safe for all languages we define suffixes for every number up to
    // 20, then just define suffixes for the second digit for numbers greater
    // than that.
    if( nMeaningfulDigits < kNumberOfSuffixesDefinedFromZero )
    {
        /*!!!!!!!!!!!!       NOTE        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
        // Smart number ids from 0-19 MUST be sequential or the proper suffix will
        // NOT be used!!!!!! -MWH
        int nFirstSuffixInResource = IDS_SMARTNUM_SUFFIX_0;
        return ::GetResourceManager().GetResourceString( nFirstSuffixInResource + nMeaningfulDigits );
    }
    else
    {
        //
        // Number is greater than 20, need to get last digit suffix
        RMBCString rLastDigit("");
        rLastDigit += rNumber[rNumber.GetStringLength()-1];
        int nLastDigit = atoi( (LPCSZ)rLastDigit );
        /*!!!!!!!!!!!!       NOTE        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
        // Smart number two digit ids MUST be sequential or the proper suffix will
        // NOT be used!!!!!! -MWH
        int nFirst2DigitSuffixInResource = IDS_SMARTNUM_2DIGIT_SUFFIX_0;
        return ::GetResourceManager().GetResourceString( nFirst2DigitSuffixInResource + nLastDigit );
    }
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:63,代码来源:NumberDialog.cpp

示例2: RSearchCollection

ASSERTNAME

#include "CustomGraphicSearch.h"				// header for this class


/****************************************************************************
	RCustomGraphicSearchCollection::RCustomGraphicSearchCollection(
		RChunkStorage *aChunkStorage, YChunkTag anIndexChunkType )

	Construct an RCustomGraphicSearchCollection from aChunkStorage
	and anIndexChunkType. (Also seeks to beginning of anIndexChunkType chunk and
	caches into memory in theINDX for better performance.)
*****************************************************************************/

RCustomGraphicSearchCollection::RCustomGraphicSearchCollection(
	RChunkStorage *aChunkStorage, YChunkTag anIndexChunkType )
	:	RSearchCollection( aChunkStorage ),
		theINDX( 0 ),
		theIndexChunkType( anIndexChunkType ),
		theIndexOffset( 0 ),
		theKeywordOffset( 0 ),
		theMinorCategory( 0 ),
		theGraphicType( 0 )
{
	TpsAssert( theIndexChunkType != 0, "Index chunk type must be non-zero." );

	CacheIndexChunk();	// cache into theINDX for better performance
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:28,代码来源:CustomGraphicSearch.cpp

示例3: TpsAssert

//****************************************************************************
//
// Function Name: FillData
//
// Description:   Fills an HeadlineDataStruct with the Headline 
//						proportion attribute data
//
// Returns:       None
//
// Exceptions:	   None
//
//****************************************************************************
void RHeadlineProportionPage::FillData( RHeadlineInterface* pInterface )
{
	TpsAssert( pInterface, "Invalid Interface!" ) ;

	pInterface->SetScale1( m_uwScale1 ) ;
	pInterface->SetScale2( m_uwScale2 ) ;
	pInterface->SetScale3( m_uwScale3 ) ;
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:20,代码来源:HeadlineProportionPage.cpp


注:本文中的TpsAssert函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。