本文整理汇总了C++中QChar::latin1方法的典型用法代码示例。如果您正苦于以下问题:C++ QChar::latin1方法的具体用法?C++ QChar::latin1怎么用?C++ QChar::latin1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QChar
的用法示例。
在下文中一共展示了QChar::latin1方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readNext
// NOTE: setting 'peek' to true allows the same char to be read again,
// however this still advances the internal byte processing.
QChar readNext(bool peek=false)
{
QChar c;
if(mightChangeEncoding)
c = EndOfData;
else {
if(out.isEmpty()) {
QString s;
if(!tryExtractPart(&s))
c = EndOfData;
else {
out = s;
c = out[0];
}
}
else
c = out[0];
if(!peek)
out.remove(0, 1);
}
if(c == EndOfData) {
#ifdef XMPP_PARSER_DEBUG
printf("next() = EOD\n");
#endif
}
else {
#ifdef XMPP_PARSER_DEBUG
printf("next() = [%c]\n", c.latin1());
#endif
last = c;
}
return c;
}
示例2:
char
toAscii(QChar c)
{
#if QT_VERSION>=0x040000
// QT4 code
return c.toAscii();
#else
// QT3 code
return c.latin1();
#endif
}
示例3: latinize
void TabDialog::latinize(QString & s) {
unsigned i = s.length();
while (i != 0) {
QChar c = s.at(--i);
if (c.latin1() == 0) {
if (c.unicode() == 8217)
// special case for the pseudo ' returned by microsoft editors
c = '\'';
else
c = ' ';
s.replace(i, 1, &c, 1);
}
}
}
示例4: process
void QSASyntaxHighlighter::process( QTextDocument *doc, QTextParagraph *string, int, bool invalidate )
{
// ### AbanQ
if (this == 0)
return;
QTextFormat *formatStandard = format( Standard );
QTextFormat *formatComment = format( Comment );
QTextFormat *formatNumber = format( Number );
QTextFormat *formatString = format( String );
QTextFormat *formatType = format( Type );
QTextFormat *formatPreProcessor = format( PreProcessor );
QTextFormat *formatLabel = format( Label );
// states
const int StateStandard = 0;
const int StateCommentStart1 = 1;
const int StateCCommentStart2 = 2;
const int StateCppCommentStart2 = 3;
const int StateCComment = 4;
const int StateCppComment = 5;
const int StateCCommentEnd1 = 6;
const int StateCCommentEnd2 = 7;
const int StateStringStart = 8;
const int StateString = 9;
const int StateStringEnd = 10;
const int StateString2Start = 11;
const int StateString2 = 12;
const int StateString2End = 13;
const int StateNumber = 14;
const int StatePreProcessor = 15;
// tokens
const int InputAlpha = 0;
const int InputNumber = 1;
const int InputAsterix = 2;
const int InputSlash = 3;
const int InputParen = 4;
const int InputSpace = 5;
const int InputHash = 6;
const int InputQuotation = 7;
const int InputApostrophe = 8;
const int InputSep = 9;
static const uchar table[ 16 ][ 10 ] = {
{ StateStandard, StateNumber, StateStandard, StateCommentStart1, StateStandard, StateStandard, StatePreProcessor, StateStringStart, StateString2Start, StateStandard }, // StateStandard
{ StateStandard, StateNumber, StateCCommentStart2, StateCppCommentStart2, StateStandard, StateStandard, StatePreProcessor, StateStringStart, StateString2Start, StateStandard }, // StateCommentStart1
{ StateCComment, StateCComment, StateCCommentEnd1, StateCComment, StateCComment, StateCComment, StateCComment, StateCComment, StateCComment, StateCComment }, // StateCCommentStart2
{ StateCppComment, StateCppComment, StateCppComment, StateCppComment, StateCppComment, StateCppComment, StateCppComment, StateCppComment, StateCppComment, StateCppComment }, // CppCommentStart2
{ StateCComment, StateCComment, StateCCommentEnd1, StateCComment, StateCComment, StateCComment, StateCComment, StateCComment, StateCComment, StateCComment }, // StateCComment
{ StateCppComment, StateCppComment, StateCppComment, StateCppComment, StateCppComment, StateCppComment, StateCppComment, StateCppComment, StateCppComment, StateCppComment }, // StateCppComment
{ StateCComment, StateCComment, StateCCommentEnd1, StateCCommentEnd2, StateCComment, StateCComment, StateCComment, StateCComment, StateCComment, StateCComment }, // StateCCommentEnd1
{ StateStandard, StateNumber, StateStandard, StateCommentStart1, StateStandard, StateStandard, StatePreProcessor, StateStringStart, StateString2Start, StateStandard }, // StateCCommentEnd2
{ StateString, StateString, StateString, StateString, StateString, StateString, StateString, StateStringEnd, StateString, StateString }, // StateStringStart
{ StateString, StateString, StateString, StateString, StateString, StateString, StateString, StateStringEnd, StateString, StateString }, // StateString
{ StateStandard, StateStandard, StateStandard, StateCommentStart1, StateStandard, StateStandard, StatePreProcessor, StateStringStart, StateString2Start, StateStandard }, // StateStringEnd
{ StateString2, StateString2, StateString2, StateString2, StateString2, StateString2, StateString2, StateString2, StateString2End, StateString2 }, // StateString2Start
{ StateString2, StateString2, StateString2, StateString2, StateString2, StateString2, StateString2, StateString2, StateString2End, StateString2 }, // StateString2
{ StateStandard, StateStandard, StateStandard, StateCommentStart1, StateStandard, StateStandard, StatePreProcessor, StateStringStart, StateString2Start, StateStandard }, // StateString2End
{ StateNumber, StateNumber, StateStandard, StateCommentStart1, StateStandard, StateStandard, StatePreProcessor, StateStringStart, StateString2Start, StateStandard }, // StateNumber
{ StatePreProcessor, StateStandard, StateStandard, StateCommentStart1, StateStandard, StateStandard, StatePreProcessor, StateStringStart, StateString2Start, StateStandard } // StatePreProcessor
};
QString buffer;
int state = StateStandard;
if ( string->prev() ) {
if ( string->prev()->endState() == -1 )
process( doc, string->prev(), 0, FALSE );
state = string->prev()->endState();
}
int input = -1;
int i = 0;
bool lastWasBackSlash = FALSE;
bool makeLastStandard = FALSE;
ParagData *paragData = (ParagData*)string->extraData();
if ( paragData )
paragData->parenList.clear();
else
paragData = new ParagData;
string->setExtraData( paragData );
static QString alphabeth = QString::fromLatin1("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
static QString mathChars = QString::fromLatin1("xXeE");
static QString numbers = QString::fromLatin1("0123456789");
bool questionMark = FALSE;
bool resetLineState = TRUE;
QChar lastChar;
QString firstWord;
while ( TRUE ) {
QChar c = string->at( i )->c;
if ( lastWasBackSlash ) {
input = InputSep;
} else {
switch ( c.latin1() ) {
case '*':
input = InputAsterix;
break;
//.........这里部分代码省略.........
示例5: init
void TypeDesc::init( QString stri ) {
m_data = 0;
maybeInit();
if ( stri.isEmpty() )
return ;
m_data->m_dec = stri; ///Store the decoration
QStringList ls = splitType( stri );
QString str = ls.front().stripWhiteSpace();
///Extract multiple types that may be written as a scope and put them to the next-types-list
if ( !ls.isEmpty() ) {
ls.pop_front();
if ( !ls.isEmpty() ) {
m_data->m_nextType = TypeDescPointer( new TypeDescShared( ls.join( "::" ) ) );
}
}
while ( str.startsWith( QString( functionMark ) ) ) {
m_data->m_functionDepth++;
str = str.mid( strlen( functionMark ) ).stripWhiteSpace();
}
bool isFunction = false, shorten = true;
//Little hack done for performance-reasons, to do less comparing
if( str.length() >= 4 ) {
QChar c = str[0];
switch( c.latin1() ) {
case 's':
if( str[1] == 'h' ) {
if( str.startsWith( "short" ) )
shorten = false;
} else if( str[1] == 'i' ) {
if( str.startsWith( "signed" ) )
shorten = false;
}
break;
case 'l':
if( str.startsWith( "long" ) )
shorten = false;
break;
case 'u':
if( str.startsWith( "unsigned" ) )
shorten = false;
break;
case 'o':
if( str.startsWith( "operator " ) ) {
isFunction = true;
shorten = false;
}
}
}
///Since function-names are also processed by this function, this check has to be done
if( shorten ) {
///Remove any prefixes like const or typename(very limited algorithm)
int len = str.find( "<" );
if ( len == -1 )
len = str.length();
int currentStart = 0;
bool wasEmpty = false;
for ( int a = 0; a < len; a++ ) {
if ( str[ a ] == ' ' ) {
wasEmpty = true;
} else if( wasEmpty && isValidIdentifierSign( str[a] ) ){
currentStart = a;
wasEmpty = false;
}
}
str = str.mid( currentStart );
}
#ifdef USELEXER
Driver d;
Lexer lex( &d );
lex.setSource( str );
Parser parser( &d, &lex );
TypeSpecifierAST::Node typeSpec;
if ( parser.parseTypeSpecifier( typeSpec ) ) {
NameAST * name = typeSpec->name();
QPtrList<ClassOrNamespaceNameAST> l = name->classOrNamespaceNameList();
QPtrListIterator<ClassOrNamespaceNameAST> it( l );
QString type;
while ( it.current() ) {
if ( it.current() ->name() ) {
type += it.current() ->name() ->text() + "::";
}
++it;
}
if ( name->unqualifiedName() && name->unqualifiedName() ->name() ) {
type += name->unqualifiedName() ->name() ->text();
}
//.........这里部分代码省略.........