本文整理匯總了C++中APPEND函數的典型用法代碼示例。如果您正苦於以下問題:C++ APPEND函數的具體用法?C++ APPEND怎麽用?C++ APPEND使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了APPEND函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: generateTrueTypeCMap
static QByteArray generateTrueTypeCMap(QFontEngine *fe)
{
QByteArray cmap;
const int glyphCount = fe->glyphCount();
if (!glyphCount)
return cmap;
// cmap header
APPEND(quint16, 0); // table version number
APPEND(quint16, 1); // number of tables
// encoding record
APPEND(quint16, 3); // platform-id
APPEND(quint16, 10); // encoding-id (ucs-4)
const int cmapOffset = cmap.size() + sizeof(quint32);
APPEND(quint32, cmapOffset); // offset to sub-table
APPEND(quint16, 4); // subtable format
const int cmapTableLengthOffset = cmap.size();
APPEND(quint16, 0); // length in bytes, will fill in later
APPEND(quint16, 0); // language field
QList<CMapSegment> segments;
CMapSegment currentSegment;
currentSegment.start = 0xffff;
currentSegment.end = 0;
currentSegment.startGlyphIndex = 0;
quint32 previousGlyphIndex = 0xfffffffe;
bool inSegment = false;
QGlyphLayoutArray<10> layout;
for (uint uc = 0; uc < 0x10000; ++uc) {
QChar ch(uc);
int nglyphs = 10;
bool validGlyph = fe->stringToCMap(&ch, 1, &layout, &nglyphs, /*flags*/ 0)
&& nglyphs == 1 && layout.glyphs[0];
// leaving a segment?
if (inSegment && (!validGlyph || layout.glyphs[0] != previousGlyphIndex + 1)) {
Q_ASSERT(currentSegment.start != 0xffff);
// store the current segment
currentSegment.end = uc - 1;
segments.append(currentSegment);
currentSegment.start = 0xffff;
inSegment = false;
}
// entering a new segment?
if (validGlyph && (!inSegment || layout.glyphs[0] != previousGlyphIndex + 1)) {
currentSegment.start = uc;
currentSegment.startGlyphIndex = layout.glyphs[0];
inSegment = true;
}
if (validGlyph)
previousGlyphIndex = layout.glyphs[0];
else
previousGlyphIndex = 0xfffffffe;
}
currentSegment.start = 0xffff;
currentSegment.end = 0xffff;
currentSegment.startGlyphIndex = 0;
segments.append(currentSegment);
if (QPF::debugVerbosity > 3)
qDebug() << "segments:" << segments.count();
Q_ASSERT(!inSegment);
const quint16 entrySelector = int(log2(segments.count()));
const quint16 searchRange = 2 * (1 << entrySelector);
const quint16 rangeShift = segments.count() * 2 - searchRange;
if (QPF::debugVerbosity > 3)
qDebug() << "entrySelector" << entrySelector << "searchRange" << searchRange
<< "rangeShift" << rangeShift;
APPEND(quint16, segments.count() * 2); // segCountX2
APPEND(quint16, searchRange);
APPEND(quint16, entrySelector);
APPEND(quint16, rangeShift);
// end character codes
for (int i = 0; i < segments.count(); ++i)
APPEND(quint16, segments.at(i).end);
APPEND(quint16, 0); // pad
// start character codes
for (int i = 0; i < segments.count(); ++i)
APPEND(quint16, segments.at(i).start);
// id deltas
for (int i = 0; i < segments.count(); ++i)
APPEND(quint16, segments.at(i).startGlyphIndex - segments.at(i).start);
// id range offsets
for (int i = 0; i < segments.count(); ++i)
APPEND(quint16, 0);
//.........這裏部分代碼省略.........
示例2: INHERITED
void SkRecorder::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edgeStyle) {
INHERITED(onClipRRect, rrect, op, edgeStyle);
SkRecords::ClipOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
APPEND(ClipRRect, this->getDeviceClipBounds(), rrect, opAA);
}
示例3: APPEND
void SkRecorder::didRestore() {
APPEND(Restore, this->getDeviceClipBounds(), this->getTotalMatrix());
}
示例4: TRY_MINIRECORDER
void SkRecorder::onDrawRect(const SkRect& rect, const SkPaint& paint) {
TRY_MINIRECORDER(drawRect, rect, paint);
APPEND(DrawRect, paint, rect);
}
示例5: OCTET_STRING_decode_ber
/*
* Decode OCTET STRING type.
*/
asn_dec_rval_t
OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td,
void **sptr, const void *buf_ptr, size_t size, int tag_mode) {
asn_OCTET_STRING_specifics_t *specs = td->specifics
? (asn_OCTET_STRING_specifics_t *)td->specifics
: &asn_DEF_OCTET_STRING_specs;
BIT_STRING_t *st = (BIT_STRING_t *)*sptr;
asn_dec_rval_t rval;
asn_struct_ctx_t *ctx;
ssize_t consumed_myself = 0;
struct _stack *stck; /* Expectations stack structure */
struct _stack_el *sel = 0; /* Stack element */
int tlv_constr;
enum asn_OS_Subvariant type_variant = specs->subvariant;
ASN_DEBUG("Decoding %s as %s (frame %ld)",
td->name,
(type_variant == ASN_OSUBV_STR) ?
"OCTET STRING" : "OS-SpecialCase",
(long)size);
/*
* Create the string if does not exist.
*/
if(st == NULL) {
st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size));
if(st == NULL) RETURN(RC_FAIL);
}
/* Restore parsing context */
ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
switch(ctx->phase) {
case 0:
/*
* Check tags.
*/
rval = ber_check_tags(opt_codec_ctx, td, ctx,
buf_ptr, size, tag_mode, -1,
&ctx->left, &tlv_constr);
if(rval.code != RC_OK)
return rval;
if(tlv_constr) {
/*
* Complex operation, requires stack of expectations.
*/
ctx->ptr = _new_stack();
if(ctx->ptr) {
stck = (struct _stack *)ctx->ptr;
} else {
RETURN(RC_FAIL);
}
} else {
/*
* Jump into stackless primitive decoding.
*/
_CH_PHASE(ctx, 3);
if(type_variant == ASN_OSUBV_ANY && tag_mode != 1)
APPEND(buf_ptr, rval.consumed);
ADVANCE(rval.consumed);
goto phase3;
}
NEXT_PHASE(ctx);
/* Fall through */
case 1:
phase1:
/*
* Fill the stack with expectations.
*/
stck = (struct _stack *)ctx->ptr;
sel = stck->cur_ptr;
do {
ber_tlv_tag_t tlv_tag;
ber_tlv_len_t tlv_len;
ber_tlv_tag_t expected_tag;
ssize_t tl, ll, tlvl;
/* This one works even if (sel->left == -1) */
ssize_t Left = ((!sel||(size_t)sel->left >= size)
?(ssize_t)size:sel->left);
ASN_DEBUG("%p, s->l=%ld, s->wn=%ld, s->g=%ld\n", sel,
(long)(sel?sel->left:0),
(long)(sel?sel->want_nulls:0),
(long)(sel?sel->got:0)
);
if(sel && sel->left <= 0 && sel->want_nulls == 0) {
if(sel->prev) {
struct _stack_el *prev = sel->prev;
if(prev->left != -1) {
if(prev->left < sel->got)
RETURN(RC_FAIL);
prev->left -= sel->got;
}
//.........這裏部分代碼省略.........
示例6: main
int main(int argc,
char *argv[])
{
ptl_handle_ni_t ni_logical;
ptl_pt_index_t logical_pt_index;
ptl_process_t myself;
struct timeval start, stop;
int potato = 0;
ENTRY_T potato_catcher;
HANDLE_T potato_catcher_handle;
ptl_md_t potato_launcher;
ptl_handle_md_t potato_launcher_handle;
int num_procs;
ptl_handle_eq_t pt_eq_handle;
CHECK_RETURNVAL(PtlInit());
CHECK_RETURNVAL(libtest_init());
num_procs = libtest_get_size();
if (NULL != getenv("MAKELEVEL") && num_procs > 2) {
return 77;
}
CHECK_RETURNVAL(PtlNIInit
(PTL_IFACE_DEFAULT, NI_TYPE | PTL_NI_LOGICAL, PTL_PID_ANY,
NULL, NULL, &ni_logical));
CHECK_RETURNVAL(PtlSetMap(ni_logical, num_procs,
libtest_get_mapping(ni_logical)));
CHECK_RETURNVAL(PtlGetId(ni_logical, &myself));
CHECK_RETURNVAL(PtlEQAlloc(ni_logical, 100, &pt_eq_handle));
CHECK_RETURNVAL(PtlPTAlloc
(ni_logical, 0, pt_eq_handle, PTL_PT_ANY,
&logical_pt_index));
assert(logical_pt_index == 0);
/* Now do the initial setup on ni_logical */
potato_catcher.start = &potato;
potato_catcher.length = sizeof(potato);
potato_catcher.uid = PTL_UID_ANY;
potato_catcher.options = OPTIONS;
#if INTERFACE == 1
potato_catcher.match_id.rank = PTL_RANK_ANY;
potato_catcher.match_bits = 1;
potato_catcher.ignore_bits = ~potato_catcher.match_bits;
#endif
potato_catcher.ct_handle = PTL_CT_NONE;
CHECK_RETURNVAL(APPEND
(ni_logical, logical_pt_index, &potato_catcher,
PTL_PRIORITY_LIST, NULL, &potato_catcher_handle));
{
ptl_event_t event;
CHECK_RETURNVAL(PtlEQWait(pt_eq_handle, &event)); // wait for link event
assert(event.type == PTL_EVENT_LINK);
}
/* Now do a barrier (on ni_physical) to make sure that everyone has their
* logical interface set up */
libtest_barrier();
/* now I can communicate between ranks with ni_logical */
/* set up the potato launcher */
potato_launcher.start = &potato;
potato_launcher.length = sizeof(potato);
potato_launcher.options = PTL_MD_EVENT_CT_ACK | PTL_MD_EVENT_CT_SEND;
potato_launcher.eq_handle = PTL_EQ_NONE; // i.e. don't queue send events
CHECK_RETURNVAL(PtlCTAlloc(ni_logical, &potato_launcher.ct_handle));
CHECK_RETURNVAL(PtlMDBind
(ni_logical, &potato_launcher, &potato_launcher_handle));
/* rank 0 starts the potato going */
if (myself.rank == 0) {
ptl_process_t nextrank;
nextrank.rank = myself.rank + 1;
nextrank.rank *= (nextrank.rank <= num_procs - 1);
gettimeofday(&start, NULL);
CHECK_RETURNVAL(PtlPut(potato_launcher_handle, 0, potato_launcher.length,
(LOOPS == 1) ? PTL_OC_ACK_REQ : PTL_NO_ACK_REQ,
nextrank, logical_pt_index, 1, 0, NULL, 1));
}
{ /* the potato-passing loop */
size_t waitfor;
ptl_ct_event_t ctc;
ptl_process_t nextrank;
nextrank.rank = myself.rank + 1;
nextrank.rank *= (nextrank.rank <= num_procs - 1);
for (waitfor = 1; waitfor <= LOOPS; ++waitfor) {
do {
ptl_event_t event;
CHECK_RETURNVAL(PtlEQWait(pt_eq_handle, &event)); // wait for potato
if (event.type != PTL_EVENT_PUT) {
printf("unexpected event: %i\n", (int)event.type);
} else {
break;
}
} while (1);
/* I have the potato! */
//.........這裏部分代碼省略.........
示例7: APPEND
void IRenderPass::assignDrawBuffer(GLenum buf) {
APPEND(_drawBuffers,buf);
flags|=RP_SET_DRAW_BUFFERS;
}