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


C++ parseText函数代码示例

本文整理汇总了C++中parseText函数的典型用法代码示例。如果您正苦于以下问题:C++ parseText函数的具体用法?C++ parseText怎么用?C++ parseText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: qDebug

void UpdateChecker::onRequestFinished(QNetworkReply* reply)
{
    if(reply->error() != QNetworkReply::NoError){
        qDebug("Error while checking update [%s]\n", reply->errorString().toLatin1().constData());
        return;
    }

    QSettings s;
    s.beginGroup("Update");
    s.setValue("lastUpdateDate", QDateTime::currentDateTime());
    s.endGroup();

    QByteArray data = reply->readAll();
    QXmlStreamReader reader(data);
    QString version;
    QString upgradeRevision;
    QString downloadUrl;
    QString infoUrl;
    QString description;
    QString releaseType;

    while (!reader.atEnd() && !reader.hasError()) {
        QXmlStreamReader::TokenType token = reader.readNext();
        if(token == QXmlStreamReader::StartDocument) {
            continue;
        }
        if(token == QXmlStreamReader::StartElement) {
            if(reader.name() == "version") {
                version = parseText(reader);
            }else if (reader.name() == "revision") {
                upgradeRevision = parseText(reader);
            }else if (reader.name() == "downloadUrl") {
                downloadUrl = parseText(reader);
            }else if (reader.name() == "infoUrl") {
                infoUrl = parseText(reader);
            }else if (reader.name() == "description") {
                description = parseText(reader);
            }
        }
    }

    if (reader.error())
        qDebug() << reader.error() << reader.errorString();

    QString message = QString(tr("An update for MuseScore is available: <a href=\"%1\">MuseScore %2 r.%3</a>")).arg(downloadUrl).arg(version).arg(upgradeRevision);
//    qDebug("revision %s\n", revision.toLatin1().constData());
    if(!version.isEmpty() &&  upgradeRevision > revision ){
        QMessageBox msgBox;
        msgBox.setWindowTitle(tr("Update Available"));
        msgBox.setText(message);
        msgBox.setTextFormat(Qt::RichText);
        msgBox.exec();
    }else if(manual){
        QMessageBox msgBox;
        msgBox.setWindowTitle(tr("No Update Available"));
        msgBox.setText(tr("No Update Available"));
        msgBox.setTextFormat(Qt::RichText);
        msgBox.exec();
    }
}
开发者ID:AndresDose,项目名称:MuseScore,代码行数:60,代码来源:updatechecker.cpp

示例2: while

void CTextHelper::loadFromFile(const std::string& fileName)
{
	std::string tmpStr = "";
	std::ifstream file;
	try
	{
		file.open(fileName);
		if (!file.is_open())
		{
			CLog::getInstance()->addError("Cant open" + fileName);
			return;
		}

		while (!file.eof())
		{
			std::getline(file, tmpStr);
			parseText(tmpStr);
		}
	}
	catch (...)
	{
		CLog::getInstance()->addError("Cant read " + fileName);
	}
		
	file.close();
}
开发者ID:AntonBogomolov,项目名称:NovemberLib,代码行数:26,代码来源:CTextHelper.cpp

示例3: parseHeader

String Communication::getUnpackedMessage(String message) {
  // Check Start of Header
  if (!checkStartOfHeader(message)) {
    return "";
  }
  
  // Parse Header
  int message_size = parseHeader(message);
  if (message_size < 0) {
    return "";
  }

  // Parse Text
  String unpacked_message = parseText(message); 
  if (unpacked_message == "") {
    return "";
  }

  // Check Message Size
  if (message_size != unpacked_message.length()) {
    return "";
  }
  
  // Compute & Compare Checksums
  String incoming_checksum = parseFooter(message);
  String computed_checksum = getChecksum(unpacked_message);
  if (incoming_checksum != computed_checksum) {
    return "";
  }
  
  // Received Valid Message
  return unpacked_message;
}
开发者ID:CoolJoe72,项目名称:gro-microcontroller,代码行数:33,代码来源:communication.cpp

示例4: setInnerHTML

PassRefPtrWillBeRawPtr<Text> GranularityStrategyTest::setupRotate(String str)
{
    setInnerHTML(
        "<html>"
        "<head>"
        "<style>"
            "div {"
                "transform: translate(0px,600px) rotate(90deg);"
            "}"
        "</style>"
        "</head>"
        "<body>"
        "<div id='mytext'></div>"
        "</body>"
        "</html>");

    RefPtrWillBeRawPtr<Text> text = document().createTextNode(str);
    Element* div = document().getElementById("mytext");
    div->appendChild(text);

    document().view()->updateAllLifecyclePhases();

    parseText(text.get());
    return text.release();
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:25,代码来源:GranularityStrategyTest.cpp

示例5: lyricsFile

bool KNMusicLrcParser::parseFile(const QString &filePath,
                                 QList<qint64> &positionList,
                                 QStringList &textList)
{
    //Read the file contents.
    QFile lyricsFile(filePath);
    if(!lyricsFile.open(QIODevice::ReadOnly))
    {
        return false;
    }
    QByteArray lyricsContent=lyricsFile.readAll();
    lyricsFile.close();
    //Try to parse the lyrics data via UTF-8 codecs.
    QTextCodec::ConverterState convState;
    QString lyricsTextData=m_utf8Codec->toUnicode(lyricsContent.constData(),
                                                  lyricsContent.size(),
                                                  &convState);
    //If we can't decode it, try to use default codec.
    if(convState.invalidChars>0)
    {
        lyricsTextData=m_localeCodec->toUnicode(lyricsContent.constData(),
                                                lyricsContent.size(),
                                                &convState);
        //If we still cannot decode it, ask user to select a codec.
        if(convState.invalidChars>0)
        {
            //! FIXME: add ask user to choice the text codec.
            ;
        }
    }
    //Parse the lyrics data.
    return parseText(lyricsTextData, positionList, textList);
}
开发者ID:Kreogist,项目名称:Mu,代码行数:33,代码来源:knmusiclrcparser.cpp

示例6: main

int main  ( int argc, char **argv ) {
#ifdef DEBUG
	printf("IN MAIN\n");
#endif
	/*Displays Help Command*/
	if(argc!=MIN_REQUIRED || !strcmp(argv[1], "-h")) {
		return help();
	}
	double time_spent;
	char* stringFile = readFile(argv[1]);
	if(stringFile == NULL){
		return help();
	}
	int numberWords=countCharacters(stringFile, ' ', '\n', '\t');
#ifdef DEBUG
	printf("File: %s\nTotal number of Words: %d\n %s\n",argv[1], numberWords, stringFile);
#endif
	clock_t tic = clock();
	parseText(stringFile, numberWords);
	clock_t toc = clock();
	printList();
	time_spent=(double)(toc-tic)/CLOCKS_PER_SEC;
	time_spent=time_spent/1000000;
#ifdef DEBUG
	printf("\n =========\n TIME SPENT: %.032f \n =========\n", time_spent);
#endif
#ifdef DEBUG
	printf("OUT OF MAIN\n");
#endif
	freeList();
	free(stringFile);
	return 0;
  }
开发者ID:spjps2009,项目名称:cs211,代码行数:33,代码来源:wordStat.c

示例7: QWidget

DraggableElement::DraggableElement(const QString& identifier, const QString& text, const QColor& color, Sprite* sprite, QWidget* parent) :
    QWidget(parent),
    _color(color),
    _text(text),
    _identifier(identifier),
    _static(false),
    _sprite(sprite),
    _path(QPoint(0, 0)),
    _currentDock(0),
    _prevElem(0),
    _nextElem(0)
{
    _paramLayout = new QHBoxLayout();
    _paramLayout->setSpacing(5);
    _paramLayout->setSizeConstraint(QLayout::SetFixedSize);
    _paramLayout->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);

    hide();
    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
    connect(this, SIGNAL(dragElemContextMenuRequested(QPoint,DraggableElement*)), sMainWindow, SLOT(dragElemContextMenuRequested(QPoint,DraggableElement*)));

    if(_sprite)
        _sprite->addElement(this);

    parseText(text);
}
开发者ID:IT4Kids,项目名称:it4kids,代码行数:27,代码来源:draggableelement.cpp

示例8: CHECK

// Each text sample consists of a string of text, optionally with sample
// modifier description. The modifier description could specify a new
// text style for the string of text. These descriptions are present only
// if they are needed. This method is used to extract the modifier
// description and append it at the end of the text.
status_t TimedTextASSSource::in_extractAndAppendLocalDescriptions(
        int64_t timeUs, const MediaBuffer *textBuffer, Parcel *parcel) {
    const void *data;
    size_t size = 0;
    int32_t flag = TextDescriptions::LOCAL_DESCRIPTIONS;

    const char *mime;
    CHECK(mInSource->getFormat()->findCString(kKeyMIMEType, &mime));
    CHECK(strcasecmp(mime, MEDIA_MIMETYPE_TEXT_ASS) == 0);

    data = textBuffer->data();
    size = textBuffer->size();

	MagicString* textData = parseText((const char*)data, size);
	MagicString::print("[Internal ASS Subtitle] ", *textData);

	if(NULL != textData){
		if (size > 0) {
	      parcel->freeData();
	      flag |= TextDescriptions::IN_BAND_TEXT_ASS;
	      return TextDescriptions::getParcelOfDescriptions(
	          (const uint8_t *)textData->c_str(), textData->length(), flag, timeUs / 1000, parcel);
	    }
		free(textData);
	}
    return OK;
}
开发者ID:LuckJC,项目名称:pro-fw,代码行数:32,代码来源:TimedTextASSSource.cpp

示例9: run_main

  static int run_main(int ac, char* av[]) {
    namespace po = boost::program_options;
    try {
      po::options_description generic("Allowed options");

      add(generic)("config-file,c", po::value<std::string>(), "config file name");
      add(generic)("help,h", "produce help message");

      po::options_description hidden("Hidden options");
      hidden.add_options()("input-file", po::value<std::string>(), "input file");

      po::options_description cmdline_options;
      cmdline_options.add(generic).add(hidden);

      po::options_description config_file_options;
      config_file_options.add(generic).add(hidden);

      po::positional_options_description p;
      p.add("input-file", -1);

      po::variables_map vm;
      store(po::command_line_parser(ac, av).options(cmdline_options).positional(p).run(), vm);

      if (vm.count("config-file")) {
        Util::Input ifs(vm["config-file"].as<std::string>());
        store(parse_config_file(*ifs, config_file_options), vm);
        notify(vm);
      }

      if (vm.count("help")) {
        std::cout << generic << "\n\n";
        std::cout << "Convert FSM (in hypergraph format) to OpenFst text format" << '\n';
        return EXIT_FAILURE;
      }

      std::string file;
      if (vm.count("input-file")) {
        file = vm["input-file"].as<std::string>();
      }

      typedef ViterbiWeightTpl<float> Weight;
      typedef Hypergraph::ArcTpl<Weight> Arc;

      IVocabularyPtr pVoc = Vocabulary::createDefaultVocab();

      Util::Input in_(file);

      MutableHypergraph<Arc> hg;
      hg.setVocabulary(pVoc);
      parseText(*in_, file, &hg);

      writeOpenFstFormat(std::cout, hg);

      assert(hg.checkValid());
    } catch (std::exception& e) {
      std::cerr << e.what() << '\n';
      return EXIT_FAILURE;
    }
    return EXIT_SUCCESS;
  }
开发者ID:sdl-research,项目名称:hyp,代码行数:60,代码来源:HypToOpenFstText.cpp

示例10: parseText

int GUIText::Update(void)
{
	if (!isConditionTrue())
		return 0;

	static int updateCounter = 3;

	// This hack just makes sure we update at least once a minute for things like clock and battery
	if (updateCounter)  updateCounter--;
	else
	{
		mVarChanged = 1;
		updateCounter = 3;
	}

	if (mIsStatic || !mVarChanged)
		return 0;

	std::string newValue = parseText();
	if (mLastValue == newValue)
		return 0;
	else
		mLastValue = newValue;
	return 2;
}
开发者ID:Abhinav1997,项目名称:Team-Win-Recovery-Project,代码行数:25,代码来源:text.cpp

示例11: TEST_F

// Tests moving extent over to the other side of the vase and immediately
// passing the word boundary and going into word granularity.
TEST_F(GranularityStrategyTest, DirectionSwitchSideWordGranularityThenShrink)
{
    dummyPageHolder().frame().settings()->setDefaultFontSize(12);
    String str = "ab cd efghijkl mnopqr iiin, abc";
    RefPtrWillBeRawPtr<Text> text = document().createTextNode(str);
    document().body()->appendChild(text);
    dummyPageHolder().frame().settings()->setSelectionStrategy(SelectionStrategy::Direction);

    parseText(text.get());

    // "abcd efgh ijkl mno^pqr|> iiin, abc" (^ means base, | means extent, < means start, and > means end).
    selection().setSelection(VisibleSelection(Position(text, 18), Position(text, 21)));
    EXPECT_EQ_SELECTED_TEXT("pqr");
    // Move to the middle of word #4 selecting it - this will set the offset to
    // be half the width of "iiin".
    selection().moveRangeSelectionExtent(m_wordMiddles[4]);
    EXPECT_EQ_SELECTED_TEXT("pqr iiin");
    // Move to the middle of word #2 - extent will switch over to the other
    // side of the base, and we should enter word granularity since we pass
    // the word boundary. The offset should become negative since the width
    // of "efghjkkl" is greater than that of "iiin".
    int offset = m_letterPos[26].x() - m_wordMiddles[4].x();
    IntPoint p = IntPoint(m_wordMiddles[2].x() - offset - 1, m_wordMiddles[2].y());
    selection().moveRangeSelectionExtent(p);
    EXPECT_EQ_SELECTED_TEXT("efghijkl mno");
    p.move(m_letterPos[7].x() - m_letterPos[6].x(), 0);
    selection().moveRangeSelectionExtent(p);
    EXPECT_EQ_SELECTED_TEXT("fghijkl mno");
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:31,代码来源:GranularityStrategyTest.cpp

示例12: insertIntoActiveView

void SnippetWidget::slotExecuted(QListViewItem * item)
{
  SnippetItem *pSnippet = dynamic_cast<SnippetItem*>( item );
  if (!pSnippet || dynamic_cast<SnippetGroup*>(item))
      return;

  //process variables if any, then insert into the active view
  insertIntoActiveView( parseText(pSnippet->getText(), _SnippetConfig.getDelimiter()) );
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:9,代码来源:snippet_widget.cpp

示例13: while

void Configuration::add( const EString & l )
{
    uint i = 0;
    while ( i < l.length() && ( l[i] == ' ' || l[i] == '\t' ) )
        i++;
    if ( i == l.length() || l[i] == '#' )
        return;

    while ( i < l.length() &&
            ( ( l[i] >= 'a' && l[i] <= 'z' ) ||
              ( l[i] >= 'A' && l[i] <= 'Z' ) ||
              ( l[i] >= '0' && l[i] <= '9' ) ||
              ( l[i] == '-' ) ) )
        i++;
    EString name = l.mid( 0, i ).lower().simplified();
    while ( l[i] == ' ' || l[i] == '\t' )
        i++;
    if ( l[i] == '#' ) {
        log( "comment immediately after variable name: " + l, Log::Disaster );
        return;
    }
    if ( l[i] != '=' ) {
        log( "no '=' after variable name: " + l, Log::Disaster );
        return;
    }
    i++;
    while ( l[i] == ' ' || l[i] == '\t' )
        i++;
    if ( d->contains( name ) )
        log( "Variable specified twice: " + name, Log::Disaster );
    d->seen.append( name );

    uint n = 0;
    while ( n < NumScalars && name != scalarDefaults[n].name )
        n++;
    if ( n < NumScalars ) {
        parseScalar( n, l.mid( i ) );
        return;
    }
    n = 0;
    while ( n < NumTexts && name != textDefaults[n].name )
        n++;
    if ( n < NumTexts ) {
        parseText( n, l.mid( i ) );
        return;
    }
    n = 0;
    while ( n < NumToggles && name != toggleDefaults[n].name )
        n++;
    if ( n < NumToggles ) {
        parseToggle( n, l.mid( i ) );
        return;
    }

    log( "Unknown variable: " + name, Log::Disaster );
}
开发者ID:copernicus,项目名称:aox,代码行数:56,代码来源:configuration.cpp

示例14: getNextToken

boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseImp (bool allowEmpty, bool ignoreOneShot)
{
    if (Token token = getNextToken())
    {
        if (token==Token (Token::Type_OneShot))
            token = getNextToken();

        if (token)
            switch (token.mType)
            {
                case Token::Type_Keyword_True:

                    return boost::shared_ptr<CSMFilter::Node> (new BooleanNode (true));

                case Token::Type_Keyword_False:

                    return boost::shared_ptr<CSMFilter::Node> (new BooleanNode (false));

                case Token::Type_Keyword_And:
                case Token::Type_Keyword_Or:

                    return parseNAry (token);

                case Token::Type_Keyword_Not:
                {
                    boost::shared_ptr<CSMFilter::Node> node = parseImp();

                    if (mError)
                        return boost::shared_ptr<Node>();

                    return boost::shared_ptr<CSMFilter::Node> (new NotNode (node));
                }

                case Token::Type_Keyword_Text:

                    return parseText();

                case Token::Type_Keyword_Value:

                    return parseValue();

                case Token::Type_EOS:

                    if (!allowEmpty)
                        error();

                    return boost::shared_ptr<Node>();

                default:

                    error();
            }
    }

    return boost::shared_ptr<Node>();
}
开发者ID:AAlderman,项目名称:openmw,代码行数:56,代码来源:parser.cpp

示例15: parseText

void TextLnk::execute()
{
	QClipboard* cb = QApplication::clipboard();
	parseText();
	cb->setText(m_params[1]);
	QWSServer::sendKeyEvent('V'-'@',Qt::Key_V, Qt::ControlButton,
		true, false);
	QWSServer::sendKeyEvent('V'-'@',Qt::Key_V, Qt::ControlButton,
		false, false);
}
开发者ID:opieproject,项目名称:opie,代码行数:10,代码来源:TextLnk.cpp


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