Config EarthFileSerializer2::serialize(const MapNode* input, const std::string& referrer) const { Config mapConf("map"); mapConf.set("version", "2"); if ( !input || !input->getMap() ) return mapConf; const Map* map = input->getMap(); MapFrame mapf( map ); // the map and node options: Config optionsConf = map->getInitialMapOptions().getConfig(); optionsConf.merge( input->getMapNodeOptions().getConfig() ); mapConf.add( "options", optionsConf ); // the layers LayerVector layers; mapf.getLayers(layers); for (LayerVector::const_iterator i = layers.begin(); i != layers.end(); ++i) { const Layer* layer = i->get(); Config layerConf = layer->getConfig(); if (!layerConf.empty()) { mapConf.add(layerConf); } } typedef std::vector< osg::ref_ptr<Extension> > Extensions; for(Extensions::const_iterator i = input->getExtensions().begin(); i != input->getExtensions().end(); ++i) { Extension* e = i->get(); Config conf = e->getConfigOptions().getConfig(); if ( !conf.key().empty() ) { mapConf.add( conf ); } } Config ext = input->externalConfig(); if ( !ext.empty() ) { ext.key() = "external"; mapConf.add( ext ); } // Re-write pathnames in the Config so they are relative to the new referrer. if ( _rewritePaths && !referrer.empty() ) { RewritePaths rewritePaths( referrer ); rewritePaths.setRewriteAbsolutePaths( _rewriteAbsolutePaths ); rewritePaths.apply( mapConf ); } return mapConf; }
void Slider::reallocate_thumb(const Allocation& a) { Patch& thumb = *impl_->thumb_patch_; Extension ext; ext.clear(); thumb.allocate(canvas(), a, ext); thumb.redraw(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); Extension exten; exten.show(); return a.exec(); }
void BoxImpl::full_allocate(AllocationInfo& info) { Canvas* c = info.canvas(); GlyphIndex n = box_->count(); Allocation* a = info.component_allocations(); Requisition* r = new Requisition[n]; GlyphIndex i; for (i = 0; i < n; i++) { Glyph* g = box_->component(i); if (g != nil) { g->request(r[i]); } } layout_->allocate(info.allocation(), n, r, a); delete [] r; Extension& box = info.extension(); Extension child; for (i = 0; i < n; i++) { Glyph* g = box_->component(i); if (g != nil) { child.clear(); g->allocate(c, a[i], child); box.merge(child); } } }
/** ***************************************************************************/ void SettingsWidget::updatePluginInformations(const QModelIndex & current) { // Hidde the placehodler text QLayoutItem *i = ui.widget_pluginInfos->layout()->takeAt(1); delete i->widget(); delete i; if (extensionManager_->extensionSpecs()[current.row()]->state() == ExtensionSpec::State::Loaded){ Extension *extension = dynamic_cast<Extension*>(extensionManager_->extensionSpecs()[current.row()]->instance()); if (!extension){ qWarning() << "Cannot cast an object of extension spec to an extension!"; return; // Should no happen } QWidget *pw = extension->widget(); if ( pw->layout() != nullptr) pw->layout()->setMargin(0); ui.widget_pluginInfos->layout()->addWidget(pw);// Takes ownership ui.label_pluginTitle->setText(extension->name()); ui.label_pluginTitle->show(); } else{ QString msg("Plugin not loaded.\n%1"); QLabel *lbl = new QLabel(msg.arg(extensionManager_->extensionSpecs()[current.row()]->lastError())); lbl->setEnabled(false); lbl->setAlignment(Qt::AlignCenter); ui.widget_pluginInfos->layout()->addWidget(lbl); ui.label_pluginTitle->hide(); } }
void XYView::set_damage_area(Canvas* c) { Extension e; c->restrict_damage(0.,0., c->width(), c->height()); c->damage_area(e); const float off = c->to_coord(1); c->transformer().inverse_transform(e.left()-off, e.bottom()-off, xd1_, yd1_); c->transformer().inverse_transform(e.right()+off, e.top()+off, xd2_, yd2_); }
void Engine::addExtension(const Str& name, const Extension& extension) { Extension result = extension; result.data = result.init(this, result.data); extensions.set(name, result); }
void Background::draw(Canvas* c, const Allocation& a) const { Extension ext; ext.set(c, a); if (c->damaged(ext)) { c->fill_rect(a.left(), a.bottom(), a.right(), a.top(), color_); } MonoGlyph::draw(c, a); }
Extension Spectrum::getExtension() const { Dimension dim = getDimCount(); Extension ext; for( Dimension d = 0; d < dim; d++ ) ext.push_back( getScale( d ).getSampleCount() ); return ext; }
void UnprocessedStatement::process(Ruleset &r) { Extension extension; Mixin mixin; Declaration* declaration; #ifdef WITH_LIBGLOG VLOG(2) << "Statement: " << getTokens()->toString(); #endif // process extends statement if (getExtension(extension.getTarget())) { extension.setExtension(r.getSelector()); getLessRuleset()->getContext()->addExtension(extension); return; } mixin.setStylesheet(getLessRuleset()->getLessStylesheet()); // process mixin if (mixin.parse(*getTokens()) && mixin.insert(*r.getStylesheet(), *getLessRuleset()->getContext(), &r, getLessRuleset())) { } else { declaration = r.createDeclaration(); if (processDeclaration(declaration)) { #ifdef WITH_LIBGLOG VLOG(2) << "Declaration: " << declaration->getProperty() << ": " << declaration->getValue().toString(); #endif getLessRuleset()->getContext()->processValue(declaration->getValue()); #ifdef WITH_LIBGLOG VLOG(2) << "Processed declaration: " << declaration->getProperty() << ": " << declaration->getValue().toString(); #endif } else { r.deleteDeclaration(*declaration); throw new ParseException(getTokens()->toString(), "variable, mixin or declaration.", getTokens()->front().line, getTokens()->front().column, getTokens()->front().source); } } #ifdef WITH_LIBGLOG VLOG(3) << "Statement done"; #endif }
void MetaBlock::parseLuaSection(xmlNodePtr node, std::auto_ptr<Block> &block) { Extension *ext = ExtensionList::instance()->extension(node, false); if (NULL == ext) { OperationMode::instance()->processError("Lua module is not loaded"); return; } block = ext->createBlock(owner(), node); assert(block.get()); block->parse(); }
void Slider::reallocate_thumb(const Allocation& a) { Patch& thumb = *impl_->thumb_patch_; Canvas* c = canvas(); c->push_transform(); c->transformer(transformer()); Extension ext; ext.clear(); thumb.allocate(c, a, ext); c->pop_transform(); thumb.redraw(); }
Variant f_phpversion(const String& extension /* = null_string */) { Extension *ext; if (!extension) { return k_PHP_VERSION; } if ((ext = Extension::GetExtension(extension)) != nullptr && strcmp(ext->getVersion(), NO_EXTENSION_VERSION_YET) != 0) { return ext->getVersion(); } return false; }
void Extension::square(Extension& ext) { this->a.add(ext.getA(), ext.getC()); this->a.multiply(this->a, this->a); this->b.add(ext.getB(), ext.getD()); this->b.multiply(this->b, this->b); this->a.add(this->a, this->b); this->c.multiply(ext.getC(), ext.getC()); this->d.multiply(ext.getD(), ext.getD()); this->d.add(this->d, this->c); /* Element m0, m1, m2, m3; m0.square(ext.getA()); m1.square(ext.getB()); m2.square(ext.getC()); m3.square(ext.getD()); this->a.add(m0, m1); this->a.add(this->a, m2); this->a.add(this->a, m3); this->b.add(m1, m3); this->c.set(m2); this->d.add(m2, m3); */ }
void Slider::drag(const Event& e) { SliderImpl& s = *impl_; if (!s.aborted_ && s.dragging_) { if (!s.showing_old_thumb_ && s.old_thumb_ != nil) { s.showing_old_thumb_ = true; Extension ext; ext.clear(); s.old_thumb_->allocate( canvas(), s.thumb_patch_->allocation(), ext ); } move_to(e.pointer_x() - s.xoffset_, e.pointer_y() - s.yoffset_); } }
int main(int argc, char * argv[]) { QApplication app(argc,argv); QFont f("ZYSong18030",12); QApplication::setFont(f); QTranslator translator; translator.load("extension_zh"); app.installTranslator(&translator); Extension ex; ex.show(); return app.exec(); }
static Variant HHVM_FUNCTION(phpversion, const String& extension /*="" */) { Extension *ext; if (extension.empty()) { return k_PHP_VERSION; } if ((ext = Extension::GetExtension(extension)) != nullptr && strcmp(ext->getVersion(), NO_EXTENSION_VERSION_YET) != 0) { return ext->getVersion(); } return false; }
Array f_hphp_get_extension_info(CStrRef name) { Array ret; Extension *ext = Extension::GetExtension(name); ret.set("name", name); ret.set("version", ext ? ext->getVersion() : ""); ret.set("info", ""); ret.set("ini", Array::Create()); ret.set("constants", Array::Create()); ret.set("functions", Array::Create()); ret.set("classes", Array::Create()); return ret; }
Array f_hphp_get_extension_info(CStrRef name) { Array ret; Extension *ext = Extension::GetExtension(name); ret.set(s_name, name); ret.set(s_version, ext ? ext->getVersion() : ""); ret.set(s_info, empty_string); ret.set(s_ini, Array::Create()); ret.set(s_constants, Array::Create()); ret.set(s_functions, Array::Create()); ret.set(s_classes, Array::Create()); return ret; }
void Box::print(Printer* p, const Allocation& allocation) const { BoxImpl* b = impl_; Extension ext; ext.clear(); AllocationInfo& info = b->info(p, allocation, ext); if (p->damaged(ext)) { Allocation* a = info.component_allocations(); GlyphIndex n = count(); for (GlyphIndex i = 0; i < n; i++) { Glyph* g = component(i); if (g != nil) { g->print(p, a[i]); } } } }
void Character::allocate(Canvas* c, const Allocation& a, Extension& ext) { Coord x = a.x(); Coord y = a.y(); ext.set_xy( c, x - left_bearing_, y - descent_, x + right_bearing_, y + ascent_ ); }
void Format::Integer::Traverse(std::basic_ifstream<Char> &from, Extension &ext) const { if(size == 1) { from.read((Char*)&ext.ByteValue, sizeof(ext.ByteValue)); ext.Runtime.GenerateEvent(Extension::Trigger::Load::Byte); } else if(size == 2) { from.read((Char*)&ext.ShortValue, sizeof(ext.ShortValue)/sizeof(Char)); ext.Runtime.GenerateEvent(Extension::Trigger::Load::Short); } else if(size == 4) { from.read((Char*)&ext.IntValue, sizeof(ext.IntValue)/sizeof(Char)); ext.Runtime.GenerateEvent(Extension::Trigger::Load::Int); } else if(size == 8) { from.read((Char*)&ext.LongValue, sizeof(ext.LongValue)/sizeof(Char)); ext.Runtime.GenerateEvent(Extension::Trigger::Load::Long); } else { ext.GenerateError(_T("Unkown Size; not Byte, Short, Int, or Long")); } }
void Extension::LoadModules(Hdf hdf) { // Load up any dynamic extensions std::string path = hdf["DynamicExtensionPath"].getString("."); for (Hdf ext = hdf["DynamicExtensions"].firstChild(); ext.exists(); ext = ext.next()) { std::string extLoc = ext.getString(); if (extLoc.empty()) { continue; } if (extLoc[0] != '/') { extLoc = path + "/" + extLoc; } // Extensions are self-registering, // so we bring in the SO then // throw away its handle. void *ptr = dlopen(extLoc.c_str()); if (!ptr) { throw Exception("Could not open extension %s: %s", extLoc.c_str(), dlerror()); } auto getModule = (Extension *(*)())dlsym(ptr, "getModule"); if (!getModule) { throw Exception("Could not load extension %s: %s (%s)", extLoc.c_str(), "getModule() symbol not defined.", dlerror()); } Extension *mod = getModule(); if (mod->m_hhvmAPIVersion != HHVM_API_VERSION) { throw Exception("Could not use extension %s: " "Compiled with HHVM API Version %" PRId64 ", " "this version of HHVM expects %ld", extLoc.c_str(), mod->m_hhvmAPIVersion, HHVM_API_VERSION); } mod->setDSOName(extLoc); } // Invoke Extension::moduleLoad() callbacks assert(s_registered_extensions); for (ExtensionMap::const_iterator iter = s_registered_extensions->begin(); iter != s_registered_extensions->end(); ++iter) { iter->second->moduleLoad(hdf); } }
void DebugGlyph::draw(Canvas* c, const Allocation& a) const { if ((flags_ & trace_draw) != 0) { heading("draw "); print_allotment(a.allotment(Dimension_X)); printf(", "); print_allotment(a.allotment(Dimension_Y)); if (c != nil) { Extension e; c->damage_area(e); printf( " [%.2f,%.2f %.2f,%.2f]", e.left(), e.bottom(), e.right(), e.top() ); } printf("\n"); } MonoGlyph::draw(c, a); }
void Deck::allocate(Canvas* c, const Allocation& a, Extension& ext) { allocation_ = a; if (card_ >= 0 && card_ < count()) { Glyph* g = component(card_); if (g != nil) { g->allocate(c, a, ext); } ext.merge(c, a); } }
void Slider::drag(const Event& e) { SliderImpl& s = *impl_; if (!s.aborted_ && s.dragging_) { if (!s.showing_old_thumb_ && s.old_thumb_ != nil) { s.showing_old_thumb_ = true; Patch* p = s.thumb_patch_; Canvas* c = canvas(); c->push_transform(); c->transformer(transformer()); Extension ext; ext.clear(); s.old_thumb_->allocate(c, p->allocation(), ext); c->pop_transform(); } Coord x, y; s.get_position(this, e, x, y); move_to(x - s.xoffset_, y - s.yoffset_); } }
void Box::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if (h.right() >= a.left() && h.left() < a.right() && h.top() >= a.bottom() && h.bottom() < a.top() ) { BoxImpl* b = impl_; Extension ext; ext.clear(); AllocationInfo& info = b->info(c, a, ext); Allocation* aa = info.component_allocations(); GlyphIndex n = count(); for (GlyphIndex i = 0; i < n; i++) { Glyph* g = component(i); if (g != nil) { h.begin(depth, this, i); g->pick(c, aa[i], depth + 1, h); h.end(); } } } }
void BoxImpl::offset_allocate(AllocationInfo& info, Coord dx, Coord dy) { Canvas* c = info.canvas(); Allocation* a = info.component_allocations(); Extension& box = info.extension(); Extension child; GlyphIndex n = box_->count(); for (GlyphIndex i = 0; i < n; i++) { Glyph* g = box_->component(i); if (g != nil) { Allocation& a_i = a[i]; Allotment& ax = a_i.x_allotment(); Allotment& ay = a_i.y_allotment(); ax.offset(dx); ay.offset(dy); child.clear(); g->allocate(c, a_i, child); box.merge(child); } } }
void Graphic31::allocate(Canvas* c, const Allocation& a, Extension& ext) { if (_ctrlpts > 0) { Coord w = _brush == nil ? 0 : _brush->width(); Coord x = a.x(); Coord y = a.y(); ext.merge_xy( c, x + _xmin - w, x + _xmax + w, y + _ymin - w, y + _ymax + w ); } }
int BXObject::GetExtensions(const TiXmlNode *pNode) { const TiXmlNode *pExtensionsTag = 0; while (pExtensionsTag = pNode->IterateChildren(pExtensionsTag)) { if(pExtensionsTag->ValueStr() == "extensions") { const TiXmlNode *pExtensionTag = 0; while (pExtensionTag = pExtensionsTag->IterateChildren(pExtensionTag)) { if(pExtensionTag->ValueStr() == "extension") { Extension* extension = new Extension(); const char* provider = ((TiXmlElement*)pExtensionTag)->Attribute("provider"); if(provider) { extension->AddToMap("provider",provider); } const TiXmlNode *pChild = 0; while (pChild = pExtensionTag->IterateChildren(pChild)) { const TiXmlNode *pValue = pChild->FirstChild(); if ( pValue && pValue->Type() == TiXmlNode::TEXT) { extension->AddToMap(pChild->ValueStr(),pValue->ValueStr()); } } m_extensions.push_back(extension); } } break; // There won't be another <extensions> tags } } return m_extensions.size(); }