本文整理汇总了C++中IOOptions::addOption方法的典型用法代码示例。如果您正苦于以下问题:C++ IOOptions::addOption方法的具体用法?C++ IOOptions::addOption怎么用?C++ IOOptions::addOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOOptions
的用法示例。
在下文中一共展示了IOOptions::addOption方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: merge
IOOptions PostgresqlFeatureConnector::merge(const IOOptions &first, const IOOptions &second) {
IOOptions result;
auto end = first.end();
for (auto it = first.begin(); it != end; ++it)
{
result.addOption( it.key(), it.value());
}
end = second.end();
for (auto it = second.begin(); it != end; ++it)
{
result.addOption( it.key(), it.value());
}
return result;
}
示例2: connectTo
void IlwisObject::connectTo(const QUrl& outurl, const QString& format, const QString& fnamespace, ConnectorMode cmode, const IOOptions& options) {
Locker<> lock(_mutex);
if ( (!(cmode == cmOUTPUT)) && isReadOnly())
return throw ErrorObject(TR(QString("format %1 or data object is readonly").arg(format)));
QUrl url(outurl);
if (!url.isValid()){
url = resource(cmode).url(true);
if ( !url.isValid()){
ERROR2(ERR_ILLEGAL_VALUE_2, "Url","");
throw ErrorObject(TR(QString("illegal url %1 for format %2").arg(url.toString()).arg(format)));
}
}
Resource res = resource();
if ( !res.isValid()) {
res = Resource(url,ilwisType(), false);
res.setId(id());
}
if ( url != QUrl()) {
QString currenturl = res.url().toString();
// we dont replace the normalized urls for internal objects if the url is pointing to the (disk based) cache
if ( !(currenturl.indexOf(INTERNAL_CATALOG) == 0 && !outurl.isValid())){
res.setUrl(url);
}
if ( url.scheme() != "ilwis") // raw urls can never go to an ilwis scheme
res.setUrl(url,true);
else {
// if we are going to the internalcatalog ensure that the physical path is good
if ( url.toString().indexOf(INTERNAL_CATALOG) == 0){
QString rawUrl = context()->persistentInternalCatalog().toString() + "/" + res.name();
res.setUrl(rawUrl, true);
}
}
}
const Ilwis::ConnectorFactory *factory = kernel()->factory<Ilwis::ConnectorFactory>("ilwis::ConnectorFactory");
if ( !factory)
throw ErrorObject(TR(QString("couldnt find factory for %1").arg(format)));
IOOptions opt = options;
opt.addOption("format", format);
Ilwis::ConnectorInterface *conn = factory->createFromFormat(res, format,fnamespace,opt);
if (!conn){
throw ErrorObject(TR(QString("couldnt connect to %1 datasource for %2").arg(format).arg(url.toString())));
}
setConnector(conn, cmode, options);
}
示例3: connectTo
void IlwisObject::connectTo(const QUrl& outurl, const QString& format, const QString& fnamespace, ConnectorMode cmode, const IOOptions& options) {
Locker<> lock(_mutex);
if ( isReadOnly())
return throw ErrorObject(TR(QString("format %1 or data object is readonly").arg(format)));
QUrl url(outurl);
if (!url.isValid()){
url = source(cmode).url(true);
if ( !url.isValid()){
ERROR2(ERR_ILLEGAL_VALUE_2, "Url","");
throw ErrorObject(TR(QString("illegal url %1 for format %2").arg(url.toString()).arg(format)));
}
}
Resource resource;
resource = mastercatalog()->id2Resource(id());
if ( !resource.isValid()) {
resource = Resource(url,ilwisType(), false);
resource.setId(id());
}
if ( url != QUrl()) {
QString currenturl = resource.url().toString();
// we dont replace the normalized urls for internal objects if the url is pointing to the (disk based) cache
if ( !(currenturl.indexOf("ilwis://internalcatalog") == 0 && !outurl.isValid()))
resource.setUrl(url);
resource.setUrl(url,true);
}
const Ilwis::ConnectorFactory *factory = kernel()->factory<Ilwis::ConnectorFactory>("ilwis::ConnectorFactory");
if ( !factory)
throw ErrorObject(TR(QString("couldnt find factory for %1").arg(format)));
IOOptions opt = options;
opt.addOption("format", format);
Ilwis::ConnectorInterface *conn = factory->createFromFormat(resource, format,fnamespace,opt);
if (!conn){
throw ErrorObject(TR(QString("couldnt connect to %1 datasource for %2").arg(format).arg(url.toString())));
}
setConnector(conn, cmode, options);
if ( Identity::name() == sUNDEF)
name(resource.name());
}