本文整理汇总了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());
}
示例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)));
}
示例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);
}
}
}
示例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();
}
}
示例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);
示例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);
}
示例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);
}
示例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;
}
示例9: Pack
uint WBEvent::GetSerializationSize() const
{
WBPackedEvent PackedEvent;
Pack( PackedEvent );
return PackedEvent.GetSize() + 4;
}
示例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;
}
示例11: Pack
void CDownloadFileCompletePacket::InitData(string strUrl, int64 nFileLength, string strHashValue)
{
this->strUrl = strUrl;
this->nFileLength = nFileLength;
this->strHashValue = strHashValue;
Pack();
};
示例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;
}
示例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;
}
示例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();
}
}
}
示例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);
}