本文整理汇总了C++中ListBox::head方法的典型用法代码示例。如果您正苦于以下问题:C++ ListBox::head方法的具体用法?C++ ListBox::head怎么用?C++ ListBox::head使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListBox
的用法示例。
在下文中一共展示了ListBox::head方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: normalize
// Stacked alignment
static Box *op_ualign(ListBox *args)
{
CHECK_ATOMS(args);
UAlignBox *ret = 0;
for (ListBox *b = args; !b->isEmpty(); b = b->tail())
{
Box *box = b->head();
if (ret == 0)
ret = new UAlignBox;
*ret ^= box;
}
// No child? Return null box.
if (ret == 0)
return new NullBox;
// One child? Return it.
if (ret->nchildren() == 1)
{
Box *child = (*ret)[0]->link();
ret->unlink();
return child;
}
// Return normalized alignment
return normalize(ret);
}
示例2: checkSize
// True iff all args have some size
static bool checkSize(ListBox *args)
{
for (ListBox *b = args; !b->isEmpty(); b = b->tail())
{
Box *box = b->head();
if (!box->size().isValid())
return false;
}
return true;
}
示例3: checkAtoms
// True iff all args are atoms
static bool checkAtoms(ListBox *args)
{
for (ListBox *b = args; !b->isEmpty(); b = b->tail())
{
Box *box = b->head();
if (box->isListBox() && !box->isDummyBox())
{
VSLLib::eval_error("invalid argument -- argument is list");
return false;
}
}
return true;
}
示例4: product
// Multiplication
static Box *op_mult(ListBox *args)
{
CHECK_ATOMS(args);
CHECK_SIZE(args);
BoxSize product(1,1);
for (ListBox *b = args; !b->isEmpty(); b = b->tail())
{
Box *box = b->head();
product *= box->size();
}
return new SpaceBox(product);
}
示例5: sum
// Addition
static Box *op_plus(ListBox *args)
{
CHECK_ATOMS(args);
CHECK_SIZE(args);
BoxSize sum(0,0);
for (ListBox *b = args; !b->isEmpty(); b = b->tail())
{
Box *box = b->head();
sum += box->size();
}
return new SpaceBox(sum);
}
示例6:
// Cons lists
static Box *op_cons(ListBox *args)
{
ListBox *ret = 0;
for (ListBox *b = args; !b->isEmpty(); b = b->tail())
{
Box *box = b->head();
if (!box->isListBox())
{
VSLLib::eval_error("invalid argument -- argument is list");
if (ret)
ret->unlink();
return 0;
}
if (!((ListBox *)box)->isEmpty())
{
// Create list to append
// If box is last arg, a link suffices
ListBox *box2;
if (b->tail()->isEmpty())
box2 = (ListBox *)box->link();
else
box2 = (ListBox *)box->dup();
// Append list:
// If box is first arg, copy box
if (ret == 0)
ret = box2;
else
{
ret->cons(box2);
box2->unlink();
}
}
}
// No args? return []
if (ret == 0)
ret = new ListBox;
return ret;
}