• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ contents函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: method

/* Returns index if a sentence matches, 0 otherwise */
int method(int index)
{
  if(tokens[(index = readTok(index))] == VOID_METHOD_START)
    {
      if(tokens[(index = readTok(index))] == OPENTOK)
	{
	  if(index = contents(index))
	    {
	      if(tokens[(index = readTok(index))] == CLOSETOK)
		return index;
	    }
	}
    }
  if(nextTok(index) == METHOD_START)
    {
      if(nextTok(index) == OPENTOK)
	{
	  if(index = contents(index))
	    {
	      if(nextTok(index) == CLOSETOK)
		return index;
	    }
	}
    }
  return index;
}
开发者ID:ddilger,项目名称:error-diagnosis,代码行数:27,代码来源:return_diagnoser2.c


示例2: _dbSession

AutoChamada::AutoChamada(Wt::Dbo::Session& dbSession, std::vector<std::pair<Wt::WCheckBox*, Wt::Dbo::ptr<SiconfModel::Aluno>>> list) :
																								Wt::WDialog(),
																								_dbSession(dbSession),
																								_list(list),
																								index(0){

	Wt::Dbo::Transaction transaction(_dbSession);

	_presente = new Wt::WPushButton("Presente", footer());
	_ausente = new Wt::WPushButton("Ausente", footer());
	_anterior = new Wt::WPushButton("Anterior", footer());
	_cancelar = new Wt::WPushButton("Cancelar", footer());

	new Wt::WText("<h3>Chamada Automatica</h3>", titleBar());
	titleBar()->setContentAlignment(Wt::AlignCenter);
	contents()->setContentAlignment(Wt::AlignCenter);
	footer()->setContentAlignment(Wt::AlignCenter);

	_presente->clicked().connect(this, &AutoChamada::_presenteClicked);
	_ausente->clicked().connect(this, &AutoChamada::_ausenteClicked);
	_anterior->clicked().connect(this, &AutoChamada::_anteriorClicked);
	_cancelar->clicked().connect(this, &AutoChamada::_cancelClicked);

	_presente->setStyleClass("btn-success");
	_ausente->setStyleClass("btn-warning");
	_anterior->setStyleClass("btn-primary");
	_cancelar->setStyleClass("btn-danger");

	rejectWhenEscapePressed();

	auto aluno = _list.begin()->second->usuario();
	_name = new Wt::WText("<h4>" + aluno->nome() + " " + aluno->sobrenome() + "</h4>", contents());
	setWidth(Wt::WLength("30%"));
	show();
}
开发者ID:MichaelSantosSim,项目名称:Siconf,代码行数:35,代码来源:ChamadaForm.cpp


示例3: testDir

void KateSyntaxTest::testSyntaxHighlighting_data()
{
    QTest::addColumn<QString>("hlTestCase");

    /**
     * check for directories, one dir == one hl
     */
    const QString testDir(QLatin1String(TEST_DATA_DIR) + QLatin1String("/syntax/"));
    QDirIterator contents(testDir);
    while (contents.hasNext()) {
        const QString hlDir = contents.next();
        const QFileInfo info(hlDir);
        if (!info.isDir() || hlDir.contains(QLatin1Char('.'))) {
            continue;
        }

        /**
         * now: get the tests per hl
         */
        QDirIterator contents(hlDir);
        while (contents.hasNext()) {
            const QString hlTestCase = contents.next();
            const QFileInfo info(hlTestCase);
            if (!info.isFile()) {
                continue;
            }

            QTest::newRow(info.absoluteFilePath().toLocal8Bit().constData()) << info.absoluteFilePath();
        }
    }
}
开发者ID:KDE,项目名称:ktexteditor,代码行数:31,代码来源:katesyntaxtest.cpp


示例4: scrollBar

void
ScrollView::resize(float newwidth, float newheight)
{
    float scrollBarWidth = scrollBar().getComponent()->getWidth();
    scrollBar().getComponent()->resize(scrollBarWidth, newheight);
    scrollBar().setPos(Vector2(newwidth - scrollBarWidth, 0));
   
    float scrollarea = 0;
    if(contents().getComponent() != 0) {
        Component* component = contents().getComponent();
        if(component->getFlags() & FLAG_RESIZABLE)
            component->resize(newwidth - scrollBarWidth, newheight);
        contents().setClipRect(
                Rect2D(0, 0, newwidth - scrollBarWidth, newheight));
        scrollarea = component->getHeight() - newheight;
        if(scrollarea < 0)
            scrollarea = 0;        
    }

    ScrollBar* scrollBarComponent = (ScrollBar*) scrollBar().getComponent();
    scrollBarComponent->setRange(0, scrollarea);
    scrollBarComponent->setValue(0);

    width = newwidth;
    height = newheight;

    setDirty();
}
开发者ID:BackupTheBerlios,项目名称:lincity-ng-svn,代码行数:28,代码来源:ScrollView.cpp


示例5: resetChild

void
ScrollView::replaceContents(Component* component)
{
    resetChild(contents(), component);
    contents().setPos(Vector2(0, 0));
    resize(width, height);
}
开发者ID:BackupTheBerlios,项目名称:lincity-ng-svn,代码行数:7,代码来源:ScrollView.cpp


示例6: assert

void
ScrollView::event(const Event& event)
{
    if(event.type == Event::MOUSEBUTTONDOWN
            && (event.mousebutton == SDL_BUTTON_WHEELUP
            || event.mousebutton == SDL_BUTTON_WHEELDOWN)) {
        if(!event.inside)
            return;

        ScrollBar* scrollBarComp 
            = dynamic_cast<ScrollBar*> (scrollBar().getComponent());
        if(scrollBarComp == 0) {
#ifdef DEBUG
            assert(false);
#endif
            return;
        }
        float val = - contents().getPos().y;
        if(event.mousebutton == SDL_BUTTON_WHEELUP) {
            val -= MOUSEWHEELSCROLL;
            if(val < 0)
                val = 0;
        } else {
            val += MOUSEWHEELSCROLL;
            if(val > scrollBarComp->getRangeMax())
                val = scrollBarComp->getRangeMax();
        }
        contents().setPos(Vector2(0, -val));
        scrollBarComp->setValue(val);
        setDirty();
    }

    Component::event(event);
}
开发者ID:BackupTheBerlios,项目名称:lincity-ng-svn,代码行数:34,代码来源:ScrollView.cpp


示例7: get_remaining

jint ByteChannel::read(jobject destination)
{
  const ByteBuffer::ClassImpl& bufimpl = ByteBuffer::impl(m_env);

  const jint remaining = get_remaining(m_env, destination,
                                       bufimpl.m_mid_get_remaining);
  if (!remaining)
    {
      // No space in the buffer; don't try to read anything.
      return 0;
    }

  const jint position = get_position(m_env, destination,
                                     bufimpl.m_mid_get_position);

  jint bytes_read = 0;
  void* data = m_env.GetDirectBufferAddress(destination);
  if (data)
    {
      data = static_cast<char*>(data) + position;
      bytes_read = m_reader(m_env, data, remaining);
    }
  else
    {
      // It was not a direct buffer ... see if it has an array.
      jbyteArray raw_array = get_array(m_env, destination,
                                       bufimpl.m_mid_has_array,
                                       bufimpl.m_mid_get_array);
      if (raw_array)
        {
          const jint array_offset = get_array_offset(
              m_env, destination,
              bufimpl.m_mid_get_array_offset);
          ByteArray array(m_env, raw_array);
          ByteArray::MutableContents contents(array);
          data = contents.data();
          data = static_cast<char*>(data) + position + array_offset;
          bytes_read = m_reader(m_env, data, remaining);
        }
    }
  if (data)
    {
      if (bytes_read > 0)
        set_position(m_env, destination,
                     bufimpl.m_mid_set_position,
                     position + bytes_read);
      return bytes_read;
    }

  // No accessible array, either. Oh well. Create a byte array and
  // push it into the buffer.
  ByteArray array(m_env, remaining);
  ByteArray::MutableContents contents(array);
  bytes_read = m_reader(m_env, contents.data(), contents.length());
  if (bytes_read > 0)
    put_bytearray(m_env, destination,
                  bufimpl.m_mid_put_bytearray,
                  array, bytes_read);
  return bytes_read;
}
开发者ID:gunjanms,项目名称:svnmigration,代码行数:60,代码来源:jni_channel.cpp


示例8: SafeFile

void Teuchos::updateParametersFromYamlFileAndBroadcast(
  const std::string &yamlFileName, 
  const Teuchos::Ptr<Teuchos::ParameterList> &paramList, 
  const Teuchos::Comm<int> &comm, 
  bool overwrite)
{
  struct SafeFile
  {
    SafeFile(const char* fname, const char* options)
    {
      handle = fopen(fname, options);
    }
    ~SafeFile()
    {
      if(handle)
        fclose(handle);
    }
    FILE* handle;
  };
  //BMK note: see teuchos/comm/src/Teuchos_XMLParameterListHelpers.cpp
  if(comm.getSize() == 1)
  {
    updateParametersFromYamlFile(yamlFileName, paramList);
  }
  else
  {
    if(comm.getRank() == 0)
    {
      //BMK: TODO! //reader.setAllowsDuplicateSublists(false);
      //create a string and load file contents into it
      //C way for readability and speed, same thing with C++ streams is slow & ugly
      SafeFile yamlFile(yamlFileName.c_str(), "rb");
      if(!yamlFile.handle)
      {
        throw std::runtime_error(std::string("Failed to open YAML file \"") + yamlFileName + "\"for reading.");
      }
      fseek(yamlFile.handle, 0, SEEK_END);
      int strsize = ftell(yamlFile.handle) + 1;
      rewind(yamlFile.handle);
      //Make the array raii
      Teuchos::ArrayRCP<char> contents(new char[strsize], 0, strsize, true);
      fread((void*) contents.get(), strsize - 1, 1, yamlFile.handle);
      contents.get()[strsize - 1] = 0;
      Teuchos::broadcast<int, int>(comm, 0, &strsize);
      Teuchos::broadcast<int, char>(comm, 0, strsize, contents.get());
      updateParametersFromYamlCString(contents.get(), paramList, overwrite);
    }
    else
    {
      int strsize;
      Teuchos::broadcast<int, int>(comm, 0, &strsize);
      Teuchos::ArrayRCP<char> contents(new char[strsize], 0, strsize, true);
      Teuchos::broadcast<int, char>(comm, 0, strsize, contents.get());
      updateParametersFromYamlCString(contents.get(), paramList, overwrite);
    }
  }
}
开发者ID:OpenModelica,项目名称:OMCompiler-3rdParty,代码行数:57,代码来源:Teuchos_YamlParameterListHelpers.cpp


示例9: AddFriendDialog

		AddFriendDialog(RsPeers *mp) : mPeers(mp)
	{
		Wt::WVBoxLayout *layout = new Wt::WVBoxLayout ;
		contents()->setLayout(layout) ;

		// add a text box to paste the certificate into
		_cert_area = new Wt::WTextArea(contents()) ;
		_cert_area->setEmptyText("Paste a Retroshare certificate here to make friend with someone.") ;
		_cert_area->setMinimumSize(560,300) ;
		layout->addWidget(_cert_area,1) ;

		_cert_area->changed().connect(this,&AddFriendDialog::updateCertInfo) ;

		// add a text label to display the info
	Wt::WString str ;
	str += "Not a valid certificate<br/>" ;
	str += "<b>Name</b>   \t\t: <br/>" ;
	str += "<b>PGP id</b> \t\t: <br/>" ;
	str += "<b>PGP fingerprint</b> \t: <br/>" ;
	str += "<b>Location name  </b> \t: <br/>" ;
	str += "<b>Location ID    </b> \t: <br/>" ;

		_info_label = new Wt::WLabel(str,contents()) ;
		_info_label->setMinimumSize(128,0) ;

		layout->addWidget(_info_label) ;

		// add buttons 'make friend', 'only add to keyring', 'cancel'

		Wt::WHBoxLayout *lay2 = new Wt::WHBoxLayout;

		_ok_bnt = new Wt::WPushButton("Make friend", contents());
		lay2->addWidget(_ok_bnt) ;
		_ok_bnt->clicked().connect(this, &AddFriendDialog::makeFriend);
		_ok_bnt->setEnabled(false) ;

		Wt::WPushButton *cn_bnt = new Wt::WPushButton("Cancel", contents());
		lay2->addWidget(cn_bnt) ;
		cn_bnt->clicked().connect(this, &Wt::WDialog::reject);

		lay2->addStretch() ;

		layout->addLayout(lay2) ;
		layout->addSpacing(0);

		_timer = new Wt::WTimer(this) ;
		_timer->setInterval(1000) ;
		_timer->timeout().connect(this,&AddFriendDialog::updateCertInfo) ;
		_timer->start() ;

		setMinimumSize(620,300) ;
		//resize() ;
	}
开发者ID:RetroShare,项目名称:RSWebUI,代码行数:53,代码来源:RSWappFriendsPage.cpp


示例10: WIcon

void WMessageBox::create()
{
  iconW_ = new WIcon(contents());
  text_ = new WText(contents());
  contents()->addStyleClass("Wt-msgbox-body");

  buttonMapper_ = new WSignalMapper<StandardButton>(this);
  buttonMapper_->mapped().connect(this, &WMessageBox::onButtonClick);

  rejectWhenEscapePressed();

  finished().connect(this, &WMessageBox::onFinished);
}
开发者ID:913862627,项目名称:wt,代码行数:13,代码来源:WMessageBox.C


示例11: icon

void WMessageBox::create()
{
  std::unique_ptr<WIcon> icon(iconW_ = new WIcon());
  contents()->addWidget(std::move(icon));

  std::unique_ptr<WText> text(text_ = new WText());
  contents()->addWidget(std::move(text));

  contents()->addStyleClass("Wt-msgbox-body");

  rejectWhenEscapePressed();

  finished().connect(this, &WMessageBox::onFinished);
}
开发者ID:kdeforche,项目名称:wt,代码行数:14,代码来源:WMessageBox.C


示例12: file

void
M3UPlaylist::triggerTrackLoad()
{
    //TODO make sure we've got all tracks first.
    if( m_tracksLoaded )
        return;

    //check if file is local or remote
    if( m_url.isLocalFile() )
    {
        QFile file( m_url.toLocalFile() );
        if( !file.open( QIODevice::ReadOnly ) )
        {
            error() << "cannot open file";
            return;
        }

        QString contents( file.readAll() );
        file.close();

        QTextStream stream;
        stream.setString( &contents );
        loadM3u( stream );
        m_tracksLoaded = true;
    }
    else
    {
        The::playlistManager()->downloadPlaylist( m_url, PlaylistFilePtr( this ) );
    }
}
开发者ID:saurabhsood91,项目名称:Amarok,代码行数:30,代码来源:M3UPlaylist.cpp


示例13: main

int main()
{
	int len;
	// meh don't want it to start like decorations.txt
	// because it messes with tab completion
	char *data = contents( "./namesDecorations.bin", &len );

	// get rid of the damn \n vim insists on adding...
	data[ len - 1 ] = '\0';

	char *currName = data;

	while( 1 )
	{
		// want \n after the last name too to
		// make loading the list easier
		printf( "%s\n", currName );

		char *nextName = memnchr( currName, '\0', len );

		if( *nextName == NULL )
		{
			break;
		}

		currName = nextName;
	}

	return EXIT_SUCCESS;
}
开发者ID:capcomvertigo,项目名称:MHP3DB,代码行数:30,代码来源:genDecorationNames.c


示例14: main

int main(int argc, char* argv[])
{
    CClass newclass;
    CBotDoc *botdoc;
    if (argc != 2)
    {
    	std::cout << "Usage: "<<argv[0] << " <filename>" << std::endl;
    	return 0;
    }

    std::ifstream in(argv[1]);
    std::cout << argv[1] << std::endl;
    if (!in.good())
    {
    	std::cout << "Oh no, error!" << std::endl;
    	return 1;
    }

    std::string contents((std::istreambuf_iterator<char>(in)),
        std::istreambuf_iterator<char>());
    str = contents;

    if(!newclass.InitInstance())
    {
    	std::cerr << "Initialization not complete!" << std::endl;
    	return 1;
    }

    botdoc = new CBotDoc(str);
//    std::cout << "Hello CBot!" << std::endl << s;
    botdoc->OnRun();
    delete botdoc;
    newclass.ExitInstance();
}
开发者ID:ManuelBlanc,项目名称:colobot,代码行数:34,代码来源:main.cpp


示例15: reserve

void ZCompressor::Deflate(uint8 level)
{
    if( _iscompressed || (!size()) || level>9 )
        return;

    char *buf;
    buf=new char[size()+8];

    uint32 newsize=size(),oldsize=size();
    reserve(size()+8);

    _compress((void*)buf, &newsize, (void*)contents(),size(),level);

    if(!newsize)
        return;

    resize(newsize);
    rpos(0);
    wpos(0);
    append(buf,newsize);
    delete [] buf;

    _iscompressed=true;

    _real_size=oldsize;
}
开发者ID:BThallid,项目名称:pseuwow,代码行数:26,代码来源:ZCompressor.cpp


示例16: indenterFile

void IndentTest::getTestData(const QString& indenter)
{
  QTest::addColumn<QString>("testcase");

  // make sure the indenters are valid
  QFile indenterFile(srcPath + "/../script/data/" + indenter + ".js");
  if (!indenterFile.exists()) {
    QSKIP(qPrintable(QString(indenterFile.fileName() + " does not exist")), SkipAll);
  }
  QVERIFY(indenterFile.open(QFile::ReadOnly));
  QScriptValue result = m_env->engine()->evaluate(indenterFile.readAll(), indenterFile.fileName());
  QVERIFY2( !result.isError(), qPrintable(result.toString() + "\nat "
                                          + m_env->engine()->uncaughtExceptionBacktrace().join("\n")) );

  const QString testDir( testDataPath + indenter + '/' );
  if ( !QFile::exists(testDir) ) {
    QSKIP(qPrintable(QString(testDir + " does not exist")), SkipAll);
  }
  QDirIterator contents( testDir );
  while ( contents.hasNext() ) {
    QString entry = contents.next();
    if ( entry.endsWith('.') ) {
      continue;
    }
    QFileInfo info(entry);
    if ( !info.isDir() ) {
      continue;
    }
    QTest::newRow( info.baseName().toLocal8Bit() ) << info.absoluteFilePath();
  }
}
开发者ID:rtaycher,项目名称:kate,代码行数:31,代码来源:indenttest.cpp


示例17: shader

unsigned ShaderLibrary::loadShader(QString const& path, unsigned const mode)
{
   unsigned shader(0);
   QFile file(path);

   if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
      QString contents(file.readAll()); 
      file.close();

      QByteArray raw(contents.toLocal8Bit());
      const char* c_str(raw.data());

      shader = glCreateShader(mode);
      glShaderSource(shader, 1, &c_str, NULL);
      glCompileShader(shader);

      // Check if things compiled okay
      unsigned buflen(1000);
      GLsizei msgLength;
      char msg[buflen];
      glGetShaderInfoLog(shader, buflen, &msgLength, msg);

      if (msgLength != 0) {
         QLOG_WARN() << "Failed to compile shader " << path;
         QLOG_WARN() << QString(msg);
         glDeleteShader(shader);  // required?
         shader = 0;
      }
   }

   return shader;
}
开发者ID:epifanovsky,项目名称:IQmol,代码行数:32,代码来源:ShaderLibrary.C


示例18: contents

bool IdenticalCodeFolding::matchCandidates(FoldingCandidates& pCandidateList) {
  typedef std::multimap<uint32_t, size_t> ChecksumMap;
  ChecksumMap checksum_map;
  std::vector<std::string> contents(pCandidateList.size());
  bool converged = true;

  for (size_t index = 0; index < pCandidateList.size(); ++index) {
    contents[index] = pCandidateList[index].getContentWithVariables(
        m_Backend, m_KeptSections);
    uint32_t checksum = ::crc32(0xFFFFFFFF,
                                (const uint8_t*)contents[index].c_str(),
                                contents[index].length());

    size_t count = checksum_map.count(checksum);
    if (count == 0) {
      checksum_map.insert(std::make_pair(checksum, index));
    } else {
      std::pair<ChecksumMap::iterator, ChecksumMap::iterator> ret =
          checksum_map.equal_range(checksum);
      for (ChecksumMap::iterator it = ret.first; it != ret.second; ++it) {
        size_t kept_index = (*it).second;
        if (contents[index].compare(contents[kept_index]) == 0) {
          m_KeptSections[pCandidateList[index].sect].second = kept_index;
          converged = false;
          break;
        }
      }
    }
  }

  return converged;
}
开发者ID:ChihMin,项目名称:mclinker,代码行数:32,代码来源:IdenticalCodeFolding.cpp


示例19: main

int main(int argc, const char **argv) {
    if (argc < 2) {
        printf("no file name entered\n");
        return 1;
    }

    if (argc > 2)
        printCFG = atoi(&argv[2][0]);

    if (argc > 3)
        funcToAnalyze = argv[3];
    else
        funcToAnalyze = "main";
    printf("Will analyze function %s\n", funcToAnalyze);

    // Read file contents into a char array
    std::ifstream in(argv[1]);
    std::string contents((std::istreambuf_iterator<char>(in)), 
            std::istreambuf_iterator<char>());

    // Interval package
    man = box_manager_alloc();
    printf("******************************\n");
    printf("Apron: Library %s, version %s\n", man->library, man->version);
    printf("******************************\n");

    int ret = !clang::tooling::runToolOnCode(new ExampleFrontendAction,
            contents.c_str());

    ap_manager_free(man);

    return ret;
}
开发者ID:OrenKishon,项目名称:worklist-clang-apron,代码行数:33,代码来源:worklist.cpp


示例20: decompress

  std::vector<uint8_t> decompress(std::string filename)
  {
    std::vector<uint8_t> contents(8);

    std::ifstream file(filename, std::ios_base::in | std::ios_base::binary);

    std::string start(8, ' ');
    file.read(&start[0], 8);

    if (boost::starts_with(start, "CWS") == false)
    {
      return std::vector<uint8_t>(0);
    }

    contents[0] = 'F';
    std::copy(start.begin() + 1, start.end(), contents.begin() + 1);

    file.seekg(8, std::ios::beg);

    boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
    in.push(boost::iostreams::zlib_decompressor());
    in.push(file);
    boost::iostreams::copy(in, std::back_inserter(contents));

    file.close();

    return contents;
  }
开发者ID:Roughsketch,项目名称:mdswf,代码行数:28,代码来源:swf.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ contentsChanged函数代码示例发布时间:2022-05-30
下一篇:
C++ content_error函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap