KString KString::operator + (TAlignment Alignment) const
{
	if(Alignment == ALIGNMENT_MIN)
		return KString(GetDataPtr(), GetLength(), TEXT("min"), 3);

	if(Alignment == ALIGNMENT_MID)
		return KString(GetDataPtr(), GetLength(), TEXT("mid"), 3);

	if(Alignment == ALIGNMENT_MAX)
		return KString(GetDataPtr(), GetLength(), TEXT("max"), 3);

	INITIATE_FAILURE;
}
KString KString::Right(size_t szCount) const
{
	if(szCount > GetLength())
		throw 1;

	return KString(GetDataPtr() + (GetLength() - szCount), szCount);
}
KString KString::operator + (float fValue) const
{
	TCHAR Buf[32];
	_stprintf(Buf, TEXT("%.2f"), fValue);

	return KString(GetDataPtr(), GetLength(), Buf, _tcslen(Buf));
};
KString KString::operator + (const void* pPtr) const
{
	TCHAR Buf[32];
	_stprintf(Buf, TEXT("%p"), pPtr);

	return KString(GetDataPtr(), GetLength(), Buf, _tcslen(Buf));
}
KString KString::operator + (double dValue) const
{
	TCHAR Buf[32];
	_stprintf(Buf, TEXT("%.4lf"), dValue);

	return KString(GetDataPtr(), GetLength(), Buf, _tcslen(Buf));
}
KString KString::operator + (__int64 iValue) const
{
	TCHAR Buf[32];
	_stprintf(Buf, TEXT("%I64d"), iValue);

	return KString(GetDataPtr(), GetLength(), Buf, _tcslen(Buf));
}
//Setting OOM testing
void CenrepSrvOOMTest::SetL()
	{
	TInt ret=KErrNone;
	TInt intValue=0;
	TReal realValue=0;

	//---------------SetL-----------------------------------
	//Setting an integer key
	ret = RepositorySingleSetL(*iServerRepo, 0x60, 600);
	TESTKErrNoneL(ret);
	ret=iServerRepo->Get(0x60,intValue);
	TESTL(intValue== 600);

	//Setting a real key
	ret = RepositorySingleSetL(*iServerRepo, 0x66, 99.99);
	TESTKErrNoneL(ret);
	ret=iServerRepo->Get(0x66,realValue);
	TESTL(realValue==99.99);

	//Setting a string key
	//Even ascii(8 bytes) are stored as 16 bytes!!!
	_LIT8(KString,"sixhundred");
	TBuf8<50> stringChangeValue=KString();
	ret = RepositorySingleSetL(*iServerRepo, 0x69, stringChangeValue);
	TESTKErrNoneL(ret);

	TBuf8<50> keyString;
	ret=iServerRepo->Get(0x69,keyString);
	TESTKErrNoneL(ret);
	TESTL(keyString.Compare(KString)==0);
	}
KString KString::Mid(size_t szStart, size_t szCount) const
{
	if(szStart > GetLength())
		throw 1;

	if(szCount == UINT_MAX)
		szCount = GetLength() - szStart;

	if(szStart + szCount > GetLength())
		throw 1;

	return KString(GetDataPtr() + szStart, szCount);
}
/**
Test MSdpElementBuilder::BuildStringL()
*/
void CT_DataSdpElementBuilder::DoCmdBuildStringL(MSdpElementBuilder& aElementBuilder, const TDesC& aSection)
{
    iDataWrapper.INFO_PRINTF1(_L("MSdpElementBuilder BuildStringL Call"));

    TPtrC 								theString;
    if( iDataWrapper.GetStringFromConfig(aSection, KString(), theString) )
    {
        HBufC8*	theString8=HBufC8::NewLC(theString.Length());
        theString8->Des().Copy(theString);
        TPtrC8 stringPtr = theString8->Des();
        TRAPD(err, aElementBuilder.BuildStringL(stringPtr));
        if(err != KErrNone)
        {
            iDataWrapper.ERR_PRINTF2(_L("MSdpElementBuilder BuildStringL failed with error %d"), err);
            iDataWrapper.SetError(err);
        }
        CleanupStack::PopAndDestroy(theString8);
    }
    else
    {
        iDataWrapper.ERR_PRINTF2(_L("Missing parameter %S"), &KString());
        iDataWrapper.SetBlockResult(EFail);
    }
}
Exemple #10
0
void OpenGLRenderer::render(OpenGLScene &scene)
{
  P(OpenGLRendererPrivate);
  unsigned int currViewport = 1;
  OpenGLMarkerScoped _("Total Render Time");
  for (OpenGLRenderView &renderView: p.m_renderViews)
  {
    OpenGLMarkerScoped _(KString("Viewport %1").arg(currViewport));
    renderView.bind();
    renderView.commit(scene);
    renderView.render(scene);
    renderView.release();
    ++currViewport;
  }
  GL::glViewport(0, 0, p.m_screenDimensions.width(), p.m_screenDimensions.height());
}
Exemple #11
0
	aWin->Win()->EndRedraw();
	}


void CTGdi::TestDefetct_DEF045746L()
	{
	_LIT(KString,"This is a test window for the defect fix DEF045746 \
		propagated from Opera browser. Most window graphics context drawing\
		functions map to equivalent CFbsBitGc functions they are implemented\
		on the screen with any co-ordinates being relative to the top left\
		corner of the window. However extra clipping is applied. The drawing\
		will always be clipped to the visible part of the window, in addition\
		it will be clipped to the non-invalid part if you are not doing a\
		redraw and to the region being validated if you are doing a redraw.");

	TPtrC TestText(KString().Ptr(),100);
	TPtrC LargeText(KString().Ptr());
	TPtrC ShortText(KString().Ptr(),200);

	TSize scrSize=TheClient->iScreen->SizeInPixels();
	TSize winSize;
	const TInt windowGap=5;
	winSize.SetSize(scrSize.iWidth -2* windowGap,scrSize.iHeight/2 - windowGap);

	iWin=new(ELeave) CTestWindow(TRgb(0,0,0));
	iWin->ConstructL(TPoint(5,5),TSize(winSize),TheClient->iGroup,*TheClient->iGc);
	CTestWindow* expectWin= new(ELeave) CTestWindow(TRgb(0,0,0));
	expectWin->ConstructL(TPoint(5,scrSize.iHeight/2 + windowGap),TSize(winSize),TheClient->iGroup,*TheClient->iGc);
	DrawTextOnWindow(ShortText,iWin);
	DrawTextOnWindow(TestText,expectWin);
	TInt fHeight=iFont->HeightInPixels();//Used to compare only pixels where text is drawn
Exemple #12
0
bool MeshImportFBX::Import( const char* filename, NVSHARE::MeshImportInterface *callback  )
{
	char message[OUTPUT_TEXT_BUFFER_SIZE+1] = "";
	message[OUTPUT_TEXT_BUFFER_SIZE] = '\0';
	
    const char* localName = getFileName( filename );
	KString fileName = KString( filename );
	KString filePath = fileName.Left( localName - filename );

	m_sdkManager = KFbxSdkManager::Create();

	if(m_sdkManager == NULL)
		return false;


    // Create the importer.
    int fileFormat = -1;
    //int registeredCount;
    //int pluginId;
    //m_sdkManager->GetIOPluginRegistry()->RegisterReader( CreateFBXImporterReader, GetFBXImporterReaderInfo,
    //             pluginId, registeredCount, FillFBXImporterReaderIOSettings );

    m_importer = KFbxImporter::Create( m_sdkManager, "" );
	if( !m_sdkManager->GetIOPluginRegistry()->DetectFileFormat( filename, fileFormat ) )
    {
        // Unrecognizable file format. Try to fall back to KFbxImporter::eFBX_BINARY
        fileFormat = m_sdkManager->GetIOPluginRegistry()->FindReaderIDByDescription( "FBX binary (*.fbx)" );;
    }

    m_importer->SetFileFormat( fileFormat );


    // Initialize the importer by providing a filename.
    if( !m_importer->Initialize( filename ) )
		return false;

    // Create the scene.
    m_scene = KFbxScene::Create( m_sdkManager, "" );


    if (m_importer->IsFBX())
    {
        // Set the import states. By default, the import states are always set to 
        // true. The code below shows how to change these states.
        IOSREF.SetBoolProp(IMP_FBX_MATERIAL,        true);
        IOSREF.SetBoolProp(IMP_FBX_TEXTURE,         true);
        IOSREF.SetBoolProp(IMP_FBX_LINK,            true);
        IOSREF.SetBoolProp(IMP_FBX_SHAPE,           true);
        IOSREF.SetBoolProp(IMP_FBX_GOBO,            true);
        IOSREF.SetBoolProp(IMP_FBX_ANIMATION,       true);
        IOSREF.SetBoolProp(IMP_FBX_GLOBAL_SETTINGS, true);
    }



	sprintf_s( message, OUTPUT_TEXT_BUFFER_SIZE, "Importing file %s", filename );
	outputMessage( message );
	if( !m_importer->Import(m_scene) )
		return false;

	//// Convert Axis System to what is used in this example, if needed
	//KFbxAxisSystem sceneAxisSystem = m_scene->GetGlobalSettings().GetAxisSystem();
	//KFbxAxisSystem ourAxisSystem(sceneAxisSystem.KFbxAxisSystem::ZAxis, KFbxAxisSystem::ParityOdd, KFbxAxisSystem::LeftHanded);
	//if( sceneAxisSystem != ourAxisSystem )
	//{
	//     ourAxisSystem.ConvertScene(m_scene);
	//}

	//// Convert Unit System to what is used in this example, if needed
	//KFbxSystemUnit sceneSystemUnit = m_scene->GetGlobalSettings().GetSystemUnit();
	//if( sceneSystemUnit.GetScaleFactor() != 1.0 )
	//{
	//	
	//    KFbxSystemUnit ourSystemUnit(1.0);
	//	ourSystemUnit.ConvertScene(m_scene);
	//	
	//}

	m_callback = callback;
	
	ImportSkeleton();

	m_takeName = NULL;
	m_takeInfo = NULL;
	m_takeNameArray.Clear();

    int takeCount = m_importer->GetTakeCount();
	int tSelected = -1;

	for(int t = 0; t < takeCount; t++ )
	{
		m_takeInfo = m_importer->GetTakeInfo(t);
		m_takeNameArray.Add( &m_takeInfo->mName );
		if(m_takeInfo->mSelect)
			tSelected = t;
	}        
	if(tSelected == -1 && takeCount > 0)
		tSelected = 0;

	if(tSelected >= 0)
	{
		m_takeInfo = m_importer->GetTakeInfo(tSelected);
		m_takeName = m_takeNameArray[tSelected];
		m_scene->SetCurrentTake( m_takeName->Buffer() );

		if (!ImportAnimation())
		{
			Release();
			return false;
		}
	}

    m_scene->FillMaterialArray(m_MaterialArray);


    ProcessScene();
				
	//// Load the texture data in memory (for supported formats)
	//LoadSupportedTextures(m_scene, m_textureArray);
				
	sprintf_s( message, OUTPUT_TEXT_BUFFER_SIZE, "done!" );
	outputMessage( message );


	m_scene->Destroy(true, true);
	m_scene = NULL;

	m_importer->Destroy(true, true);
	m_importer = NULL;

	m_sdkManager->Destroy();
	m_sdkManager = NULL;

	return true;
}
KString KString::operator + (bool bValue) const
{
	return bValue ?
				KString(GetDataPtr(), GetLength(), TEXT("true"),	4) :
				KString(GetDataPtr(), GetLength(), TEXT("false"),	5);
}
KString KString::operator + (TCHAR cChar) const
{
	return KString(GetDataPtr(), GetLength(), &cChar, 1);
}
KString KString::operator + (LPCTSTR pSString) const
{
	return KString(GetDataPtr(), GetLength(), pSString, _tcslen(pSString));
}
KString KString::operator + (const KString& SString) const
{
	return KString(GetDataPtr(), GetLength(), SString, SString.GetLength());
}