本文整理汇总了C++中Listing::append方法的典型用法代码示例。如果您正苦于以下问题:C++ Listing::append方法的具体用法?C++ Listing::append怎么用?C++ Listing::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Listing
的用法示例。
在下文中一共展示了Listing::append方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: store
bool BodyItemImpl::store(Archive& archive)
{
archive.setDoubleFormat("% .6f");
archive.writeRelocatablePath("modelFile", self->filePath());
archive.write("currentBaseLink", (currentBaseLink ? currentBaseLink->name() : ""), DOUBLE_QUOTED);
/// \todo Improve the following for current / initial position representations
write(archive, "rootPosition", body->rootLink()->p());
write(archive, "rootAttitude", Matrix3(body->rootLink()->R()));
Listing* qs = archive.createFlowStyleListing("jointPositions");
int n = body->numJoints();
for(int i=0; i < n; ++i){
qs->append(body->joint(i)->q(), 10, n);
}
//! \todo replace the following code with the ValueTree serialization function of BodyState
SE3 initialRootPosition;
if(initialState.getRootLinkPosition(initialRootPosition)){
write(archive, "initialRootPosition", initialRootPosition.translation());
write(archive, "initialRootAttitude", Matrix3(initialRootPosition.rotation()));
}
BodyState::Data& initialJointPositions = initialState.data(BodyState::JOINT_POSITIONS);
if(!initialJointPositions.empty()){
qs = archive.createFlowStyleListing("initialJointPositions");
for(int i=0; i < initialJointPositions.size(); ++i){
qs->append(initialJointPositions[i], 10, n);
}
}
write(archive, "zmp", zmp);
if(isOriginalModelStatic != body->isStaticModel()){
archive.write("staticModel", body->isStaticModel());
}
archive.write("selfCollisionDetection", isSelfCollisionDetectionEnabled);
archive.write("isEditable", isEditable);
return true;
}
示例2: storeLayout
void ViewAreaImpl::storeLayout(Archive* archive)
{
QDesktopWidget* desktop = QApplication::desktop();
const int primaryScreen = desktop->primaryScreen();
try {
MappingPtr state = storeSplitterState(topSplitter, archive);
if(state){
if(!self->isWindow()){
archive->write("type", "embedded");
} else {
archive->write("type", "independent");
const int screen = desktop->screenNumber(self->pos());
if(screen != primaryScreen){
archive->write("screen", screen);
}
const QRect s = desktop->screenGeometry(screen);
const QRect r = self->geometry().translated(-s.x(), -s.y());
Listing* geometry = archive->createFlowStyleListing("geometry");
geometry->append(r.x());
geometry->append(r.y());
geometry->append(r.width());
geometry->append(r.height());
if(self->isFullScreen()){
archive->write("fullScreen", true);
archive->write("maximized", isMaximizedBeforeFullScreen);
} else {
archive->write("fullScreen", false);
archive->write("maximized", self->isMaximized());
}
}
archive->write("tabs", viewTabsVisible);
archive->insert("contents", state);
}
}
catch(const ValueNode::Exception& ex){
MessageView::instance()->putln(ex.message());
}
}
示例3: addNode
void YAMLReaderImpl::addNode(ValueNode* node, yaml_event_t& event)
{
NodeInfo& info = nodeStack.top();
ValueNode* parent = info.node;
if(parent->isListing()){
Listing* listing = static_cast<Listing*>(parent);
listing->append(node);
} else if(parent->isMapping()){
Mapping* mapping = static_cast<Mapping*>(parent);
if(info.key == "<<"){
if(node->isMapping()){
mapping->insert(static_cast<Mapping*>(node));
} else if(node->isListing()){
Listing* listing = static_cast<Listing*>(node);
for(auto& element : *listing){
if(element->isMapping()){
mapping->insert(static_cast<Mapping*>(element.get()));
} else {
ValueNode::SyntaxException ex;
ex.setMessage(_("An element to merge by the \"<<\" key must be a mapping"));
const yaml_mark_t& start_mark = event.start_mark;
ex.setPosition(start_mark.line, start_mark.column);
throw ex;
}
}
} else {
ValueNode::SyntaxException ex;
ex.setMessage(_("A value to merge by the \"<<\" key must be mapping or listing"));
const yaml_mark_t& start_mark = event.start_mark;
ex.setPosition(start_mark.line, start_mark.column);
throw ex;
}
}
mapping->insert(info.key, node);
info.key.clear();
}
}
示例4: storeSplitterState
MappingPtr ViewAreaImpl::storeSplitterState(QSplitter* splitter, Archive* archive)
{
MappingPtr state = new Mapping;
ListingPtr children = new Listing;
for(int i=0; i < splitter->count(); ++i){
QSplitter* childSplitter = dynamic_cast<QSplitter*>(splitter->widget(i));
if(childSplitter){
MappingPtr childState = storeSplitterState(childSplitter, archive);
if(childState){
children->append(childState);
}
} else {
ViewPane* pane = dynamic_cast<ViewPane*>(splitter->widget(i));
if(pane && pane->count() > 0){
MappingPtr childState = storePaneState(pane, archive);
if(childState){
children->append(childState);
}
}
}
}
const int numChildren = children->size();
if(numChildren == 0){
state.reset();
} else if(numChildren == 1){
state = children->at(0)->toMapping();
} else if(numChildren == 2){
state->write("type", "splitter");
state->write("orientation", (splitter->orientation() == Qt::Vertical) ? "vertical" : "horizontal");
Listing* sizeSeq = state->createFlowStyleListing("sizes");
QList<int> sizes = splitter->sizes();
for(int i=0; i < sizes.size(); ++i){
sizeSeq->append(sizes[i]);
}
state->insert("children", children);
}
return state;
}
示例5: storePaneState
MappingPtr ViewAreaImpl::storePaneState(ViewPane* pane, Archive* archive)
{
MappingPtr state = new Mapping();
state->write("type", "pane");
Listing* views = state->createFlowStyleListing("views");
const int n = pane->count();
for(int i=0; i < n; ++i){
View* view = pane->view(i);
int id = archive->getViewId(view);
if(id >= 0){
views->append(id);
if(i == pane->currentIndex()){
state->write("current", id);
}
}
}
if(views->empty()){
state.reset();
}
return state;
}