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


C++ contents函数代码示例

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


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


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