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


C++ CUtlSymbol类代码示例

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


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

示例1: CUtlSymbol

CUtlSymbol CUtlSymbolTable::AddString( char const* pString )
{
    if (!pString)
        return CUtlSymbol( UTL_INVAL_SYMBOL );

    CUtlSymbol id = Find( pString );

    //g_SymbolCS.Lock( );

    if (id.IsValid())
    {
        //g_SymbolCS.Unlock( );
        return id;
    }

    // Store a special context used to help with insertion
    g_LessCtx.m_pUserString = pString;
    g_LessCtx.m_pTable = this;

    // didn't find, insert the string into the vector.
    int len = strlen(pString) + 1;
    int stridx = m_Strings.AddMultipleToTail( len );
    memcpy( &m_Strings[stridx], pString, len * sizeof(char) );
    UtlSymId_t idx = m_Lookup.Insert( stridx );
    CUtlSymbol syRet( idx );

    //g_SymbolCS.Unlock( );

    return syRet;
}
开发者ID:songjundev,项目名称:b,代码行数:30,代码来源:utlsymbol.cpp

示例2: _bstr_t

//-----------------------------------------------------------------------------
// Purpose: extracts the list of configuration names from the vcproj
//-----------------------------------------------------------------------------
bool CVCProjConvert::ExtractConfigurations( IXMLDOMDocument *pDoc )
{
	m_Configurations.RemoveAll();

	if (!pDoc)
	{
		return false;
	}

#ifdef _WIN32
	CComPtr<IXMLDOMNodeList> pConfigs;
	pDoc->getElementsByTagName( _bstr_t("Configuration"), &pConfigs);
    if (pConfigs)
	{
		long len = 0;
		pConfigs->get_length(&len);
		for ( int i=0; i<len; i++ )
		{
			CComPtr<IXMLDOMNode> pNode;
			pConfigs->get_item( i, &pNode );
			if (pNode)
			{
				CComQIPtr<IXMLDOMElement> pElem( pNode );
				CUtlSymbol configName = GetXMLAttribValue( pElem, "Name" );
				if ( configName.IsValid() )
				{
					int newIndex = m_Configurations.AddToTail();
					CConfiguration & config = m_Configurations[newIndex];
					config.SetName( configName );
					ExtractIncludes( pElem, config );
				}
			}
		}
	}
#elif _LINUX
	 DOMNodeList *nodes = pDoc->getElementsByTagName( _bstr_t("Configuration"));
    	if ( nodes )
	{
		int len = nodes->getLength();
		for ( int i=0; i<len; i++ )
		{
			DOMNode *node = nodes->item(i);
			if (node)
			{
				CUtlSymbol configName = GetXMLAttribValue( node, "Name" );
				if ( configName.IsValid() )
				{
					int newIndex = m_Configurations.AddToTail();
					CConfiguration & config = m_Configurations[newIndex];
					config.SetName( configName );
					ExtractIncludes( node, config );
				}
			}
		}
	}
#endif
	return true;
}
开发者ID:Epic-xx,项目名称:impending,代码行数:61,代码来源:vcprojconvert.cpp

示例3: AddOrMarkPrecached

//-----------------------------------------------------------------------------
// Purpose: mark or add
// Input  : *pEntity - 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CPrecacheOtherList::AddOrMarkPrecached( const char *pClassname )
{
	CUtlSymbol sym = m_list.Find( pClassname );
	if ( sym.IsValid() )
		return false;

	m_list.AddString( pClassname );
	return true;
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:14,代码来源:cdll_util.cpp

示例4:

//-----------------------------------------------------------------------------
// Purpose: gets the icon for a binding, if it exists
//-----------------------------------------------------------------------------
const char *CControllerMap::GetBindingIcon( int idx )
{
	CUtlSymbol s = m_buttonMap[idx].icon;
	if ( s.IsValid() )
	{
		return s.String();
	}
	return NULL;
}
开发者ID:hzqst,项目名称:CaptionMod,代码行数:12,代码来源:ControllerMap.cpp

示例5: GetVarString

//-----------------------------------------------------------------------------
// Purpose: Updates the value shown in the mapcycle field
//-----------------------------------------------------------------------------
void CServerInfoPanel::UpdateMapCycleValue()
{
	// look at current map
	CUtlSymbol currentMap = GetVarString("map");
	if (!currentMap.IsValid())
		return;

	// find it in the map cycle list
	int listPoint = -1;
	for (int i = 0; i < m_MapCycle.Count(); i++)
	{
		if (!stricmp(m_MapCycle[i].String(), currentMap.String()))
		{
			listPoint = i;
		}
	}

	// take out the next 2 maps and make them the value
	char nextMaps[512];
	nextMaps[0] = 0;
	bool needComma = false;
	for (int i = 0; i < 2; i++)
	{
		int point = listPoint + i + 1;
		if (point >= m_MapCycle.Count())
		{
			point -= m_MapCycle.Count();
		}

		if (m_MapCycle.IsValidIndex(point))
		{
			if (needComma)
			{
				strcat(nextMaps, ", ");
			}
			strcat(nextMaps, m_MapCycle[point].String());
			needComma = true;
		}
	}

	// add some elipses to show there is more maps
	if (needComma)
	{
		strcat(nextMaps, ", ");
	}
	strcat(nextMaps, "...");

	// show in varlist
	SetVarString("mapcycle", nextMaps);
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:53,代码来源:serverinfopanel.cpp

示例6: GetReservedSurfaceIndex

int CPhysicsSurfaceProps::GetSurfaceIndex(const char* pSurfacePropName) const {
	if (pSurfacePropName[0] == '$') {
		int index = GetReservedSurfaceIndex(pSurfacePropName);
		if (index >= 0) return index;
	}

	CUtlSymbol id = m_strings->Find(pSurfacePropName);
	if (id.IsValid()) {
		for (int i = 0; i < m_props.Size(); i++) {
			if (m_props[i].m_name == id) return i;
		}
	}

	return -1;
}
开发者ID:Jcw87,项目名称:Gmod-vphysics,代码行数:15,代码来源:CPhysicsSurfaceProps.cpp

示例7: GetIndex

	int GetIndex( const char *pGlobalname )
	{
		CUtlSymbol symName = m_nameList.Find( pGlobalname );

		if ( symName.IsValid() )
		{
			for ( int i = m_list.Count() - 1; i >= 0; --i )
			{
				if ( m_list[i].name == symName )
					return i;
			}
		}

		return -1;
	}
开发者ID:paralin,项目名称:hl2sdk,代码行数:15,代码来源:globalstate.cpp

示例8: CUtlSymbol

CUtlSymbol CUtlSymbolTable::AddString( const char* pString )
{
	if (!pString) 
		return CUtlSymbol( UTL_INVAL_SYMBOL );

	CUtlSymbol id = Find( pString );
	
	if (id.IsValid())
		return id;

	int len = strlen(pString) + 1;

	// Find a pool with space for this string, or allocate a new one.
	int iPool = FindPoolWithSpace( len );
	if ( iPool == -1 )
	{
		// Add a new pool.
		int newPoolSize = max( len, MIN_STRING_POOL_SIZE );
		StringPool_t *pPool = (StringPool_t*)malloc( sizeof( StringPool_t ) + newPoolSize - 1 );
		pPool->m_TotalLen = newPoolSize;
		pPool->m_SpaceUsed = 0;
		iPool = m_StringPools.AddToTail( pPool );
	}

	// Copy the string in.
	StringPool_t *pPool = m_StringPools[iPool];
	Assert( pPool->m_SpaceUsed < 0xFFFF );	// This should never happen, because if we had a string > 64k, it
											// would have been given its entire own pool.
	
	unsigned short iStringOffset = pPool->m_SpaceUsed;

	memcpy( &pPool->m_Data[pPool->m_SpaceUsed], pString, len );
	pPool->m_SpaceUsed += len;

	// didn't find, insert the string into the vector.
	CStringPoolIndex index;
	index.m_iPool = iPool;
	index.m_iOffset = iStringOffset;

	UtlSymId_t idx = m_Lookup.Insert( index );
	return CUtlSymbol( idx );
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:42,代码来源:utlsymbol.cpp

示例9: FindConfiguration

//-----------------------------------------------------------------------------
// Purpose: returns the index of a config with this name, -1 on err
//-----------------------------------------------------------------------------
int CVCProjConvert::FindConfiguration( CUtlSymbol name )
{
	if ( !name.IsValid() )
	{
		return -1;
	}
	
	for ( int i = 0; i < m_Configurations.Count(); i++ )
	{
		if ( m_Configurations[i].GetName() == name )
		{
			return i;
		}
	}
	return -1;
}
开发者ID:Epic-xx,项目名称:impending,代码行数:19,代码来源:vcprojconvert.cpp

示例10: Assert

//-----------------------------------------------------------------------------
// Purpose: walks the file elements in the vcproj and inserts them into configs
//-----------------------------------------------------------------------------
bool CVCProjConvert::ExtractFiles( IXMLDOMDocument *pDoc  )
{
	if (!pDoc)
	{
		return false;
	}
	Assert( m_Configurations.Count() ); // some configs must be loaded first

#ifdef _WIN32
	CComPtr<IXMLDOMNodeList> pFiles;
	pDoc->getElementsByTagName( _bstr_t("File"), &pFiles);
	if (pFiles)
	{
		long len = 0;
		pFiles->get_length(&len);
		for ( int i=0; i<len; i++ )
		{
			CComPtr<IXMLDOMNode> pNode;
			pFiles->get_item( i, &pNode);
			if (pNode)
			{
				CComQIPtr<IXMLDOMElement> pElem( pNode );
				CUtlSymbol fileName = GetXMLAttribValue(pElem,"RelativePath");
				if ( fileName.IsValid() )
				{
					CConfiguration::FileType_e type = GetFileType( fileName.String() );
					CConfiguration::CFileEntry fileEntry( fileName.String(), type );
					for ( int i = 0; i < m_Configurations.Count(); i++ ) // add the file to all configs
					{
						CConfiguration & config = m_Configurations[i];
						config.InsertFile( fileEntry );
					}
					IterateFileConfigurations( pElem, fileName ); // now remove the excluded ones
				}
			}
		}//for
	}
#elif _LINUX
	DOMNodeList *nodes = pDoc->getElementsByTagName( _bstr_t("File") );
	if (nodes)
	{
		int len = nodes->getLength();
		for ( int i=0; i<len; i++ )
		{
			DOMNode *node = nodes->item(i);
			if (node)
			{
				CUtlSymbol fileName = GetXMLAttribValue(node,"RelativePath");
				if ( fileName.IsValid() )
				{
					char fixedFileName[ MAX_PATH ];
					Q_strncpy( fixedFileName, fileName.String(), sizeof(fixedFileName) );
					if ( fixedFileName[0] == '.' && fixedFileName[1] == '\\' )
					{
						Q_memmove( fixedFileName, fixedFileName+2, sizeof(fixedFileName)-2 );
					}

					Q_FixSlashes( fixedFileName );
					FindFileCaseInsensitive( fixedFileName, sizeof(fixedFileName) );
					CConfiguration::FileType_e type = GetFileType( fileName.String() );
					CConfiguration::CFileEntry fileEntry( fixedFileName, type );
					for ( int i = 0; i < m_Configurations.Count(); i++ ) // add the file to all configs
					{
						CConfiguration & config = m_Configurations[i];
						config.InsertFile( fileEntry );
					}
					IterateFileConfigurations( node, fixedFileName ); // now remove the excluded ones
				}
			}
		}//for
	}
#endif
	return true;
}
开发者ID:Epic-xx,项目名称:impending,代码行数:77,代码来源:vcprojconvert.cpp

示例11: BeginEditingMaterial

//-----------------------------------------------------------------------------
// Begin editing a particular material
//-----------------------------------------------------------------------------
void CMaterialEditorPanel::BeginEditingMaterial( const char *pMaterialName, IMaterial *pMaterial )
{
	m_bMaterialDirty = false;
	m_EditedMaterial = pMaterialName;
	m_pTitleLabel->SetText( m_EditedMaterial.String() );
	m_pMaterialViewer->SetMaterial(pMaterial);
	m_pMaterial = pMaterial;
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:11,代码来源:mateditpanel.cpp

示例12:

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
const char *CMaterialSubRect::GetTextureGroupName() const
{
	return m_symTextureGroupName.String();
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:7,代码来源:CMaterialSubRect.cpp

示例13:

char const *CBugReporter::GetUserName()
{
	return m_UserName.String();
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:4,代码来源:bugreporter_public.cpp


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