void FoxPro::load(SeekableReadStream *dbf, SeekableReadStream *cdx, SeekableReadStream *fpt) { assert(dbf); // Read header uint32 recordSize, recordCount, firstRecordPos; loadHeader(*dbf, recordSize, recordCount, firstRecordPos); if (_hasIndex && !cdx) throw Exception("Index needed"); if (_hasMemo && !fpt) throw Exception("Memo needed"); // Read fields loadFields(*dbf, recordSize); if (_hasMemo && !fpt) throw Exception("Memo needed"); // Read records dbf->seek(firstRecordPos); loadRecords(*dbf, recordSize, recordCount); // Read memos if (fpt) loadMemos(*fpt); // TODO: Read the compound index (CDX) file }
void JPClass::postLoad() { // Is this an interface? m_IsInterface = JPJni::isInterface(m_Class); loadSuperClass(); loadSuperInterfaces(); loadFields(); loadMethods(); loadConstructors(); }
int movie(char *command, const char *frameFile) { int failed = TRUE; double step; LINEBUF frameData[1]; register int j; static const char noDataMsg[] = "/** Data file does not define any fields **/"; if (*command == 'R' || *command == 'D' || *command == 'I') { loadData(infile); if (npnts < 1) return TRUE; step = (qmax - qmin) / (double) (npnts - 1); for (j = 0; j < npnts; j++) xtemp[j] = (double) j * step + qmin; if (extend(xtemp, npnts, lambda, lamdel, thedel) == NULL) return TRUE; } if (openBuf(frameFile, "r", frameData, FBUFFLEN) == NULL) noFile(frameFile); else { int frames; long headerOffset; frames = countData(frameData); headerOffset = locateHeader(frameData); if (headerOffset == -1) puts(noDataMsg); else { int numFields; setNextLine(frameData, headerOffset); getNextLine(frameData); numFields = loadFields(frameData, frameData->buffer+1); if (numFields == 0) puts(noDataMsg); else if (numFields > 0) { FILE *gnuPipe; genva(fields, 1, fitlist); gnuPipe = popen("gnuplot", "w"); if (gnuPipe != NULL) { failed = runMovie(npnts, frames, numFields, frameData, gnuPipe, command); pclose(gnuPipe); } } } closeBuf(frameData, 0); } return failed; }
int movie(char *command, int xspin[4], const char *frameFile) { int failed = TRUE; LINEBUF frameData[1]; static const char noDataMsg[] = "/** Data file does not define any fields **/"; /* Determine reflectivities to print */ setPspin(pspin, xspin, command + 1); if ((*command == 'R' || *command == 'D' || *command == 'I') && ( loadData(infile, xspin) || extend(q4x, n4x, lambda, lamdel, thedel) == NULL ) ) return TRUE; if (openBuf(frameFile, "r", frameData, FBUFFLEN) == NULL) noFile(frameFile); else { int frames; long headerOffset; frames = countData(frameData); headerOffset = locateHeader(frameData); if (headerOffset == -1) puts(noDataMsg); else { int numFields; setNextLine(frameData, headerOffset); getNextLine(frameData); numFields = loadFields(frameData, frameData->buffer + 1); if (numFields == 0) puts(noDataMsg); else if (numFields > 0) { FILE *gnuPipe; genva(fields, 1, fitlist); gnuPipe = popen("gnuplot", "w"); if (gnuPipe != NULL) { failed = runMovie(frames, numFields, frameData, gnuPipe, command); pclose(gnuPipe); } } } closeBuf(frameData, 0); } return failed; }
void MucConfigurator::parse() { QList<ConfigField> fields=loadFields(); for (QList<ConfigField>::iterator it=fields.begin(); it!=fields.end(); ++it) { ConfigField field=*it; if (field.name()=="alists_members") applyAlistsToMembers_=field.boolValue(); if (field.name()=="alists_every_presence") checkAlistsEveryPresence_=field.boolValue(); if (field.name()=="devoice_no_vcard") devoiceNoVCard_=field.boolValue(); if (field.name()=="devoice_no_vcard_reason") devoiceNoVCardReason_=field.value(); if (field.name()=="query_version_on_join") queryVersionOnJoin_=field.boolValue(); if (field.name()=="query_version_timeout") queryVersionTimeout_=field.value().toInt(); } }
ApplicationView::ApplicationView(utils::attributes const & attrs, std::string const & name) : Gtk::VBox () , PROXY_TYPE ("proxy") , TEXT_TYPE ("text") , AUTH_TYPE ("auth") , myPluginName(name) { utils::plugins_t plugins; utils::list_plugins(utils::search_pathes(), plugins); utils::plugins_t::const_iterator it = plugins.find(myPluginName); if ( it != plugins.end() ) { std::string fieldsFileName(it->second + "/" + utils::FIELDS_FILE); std::ifstream input( fieldsFileName.c_str() ); if ( input.is_open() ) { utils::IniData data; input >> data; for (utils::IniData::const_iterator iit = data.begin(); iit != data.end(); ++iit) if ( iit->first == "fields" ) loadFields(attrs, iit->second); input.close(); }
QgsMssqlProvider::QgsMssqlProvider( QString uri ) : QgsVectorDataProvider( uri ) , mCrs() , mWkbType( QGis::WKBUnknown ) { QgsDataSourceURI anUri = QgsDataSourceURI( uri ); if ( !anUri.srid().isEmpty() ) mSRId = anUri.srid().toInt(); else mSRId = -1; mWkbType = anUri.wkbType(); mValid = true; mUseWkb = false; mSkipFailures = false; mUseEstimatedMetadata = anUri.useEstimatedMetadata(); mSqlWhereClause = anUri.sql(); mDatabase = GetDatabase( anUri.service(), anUri.host(), anUri.database(), anUri.username(), anUri.password() ); if ( !OpenDatabase( mDatabase ) ) { setLastError( mDatabase.lastError( ).text( ) ); mValid = false; return; } // Create a query for default connection mQuery = QSqlQuery( mDatabase ); // Database successfully opened; we can now issue SQL commands. if ( !anUri.schema().isEmpty() ) mSchemaName = anUri.schema(); else mSchemaName = "dbo"; if ( !anUri.table().isEmpty() ) { // the layer name has been specified mTableName = anUri.table(); QStringList sl = mTableName.split( '.' ); if ( sl.length() == 2 ) { mSchemaName = sl[0]; mTableName = sl[1]; } mTables = QStringList( mTableName ); } else { // Get a list of table mTables = mDatabase.tables( QSql::Tables ); if ( mTables.count() > 0 ) mTableName = mTables[0]; else mValid = false; } if ( mValid ) { if ( !anUri.keyColumn().isEmpty() ) mFidColName = anUri.keyColumn(); if ( !anUri.geometryColumn().isEmpty() ) mGeometryColName = anUri.geometryColumn(); if ( mSRId < 0 || mWkbType == QGis::WKBUnknown || mGeometryColName.isEmpty() ) loadMetadata(); loadFields(); UpdateStatistics( mUseEstimatedMetadata ); if ( mGeometryColName.isEmpty() ) { // table contains no geometries mWkbType = QGis::WKBNoGeometry; mSRId = 0; } } //fill type names into sets mNativeTypes // integer types << QgsVectorDataProvider::NativeType( tr( "8 Bytes integer" ), "bigint", QVariant::Int ) << QgsVectorDataProvider::NativeType( tr( "4 Bytes integer" ), "int", QVariant::Int ) << QgsVectorDataProvider::NativeType( tr( "2 Bytes integer" ), "smallint", QVariant::Int ) << QgsVectorDataProvider::NativeType( tr( "1 Bytes integer" ), "tinyint", QVariant::Int ) << QgsVectorDataProvider::NativeType( tr( "Decimal number (numeric)" ), "numeric", QVariant::Double, 1, 20, 0, 20 ) << QgsVectorDataProvider::NativeType( tr( "Decimal number (decimal)" ), "decimal", QVariant::Double, 1, 20, 0, 20 ) // floating point << QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), "real", QVariant::Double ) << QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), "float", QVariant::Double ) // string types << QgsVectorDataProvider::NativeType( tr( "Text, fixed length (char)" ), "char", QVariant::String, 1, 255 ) << QgsVectorDataProvider::NativeType( tr( "Text, limited variable length (varchar)" ), "varchar", QVariant::String, 1, 255 ) << QgsVectorDataProvider::NativeType( tr( "Text, fixed length unicode (nchar)" ), "nchar", QVariant::String, 1, 255 ) << QgsVectorDataProvider::NativeType( tr( "Text, limited variable length unicode (nvarchar)" ), "nvarchar", QVariant::String, 1, 255 ) << QgsVectorDataProvider::NativeType( tr( "Text, unlimited length (text)" ), "text", QVariant::String ) << QgsVectorDataProvider::NativeType( tr( "Text, unlimited length unicode (ntext)" ), "text", QVariant::String ) ; }
int ClassFile::loadClass(std::string classFileName) { std::ifstream file; int length; char * p; file.open(classFileName.c_str()); if(file.is_open()) { file.seekg(0,std::ios::end); length = file.tellg(); file.seekg(0, std::ios::beg); p = new char[length]; file.read(p, length); file.close(); } else { std::cout << "File (" << classFileName << ") load failed!" << std::endl; throw 25; } magic = getu4(p); p += 4; if(magic != 0xCAFEBABE) { std::cout << "Magic constant is not right!:" << std::endl; return 1; } minor_version = getu2(p); p += 2; major_version = getu2(p); p += 2; constant_pool_count = getu2(p); p += 2; if(constant_pool_count > 0) { loadConstants(p); } access_flags = getu2(p); p += 2; this_class = getu2(p); p += 2; super_class = getu2(p); p += 2; interfaces_count = getu2(p); p += 2; if(interfaces_count > 0) { loadInterfaces(p); } fields_count = getu2(p); p += 2; if(fields_count > 0) { loadFields(p); } methods_count = getu2(p); p += 2; if(methods_count > 0) { loadMethods(p); } attributes_count = getu2(p); p += 2; if(attributes_count > 0) { loadAttributes(p); } return 0; }
QgsDb2Provider::QgsDb2Provider( QString uri ) : QgsVectorDataProvider( uri ) , mNumberFeatures( 0 ) , mEnvironment( ENV_LUW ) , mWkbType( QgsWkbTypes::Unknown ) { QgsDebugMsg( "uri: " + uri ); QgsDataSourceUri anUri = QgsDataSourceUri( uri ); if ( !anUri.srid().isEmpty() ) mSRId = anUri.srid().toInt(); else mSRId = -1; if ( 0 != anUri.wkbType() ) { mWkbType = anUri.wkbType(); } QgsDebugMsg( QString( "mWkbType: %1" ).arg( mWkbType ) ); QgsDebugMsg( QString( "new mWkbType: %1" ).arg( anUri.wkbType() ) ); mValid = true; mSkipFailures = false; int dim; // Not used db2WkbTypeAndDimension( mWkbType, mGeometryColType, dim ); // Get DB2 geometry type name mFidColName = anUri.keyColumn().toUpper(); QgsDebugMsg( "mFidColName " + mFidColName ); mExtents = anUri.param( "extents" ); QgsDebugMsg( "mExtents " + mExtents ); mUseEstimatedMetadata = anUri.useEstimatedMetadata(); QgsDebugMsg( QString( "mUseEstimatedMetadata: '%1'" ).arg( mUseEstimatedMetadata ) ); mSqlWhereClause = anUri.sql(); QString errMsg; mDatabase = getDatabase( uri, errMsg ); mConnInfo = anUri.connectionInfo(); QgsCoordinateReferenceSystem layerCrs = crs(); QgsDebugMsg( "CRS: " + layerCrs.toWkt() ); if ( !errMsg.isEmpty() ) { setLastError( errMsg ); QgsDebugMsg( mLastError ); mValid = false; return; } // Create a query for default connection mQuery = QSqlQuery( mDatabase ); mSchemaName = anUri.schema(); mTableName = anUri.table().toUpper(); QStringList sl = mTableName.split( '.' ); if ( sl.length() == 2 ) // Never seems to be the case { mSchemaName = sl[0]; mTableName = sl[1]; } if ( mSchemaName.isEmpty() ) { mSchemaName = anUri.username().toUpper(); } QgsDebugMsg( "mSchemaName: '" + mSchemaName + "; mTableName: '" + mTableName ); if ( !anUri.geometryColumn().isEmpty() ) mGeometryColName = anUri.geometryColumn().toUpper(); loadFields(); updateStatistics(); if ( mGeometryColName.isEmpty() ) { // table contains no geometries mWkbType = QgsWkbTypes::NoGeometry; mSRId = 0; } //fill type names into sets mNativeTypes // integer types << QgsVectorDataProvider::NativeType( tr( "8 Bytes integer" ), "bigint", QVariant::Int ) << QgsVectorDataProvider::NativeType( tr( "4 Bytes integer" ), "integer", QVariant::Int ) << QgsVectorDataProvider::NativeType( tr( "2 Bytes integer" ), "smallint", QVariant::Int ) << QgsVectorDataProvider::NativeType( tr( "Decimal number (numeric)" ), "numeric", QVariant::Double, 1, 31, 0, 31 ) << QgsVectorDataProvider::NativeType( tr( "Decimal number (decimal)" ), "decimal", QVariant::Double, 1, 31, 0, 31 ) // floating point << QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), "real", QVariant::Double ) << QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), "double", QVariant::Double ) // date/time types << QgsVectorDataProvider::NativeType( tr( "Date" ), "date", QVariant::Date, -1, -1, -1, -1 ) << QgsVectorDataProvider::NativeType( tr( "Time" ), "time", QVariant::Time, -1, -1, -1, -1 ) << QgsVectorDataProvider::NativeType( tr( "Date & Time" ), "datetime", QVariant::DateTime, -1, -1, -1, -1 ) // string types << QgsVectorDataProvider::NativeType( tr( "Text, fixed length (char)" ), "char", QVariant::String, 1, 254 ) << QgsVectorDataProvider::NativeType( tr( "Text, variable length (varchar)" ), "varchar", QVariant::String, 1, 32704 ) << QgsVectorDataProvider::NativeType( tr( "Text, variable length large object (clob)" ), "clob", QVariant::String, 1, 2147483647 ) //DBCLOB is for 1073741824 double-byte characters, data length should be the same as CLOB (2147483647)? << QgsVectorDataProvider::NativeType( tr( "Text, variable length large object (dbclob)" ), "dbclob", QVariant::String, 1, 1073741824 ) ; }
void cacheConfigWidget::resetClicked() { loadFields() ; }
cacheConfigWidget::cacheConfigWidget(eewsadmObject *argEews) : eewsadm(argEews) { setupUi(this) ; loadFields() ; }
void databaseConfigWidget::resetClicked() { loadFields() ; }