本文整理汇总了C++中CConsoleBase::Write方法的典型用法代码示例。如果您正苦于以下问题:C++ CConsoleBase::Write方法的具体用法?C++ CConsoleBase::Write怎么用?C++ CConsoleBase::Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConsoleBase
的用法示例。
在下文中一共展示了CConsoleBase::Write方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MainL
LOCAL_C void MainL()
{
_LIT(KTitle,"TestExecuteLogger Test Code for serial logging");
CConsoleBase* console = Console::NewL(KTitle,TSize(KConsFullScreen,KConsFullScreen));
CleanupStack::PushL(console);
CTestExecuteLogger logger;
TInt logLevel =1 ;
TBool separateLogFiles(EFalse);
_LIT(KScriptPath,"E:\\plattest\\Selective.script");
TPtrC scriptFilePath(KScriptPath);
console->Write(_L("logger.InitialiseLoggingL next2 \n")) ;
logger.InitialiseLoggingL(scriptFilePath, separateLogFiles, logLevel);
console->Write(_L("post logger.InitialiseLoggingL next \n"));
TestWorkAPIsL(logger, console) ;
console->Write(_L("attempting TerminateLoggingL \n")) ;
logger.TerminateLoggingL(3, 4, 3); //suggested by todays fortune cookie...
console->Write(_L("Done testing, press a key to finish \n")) ;
console->Getch() ;
CleanupStack::PopAndDestroy(console);
}
示例2: Write
void Write(const TDesC& str) {
if (cons) {
cons->Write(str);
}
if (foutput.SubSessionHandle()!=0) {
TInt len=str.Length()*2;
TPtrC8 p( (const TUint8*)str.Ptr(), len );
foutput.Write(p);
foutput.Flush();
}
}
示例3: Write
void CTestConsole::Write(const TDesC16& aString)
{
iCon->Write(aString);
if (iFile)
{
TUint8 space[200];
TPtr8 ptr(space,200);
ptr.Copy(aString);
iFile->Write(ptr);
}
}
示例4: InitConsoleL
LOCAL_C void InitConsoleL()
{
// create a full screen console object
CConsoleBase* console;
console = Console::NewL(KTxtTitle, TSize(KConsFullScreen,KConsFullScreen));
CleanupStack::PushL(console);
//Gets the size of the console
TSize screenSize = console->ScreenSize();
test.Printf(_L("Screen size %d %d\r\n"),screenSize.iWidth,screenSize.iHeight);
// Gets the cursor's x-position
TInt x = console->WhereX();
// Gets the cursor's y-position
TInt y = console->WhereY();
test_Equal(x, 0);
test_Equal(y, 0);
test.Printf(_L("**1** Cursor positions x: %d y: %d\r\n"),x, y);
// Sets the cursor's x-position
for(TInt i=0; i<4; i++)
{
console->SetPos(screenSize.iWidth + i);
x = console->WhereX();
test_Equal(x, screenSize.iWidth -3);
}
test.Printf(_L("**2** Cursor positions x: %d y: %d\r\n"),x, y);
// Clears the console and set cursor to position 0,0
console->ClearScreen();
test_Equal(console->WhereX(), 0);
test_Equal(console->WhereY(), 0);
// Sets the cursor's x-position and y-position
for(TInt j=0; j<4; j++)
{
console->SetPos(screenSize.iWidth - j, screenSize.iHeight - j);
x = console->WhereX();
y = console->WhereY();
test_Equal(x, screenSize.iWidth -3);
test_Equal(y, screenSize.iHeight -3);
}
test.Printf(_L("**3** Cursor positions x: %d y: %d\r\n"),x, y);
console->SetPos(0,0);
x = console->WhereX();
y = console->WhereY();
test_Equal(x, 0);
test_Equal(y, 0);
test.Printf(_L("**4** Cursor positions x: %d y: %d\r\n"),x, y);
console->SetPos(screenSize.iWidth/2,screenSize.iHeight/2);
x = console->WhereX();
y = console->WhereY();
test.Printf(_L("**5** Cursor positions x: %d y: %d\r\n"),x, y);
// Sets the percentage height of the cursor
console->SetCursorHeight(50);
// Gets the current cursor position relative to the console window
TPoint cursorPos = console->CursorPos();
test.Printf(_L("CursorPos iX: %d iY: %d\r\n"),cursorPos.iX, cursorPos.iY);
// Puts the cursor at the specified position relative
// to the current cursor position
TPoint relPos;
relPos.iX = screenSize.iWidth/4;
relPos.iY = screenSize.iHeight/4;
console->SetCursorPosRel(relPos);
cursorPos = console->CursorPos();
test.Printf(_L("CursorPosRel iX: %d iY: %d\r\n"),cursorPos.iX, cursorPos.iY);
// Puts the cursor at the absolute position in the window
cursorPos.iX = screenSize.iWidth/6;
cursorPos.iY = screenSize.iHeight/6;
console->SetCursorPosAbs(cursorPos);
cursorPos = console->CursorPos();
test.Printf(_L("CursorPosAbs iX: %d iY: %d\r\n"),cursorPos.iX, cursorPos.iY);
// Sets a new console title
console->SetTitle(KTxtNewTitle);
// Writes the content of the specified descriptor to the console window
console->Write(KTxtWrite);
cursorPos.iX = cursorPos.iX + 6;
console->SetCursorPosAbs(cursorPos);
// Clears the console from the current cursor position to the end of the line
console->ClearToEndOfLine();
// Clears the console and set cursor to position 0,0
console->ClearScreen();
TUint keyModifiers = console->KeyModifiers();
test.Printf(_L("keyModifiers %d"),keyModifiers);
TKeyCode keyCode = console->KeyCode();
ReadConsole(console);
SimulateKeyPress(EStdKeyEnter);
keyCode = console->Getch();
//.........这里部分代码省略.........
示例5: PerformTestsL
TBool CTestBitStr::PerformTestsL(CConsoleBase& aConsole)
{
TBool pass = ETrue;
// Test the encoding varying length bit strings by encoding 65
// different bit strings with a single bit set in each position. Position -1
// indicates the empty bit string.
for (TInt8 bitNum = -1; bitNum < 64; bitNum++)
{
TBuf8<8> bitStr;
TUint numOctets;
if (bitNum >= 0)
{
numOctets = 1 + (bitNum / 8);
}
else
{
numOctets = 0;
}
bitStr.SetLength(numOctets);
bitStr.FillZ();
TUint8 valToEncode = 0;
if (bitNum >= 0 )
{
// The most significant bit in the most significant byte is bit zero
valToEncode = (TUint8) (1 << (7 - (bitNum % 8)));
bitStr[bitNum / 8] = valToEncode;
}
// Get the encoder and decoder
CASN1EncBitString* encoder = CASN1EncBitString::NewLC(bitStr, bitNum + 1);
TASN1DecBitString decoder;
// Prepare an encode buffer
TInt totalLength = encoder->LengthDER();
HBufC8* encodeBuffer = HBufC8::NewMaxLC(totalLength);
TPtr8 tEncodeBuf = encodeBuffer->Des();
// Write into the encode buffer
TUint writeLength = 0;
encoder->WriteDERL(tEncodeBuf, writeLength);
// Read it out again and check lengths plus encoded value
TInt readLength = 0;
HBufC8* decodeBuffer = decoder.ExtractOctetStringL(tEncodeBuf, readLength);
CleanupStack::PushL(decodeBuffer);
TPtr8 tDecodeBuf = decodeBuffer->Des();
if (writeLength != STATIC_CAST(TUint, readLength))
{
aConsole.Write(_L("ERROR!\n"));
iASN1Action.ReportProgressL(KErrASN1EncodingError, 1, 1);
pass = EFalse;
}
else if (bitNum >= 0 && valToEncode != tDecodeBuf[bitNum / 8])
{
aConsole.Write(_L("ENCODING ERROR!\n"));
iASN1Action.ReportProgressL(KErrASN1EncodingError, 1, 1);
pass = EFalse;
}
else
{
iASN1Action.ReportProgressL(KErrNone, bitNum + 1, 65);
}
CleanupStack::PopAndDestroy(3, encoder); // decodeBuffer, encodeBuffer, encoder
}
return pass;
}