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


C++ Pack函数代码示例

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


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

示例1: TEST_F

TEST_F(PacksTests, test_check_version) {
  auto fpack = Pack("foobar", getPackWithDiscovery());
  EXPECT_TRUE(fpack.checkVersion());

  auto zpack = Pack("foobaz", getPackWithFakeVersion());
  EXPECT_FALSE(zpack.checkVersion());
}
开发者ID:hungld,项目名称:osquery,代码行数:7,代码来源:packs_tests.cpp

示例2: Vector2f

void MpHostSetupUi::initWindow() {
    window->SetStyle(Style::Fullscreen);
    window->SetRequisition(Vector2f((float)ct::WindowWidth, (float)ct::WindowHeight));

    mainBox = Box::Create(Box::Orientation::VERTICAL, 5);
    auto closeButton = Button::Create("Close");
    closeButton->GetSignal(Widget::OnLeftClick).Connect(backAction);
    mainBox->Pack(createAlignment(closeButton, Vector2f(0.0f, 0.0f), Vector2f(1.0f, 0.0f)));

    auto nameBox = Box::Create(Box::Orientation::HORIZONTAL, 5);
    nameEntry = Entry::Create("Player 1");
    nameEntry->SetMaximumLength(10);
    nameEntry->SetRequisition(Vector2f(ct::WindowWidth * 0.1f, 0.0f));
    auto createButton = Button::Create("Create");
    createButton->GetSignal(Widget::OnLeftClick).Connect(bind(&MpHostSetupUi::triggerCreateServer, this));

    nameBox->Pack(nameEntry, true, true);
    nameBox->Pack(createButton, true, true);

    nameFrame = Frame::Create("Your name:");
    nameFrame->Add(nameBox);
    nameFrame->SetRequisition(Vector2f(0.0f, ct::WindowHeight * 0.1f));
    mainBox->Pack(createAlignment(nameFrame, Vector2f(0.5f, 0.01f), Vector2f(1.0f, 0.0f)));

    window->Add(createAlignment(mainBox, Vector2f(0.5f, 0.5f), Vector2f(0.9f, 0.9f)));
}
开发者ID:TED-996,项目名称:MinesweeperMp,代码行数:26,代码来源:MpHostSetupUi.cpp

示例3: Pack

void ExteriorNeighbor::Pack(
	const GridData4D & data
) {
	// Model grid
	const Grid & grid = m_pConnect->GetGridPatch().GetGrid();

	// 3D Grid Data
	GridData3D data3D;

	// For state data exclude non-collacted data points
	if (data.GetDataType() == DataType_State) {
		// List of variable indices to send
		// - exclude variables which are not-collocated with this data structure
		for (int c = 0; c < data.GetComponents(); c++) {
			if (grid.GetVarLocation(c) != data.GetDataLocation()) {
				continue;
			}
			data.GetAsGridData3D(c, data3D);
			Pack(data3D);
		}

	// Send everything
	} else {
		for (int c = 0; c < data.GetComponents(); c++) {
			data.GetAsGridData3D(c, data3D);
			Pack(data3D);
		}
	}
}
开发者ID:AntoninVerletBanide,项目名称:tempestmodel,代码行数:29,代码来源:Connectivity.cpp

示例4: render_window

void CustomWidget::Run() {
	// Create SFML's window.
	sf::RenderWindow render_window( sf::VideoMode( SCREEN_WIDTH, SCREEN_HEIGHT ), "Custom Widget" );

	// Create our custom widget.
	m_custom_widget = MyCustomWidget::Create( "Custom Text" );

	// Create a simple button and connect the click signal.
	auto button = sfg::Button::Create( "Button" );
	button->GetSignal( sfg::Widget::OnLeftClick ).Connect( std::bind( &CustomWidget::OnButtonClick, this ) );

	// Create a vertical box layouter with 5 pixels spacing and add our custom widget and button
	// and button to it.
	auto box = sfg::Box::Create( sfg::Box::Orientation::VERTICAL, 5.0f );
	box->Pack( m_custom_widget );
	box->Pack( button, false );

	// Create a window and add the box layouter to it. Also set the window's title.
	auto window = sfg::Window::Create();
	window->SetTitle( "Custom Widget" );
	window->Add( box );

	// Create a desktop and add the window to it.
	sfg::Desktop desktop;
	desktop.Add( window );

	// We're not using SFML to render anything in this program, so reset OpenGL
	// states. Otherwise we wouldn't see anything.
	render_window.resetGLStates();

	// Main loop!
	sf::Event event;
	sf::Clock clock;

	while( render_window.isOpen() ) {
		// Event processing.
		while( render_window.pollEvent( event ) ) {
			desktop.HandleEvent( event );

			// If window is about to be closed, leave program.
			if( event.type == sf::Event::Closed ) {
				render_window.close();
			}
		}

		// Update SFGUI with elapsed seconds since last call.
		desktop.Update( clock.restart().asSeconds() );

		// Rendering.
		render_window.clear();
		m_sfgui.Display( render_window );
		render_window.display();
	}
}
开发者ID:TankOs,项目名称:SFGUI,代码行数:54,代码来源:CustomWidget.cpp

示例5: packFile

void IHM::packFile(File f_)
{
    auto box = sfg::Box::Create( sfg::Box::Orientation::HORIZONTAL, 50.f);
    box->Pack( sfg::Label::Create( f_.getFilename() ), true, true );
    box->Pack( sfg::Label::Create( f_.getFilepath() ), true, true );
    auto button = sfg::Button::Create( L"Load" );
    //auto funct = std::bind( &IHM::OnLoadMusicBtnClick, f_.getFilename());
    auto funct = std::bind(&IHM::OnLoadMusicBtnClick,this, f_.getFilename());//need to try this
    button->GetSignal( sfg::Widget::OnLeftClick ).Connect( funct );
    box->Pack( button, false );
    _listFiles->Pack( box, false);
开发者ID:teroratsu,项目名称:OggMaster,代码行数:11,代码来源:IHM.cpp

示例6:

WindowCreateCharacter::WindowCreateCharacter()
{
	this->window = sfg::Window::Create();
	this->window->SetTitle("Create Character");
	this->window->SetStyle(sfg::Window::Style::TITLEBAR | sfg::Window::Style::SHADOW | sfg::Window::Style::BACKGROUND);

	auto vbox = sfg::Box::Create(sfg::Box::Orientation::VERTICAL, 5.f);
	auto lblCharacterName = sfg::Label::Create(L"Character Name:");
	lblCharacterName->SetAlignment(sf::Vector2f(0.f, 0.5f));
	vbox->Pack(lblCharacterName);
	this->tbCharacterName = sfg::Entry::Create();
	this->tbCharacterName->SetMaximumLength(32);
	this->tbCharacterName->SetRequisition(sf::Vector2f(200.f, 0.f));
	this->tbCharacterName->SetText(L"Player");
	vbox->Pack(this->tbCharacterName);
	auto lblClass = sfg::Label::Create(L"Class:");
	lblClass->SetAlignment(sf::Vector2f(0.f, 0.5f));
	vbox->Pack(lblClass);
	this->cbxCharacterClass = sfg::ComboBox::Create();
	this->cbxCharacterClass->AppendItem(L"General");
	this->cbxCharacterClass->SelectItem(0);
	vbox->Pack(this->cbxCharacterClass);
	vbox->Pack(sfg::Separator::Create());
	auto hbox = sfg::Box::Create(sfg::Box::Orientation::HORIZONTAL);
	this->btnCancel = sfg::Button::Create(L"Cancel");
	hbox->Pack(this->btnCancel);
	this->btnPlay = sfg::Button::Create(L"Start!");
	hbox->Pack(btnPlay);

	vbox->Pack(hbox);
	this->window->Add(vbox);
}
开发者ID:LunaticEdit,项目名称:RancerZero,代码行数:32,代码来源:WindowCreateCharacter.cpp

示例7: assert

netBool UnreliableListener::Push(SerializerLess &_ser, const Peer& _peer)
{
	assert(m_stream != nullptr);

	Channel& channel = GetChannel(m_sendChannels, _peer);

	SerializerLess *back = channel.Back();

	// bundling
	if(channel.IsEmpty() || back->GetSize() + _ser.GetSize() > back->GetBufferSize())
	{
		SerializerLess ser(m_pool.GetSerializer());
		// prepare serializer
		ser.Write(m_stream->GetType());

		SerializerLess stream_ser(ser, m_stream->GetHeaderSize(), ser.GetBufferSize());
		stream_ser.Write(GetType());
		stream_ser.Close();

		ser.SetCursor(ser.GetCursor() + stream_ser.GetSize());
		ser.Close();
		channel.Push(ser);
	}

	return Pack(_ser, _peer);
}
开发者ID:ricklesauceur,项目名称:netduke,代码行数:26,代码来源:unreliablelistener.cpp

示例8: Pack

	bool Pack(msg_buffer_t & msgbuf) const {
		int sz = msgbuf.max_size;
		bool ret = Pack(msgbuf.buffer, sz);
		if (!ret) return ret;
		msgbuf.valid_size = sz;
		return true;
	}
开发者ID:jj4jj,项目名称:dcpots,代码行数:7,代码来源:msg_proto.hpp

示例9: Pack

uint WBEvent::GetSerializationSize() const
{
	WBPackedEvent PackedEvent;
	Pack( PackedEvent );

	return PackedEvent.GetSize() + 4;
}
开发者ID:MinorKeyGames,项目名称:Eldritch,代码行数:7,代码来源:wbevent.cpp

示例10: nullNodeKey

GlobalIDDataBase::NodeKey_t
GlobalIDDataBase::push(LayoutID_t layoutID, int context, GlobalID_t globalID)
{
  int ret = data_m.size();
  data_m.push_back(Pack(layoutID, context, globalID, nullNodeKey()));
  return ret;
}
开发者ID:pathscale,项目名称:freepooma-testsuite,代码行数:7,代码来源:GlobalIDDataBase.cmpl.C

示例11: Pack

void CDownloadFileCompletePacket::InitData(string strUrl, int64 nFileLength, string strHashValue)
{
    this->strUrl = strUrl;
    this->nFileLength = nFileLength;
    this->strHashValue = strHashValue;
    Pack();
};
开发者ID:zyouhua,项目名称:ligle,代码行数:7,代码来源:cfinderpacket.cpp

示例12: PackStay

bool Pointer::PackStay(Environment &env, const char *format, const ValueList &valListArg)
{
	size_t offset = _offset;
	if (!Pack(env, format, valListArg)) return false;
	_offset = offset;
	return true;
}
开发者ID:gura-lang,项目名称:gura,代码行数:7,代码来源:Pointer.cpp

示例13: switch

bool ScrollBox::SendKey(const SDL_keysym & key)
{
  if (!WidgetList::SendKey(key)) {
    int new_offset = offset;
    switch(key.sym)
    {
    case SDLK_PAGEUP:
      new_offset -= size.y;
      break;
    case SDLK_PAGEDOWN:
      new_offset += size.y;
      break;
    default:
      return false;
    }

    if (new_offset < 0)
      new_offset = 0;
    if (new_offset > GetMaxOffset())
      new_offset = GetMaxOffset();

    if (new_offset != offset) {
      offset = new_offset;
      Pack();
      NeedRedrawing();
    }
  }
  return true;
}
开发者ID:Arnaud474,项目名称:Warmux,代码行数:29,代码来源:scroll_box.cpp

示例14: GetMaxOffset

void ScrollBox::__Update(const Point2i & mousePosition,
                         const Point2i & /*lastMousePosition*/)
{
  // update position of items because of dragging
  if (HasScrollBar() && scroll_mode!=SCROLL_MODE_NONE) {
    int max_offset = GetMaxOffset();
    int new_offset = offset;

    if (scroll_mode == SCROLL_MODE_THUMB) {
      Point2i track_pos  = GetScrollTrackPos();
      int     height     = GetTrackHeight();

      new_offset = start_drag_offset +
                   ((mousePosition.y - start_drag_y) * (size.y+max_offset))/height;
    } else if (scroll_mode == SCROLL_MODE_DRAG) {
      // Act as if the scroll corresponds to bringing the starting point to the
      // current point
      new_offset = start_drag_offset + start_drag_y - mousePosition.y;
    }

    if (new_offset < 0)
      new_offset = 0;
    if (new_offset > max_offset)
      new_offset = max_offset;

    if (new_offset != offset) {
      offset = new_offset;
      Pack();
    }
  }
}
开发者ID:Arnaud474,项目名称:Warmux,代码行数:31,代码来源:scroll_box.cpp

示例15: Pack

bool PokerMsgBase::ToStream(StreamWriter* pWriter)
{
	if (!pWriter->Write(&m_Size, sizeof(m_Size))) return false;
	if (!pWriter->Write(&m_Type, sizeof(m_Type))) return false;

	return Pack(pWriter);
}
开发者ID:mshandle,项目名称:spank,代码行数:7,代码来源:PokerMsgBase.cpp


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