本文整理汇总了C++中pack函数的典型用法代码示例。如果您正苦于以下问题:C++ pack函数的具体用法?C++ pack怎么用?C++ pack使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pack函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: pack
void Vbo::ensureFreeCapacity(size_t capacity) {
pack();
if (m_freeCapacity < capacity)
resizeVbo(m_totalCapacity + (capacity - m_freeCapacity));
}
开发者ID:WakaLakaLake,项目名称:TrenchBroom,代码行数:5,代码来源:Vbo.cpp
示例2: ActionsBase
ListPanelActions::ListPanelActions(QObject *parent, FileManagerWindow *mainWindow) :
ActionsBase(parent, mainWindow)
{
// set view type
QSignalMapper *mapper = new QSignalMapper(this);
connect(mapper, SIGNAL(mapped(int)), SLOT(setView(int)));
QActionGroup *group = new QActionGroup(this);
group->setExclusive(true);
QList<KrViewInstance*> views = KrViewFactory::registeredViews();
for(int i = 0; i < views.count(); i++) {
KrViewInstance *inst = views[i];
QAction *action = new QAction(QIcon::fromTheme(inst->icon()), inst->description(), group);
action->setCheckable(true);
connect(action, SIGNAL(triggered()), mapper, SLOT(map()));
mapper->setMapping(action, inst->id());
_mainWindow->actions()->addAction("view" + QString::number(i), action);
_mainWindow->actions()->setDefaultShortcut(action, inst->shortcut());
setViewActions.insert(inst->id(), action);
}
// standard actions
actHistoryBackward = stdAction(KStandardAction::Back, _func, SLOT(historyBackward()));
actHistoryForward = stdAction(KStandardAction::Forward, _func, SLOT(historyForward()));
//FIXME: second shortcut for up: see actDirUp
// KStandardAction::up( this, SLOT( dirUp() ), actionCollection )->setShortcut(Qt::Key_Backspace);
/* Shortcut disabled because of the Terminal Emulator bug. */
actDirUp = stdAction(KStandardAction::Up, _func, SLOT(dirUp()));
actHome = stdAction(KStandardAction::Home, _func, SLOT(home()));
stdAction(KStandardAction::Cut, _func, SLOT(cut()));
actCopy = stdAction(KStandardAction::Copy, _func, SLOT(copyToClipboard()));
actPaste = stdAction(KStandardAction::Paste, _func, SLOT(pasteFromClipboard()));
// Fn keys
actF2 = action(i18n("Rename"), 0, Qt::Key_F2, _func, SLOT(rename()) , "F2_Rename");
actF3 = action(i18n("View File"), 0, Qt::Key_F3, _func, SLOT(view()), "F3_View");
actF4 = action(i18n("Edit File"), 0, Qt::Key_F4, _func, SLOT(edit()) , "F4_Edit");
actF5 = action(i18n("Copy to other panel"), 0, Qt::Key_F5, _func, SLOT(copyFiles()) , "F5_Copy");
actF6 = action(i18n("Move..."), 0, Qt::Key_F6, _func, SLOT(moveFiles()) , "F6_Move");
actShiftF5 = action(i18n("Copy by queue..."), 0, Qt::SHIFT + Qt::Key_F5, _func, SLOT(copyFilesByQueue()) , "F5_Copy_Queue");
actShiftF6 = action(i18n("Move by queue..."), 0, Qt::SHIFT + Qt::Key_F6, _func, SLOT(moveFilesByQueue()) , "F6_Move_Queue");
actF7 = action(i18n("New Directory..."), "folder-new", Qt::Key_F7, _func, SLOT(mkdir()) , "F7_Mkdir");
actF8 = action(i18n("Delete"), "edit-delete", Qt::Key_F8, _func, SLOT(deleteFiles()) , "F8_Delete");
actF9 = action(i18n("Start Terminal Here"), "utilities-terminal", Qt::Key_F9, _func, SLOT(terminal()) , "F9_Terminal");
action(i18n("&New Text File..."), "document-new", Qt::SHIFT + Qt::Key_F4, _func, SLOT(editNew()), "edit_new_file");
action(i18n("F3 View Dialog"), 0, Qt::SHIFT + Qt::Key_F3, _func, SLOT(viewDlg()), "F3_ViewDlg");
// file operations
action(i18n("Right-click Menu"), 0, Qt::Key_Menu, _gui, SLOT(rightclickMenu()), "rightclick menu");
actProperties = action(i18n("&Properties..."), 0, Qt::ALT + Qt::Key_Return, _func, SLOT(properties()), "properties");
actCompDirs = action(i18n("&Compare Directories"), "kr_comparedirs", Qt::ALT + Qt::SHIFT + Qt::Key_C, _gui, SLOT(compareDirs()), "compare dirs");
actCalculate = action(i18n("Calculate &Occupied Space"), "accessories-calculator", 0, _func, SLOT(calcSpace()), "calculate");
actPack = action(i18n("Pac&k..."), "archive-insert", Qt::ALT + Qt::SHIFT + Qt::Key_P, _func, SLOT(pack()), "pack");
actUnpack = action(i18n("&Unpack..."), "archive-extract", Qt::ALT + Qt::SHIFT + Qt::Key_U, _func, SLOT(unpack()), "unpack");
actCreateChecksum = action(i18n("Create Checksum..."), "document-edit-sign", 0, _func, SLOT(createChecksum()), "create checksum");
actMatchChecksum = action(i18n("Verify Checksum..."), "document-edit-decrypt-verify", 0, _func, SLOT(matchChecksum()), "match checksum");
action(i18n("New Symlink..."), 0, Qt::CTRL + Qt::ALT + Qt::Key_S, _func, SLOT(krlink()), "new symlink");
actTest = action(i18n("T&est Archive"), "archive-extract", Qt::ALT + Qt::SHIFT + Qt::Key_E, _func, SLOT(testArchive()), "test archives");
// navigation
actRoot = action(i18n("Root"), "folder-red", Qt::CTRL + Qt::Key_Backspace, _func, SLOT(root()), "root");
actCdToOther = action(i18n("Go to Other Panel's Directory"), 0, Qt::CTRL + Qt::Key_Equal, _func, SLOT(cdToOtherPanel()), "cd to other panel");
action(i18n("&Reload"), "view-refresh", Qt::CTRL + Qt::Key_R, _func, SLOT(refresh()), "std_redisplay");
actCancelRefresh = action(i18n("Cancel Refresh of View"), "dialog-cancel", 0, _gui, SLOT(inlineRefreshCancel()), "cancel refresh");
actFTPNewConnect = action(i18n("New Net &Connection..."), "network-connect", Qt::CTRL + Qt::Key_N, _func, SLOT(newFTPconnection()), "ftp new connection");
actFTPDisconnect = action(i18n("Disconnect &from Net"), "network-disconnect", Qt::SHIFT + Qt::CTRL + Qt::Key_F, _func, SLOT(FTPDisconnect()), "ftp disconnect");
action(i18n("Sync Panels"), 0, Qt::ALT + Qt::SHIFT + Qt::Key_O, _func, SLOT(syncOtherPanel()), "sync panels");
actJumpBack = action(i18n("Jump Back"), "go-jump", Qt::CTRL + Qt::Key_J, _gui, SLOT(jumpBack()), "jump_back");
actSetJumpBack = action(i18n("Set Jump Back Point"), "go-jump-definition", Qt::CTRL + Qt::SHIFT + Qt::Key_J, _gui, SLOT(setJumpBack()), "set_jump_back");
actSyncBrowse = action(i18n("S&ynchron Directory Changes"), "kr_syncbrowse_off", Qt::ALT + Qt::SHIFT + Qt::Key_Y, _gui, SLOT(toggleSyncBrowse()), "sync browse");
actLocationBar = action(i18n("Go to Location Bar"), 0, Qt::CTRL + Qt::Key_L, _gui, SLOT(editLocation()), "location_bar");
toggleAction(i18n("Toggle Popup Panel"), 0, Qt::ALT + Qt::Key_Down, _gui, SLOT(togglePanelPopup()), "toggle popup panel");
action(i18n("Bookmarks"), 0, Qt::CTRL + Qt::Key_D, _gui, SLOT(openBookmarks()), "bookmarks");
action(i18n("Left Bookmarks"), 0, 0, this, SLOT(openLeftBookmarks()), "left bookmarks");
action(i18n("Right Bookmarks"), 0, 0, this, SLOT(openRightBookmarks()), "right bookmarks");
action(i18n("History"), 0, Qt::CTRL + Qt::Key_H, _gui, SLOT(openHistory()), "history");
action(i18n("Left History"), 0, Qt::ALT + Qt::CTRL + Qt::Key_Left, this, SLOT(openLeftHistory()), "left history");
action(i18n("Right History"), 0, Qt::ALT + Qt::CTRL + Qt::Key_Right, this, SLOT(openRightHistory()), "right history");
action(i18n("Media"), 0, Qt::CTRL + Qt::Key_M, _gui, SLOT(openMedia()), "media");
action(i18n("Left Media"), 0, Qt::CTRL + Qt::SHIFT + Qt::Key_Left, this, SLOT(openLeftMedia()), "left media");
action(i18n("Right Media"), 0, Qt::CTRL + Qt::SHIFT + Qt::Key_Right, this, SLOT(openRightMedia()), "right media");
// and at last we can set the tool-tips
actRoot->setToolTip(i18n("ROOT (/)"));
actF2->setToolTip(i18n("Rename file, directory, etc."));
actF3->setToolTip(i18n("Open file in viewer."));
actF4->setToolTip("<qt>" + i18n("<p>Edit file.</p>"
"<p>The editor can be defined in Konfigurator, "
"default is <b>internal editor</b>.</p>") + "</qt>");
actF5->setToolTip(i18n("Copy file from one panel to the other."));
actF6->setToolTip(i18n("Move file from one panel to the other."));
actF7->setToolTip(i18n("Create directory in current panel."));
actF8->setToolTip(i18n("Delete file, directory, etc."));
actF9->setToolTip("<qt>" + i18n("<p>Open terminal in current directory.</p>"
"<p>The terminal can be defined in Konfigurator, "
"default is <b>konsole</b>.</p>") + "</qt>");
}
开发者ID:jorgeolivares,项目名称:krusader,代码行数:97,代码来源:listpanelactions.cpp
示例3: pack
void PathManagerEvent::write(NetConnection*nc, BitStream *stream)
{
pack(nc, stream);
}
开发者ID:adhistac,项目名称:ee-client-2-0,代码行数:4,代码来源:pathManager.cpp
示例4: j2k_encode_entry
static int
j2k_encode_entry(Imaging im, ImagingCodecState state,
ImagingIncrementalCodec encoder)
{
JPEG2KENCODESTATE *context = (JPEG2KENCODESTATE *)state->context;
opj_stream_t *stream = NULL;
opj_image_t *image = NULL;
opj_codec_t *codec = NULL;
opj_cparameters_t params;
unsigned components;
OPJ_COLOR_SPACE color_space;
opj_image_cmptparm_t image_params[4];
unsigned xsiz, ysiz;
unsigned tile_width, tile_height;
unsigned tiles_x, tiles_y, num_tiles;
unsigned x, y, tile_ndx;
unsigned n;
j2k_pack_tile_t pack;
int ret = -1;
stream = opj_stream_default_create(OPJ_FALSE);
if (!stream) {
state->errcode = IMAGING_CODEC_BROKEN;
state->state = J2K_STATE_FAILED;
goto quick_exit;
}
opj_stream_set_write_function(stream, j2k_write);
opj_stream_set_skip_function(stream, j2k_skip);
opj_stream_set_seek_function(stream, j2k_seek);
opj_stream_set_user_data(stream, encoder);
/* Setup an opj_image */
if (strcmp (im->mode, "L") == 0) {
components = 1;
color_space = OPJ_CLRSPC_GRAY;
pack = j2k_pack_l;
} else if (strcmp (im->mode, "LA") == 0) {
components = 2;
color_space = OPJ_CLRSPC_GRAY;
pack = j2k_pack_la;
} else if (strcmp (im->mode, "RGB") == 0) {
components = 3;
color_space = OPJ_CLRSPC_SRGB;
pack = j2k_pack_rgb;
} else if (strcmp (im->mode, "YCbCr") == 0) {
components = 3;
color_space = OPJ_CLRSPC_SYCC;
pack = j2k_pack_rgb;
} else if (strcmp (im->mode, "RGBA") == 0) {
components = 4;
color_space = OPJ_CLRSPC_SRGB;
pack = j2k_pack_rgba;
} else {
state->errcode = IMAGING_CODEC_BROKEN;
state->state = J2K_STATE_FAILED;
goto quick_exit;
}
for (n = 0; n < components; ++n) {
image_params[n].dx = image_params[n].dy = 1;
image_params[n].w = im->xsize;
image_params[n].h = im->ysize;
image_params[n].x0 = image_params[n].y0 = 0;
image_params[n].prec = 8;
image_params[n].bpp = 8;
image_params[n].sgnd = 0;
}
image = opj_image_create(components, image_params, color_space);
/* Setup compression context */
context->error_msg = NULL;
opj_set_default_encoder_parameters(¶ms);
params.image_offset_x0 = context->offset_x;
params.image_offset_y0 = context->offset_y;
if (context->tile_size_x && context->tile_size_y) {
params.tile_size_on = OPJ_TRUE;
params.cp_tx0 = context->tile_offset_x;
params.cp_ty0 = context->tile_offset_y;
params.cp_tdx = context->tile_size_x;
params.cp_tdy = context->tile_size_y;
tile_width = params.cp_tdx;
tile_height = params.cp_tdy;
} else {
params.cp_tx0 = 0;
params.cp_ty0 = 0;
params.cp_tdx = 1;
params.cp_tdy = 1;
tile_width = im->xsize;
tile_height = im->ysize;
}
//.........这里部分代码省略.........
开发者ID:jamesra,项目名称:Pillow,代码行数:101,代码来源:Jpeg2KEncode.c
示例5: _rfs_open
int _rfs_open(struct rfs_instance *instance, const char *path, int flags, uint64_t *desc)
{
if (instance->sendrecv.socket == -1)
{
return -ECONNABORTED;
}
unsigned path_len = strlen(path) + 1;
uint16_t fi_flags = rfs_file_flags(flags);
unsigned overall_size = sizeof(fi_flags) + path_len;
struct rfs_command cmd = { cmd_open, overall_size };
char *buffer = malloc(cmd.data_len);
pack(path, path_len,
pack_16(&fi_flags, buffer
));
send_token_t token = { 0 };
if (do_send(&instance->sendrecv,
queue_data(buffer, overall_size,
queue_cmd(&cmd, &token))) < 0)
{
free(buffer);
return -ECONNABORTED;
}
free(buffer);
struct rfs_answer ans = { 0 };
if (rfs_receive_answer(&instance->sendrecv, &ans) == -1)
{
return -ECONNABORTED;
}
if (ans.command != cmd_open)
{
return cleanup_badmsg(instance, &ans);
}
if (ans.ret == -1)
{
if (ans.ret_errno == -ENOENT)
{
delete_from_cache(&instance->attr_cache, path);
}
return -ans.ret_errno;
}
uint32_t stat_failed = 0;
uint32_t user_len = 0;
uint32_t group_len = 0;
#define ans_buffer_size sizeof(*desc) \
+ sizeof(stat_failed) + STAT_BLOCK_SIZE + sizeof(user_len) + sizeof(group_len) \
+ (MAX_SUPPORTED_NAME_LEN + 1) + (MAX_SUPPORTED_NAME_LEN + 1)
char ans_buffer[ans_buffer_size] = { 0 };
if (ans.data_len > sizeof(ans_buffer))
{
return cleanup_badmsg(instance, &ans);
}
#undef ans_buffer_size
if (rfs_receive_data(&instance->sendrecv, ans_buffer, ans.data_len) == -1)
{
return -ECONNABORTED;
}
struct stat stbuf = { 0 };
const char *user =
unpack_32(&group_len,
unpack_32(&user_len,
unpack_stat(&stbuf,
unpack_32(&stat_failed,
unpack_64(desc, ans_buffer
)))));
const char *group = user + user_len;
DEBUG("handle: %llu\n", (long long unsigned)(*desc));
stbuf.st_uid = resolve_username(instance, user);
stbuf.st_gid = resolve_groupname(instance, group, user);
if (ans.ret_errno == 0)
{
if (stat_failed == 0)
{
cache_file(&instance->attr_cache, path, &stbuf);
}
resume_add_file_to_open_list(&instance->resume.open_files, path, flags, *desc);
}
else
//.........这里部分代码省略.........
开发者ID:darkphase,项目名称:remotefs,代码行数:101,代码来源:open.c
示例6: process
void process()
{
// SSL *NewFd=ssl;
tap: pthread_mutex_lock(&pthreadMutex);
pthread_cond_wait(&pthreadCond,&pthreadMutex);
pthread_mutex_unlock(&pthreadMutex);
int new_fd=tempsockfd;
struct FilePackage sendPackage;
SSL *ssl;
// SSL_CTX *ctx;
// ctx = SSL_CTX_new(SSLv23_server_method());
/* 基于 ctx 产生一个新的 SSL */
ssl = SSL_new(ctx);
/* 将连接用户的 socket 加入到 SSL */
SSL_set_fd(ssl, new_fd);
/* 建立 SSL 连接 */
if (SSL_accept(ssl) == -1)
{
perror("accept");
close(new_fd);
}
SSL *NewFd=ssl;
++CurrentClientNum;
if(CurrentClientNum>MaxClientNum) /*客服端连接数达到最大*/
{
sendPackage=pack('L'," "," ",0,2,1,"");
SSL_write(NewFd,&sendPackage,sizeof(struct FilePackage));
--CurrentClientNum;
/* 关闭 SSL 连接 */
SSL_shutdown(NewFd);
/* 释放 SSL */
SSL_free(NewFd);
close(new_fd);
}
// printf("~~~~~~~~~~~~~~~~~~~~~~~in~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
while(1)
{
SSL_read(NewFd,&buff,sizeof(struct FilePackage));
// printf("11111%s",buff.username);
// printf("%s\n",&buff);
if(buff.cmd == 'Q' && buff.ack == '0')
{
// close(*NewFd);
/* 关闭 SSL 连接 */
SSL_shutdown(NewFd);
/* 释放 SSL */
SSL_free(NewFd);
// MoveToIdle();
close(new_fd);
break;
}
else
{
sendPackage=unpack(NewFd,buff);
if(sendPackage.cmd!='\0')
{
SSL_write(NewFd,&sendPackage,sizeof(struct FilePackage));
}
}
}
--CurrentClientNum;
goto tap;
/* 关闭 SSL 连接 */
// SSL_shutdown(NewFd);
// /* 释放 SSL */
// SSL_free(NewFd);
// close(new_fd);
// close(*NewFd);
//pthread_exit(0);
}
开发者ID:1075482900,项目名称:FTOT,代码行数:81,代码来源:server.c
示例7: gkey
/*获得密钥*/
void gkey(int nb,int nk,char *key)
{
int i,j,k,m,N;
int C1,C2,C3;
WORD CipherKey[8];
Nb=nb;
Nk=nk;
/* Nr is number of rounds Nr是加密的轮数*/
if (Nb>=Nk)
Nr=6+Nb;
else
Nr=6+Nk;
C1=1;
if (Nb<8)
{
C2=2;
C3=3;
}
else
{
C2=3;
C3=4;
}
for (m=j=0;j<nb;j++,m+=3)
{
fi[m]=(j+C1)%nb;
fi[m+1]=(j+C2)%nb;
fi[m+2]=(j+C3)%nb;
ri[m]=(nb+j-C1)%nb;
ri[m+1]=(nb+j-C2)%nb;
ri[m+2]=(nb+j-C3)%nb;
}
N=Nb*(Nr+1);
for (i=j=0;i<Nk;i++,j+=4)
{
CipherKey[i]=pack((BYTE *)&key[j]);
}
for (i=0;i<Nk;i++)
fkey[i]=CipherKey[i];
for (j=Nk,k=0;j<N;j+=Nk,k++)
{
fkey[j]=fkey[j-Nk]^SubByte(ROTL24(fkey[j-1]))^rco[k];
if (Nk<=6)
{
for (i=1;i<Nk && (i+j)<N;i++)
fkey[i+j]=fkey[i+j-Nk]^fkey[i+j-1];
}
else
{
for (i=1;i<4 &&(i+j)<N;i++)
fkey[i+j]=fkey[i+j-Nk]^fkey[i+j-1];
if ((j+4)<N)
fkey[j+4]=fkey[j+4-Nk]^SubByte(fkey[j+3]);
for (i=5;i<Nk && (i+j)<N;i++)
fkey[i+j]=fkey[i+j-Nk]^fkey[i+j-1];
}
}
for (j=0;j<Nb;j++)
rkey[j+N-Nb]=fkey[j];
for (i=Nb;i<N-Nb;i+=Nb)
{
k=N-Nb-i;
for (j=0;j<Nb;j++)
rkey[k+j]=InvMixCol(fkey[i+j]);
}
for (j=N-Nb;j<N;j++)
rkey[j-N+Nb]=fkey[j];
}
开发者ID:RUIXUEZHAOFENGNIAN,项目名称:mycode,代码行数:69,代码来源:AES加解密算法1.cpp
示例8: edname
int
edname(char *src, int kind, int change)
{
int but;
REG OBJECT *obj;
obj = get_tree( SAMENAME );
pack(src, 0);
strcpy(src, (BYTE *)((TEDINFO *)(obj[FNAME].ob_spec))->te_ptext);
strcpy(src, (BYTE *)((TEDINFO *)(obj[EDFNAME].ob_spec))->te_ptext);
/* obj[COPY].ob_state = NORMAL;
obj[SKIP].ob_state = NORMAL;
obj[QUIT].ob_state = NORMAL;
*/
((TEDINFO*)(obj[SNAME].ob_spec))->te_ptext = (LONG)get_fstring( ( change ) ? RNAME : NCONFLIC );
/* desk_mice( ARROW ); */
/* fm_draw( SAMENAME, FALSE ); */
switch( but = fmdodraw( SAMENAME, 0 ) )
{
case COPY:
if (!strcmp((BYTE *)((TEDINFO *)(obj[EDFNAME].ob_spec))->te_ptext, src))
{ /* user edit the new name */
strcpy( (BYTE *)((TEDINFO *)(obj[EDFNAME].ob_spec))->te_ptext,src);
strcpy( src, (BYTE *)((TEDINFO *)(cpbox[kind].ob_spec))->te_ptext);
pack(src,1);
backdir(fixdst);
strcat(src, fixdst);
but = CHECK;
} else {/* check if the source and destination are the same */
if (kind == CPDIR)
rmstarb(fixsrc);
if (strcmp(fixsrc, fixdst))/* they are the same */
but = SKIP;
if (kind == CPDIR)
strcat(bckslsh, fixsrc);
}
break;
case SKIP:
case QUIT:
break;
}
/* desk_mice( HOURGLASS ); */
if ( d_display )
{
draw_loop( whandle, cpbox, 0, MAX_DEPTH, 0, 0, full.g_w, full.g_h );
/* fm_draw( CPBOX, FALSE ); */
}
/* else
namecon = TRUE;
*/
if (but != CHECK)
pack(src, 1);
return but;
}
开发者ID:daemqn,项目名称:Atari_ST_Sources,代码行数:61,代码来源:DESKDIR.C
示例9: tr
/**
* Responds to the Create button
*/
void AddEditLightDialog::on_btnCreate_clicked()
{
//ConnectionNameFromSystemName.getPrefixFromName((String) prefixBox.getSelectedItem())
QString lightPrefix = ConnectionNameFromSystemName::getPrefixFromName(ui->prefixBox->currentText())+"L";
QString turnoutPrefix = ConnectionNameFromSystemName::getPrefixFromName(ui->prefixBox->currentText())+"T";
QString curAddress = ui->fieldHardwareAddress->text();
if (curAddress.length()<1)
{
log->warn("Hardware Address was not entered");
ui->status1->setText( tr("Error: No Hardware Address was entered.") );
ui->status2->setVisible(false);
// addFrame.pack();
pack();
// addFrame.setVisible(true);
setVisible(true);
return;
}
QString suName = lightPrefix+curAddress;
QString uName = ui->userName->text();
if (uName==("")) uName=""; // a blank field means no user name
// Does System Name have a valid format
if (!((ProxyLightManager*)InstanceManager::lightManagerInstance())->validSystemNameFormat(suName))
{
// Invalid System Name format
log->warn("Invalid Light system name format entered: "+suName);
ui->status1->setText( tr("Error: System Name has an invalid format.") );
ui->status2->setText( tr("Please revise System Name and try again.") );
ui->status2->setVisible(true);
// addFrame.pack();
pack();
// addFrame.setVisible(true);
setVisible(true);
return;
}
// Format is valid, normalize it
QString sName = ((ProxyLightManager*)InstanceManager::lightManagerInstance())->normalizeSystemName(suName);
// check if a Light with this name already exists
AbstractLight* g = (AbstractLight*)((ProxyLightManager*)InstanceManager::lightManagerInstance())->getBySystemName(sName);
if (g!=NULL)
{
// Light already exists
ui->status1->setText( tr("Error: Light with this System Name already exists.") );
ui->status2->setText( tr("Press Edit to see User Name and Control information.") );
ui->status2->setVisible(true);
// addFrame.pack();
pack();
// addFrame.setVisible(true);
setVisible(true);
return;
}
// check if Light exists under an alternate name if an alternate name exists
QString altName = ((ProxyLightManager*)InstanceManager::lightManagerInstance())->convertSystemNameToAlternate(suName);
if (altName != "")
{
g = (AbstractLight*)((ProxyLightManager*)InstanceManager::lightManagerInstance())->getBySystemName(altName);
if (g!=NULL)
{
// Light already exists
ui->status1->setText( tr("Error: Light")+" '"+altName+"' "+
tr("exists and is the same address.") );
ui->status2->setVisible(false);
// addFrame.pack();
pack();
// addFrame.setVisible(true);
setVisible(true);
return;
}
}
// check if a Light with the same user name exists
if (uName!="")
{
g = (AbstractLight*)((ProxyLightManager*)InstanceManager::lightManagerInstance())->getByUserName(uName);
if (g!=NULL)
{
// Light with this user name already exists
ui->status1->setText( tr("Error: Light with this User Name already exists.") );
ui->status2->setText( tr("Please revise User Name and try again.") );
ui->status2->setVisible(true);
// addFrame.pack();
pack();
// addFrame.setVisible(true);
setVisible(true);
return;
}
}
// Does System Name correspond to configured hardware
if (!((ProxyLightManager*)InstanceManager::lightManagerInstance())->validSystemNameConfig(sName))
{
// System Name not in configured hardware
ui->status1->setText( tr("Error: System Name doesn't refer to configured hardware.") );
ui->status2->setText( tr("Please revise System Name and try again.") );
ui->status2->setVisible(true);
// addFrame.pack();
//.........这里部分代码省略.........
开发者ID:allenck,项目名称:DecoderPro_app,代码行数:101,代码来源:addeditlightdialog.cpp
示例10: pack_one
void Message <Args...>::pack (StreamBinOut & sbo, U val, Args2... args)
{
pack_one (sbo, val);
pack (sbo, args...);
}
开发者ID:ohmtech,项目名称:flip-public,代码行数:5,代码来源:Message.hpp
示例11: mixdown_stereo
Result mixdown_stereo(Left&& left, Right&& right, const f64x2x2& matrix)
{
return Result(internal::stereo_matrix{ matrix },
pack(std::forward<Left>(left), std::forward<Right>(right)));
}
开发者ID:dlevin256,项目名称:kfr,代码行数:5,代码来源:mixdown.hpp
示例12: GSequenceLineViewAnnotated
DetView::DetView(QWidget* p, SequenceObjectContext* ctx)
: GSequenceLineViewAnnotated(p, ctx)
{
editor = new DetViewSequenceEditor(this);
showComplementAction = new QAction(tr("Show complementary strand"), this);
showComplementAction->setIcon(QIcon(":core/images/show_compl.png"));
showComplementAction->setObjectName("complement_action");
connect(showComplementAction, SIGNAL(triggered(bool)), SLOT(sl_showComplementToggle(bool)));
showTranslationAction = new QAction(tr("Show/hide translations"), this);
showTranslationAction->setObjectName("translation_action");
connect(showTranslationAction, SIGNAL(triggered(bool)), SLOT(sl_showTranslationToggle(bool)));
doNotTranslateAction = new QAction(tr("Do not translate"), this);
doNotTranslateAction->setObjectName("do_not_translate_radiobutton");
doNotTranslateAction->setData(SequenceObjectContext::TS_DoNotTranslate);
connect(doNotTranslateAction, SIGNAL(triggered(bool)), SLOT(sl_doNotTranslate()));
doNotTranslateAction->setCheckable(true);
doNotTranslateAction->setChecked(true);
translateAnnotationsOrSelectionAction = new QAction(tr("Translate selection"), this);
translateAnnotationsOrSelectionAction->setData(SequenceObjectContext::TS_AnnotationsOrSelection);
connect(translateAnnotationsOrSelectionAction, SIGNAL(triggered(bool)), SLOT(sl_translateAnnotationsOrSelection()));
translateAnnotationsOrSelectionAction->setCheckable(true);
setUpFramesManuallyAction = new QAction(tr("Set up frames manually"), this);
setUpFramesManuallyAction->setObjectName("set_up_frames_manuallt_radiobutton");
setUpFramesManuallyAction->setData(SequenceObjectContext::TS_SetUpFramesManually);
connect(setUpFramesManuallyAction, SIGNAL(triggered(bool)), SLOT(sl_setUpFramesManually()));
setUpFramesManuallyAction->setCheckable(true);
showAllFramesAction = new QAction(tr("Show all frames"), this);
showAllFramesAction->setObjectName("show_all_frames_radiobutton");
showAllFramesAction->setData(SequenceObjectContext::TS_ShowAllFrames);
connect(showAllFramesAction, SIGNAL(triggered(bool)), SLOT(sl_showAllFrames()));
showAllFramesAction->setCheckable(true);
wrapSequenceAction = new QAction(tr("Wrap sequence"), this);
wrapSequenceAction->setIcon(QIcon(":core/images/wrap_sequence.png"));
wrapSequenceAction->setObjectName("wrap_sequence_action");
connect(wrapSequenceAction, SIGNAL(triggered(bool)), SLOT(sl_wrapSequenceToggle(bool)));
showComplementAction->setCheckable(true);
showTranslationAction->setCheckable(true);
wrapSequenceAction->setCheckable(true);
wrapSequenceAction->setChecked(true);
bool hasComplement = ctx->getComplementTT() != NULL;
showComplementAction->setChecked(hasComplement);
bool hasAmino = ctx->getAminoTT() != NULL;
showTranslationAction->setChecked(hasAmino);
assert(ctx->getSequenceObject()!=NULL);
featureFlags&=!GSLV_FF_SupportsCustomRange;
renderArea = new DetViewRenderArea(this);
renderArea->setObjectName("render_area_" + ctx->getSequenceObject()->getSequenceName());
connect(ctx, SIGNAL(si_aminoTranslationChanged()), SLOT(sl_onAminoTTChanged()));
connect(ctx, SIGNAL(si_translationRowsChanged()), SLOT(sl_translationRowsChanged()));
addActionToLocalToolbar(wrapSequenceAction);
if (hasComplement) {
addActionToLocalToolbar(showComplementAction);
}
if (hasAmino) {
setupTranslationsMenu();
setupGeneticCodeMenu();
}
addActionToLocalToolbar(editor->getEditAction());
verticalScrollBar = new GScrollBar(Qt::Vertical, this);
verticalScrollBar->setObjectName("multiline_scrollbar");
scrollBar->setObjectName("singleline_scrollbar");
currentShiftsCounter = 0;
numShiftsInOneLine = 1;
verticalScrollBar->setHidden(!wrapSequenceAction->isChecked());
scrollBar->setHidden(wrapSequenceAction->isChecked());
pack();
updateActions();
// TODO_SVEDIT: check its required
connect(ctx->getSequenceObject(), SIGNAL(si_sequenceChanged()), SLOT(sl_sequenceChanged()));
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:90,代码来源:DetView.cpp
示例13: serverEncode
void CtcpHandler::reply(const QString &bufname, const QString &ctcpTag, const QString &message) {
QList<QByteArray> params;
params << serverEncode(bufname) << lowLevelQuote(pack(serverEncode(ctcpTag), userEncode(bufname, message)));
emit putCmd("NOTICE", params);
}
开发者ID:bawNg,项目名称:quassel,代码行数:5,代码来源:ctcphandler.cpp
示例14: max
Texture* TextureFilters::blur(Texture* texture,
int passes,
int direction,
int width,
int amplify)
{
passes += 1;
direction += 1;
passes = max(1, passes);
width = max(1, width);
Texture* in = texture->clone();
Texture* out = new Texture();
in->lock();
out->lock();
if (direction & 1)
{
// Repeat box blur
for (int t = 0; t < passes; t++)
{
// For each line
for (int y = 0; y < 256; y++)
{
DWORD r = 0, g = 0, b = 0;
for (int x = 0; x < width; x++)
{
DWORD c = in->getPixel(x, y);
r += c & 0xff;
g += (c >> 8) & 0xff;
b += (c >> 16) & 0xff;
}
for (int x = 0; x < 256; x++)
{
out->putPixel((x + width / 2) & 0xff, y, pack(r, g, b, width, amplify));
DWORD c1 = in->getPixel((x + width) & 0xff, y);
DWORD c2 = in->getPixel(x, y);
r += c1 & 0xff;
g += (c1 >> 8) & 0xff;
b += (c1 >> 16) & 0xff;
r -= c2 & 0xff;
g -= (c2 >> 8) & 0xff;
b -= (c2 >> 16) & 0xff;
}
}
{
Texture *tmp = out;
out = in;
in = tmp;
}
}
}
if (direction & 2)
{
// Repeat box blur
for (int t = 0; t < passes; t++)
{
// For each column
for (int x = 0; x < 256; x++)
{
DWORD r = 0, g = 0, b = 0;
for (int y = 0; y < width; y++)
{
DWORD c = in->getPixel(x, y);
r += c & 0xff;
g += (c >> 8) & 0xff;
b += (c >> 16) & 0xff;
}
for (int y = 0; y < 256; y++)
{
out->putPixel(x, (y + width / 2) & 0xff, pack(r, g, b, width, amplify));
DWORD c1 = in->getPixel(x, (y + width) & 0xff);
DWORD c2 = in->getPixel(x, y);
r += c1 & 0xff;
g += (c1 >> 8) & 0xff;
b += (c1 >> 16) & 0xff;
r -= c2 & 0xff;
g -= (c2 >> 8) & 0xff;
b -= (c2 >> 16) & 0xff;
}
}
{
Texture *tmp = out;
out = in;
in = tmp;
}
}
}
in->unlock();
out->unlock();
//.........这里部分代码省略.........
开发者ID:weimingtom,项目名称:db-verkstan,代码行数:101,代码来源:blurtexturefilter.cpp
示例15: pack
void pack (const Elem* elem,
std::vector<largest_id_type>& data,
const ParallelMesh* mesh)
{
pack(elem, data, static_cast<const MeshBase*>(mesh));
}
开发者ID:dengchangtao,项目名称:libmesh,代码行数:6,代码来源:parallel_elem.C
示例16: pickCopyFunc
/*
* Select the appropriate copy function to use.
*/
static copyFunc
pickCopyFunc(TIFF* in, TIFF* out, uint16 bitspersample, uint16 samplesperpixel)
{
uint16 shortv;
uint32 w, l, tw, tl;
int bychunk;
(void) TIFFGetField(in, TIFFTAG_PLANARCONFIG, &shortv);
if (shortv != config && bitspersample != 8 && samplesperpixel > 1) {
fprintf(stderr,
"%s: Can not handle different planar configuration w/ bits/sample != 8\n",
TIFFFileName(in));
return (NULL);
}
TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(in, TIFFTAG_IMAGELENGTH, &l);
if (TIFFIsTiled(out)) {
if (!TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw))
tw = w;
if (!TIFFGetField(in, TIFFTAG_TILELENGTH, &tl))
tl = l;
bychunk = (tw == tilewidth && tl == tilelength);
} else if (TIFFIsTiled(in)) {
TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);
TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);
bychunk = (tw == w && tl == rowsperstrip);
} else {
uint32 irps = (uint32) -1L;
TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &irps);
bychunk = (rowsperstrip == irps);
}
#define T 1
#define F 0
#define pack(a,b,c,d,e) ((long)(((a)<<11)|((b)<<3)|((c)<<2)|((d)<<1)|(e)))
switch(pack(shortv,config,TIFFIsTiled(in),TIFFIsTiled(out),bychunk)) {
/* Strips -> Tiles */
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,T,F):
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,T,T):
return cpContigStrips2ContigTiles;
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,T,F):
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,T,T):
return cpContigStrips2SeparateTiles;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,T,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,T,T):
return cpSeparateStrips2ContigTiles;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,T,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,T,T):
return cpSeparateStrips2SeparateTiles;
/* Tiles -> Tiles */
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,T,F):
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,T,T):
return cpContigTiles2ContigTiles;
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,T,F):
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,T,T):
return cpContigTiles2SeparateTiles;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,T,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,T,T):
return cpSeparateTiles2ContigTiles;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,T,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,T,T):
return cpSeparateTiles2SeparateTiles;
/* Tiles -> Strips */
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,F,F):
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,F,T):
return cpContigTiles2ContigStrips;
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,F,F):
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,F,T):
return cpContigTiles2SeparateStrips;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,F,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,F,T):
return cpSeparateTiles2ContigStrips;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,F,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,F,T):
return cpSeparateTiles2SeparateStrips;
/* Strips -> Strips */
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,F,F):
return cpContig2ContigByRow;
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,F,T):
return cpDecodedStrips;
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,F,F):
case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,F,T):
return cpContig2SeparateByRow;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,F,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,F,T):
return cpSeparate2ContigByRow;
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,F,F):
case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,F,T):
return cpSeparate2SeparateByRow;
}
#undef pack
#undef F
#undef T
fprintf(stderr, "tiffcp: %s: Don't know how to copy/convert image.\n",
TIFFFileName(in));
return (NULL);
}
开发者ID:OS2World,项目名称:LIB-PDFLib,代码行数:99,代码来源:tiffcp.c
示例17: pack
void RemoteCommandEvent::write(NetConnection* conn, BitStream *bstream)
{
pack(conn, bstream);
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:4,代码来源:net.cpp
示例18: unpack
/*解包函数*/
struct FilePackage unpack(SSL *NewFd,struct FilePackage tpack)
{
struct FilePackage sendPack;
char username[20]="\0";
char userpwd[20]="\0";
char *pUser=tpack.buf;
char pfilename[125]="\0";
// char userdir[50]="\0";
int filesize;
int currentFsize=0;
int fd;
int fdlog;
int flag=1;
// printf("2222222%s",tpack.username);
switch(tpack.cmd)
{
case 'L': /*登陆请求*/
{
int i=0;
while(*pUser!='*') /*从数据包中读取用户帐号与密码*/
{
if(i<20)
{
username[i]=*pUser;
++i;
++pUser;
}
}
++pUser;
i=0; /*跳过*号*/
while(*pUser!='#')
{
if(i<20)
{
userpwd[i]=*pUser;
++i;
++pUser;
}
}
// strcat(userdir,"./");
// strcat(userdir,username);
// while(flag!=0)
// {
if(CheckClient(username,userpwd)==1)
{
/*返回文件列表*/
//getlist();
sendPack = pack('L',"","",0,1,1,"");
strcpy(filelist,"");
// flag=1;
// return sendPack;
}
else
{
sendPack=pack('L',"","",0,0,1,""); /*登陆失败*/
// return sendPack;
// }
}
return sendPack;
}
break;
case 'U':
{
struct statfs statfsbuf;
int count=0;
currentFsize=0;
if(tpack.ack==9)
{
strcat(pfilename,tpack.username);
// printf("111111111111111111%s\n",userdir);
strcat(pfilename,"/");
strcat(pfilename,tpack.filename);
// printf("22222222222222222222%s\n",pfilename);
// printf("%s\n",pfilename);
filesize=tpack.filesize;
/*文件名已经存在以后实现*/
statfs("./",&statfsbuf);
if((statfsbuf.f_bsize*statfsbuf.f_bfree)<=filesize)
{
printf("\033[31m磁盘空间不足\033[0m\n");
sendPack=pack('U',"","",0,1,1,"");
SSL_write(NewFd,&sendPack,sizeof(struct FilePackage));
exit(1);
}
if((fd=open(pfilename,O_RDWR|O_CREAT,0777))<0)
{
perror("open error:\n");
}
// printf("%d",fd);
sendPack=pack('U',"","",0,0,1,"");
SSL_write(NewFd,&sendPack,sizeof(struct FilePackage));
if((count=SSL_read(NewFd,&buff,sizeof(struct FilePackage)))==-1)
{
perror("read error:\n");
//.........这里部分代码省略.........
开发者ID:1075482900,项目名称:FTOT,代码行数:101,代码来源:server.c
|
请发表评论