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


C++ QCString::isNull方法代码示例

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


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

示例1: nequal

bool nequal(const QCString & s1, const QCString & 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') ;
  }
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例2: main

int main(int argc, char **argv)
{
  KCmdLineArgs::init(argc,argv,"dcoptest","dcoptest","","");
  KApplication app;
  DCOPClient &dcopclient=*(app.dcopClient());
  TiEmuDCOP_stub *tiemuDCOP;
  if (!dcopclient.attach())
    {puts("DCOP error (#1).");return 1;}
  QCStringList applist=dcopclient.registeredApplications();
  QCString appname;
  QCStringList::iterator it;
  for (it = applist.begin(); it != applist.end(); ++it) {
    if ((*it).contains(QRegExp("^tiemu-"))) {
      appname = (*it);
      break;
    }
  }
  if (appname.isNull()) { // TiEmu not running
    KRun::runCommand("tiemu");
    do {
      applist=dcopclient.registeredApplications();
      for (it = applist.begin(); it != applist.end(); ++it) {
        if ((*it).contains(QRegExp("^tiemu-"))) {
          appname = (*it);
          break;
        }
      }
    } while (appname.isNull());
  }
  tiemuDCOP = new TiEmuDCOP_stub(appname,"TiEmuDCOP");
  bool ready;
  do {
    ready=tiemuDCOP->ready_for_transfers();
    if (!tiemuDCOP->ok())
      {delete tiemuDCOP;dcopclient.detach();puts("DCOP error (#2).");return 2;}
  } while (!ready);
#if 0 // This shouldn't be needed with the new ready_for_transfers().
  if (!tiemuDCOP->turn_calc_on() || !tiemuDCOP->ok())
    {delete tiemuDCOP;dcopclient.detach();puts("DCOP error (#3).");return 3;}
  sleep(3); // give the emulated calculator time to react
#endif
  if (!tiemuDCOP->execute_command(QString("2+3")) || !tiemuDCOP->ok())
    {delete tiemuDCOP;dcopclient.detach();puts("DCOP error (#4).");return 4;}
  delete tiemuDCOP;
  if (!dcopclient.detach())
    {puts("DCOP error (#5).");return 5;}
  return 0;
}
开发者ID:debrouxl,项目名称:tiemu,代码行数:48,代码来源:dcoptest.cpp

示例3: slotConfigAmarok

void App::slotConfigAmarok( const QCString& page )
{
    DEBUG_FUNC_INFO

    AmarokConfigDialog* dialog = (AmarokConfigDialog*) KConfigDialog::exists( "settings" );

    if( !dialog )
    {
        //KConfigDialog didn't find an instance of this dialog, so lets create it :
        dialog = new AmarokConfigDialog( m_pPlaylistWindow, "settings", AmarokConfig::self() );

        connect( dialog, SIGNAL(settingsChanged()), SLOT(applySettings()) );
    }

    //FIXME it seems that if the dialog is on a different desktop it gets lost
    //      what do to? detect and move it?

    dialog->show();
    dialog->raise();
    dialog->setActiveWindow();

    //so that if the engine page is needed to be shown it works
    kapp->processEvents();

    if ( !page.isNull() ) dialog->showPage( page );
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例4: importIt

void UmlActivityObject::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(anActivityObject, token, in);
    
  if (where != 0) {
    QCString s = token.valueOf("name");
    UmlActivityObject * a = create(where, s);
    
    if (a == 0)
      in.error("cannot create activity object '"
	       + s + "' in '" + where->name() + "'");
    
    a->addItem(token.xmiId(), in);
    
    QCString ste;
    
    s = token.xmiType();
    switch (((const char *) s)[0]) {
    case 'D':
      ste = "datastore";
      break;
    case 'C':
      ste = "centralBuffer";
      break;
    default:
      break;
    }
    
    a->import_it(in, token);
    
    if (! ste.isNull())
      a->set_Stereotype(ste);
  }

}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例5: readEntryUntranslated

QString KConfigBase::readEntryUntranslated(const char *pKey, const QString &aDefault) const
{
    QCString result = readEntryUtf8(pKey);
    if(result.isNull())
        return aDefault;
    return QString::fromUtf8(result);
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:7,代码来源:kconfigbase.cpp

示例6: staticCharset

static
const char * staticCharset(int i)
{
    static QCString localcharset;

    switch ( i ) {
      case 0:
	return "UTF-8";
      case 1:
	return "ISO-10646-UCS-2";
      case 2:
	return ""; // in the 3rd place - some Xdnd targets might only look at 3
      case 3:
	if ( localcharset.isNull() ) {
	    QTextCodec *localCodec = QTextCodec::codecForLocale();
	    if ( localCodec ) {
		localcharset = localCodec->name();
		localcharset = localcharset.lower();
		stripws(localcharset);
	    } else {
		localcharset = "";
	    }
	}
	return localcharset;
    }
    return 0;
}
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:27,代码来源:qdragobject.cpp

示例7: neq

bool neq(const QCString & s1, const QCString & 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;
  }
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例8: decode

/*!
  Attempts to decode the dropped information in \a e
  into \a str, returning TRUE if successful.  If \a subtype is null,
  any text subtype is accepted, otherwise only that specified is
  accepted.  \a subtype is set to the accepted subtype.

  \sa canDecode()
*/
bool QTextDrag::decode( const QMimeSource* e, QString& str, QCString& subtype )
{
    const char* mime;
    for (int i=0; (mime = e->format(i)); i++) {
	if ( 0==qstrnicmp(mime,"text/",5) ) {
	    QCString m(mime);
	    m = m.lower();
	    int semi = m.find(';');
	    if ( semi < 0 )
		semi = m.length();
	    QCString foundst = m.mid(5,semi-5);
	    if ( subtype.isNull() || foundst == subtype ) {
		QTextCodec* codec = findcharset(m);
		if ( codec ) {
		    QByteArray payload;

		    payload = e->encodedData(mime);
		    if ( payload.size() ) {
			int l;
			if ( codec->mibEnum() != 1000) {
			    // length is at NUL or payload.size()
			    l = 0;
			    while ( l < (int)payload.size() && payload[l] )
				l++;
			} else {
			    l = payload.size();
			}

			str = codec->toUnicode(payload,l);

			if ( subtype.isNull() )
			    subtype = foundst;

			return TRUE;
		    }
		}
	    }
	}
    }
    return FALSE;
}
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:49,代码来源:qdragobject.cpp

示例9: readUnsignedLongNumEntry

unsigned long KConfigBase::readUnsignedLongNumEntry(const char *pKey, unsigned long nDefault) const
{
    QCString aValue = readEntryUtf8(pKey);
    if(aValue.isNull())
        return nDefault;
    else
    {
        bool ok;
        unsigned long rc = aValue.toULong(&ok);
        return (ok ? rc : nDefault);
    }
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:12,代码来源:kconfigbase.cpp

示例10: readDoubleNumEntry

double KConfigBase::readDoubleNumEntry(const char *pKey, double nDefault) const
{
    QCString aValue = readEntryUtf8(pKey);
    if(aValue.isNull())
        return nDefault;
    else
    {
        bool ok;
        double rc = aValue.toDouble(&ok);
        return (ok ? rc : nDefault);
    }
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:12,代码来源:kconfigbase.cpp

示例11: readNumEntry

int KConfigBase::readNumEntry(const char *pKey, int nDefault) const
{
    QCString aValue = readEntryUtf8(pKey);
    if(aValue.isNull())
        return nDefault;
    else if(aValue == "true" || aValue == "on" || aValue == "yes")
        return 1;
    else
    {
        bool ok;
        int rc = aValue.toInt(&ok);
        return (ok ? rc : nDefault);
    }
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:14,代码来源:kconfigbase.cpp

示例12: automaticDetectionForCentralEuropean

static QCString automaticDetectionForCentralEuropean(const unsigned char *ptr, int size)
{
    QCString charset;
    for(int i = 0; i < size; ++i)
    {
        if(ptr[ i ] >= 0x80 && ptr[ i ] <= 0x9F)
        {
            if(ptr[ i ] == 0x81 || ptr[ i ] == 0x83 || ptr[ i ] == 0x90 || ptr[ i ] == 0x98)
                return "ibm852";

            if(i + 1 > size)
                return "cp1250";
            else   // maybe ibm852 ?
            {
                charset = "cp1250";
                continue;
            }
        }
        if(ptr[ i ] == 0xA5 || ptr[ i ] == 0xAE || ptr[ i ] == 0xBE || ptr[ i ] == 0xC3 || ptr[ i ] == 0xD0 || ptr[ i ] == 0xE3 || ptr[ i ] == 0xF0)
        {
            if(i + 1 > size)
                return "iso-8859-2";
            else    // maybe ibm852 ?
            {
                if(charset.isNull())
                    charset = "iso-8859-2";
                continue;
            }
        }
    }

    if(charset.isNull())
        charset = "iso-8859-3";

    return charset.data();
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:36,代码来源:encodingdetector.cpp

示例13: QCString

// creates the name for the local text/plain
static const char *localTextPlain()
{
  static QCString TextPlainLocal;

  if( TextPlainLocal.isNull() )
  {
    TextPlainLocal = QCString(KGlobal::locale()->encoding()).lower();
    // remove the whitespaces
    int s;
    while( (s=TextPlainLocal.find(' ')) >= 0 )
      TextPlainLocal.remove( s, 1 );

    TextPlainLocal.prepend( TextPlainLocalStub );
  }

  return TextPlainLocal;
}
开发者ID:serghei,项目名称:kde3-kdeutils,代码行数:18,代码来源:kbufferdrag.cpp

示例14: readBoolEntry

bool KConfigBase::readBoolEntry(const char *pKey, bool bDefault) const
{
    QCString aValue = readEntryUtf8(pKey);

    if(aValue.isNull())
        return bDefault;
    else
    {
        if(aValue == "true" || aValue == "on" || aValue == "yes" || aValue == "1")
            return true;
        else
        {
            bool bOK;
            int val = aValue.toInt(&bOK);
            if(bOK && val != 0)
                return true;
            else
                return false;
        }
    }
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:21,代码来源:kconfigbase.cpp

示例15: ConverseSsh

int SshProcess::ConverseSsh(const char *password, int check)
{
    unsigned i, j, colon;

    QCString line;
    int state = 0;

    while(state < 2)
    {
        line = readLine();
        const uint len = line.length();
        if(line.isNull())
            return -1;

        switch(state)
        {
            case 0:
                // Check for "kdesu_stub" header.
                if(line == "kdesu_stub")
                {
                    unreadLine(line);
                    return 0;
                }

                // Match "Password: " with the regex ^[^:]+:[\w]*$.
                for(i = 0, j = 0, colon = 0; i < len; i++)
                {
                    if(line[i] == ':')
                    {
                        j = i;
                        colon++;
                        continue;
                    }
                    if(!isspace(line[i]))
                        j++;
                }
                if((colon == 1) && (line[j] == ':'))
                {
                    if(check == 2)
                    {
                        m_Prompt = line;
                        return SshNeedsPassword;
                    }
                    WaitSlave();
                    write(m_Fd, password, strlen(password));
                    write(m_Fd, "\n", 1);
                    state++;
                    break;
                }

                // Warning/error message.
                m_Error += line;
                m_Error += "\n";
                if(m_bTerminal)
                    fprintf(stderr, "ssh: %s\n", line.data());
                break;

            case 1:
                if(line.isEmpty())
                {
                    state++;
                    break;
                }
                return -1;
        }
    }
    return 0;
}
开发者ID:,项目名称:,代码行数:68,代码来源:


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