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


C++ KString类代码示例

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


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

示例1: SplitString

// --------
// Strings
// --------
void KStrings::SplitString(	const KString&	String,
							LPCTSTR			pSplitter,
							bool			bAddEmpty,
							bool			bClearFirst)
{
	if(bClearFirst)
		Clear();

	const size_t szSplitterLength = _tcslen(pSplitter);

	size_t szPos = 0;
	for(;;)
	{
		size_t szOldPos = szPos;
		szPos = String.Find(pSplitter, szPos);
		if(szPos == UINT_MAX)
		{
			if(bAddEmpty || szOldPos < String.GetLength())
				*AddLast() = String.Mid(szOldPos);

			break;
		}

		if(bAddEmpty || szPos > szOldPos)
			*AddLast() = String.Mid(szOldPos, szPos - szOldPos), szPos += szSplitterLength;
	}
}
开发者ID:tetratec,项目名称:runescape-classic-dump,代码行数:30,代码来源:kstrings.cpp

示例2: SaveScene

bool SaveScene(KFbxSdkManager* pSdkManager, KFbxDocument* pScene, const char* pFilename, int pFileFormat, bool pEmbedMedia)
{
    int lMajor, lMinor, lRevision;
    bool lStatus = true;

    // Create an exporter.
    KFbxExporter* lExporter = KFbxExporter::Create(pSdkManager, "");

    if( pFileFormat < 0 || pFileFormat >= pSdkManager->GetIOPluginRegistry()->GetWriterFormatCount() )
    {
        // Write in fall back format in less no ASCII format found
        pFileFormat = pSdkManager->GetIOPluginRegistry()->GetNativeWriterFormat();

        //Try to export in ASCII if possible
        int lFormatIndex, lFormatCount = pSdkManager->GetIOPluginRegistry()->GetWriterFormatCount();

        for (lFormatIndex=0; lFormatIndex<lFormatCount; lFormatIndex++)
        {
            if (pSdkManager->GetIOPluginRegistry()->WriterIsFBX(lFormatIndex))
            {
                KString lDesc =pSdkManager->GetIOPluginRegistry()->GetWriterFormatDescription(lFormatIndex);
                char *lASCII = "ascii";
                if (lDesc.Find(lASCII)>=0)
                {
                    pFileFormat = lFormatIndex;
                    break;
                }
            }
        }
    }

    // Set the export states. By default, the export states are always set to 
    // true except for the option eEXPORT_TEXTURE_AS_EMBEDDED. The code below 
    // shows how to change these states.

    IOS_REF.SetBoolProp(EXP_FBX_MATERIAL,        true);
    IOS_REF.SetBoolProp(EXP_FBX_TEXTURE,         true);
    IOS_REF.SetBoolProp(EXP_FBX_EMBEDDED,        pEmbedMedia);
    IOS_REF.SetBoolProp(EXP_FBX_SHAPE,           true);
    IOS_REF.SetBoolProp(EXP_FBX_GOBO,            true);
    IOS_REF.SetBoolProp(EXP_FBX_ANIMATION,       true);
    IOS_REF.SetBoolProp(EXP_FBX_GLOBAL_SETTINGS, true);

    // Initialize the exporter by providing a filename.
    if(lExporter->Initialize(pFilename, pFileFormat, pSdkManager->GetIOSettings()) == false)
    {
        common->Warning("Call to KFbxExporter::Initialize() failed. Error returned: %s\n\n\n", lExporter->GetLastErrorString());
        return false;
    }

    KFbxSdkManager::GetFileFormatVersion(lMajor, lMinor, lRevision);
    common->Printf("FBX version number for this version of the FBX SDK is %d.%d.%d\n\n", lMajor, lMinor, lRevision);

    // Export the scene.
    lStatus = lExporter->Export(pScene); 

    // Destroy the exporter.
    lExporter->Destroy();
    return lStatus;
}
开发者ID:Deepfreeze32,项目名称:idtech4cdk,代码行数:60,代码来源:FbxCommon.cpp

示例3: InitializeSdkObjects

void InitializeSdkObjects(KFbxSdkManager*& pSdkManager, KFbxScene*& pScene)
{
    // The first thing to do is to create the FBX SDK manager which is the 
    // object allocator for almost all the classes in the SDK.
    pSdkManager = KFbxSdkManager::Create();

    if (!pSdkManager)
    {
        printf("Unable to create the FBX SDK manager\n");
        exit(0);
    }

	// create an IOSettings object
	KFbxIOSettings * ios = KFbxIOSettings::Create(pSdkManager, IOSROOT );
	pSdkManager->SetIOSettings(ios);

	// Load plugins from the executable directory
	KString lPath = KFbxGetApplicationDirectory();
#if defined(KARCH_ENV_WIN)
	KString lExtension = "dll";
#elif defined(KARCH_ENV_MACOSX)
	KString lExtension = "dylib";
#elif defined(KARCH_ENV_LINUX)
	KString lExtension = "so";
#endif
	pSdkManager->LoadPluginsDirectory(lPath.Buffer(), lExtension.Buffer());

    // Create the entity that will hold the scene.
    pScene = KFbxScene::Create(pSdkManager,"");
}
开发者ID:gulimujyujyu,项目名称:xlzhuathku,代码行数:30,代码来源:Common.cpp

示例4: FormattedV

KString KString::FormattedV(LPCTSTR pFormat, va_list ArgList)
{
	KString String;
	String.FormatV(pFormat, ArgList);

	return String;
}
开发者ID:tetratec,项目名称:runescape-classic-dump,代码行数:7,代码来源:kstring.cpp

示例5: Upper

KString KString::Upper() const
{
	KString String = *this;

	_tcsupr(String.GetDataPtr());

	return String;
}
开发者ID:tetratec,项目名称:runescape-classic-dump,代码行数:8,代码来源:kstring.cpp

示例6: Lower

KString KString::Lower() const
{
	KString String = *this;

	_tcslwr(String.GetDataPtr());

	return String;
}
开发者ID:tetratec,项目名称:runescape-classic-dump,代码行数:8,代码来源:kstring.cpp

示例7: PrintAttribute

/**
 * Print an attribute.
 */
void PrintAttribute(FbxNodeAttribute* pAttribute) {
    if(!pAttribute) return;
 
    KString typeName = GetAttributeTypeName(pAttribute->GetAttributeType());
    KString attrName = pAttribute->GetName();
    PrintTabs();
    // Note: to retrieve the chararcter array of a KString, use its Buffer() method.
    printf("<attribute type='%s' name='%s'/>\n", typeName.Buffer(), attrName.Buffer());
}
开发者ID:ZhaoJie1987,项目名称:Radial-Engine,代码行数:12,代码来源:utils.cpp

示例8: getAttributeTypeName

// Print an attribute
void FBXParser::printAttribute(KFbxNodeAttribute const & pAttribute) const{
  if(!&pAttribute){ return; }

  KString typeName = getAttributeTypeName(pAttribute.GetAttributeType());
  KString attrName = pAttribute.GetName();
  printTabs();
  cout << "<attribute type= " << typeName.Buffer() << " name= " << attrName.Buffer();
  cout << "/>" << endl;
}
开发者ID:jlcox5,项目名称:Frost,代码行数:10,代码来源:fbxparser.cpp

示例9: va_start

KString KString::Formatted(LPCTSTR pFormat, ...)
{
	va_list ArgList;
	va_start(ArgList, pFormat);

	KString String;
	String.FormatV(pFormat, ArgList);

	va_end(ArgList);

	return String;
}
开发者ID:tetratec,项目名称:runescape-classic-dump,代码行数:12,代码来源:kstring.cpp

示例10: getCurrentAnimationIndex

int Scene::getCurrentAnimationIndex()
{
    int index = 0;
    for(int i = 0; i < animationNames.GetCount(); i++) {
        KString* currentName = animationNames[i];
        KString activeName = KFbxGet<KString>(fbxScene->ActiveAnimStackName);

        if(currentName->Compare(activeName) == 0) {
            index = i;
        }
    }
    return index;
}
开发者ID:rockolo,项目名称:FieldKit.cpp,代码行数:13,代码来源:Scene.cpp

示例11: DisplayDouble

void DisplayDouble(const char* pHeader, double pValue, const char* pSuffix /* = "" */)
{
	KString lString;
	KString lFloatValue = (float) pValue;

	lFloatValue = pValue <= -HUGE_VAL ? "-INFINITY" : lFloatValue.Buffer();
	lFloatValue = pValue >=  HUGE_VAL ?  "INFINITY" : lFloatValue.Buffer();

	lString = pHeader;
	lString += lFloatValue;
	lString += pSuffix;
	lString += "\n";
	printf(lString);
}
开发者ID:cty41,项目名称:Titan,代码行数:14,代码来源:DisplayCommon.cpp

示例12: ParseHTTPHeaderCommand

void ParseHTTPHeaderCommand(const KString&		s,
							THTTPHeaderCommand&	RCommand)
{
	int i = 0;

	i = s.Find(TEXT(":"));

	if(i == -1)
		RCommand.m_Command = s, RCommand.m_Content = TEXT("");
	else
		RCommand.m_Command = s.Left(i), RCommand.m_Content = s.Mid(i + 1);

	RCommand.m_Command = RCommand.m_Command.Trim();
	RCommand.m_Content = RCommand.m_Content.Trim();
}
开发者ID:tetratec,项目名称:runescape-classic-dump,代码行数:15,代码来源:http.cpp

示例13: LoadTextureFromFile

bool TextureManager::LoadTextureFromFile(const KString & pFilePath, unsigned int & pTextureObject)
{
	int		compo;
	GLenum		Format;
	int		w;
	int		h;
	GLbyte*		Bits;

	if (pFilePath.Right(3).Upper() == "TGA")
	{

		Bits  = gltReadTGABits(pFilePath, &w, &h, &compo, &Format);

		if (Bits != NULL)
		{
			glGenTextures(1, &pTextureObject);
			glBindTexture(GL_TEXTURE_2D, pTextureObject);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
			glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
			glTexImage2D(GL_TEXTURE_2D, 0, compo, w, h, 0, Format,
					GL_UNSIGNED_BYTE, Bits);

			return true;
		}
	}

	return false;
}
开发者ID:antoinechene,项目名称:FPS-openGL,代码行数:31,代码来源:Texture.cpp

示例14: Clear

void KStrings::SplitToTokens(	const KString&	String,
								LPCTSTR			pDelimeters,
								bool			bClearFirst)
{
	if(bClearFirst)
		Clear();

	KString TempString = String;

	TCHAR *pToken;
	for(pToken = _tcstok(TempString.GetDataPtr(), pDelimeters) ;
		pToken ;
		pToken = _tcstok(NULL, pDelimeters))
	{
		*AddLast() = pToken;
	}
}
开发者ID:tetratec,项目名称:runescape-classic-dump,代码行数:17,代码来源:kstrings.cpp

示例15: Process

// -------
// Tokens
// -------
KString TTokens::Process(const KString& String) const
{
	KString DstString;

	for(size_t szStart = 0 ; szStart < String.GetLength() ; )
	{
		// Scanning for the closest token starting at 'szStart'
		const TToken*	pClosestToken = NULL;
		size_t			szClosestTokenPos;

		for(size_t i = 0 ; i < GetN() ; i++)
		{
			const TToken& CurToken = GetDataRef(i);

			size_t szPos = String.Find(CurToken.m_SrcString, szStart);
			if(szPos == UINT_MAX)
				continue;

			if(	pClosestToken == NULL		||
				szPos < szClosestTokenPos	||
				szPos == szClosestTokenPos &&
					CurToken.m_SrcString.GetLength() >
						pClosestToken->m_SrcString.GetLength())
			{
				pClosestToken = &CurToken, szClosestTokenPos = szPos;
			}
		}
		
		if(pClosestToken == NULL) // no more tokens found
		{
			DstString += String.Mid(szStart); // adding leftovers
			break;
		}

		DstString += String.Mid(szStart, szClosestTokenPos - szStart); // adding pre-token part
		DstString += pClosestToken->m_DstString; // adding token replacement
		
		// Forwarding 'szStart' to the end of just substed token
		szStart = szClosestTokenPos + pClosestToken->m_SrcString.GetLength();
	}

	return DstString;
}
开发者ID:tetratec,项目名称:runescape-classic-dump,代码行数:46,代码来源:token.cpp


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