本文整理汇总了C++中GetPort函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPort函数的具体用法?C++ GetPort怎么用?C++ GetPort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPort函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PUSH_SERVER_ERROR
BOOL CPushServer::Start()
{
m_pServer->DoAccept.connect(&m_handler, &CPushServerHandler::OnAccept);
m_pServer->DoClose.connect(&m_handler, &CPushServerHandler::OnClose);
if (m_pServer->Bind(GetListenIP().c_str(), GetPort()) == FALSE)
{
PUSH_SERVER_ERROR("push server bind failed, ip: %s, port: %u.", GetListenIP().c_str(),
GetPort());
return FALSE;
}
m_pServer->Listen();
PUSH_SERVER_DEBUG("push server start successed, ip: %s, port: %u.", GetListenIP().c_str(),
GetPort());
return TRUE;
}
示例2: device_dialog_filter_proc
static pascal Boolean device_dialog_filter_proc(
DialogPtr dialog,
EventRecord *event,
short *item_hit)
{
GrafPtr old_port;
short item_type;
Handle item_handle;
Rect item_rectangle;
boolean handled= FALSE;
GetPort(&old_port);
SetPort(dialog);
GetDItem(dialog, iDEVICE_AREA, &item_type, &item_handle, &item_rectangle);
/* preprocess events */
switch(event->what)
{
case mouseDown:
{
Point where= event->where;
GlobalToLocal(&where);
switch (FindDItem(dialog, where)+1)
{
case iDEVICE_AREA:
{
GDHandle new_device= click_in_device_area(&device_dialog_globals.device_spec, &item_rectangle, where);
if (new_device && new_device!=device_dialog_globals.device)
{
device_dialog_globals.device= new_device;
BuildExplicitGDSpec(&device_dialog_globals.device_spec, new_device, device_dialog_globals.device_spec.flags, device_dialog_globals.device_spec.bit_depth, 0, 0);
draw_device_area(&device_dialog_globals.device_spec, device_dialog_globals.device, &item_rectangle);
*item_hit= iDEVICE_AREA;
}
handled= TRUE;
break;
}
}
break;
}
case updateEvt:
if ((DialogPtr)event->message==dialog)
{
draw_device_area(&device_dialog_globals.device_spec, device_dialog_globals.device, &item_rectangle);
}
break;
}
SetPort(old_port);
return handled ? TRUE : general_filter_proc(dialog, event, item_hit);
}
示例3: GetPort
void BURGER_API Burger::OkAlertMessage(const char *pMessage,const char *pTitle)
{
Word8 *TitleStr; /* Pointer to the window title */
DialogPtr MyDialog; /* My dialog pointer */
Handle ItemList; /* Handle to the item list */
Rect DialogRect; /* Rect of the dialog window */
Word TitleLen; /* Length of the title */
Word MessLen; /* Length of the caption */
short ItemHit; /* Junk */
Rect WorkRect;
GrafPtr MyPort; /* My grafport */
//Word Foo;
//Foo = InputSetState(FALSE);
GetPort(&MyPort); /* Save the current port */
/* Center my dialog to the screen */
#if ACCESSOR_CALLS_ARE_FUNCTIONS
GetPortBounds(MyPort,&WorkRect);
#else
WorkRect = MyPort->portRect;
#endif
DialogRect.top = static_cast<short>((((WorkRect.bottom-WorkRect.top)-190)/2)+WorkRect.top);
DialogRect.left = static_cast<short>((((WorkRect.right-WorkRect.left)-350)/2)+WorkRect.left);
DialogRect.bottom = static_cast<short>(DialogRect.top+190);
DialogRect.right = static_cast<short>(DialogRect.left+350);
TitleLen = 0; /* Assume no length */
if (pTitle) {
TitleLen = Burger::StringLength(pTitle); /* Get the length of the title string */
}
TitleStr = (Word8 *)Burger::Alloc(TitleLen+1); /* Get memory of pascal string */
if (TitleStr) { /* Did I get the memory? */
MemoryCopy(TitleStr+1,pTitle,TitleLen);
TitleStr[0] = static_cast<Word8>(TitleLen); /* Set the pascal length */
MessLen = Burger::StringLength(pMessage); /* Size of the message */
ItemList = NewHandle(static_cast<Size>(sizeof(Template)+MessLen));
if (ItemList) { /* Ok? */
Template[sizeof(Template)-1]=static_cast<Word8>(MessLen); /* Save the message length */
MemoryCopy(ItemList[0],Template,sizeof(Template)); /* Copy the template */
MemoryCopy((ItemList[0])+sizeof(Template),pMessage,MessLen); /* Copy the message */
MyDialog = NewDialog(0,&DialogRect,(Word8 *)TitleStr,TRUE,5,(WindowPtr)-1,FALSE,0,ItemList);
if (MyDialog) {
SetDialogDefaultItem(MyDialog,1); /* Default for OK button */
ModalDialog(0,&ItemHit); /* Handle the event */
DisposeDialog(MyDialog); /* Kill the dialog */
} else {
DisposeHandle(ItemList); /* I must kill this myself! */
}
}
Burger::Free(TitleStr); /* Kill the title */
}
SetPort(MyPort); /* Restore my grafport */
//InputSetState(Foo);
}
示例4: SetDialogPort
/* SetDialogPort(theDialog)
SetDialogPort sets the current GrafPort on Macintosh and does nothing on
Windows.
On Macintosh, it returns the current GrafPort before SetDialogPort was
called. On Windows, it returns theDialog. This routine exists solely to avoid
the need for an ifdef when you need to deal with the Macintosh current GrafPort
in cross-platform dialog code.
Thread Safety: SetDialogPort is not thread-safe.
*/
CGrafPtr
SetDialogPort(DialogPtr theDialog)
{
CGrafPtr savePort;
GetPort(&savePort);
SetPortDialogPort(theDialog);
return savePort;
}
示例5: HAL_UART_RxCpltCallback
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
// Give back the mutex.
xSemaphoreGiveFromISR( PxSemaphoreHandle[GetPort(huart)], &( xHigherPriorityTaskWoken ) );
UartRxReady = SET;
}
示例6: main
int main(int argc, char *argv[])
{
int rc;
int Desc;
int tm;
int Port, Ip;
char Tampon[80];
struct sockaddr_in psoo; /* o = origine */
struct sockaddr_in psos; /* s = serveur */
struct sockaddr_in psor; /* r = remote */
struct Requete UneRequete;
memset(&psoo, 0, sizeof(struct sockaddr_in));
memset(&psos, 0, sizeof(struct sockaddr_in));
memset(&psor, 0, sizeof(struct sockaddr_in));
if (argc!=5)
{
printf("cli client portc serveur ports\n");
exit(1);
}
Desc = CreateSockets(&psoo, &psos, argv[1], atoi(argv[2]), argv[3], atoi(argv[4]));
if (Desc == -1)
perror("CreateSockets:");
else
fprintf(stderr, "CreateSockets %d\n", Desc);
Ip = GetIP(&psoo);
Port = GetPort(&psoo);
memset(Tampon, 0, sizeof(Tampon));
Ipv4ToS(Ip, Tampon);
printf("Adresse Ip du client %s : Port %d \n", Tampon, Port);
UneRequete.Type = Question;
strncpy(UneRequete.Message, "Multiclient; Bonjour", sizeof(UneRequete.Message));
rc = SendDatagram(Desc, &UneRequete, sizeof(struct Requete), &psos);
if (rc == -1)
perror("SendDatagram");
else
fprintf(stderr, "Envoi de %d bytes\n", rc);
memset(&UneRequete, 0, sizeof(struct Requete));
tm = sizeof(struct Requete);
rc = ReceiveDatagram(Desc, &UneRequete, tm, &psor);
if (rc == -1)
perror("ReceiveDatagram");
else
fprintf(stderr, "bytes:%d:%s\n", rc, UneRequete.Message);
close(Desc);
}
示例7: UpdateAdditionsWin
void
UpdateAdditionsWin(void)
{
Rect r;
Cell c;
int i;
GrafPtr oldPort;
GetPort(&oldPort);
SetPort(gWPtr);
MoveTo( gControls->aw->compListBox.left, gControls->aw->compListBox.top - kInterWidgetPad + 1);
HLock(gControls->cfg->selAddMsg);
DrawString( CToPascal(*gControls->cfg->selAddMsg));
HUnlock(gControls->cfg->selAddMsg);
#if 0
RGBColor backColorOld;
Rect adjustedRect, *clRect = &gControls->aw->compListBox;
SetRect(&adjustedRect, clRect->left, clRect->top+1, clRect->right, clRect->bottom-1);
GetBackColor(&backColorOld);
BackColor(whiteColor);
EraseRect(&adjustedRect);
RGBBackColor(&backColorOld);
#endif
LUpdate( (*gControls->aw->compList)->port->visRgn, gControls->aw->compList);
SetRect(&r, gControls->aw->compListBox.left, gControls->aw->compListBox.top,
gControls->aw->compListBox.right + 1, gControls->aw->compListBox.bottom);
FrameRect(&r);
SetPt(&c, 0, 0);
if (LGetSelect(true, &c, gControls->aw->compList))
{
HLock((Handle)gControls->aw->compDescTxt);
SetRect(&r, (*gControls->aw->compDescTxt)->viewRect.left,
(*gControls->aw->compDescTxt)->viewRect.top,
(*gControls->aw->compDescTxt)->viewRect.right,
(*gControls->aw->compDescTxt)->viewRect.bottom);
HUnlock((Handle)gControls->aw->compDescTxt);
TEUpdate(&r, gControls->aw->compDescTxt);
}
DrawDiskSpaceMsgs( gControls->opt->vRefNum );
for (i = 0; i < numRows; i++)
{
if (gControls->cfg->comp[rowToComp[i]].highlighted)
{
AddInitRowHighlight(i);
break;
}
}
SetPort(oldPort);
}
示例8: LoadSettings
void WiimoteEmuGeneral::LoadSettings()
{
auto* ce_extension = static_cast<ControllerEmu::Extension*>(
Wiimote::GetWiimoteGroup(GetPort(), WiimoteEmu::WiimoteGroup::Extension));
m_extension_combo->setCurrentIndex(ce_extension->switch_extension);
OnAttachmentChanged(ce_extension->switch_extension);
Wiimote::LoadConfig();
}
示例9: GetFont
void GetFont(
TextSpec *spec)
{
GrafPtr port;
GetPort(&port);
spec->font=GetPortTextFont(port);
spec->style=GetPortTextFace(port);
spec->size=GetPortTextSize(port);
}
示例10: getCurrentPortBounds
void getCurrentPortBounds(Rect* inRect)
{
/*------------------------------------------------------
Simple utility function to get the bounds of the
current port.
--------------------------------------------------------*/
CGrafPtr thePort;
GetPort(&thePort);
GetPortBounds(thePort,inRect);
}
示例11: SetHost
void CCore::ConnectToServer(CString strHost, unsigned short usPort, CString strPass)
{
// Declare our basic network connection
SetHost(strHost);
SetClientPort(usPort);
SetPass(strPass);
// Connect to the network
CHECK_VALID_VOID(m_pNetworkManager)
m_pNetworkManager->Connect(GetHost(), (unsigned short) GetPort(), GetPass());
}
示例12: GetServer
ServerOptions IrcJoinGroupChat::GetServerOptions () const
{
ServerOptions so;
so.ServerName_ = GetServer ();
so.ServerPort_ = GetPort ();
so.ServerEncoding_ = GetEncoding ();
so.ServerPassword_ = QString ();
so.SSL_ = GetSSL ();
so.ServerNickName_ = GetNickname ();
return so;
}
示例13: IN0
void openmax_processor::emptyThisBuffer(OMX_BUFFERHEADERTYPE_p buffer, t_uint8 portNb)
//*******************************************************************************
{ //Just wrap to the base component
IN0("\n");
Port *pPort=GetPort(portNb);
WARNING(pPort);
MSG3("%s->emptyThisBuffer[%lu] Header=%p \n", GetComponentName(), buffer->nInputPortIndex, (void *)buffer);
WARNING(buffer->nInputPortIndex==portNb);
Component::deliverBuffer(portNb, buffer);
OUT0("\n");
}
示例14: apply_unseen_mask
void apply_unseen_mask()
{
Rect base_rect = {9,9,53,45},to_rect,big_to = {13,13,337,265};
GrafPtr old_port;
short i,j,k,l;
ConstPatternParam c;
bool need_bother = false;
if (PSD[SDF_NO_FRILLS] > 0)
return;
if ((is_combat()) && (which_combat_type == 0))
return;
if (!(is_out()) && (univ.town->lighting_type > 0))
return;
for (i = 0; i < 11; i++)
for (j = 0; j < 11; j++)
if (unexplored_area[i + 1][j + 1] == 1)
need_bother = true;
if (need_bother == false)
return;
GetPort(&old_port);
SetPort(terrain_screen_gworld);
//p = *bw_pats[3];
//c = p;
c = *bw_pats[3];
PenPat(c);
PenMode(notPatOr);
for (i = 0; i < 11; i++)
for (j = 0; j < 11; j++)
if (unexplored_area[i + 1][j + 1] == 1) {
to_rect = base_rect;
OffsetRect(&to_rect,-28 + i * 28,-36 + 36 * j);
SectRect(&to_rect,&big_to,&to_rect);
PaintRect(&to_rect);
//PaintRoundRect(&to_rect,4,4);
for (k = i - 2; k < i + 1; k++)
for (l = j - 2; l < j + 1; l++)
if ((k >= 0) && (l >= 0) && (k < 9) && (l < 9) && ((k != i - 1) || (l != j - 1)))
terrain_there[k][l] = -1;
}
//p = *bw_pats[6];
//c = p;
c = *bw_pats[6];
PenPat(c);
PenMode(patCopy);
SetPort(old_port);
}
示例15: GetPropertyValueInt
void ShapeKeyMatrix::MakeControlsXML( QDomElement &elem, const QList<class PinItem *> &pins, const QList<PropertyValue *> &values ) const
{
int nRows = GetPropertyValueInt("Rows",values,0);
int nCols = GetPropertyValueInt("Columns",values,0);
QStringList rows, cols;
for ( int i = 0; i < nRows; i++ )
rows << GetPort(pins, QString("R%1").arg(i) );
for ( int i = 0; i < nCols; i++ )
cols << GetPort(pins, QString("C%1").arg(i) );
MakeKeyMatrixControl( elem,
GetPropertyValueString("Key Names",values,""),
GetPropertyValueUsagePage("Usage",values,1),
GetPropertyValueUsage("Usage",values,1),
GetPropertyValueInt("DebounceMs",values,10),
rows,
cols );
}