本文整理汇总了C++中Q3CString::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3CString::isNull方法的具体用法?C++ Q3CString::isNull怎么用?C++ Q3CString::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3CString
的用法示例。
在下文中一共展示了Q3CString::isNull方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nequal
bool nequal(const Q3CString & s1, const Q3CString & s2)
{
// don't take into account first and last white spaces (like a stripWhiteSpace())
const char * p1 = (s1.isNull()) ? "" : (const char *) s1;
const char * p2 = (s2.isNull()) ? "" : (const char *) s2;
const char * e1 = p1 + s1.length();
const char * e2 = p2 + s2.length();
while ((p1 != e1) && is_white_space(p1[0]))
p1 += 1;
while ((p2 != e2) && is_white_space(p2[0]))
p2 += 1;
while ((e1 != p1) && is_white_space(e1[-1]))
e1 -= 1;
while ((e2 != p2) && is_white_space(e2[-1]))
e2 -= 1;
for (;;) {
if (p1 >= e1)
return (p2 < e2);
if (*p1 != *p2)
return TRUE;
while (*++p1 == '\r') ;
while (*++p2 == '\r') ;
}
}
示例2: QVERIFY
void tst_Q3CString::isNull()
{
Q3CString a;
QVERIFY( a.isNull() );
const char *str = "foo";
a.sprintf( str );
QVERIFY( !a.isNull() );
}
示例3: c
void tst_Q3CString::constructor()
{
Q3CString a;
Q3CString b; //b(10);
Q3CString c("String C");
char tmp[10];
tmp[0] = 'S';
tmp[1] = 't';
tmp[2] = 'r';
tmp[3] = 'i';
tmp[4] = 'n';
tmp[5] = 'g';
tmp[6] = ' ';
tmp[7] = 'D';
tmp[8] = 'X';
tmp[9] = '\0';
Q3CString d(tmp,9);
Q3CString ca(a);
Q3CString cb(b);
Q3CString cc(c);
QCOMPARE(a,ca);
QVERIFY(a.isNull());
QVERIFY(a == Q3CString(""));
QCOMPARE(b,cb);
QCOMPARE(c,cc);
QCOMPARE(d,(Q3CString)"String D");
Q3CString null(0);
QVERIFY( null.isNull() );
QVERIFY( null.isEmpty() );
Q3CString empty("");
QVERIFY( !empty.isNull() );
QVERIFY( empty.isEmpty() );
}
示例4: neq
bool neq(const Q3CString & s1, const Q3CString & s2)
{
const char * p1 = (s1.isNull()) ? "" : (const char *) s1;
const char * p2 = (s2.isNull()) ? "" : (const char *) s2;
for (;;) {
while (*p1 == '\r') p1 += 1;
while (*p2 == '\r') p2 += 1;
if (*p1 == 0)
return (*p2 != 0);
if (*p1 != *p2)
return TRUE;
p1 += 1;
p2 += 1;
}
}
示例5: solve
void UmlReplyAction::solve(Q3CString idref) {
Q3CString tr = Trigger::get(idref);
if (tr.isNull()) {
if (!FileIn::isBypassedId(idref))
UmlCom::trace("reply activity action : unknown trigger reference '" + idref + "'<br>");
}
else
set_ReplyToCall(tr);
}
示例6: importIt
void UmlAcceptCallAction::importIt(FileIn & in, Token & token, UmlItem * where)
{
where = where->container(anAcceptCallAction, token, in);
if (where != 0) {
Q3CString s = token.valueOf("name");
UmlAcceptCallAction * a = create(where, s);
if (a == 0)
in.error("cannot create accept call action '"
+ s + "' in '" + where->name() + "'");
a->addItem(token.xmiId(), in);
if (!(s = token.valueOf("trigger")).isEmpty()) {
Q3CString tr = Trigger::get(s);
if (!tr.isNull())
a->set_Trigger(tr);
else
Unresolved::addRef(a, s);
}
if (! token.closed()) {
Q3CString k = token.what();
const char * kstr = k;
while (in.read(), !token.close(kstr)) {
if (token.what() == "trigger") {
Q3CString tr_name;
Q3CString tr_ref;
Trigger::add(in, token, tr_name, tr_ref);
if (!tr_name.isNull())
a->set_Trigger(tr_name);
else
Unresolved::addRef(a, tr_ref);
}
else if (token.what() == "isunmarshall") {
// not memorized : always true
if (! token.closed())
in.finish(token.what());
}
else
a->import(in, token);
}
}
}
}
示例7: parse
static void parse( MetaTranslator *tor, const char *initialContext,
const char *defaultContext )
{
QMap<Q3CString, Q3CString> qualifiedContexts;
QStringList namespaces;
Q3CString context;
Q3CString ext;
Q3CString text;
Q3CString comment;
Q3CString functionContext = initialContext;
Q3CString prefix;
bool utf8 = FALSE;
yyTok = getToken();
while ( yyTok != Tok_Eof ) {
switch ( yyTok ) {
case Tok_i18n:
utf8 = FALSE;
yyTok = getToken();
if ( match( Tok_LeftParen ) &&
( matchString( &context ) || matchSString( &context ) ) &&
match( Tok_Comma ) &&
( matchString( &text ) || matchSString( &text ) ) )
{
if ( ( match( Tok_Comma ) &&
( matchString( &comment ) || matchSString( &comment ) ) &&
match( Tok_RightParen ) ) == false )
{
comment = "";
}
tor->insert( MetaTranslatorMessage( context, text, comment, QString::null, utf8 ) );
}
// else
// qDebug( " --- token failed ------------" );
break;
case Tok_x18n:
utf8 = FALSE;
yyTok = getToken();
if ( match( Tok_LeftParen ) &&
( matchString( &ext ) || matchSString( &ext ) ) &&
match( Tok_Comma ) &&
( matchString( &context ) || matchSString( &context ) ) &&
match( Tok_Comma ) &&
( matchString( &text ) || matchSString( &text ) ) )
{
if ( ( match( Tok_Comma ) &&
( matchString( &comment ) || matchSString( &comment ) ) &&
match( Tok_RightParen ) ) == false )
{
comment = "";
}
tor->insert( MetaTranslatorMessage( context, text, comment, QString::null, utf8 ) );
}
// else
// qDebug( " --- token failed ------------" );
break;
case Tok_Ident:
if ( !prefix.isNull() )
prefix += "::";
prefix += yyIdent;
yyTok = getToken();
if ( yyTok != Tok_Gulbrandsen )
prefix = (const char *) 0;
break;
case Tok_Comment:
comment = yyComment;
comment = comment.simplifyWhiteSpace();
yyTok = getToken();
break;
case Tok_Gulbrandsen:
// at top level?
if ( yyBraceDepth == (int) namespaces.count() && yyParenDepth == 0 )
functionContext = prefix;
yyTok = getToken();
break;
case Tok_RightBrace:
case Tok_Semicolon:
if ( yyBraceDepth >= 0 &&
yyBraceDepth + 1 == (int) namespaces.count() )
namespaces.remove( namespaces.fromLast() );
if ( yyBraceDepth == (int) namespaces.count() ) {
functionContext = defaultContext;
}
yyTok = getToken();
break;
default:
yyTok = getToken();
}
}
// if ( yyBraceDepth != 0 )
// qWarning( "%s: Unbalanced braces in PHP code", (const char *) yyFileName );
// if ( yyParenDepth != 0 )
// qWarning( "%s: Unbalanced parentheses in PHP code", (const char *) yyFileName );
}