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


C++ VString::GetSafeStr方法代码示例

本文整理汇总了C++中VString::GetSafeStr方法的典型用法代码示例。如果您正苦于以下问题:C++ VString::GetSafeStr方法的具体用法?C++ VString::GetSafeStr怎么用?C++ VString::GetSafeStr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VString的用法示例。


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

示例1: GetErrorMessage

  /// \brief
  ///   Creates a string representation of the information in this exception.
  /// \param lpszError
  ///   output buffer for storing the error message
  /// \param nMaxError
  ///   the size of the output buffer
  /// \return
  ///   \c TRUE if the error message could be successfully generated; \c FALSE if not
  VBASE_IMPEXP virtual VBool GetErrorMessage(char* lpszError, UINT nMaxError)
  { 
    char szBuffer[1024];
    const char* szFileName = m_strFileName.GetSafeStr();
    const char* szClassName = m_strClassName.GetSafeStr();
    switch (m_reason)
    {
    case general: sprintf(szBuffer,"General Error in archive '%s'",szFileName);break;
    case readOnly: sprintf(szBuffer,"Archive '%s' is read-only",szFileName);break;
    case endOfFile: sprintf(szBuffer,"End of file reached in Archive '%s'",szFileName);break;
    case writeOnly: sprintf(szBuffer,"Archive '%s' is write-only",szFileName);break;
    case badIndex: sprintf(szBuffer,"Archive '%s': Bad class index. (Class '%s'). Please check Serialization code for consistency.",szFileName,szClassName);break;
    case badClass: sprintf(szBuffer,"Archive '%s': Bad class. (Class '%s'). Please check Serialization code for consistency.",szFileName,szClassName);break;
    case badSchema: sprintf(szBuffer,"Archive '%s': Bad class scheme. (Class '%s')",szFileName,szClassName);break;
    case unknownClass: sprintf(szBuffer,"Archive '%s': Unknown class '%s'. Please check plugin dependencies.",szFileName,szClassName);break;
    default:return FALSE;
    }

    if (nMaxError<sizeof(szBuffer)) szBuffer[nMaxError-1] = 0;
    strcpy(lpszError,szBuffer);
    return TRUE; 
  };
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:30,代码来源:VExceptions.hpp

示例2: Serialize

void vHavokBehaviorComponent::Serialize(VArchive &ar)
{
	IVObjectComponent::Serialize(ar);
	if (ar.IsLoading())
	{
		// Handle project 
		unsigned int iVersion = 0;
		ar >> iVersion;
		VASSERT((iVersion > 0) && (iVersion <= s_iSerialVersion));

		if ( iVersion <= 1 )
		{
			VString projectPath;
			ar >> projectPath;
			ar >> m_projectName;

			AppendRelativePath( projectPath, m_projectName );

			hkStringBuf fullPath = projectPath.GetSafeStr();
			fullPath.pathNormalize();

			m_projectName = fullPath;
		}
开发者ID:Arpit007,项目名称:projectanarchy,代码行数:23,代码来源:vHavokBehaviorComponent.cpp

示例3: SetVariable

bool vHavokBehaviorComponent::SetVariable(const char * name, const char * value)
{
	if (!strcmp(name,"m_projectName") && !m_projectPath.IsEmpty() )
	{		
		VString fullPath = m_projectPath;
		AppendRelativePath(fullPath, value);

		hkStringBuf projectPath = fullPath.GetSafeStr();
		projectPath.pathNormalize();

		m_projectName = projectPath;
		m_projectPath = "";
#if defined (_VISION_WIN32)
		Vision::Editor.SetVariableInEditor( this, "m_projectPath", "", false, false );
		Vision::Editor.SetVariableInEditor( this, "Project", m_projectName, false, false );
#endif

		return true;
	}
	else
	{
		return IVObjectComponent::SetVariable(name, value);
	}
}
开发者ID:Arpit007,项目名称:projectanarchy,代码行数:24,代码来源:vHavokBehaviorComponent.cpp


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