ExtendedPhoto::ExtendedPhoto(LoggingFacility& logs, const Cameras& cameras, const String& filename) : logs(logs), pOriginalPath(filename), pPathInformations(new PathInformations(logs, cameras)), pStatus(epFine), pCameras(cameras) { // It is assumed files passed in parameters truly exists // (check should occur before call to the class) #ifndef NDEBUG if (!IO::Exists(filename)) { logs.error() << "Photo " << filename << " doesn't exist"; assert(false); } #endif // NDEBUG try { pImage = Exiv2::ImageFactory::open(filename.c_str()); assert(pImage.get() != 0); pImage->readMetadata(); if (!identifyPhotographer()) logs.warning() << "Photographer not identified for photo " << filename; if (!extractDate()) pStatus = epExiv2Problem; } catch (const std::exception& e) { // I do not use exception myself, so any exception stems from exiv2 logs.error() << "Exception caught for photo " << filename << ": " << e.what(); pStatus = epExiv2Problem; } }
// ------------------------------------------------------------------------- // ADate Class setDate // ------------------------------------------------------------------------- ADate& ADate :: setDate(const IString theDate) { extractDate(theDate); return *this; };
bool DbNote::selectNotes(string where = "") { sqlite3_stmt *statement; string all = ""; string s = ""; string sqlStmnt = "select NoteKey, date, NoteText, NoteTitle, " "KatKey, NoteRef from NoteTable "; if ((where.length() > 0)) { sqlStmnt += where; } if (!openDB()) { throw SQLError("Can't open the DB-Connection"); return false; } int req = sqlite3_prepare_v2(db, sqlStmnt.c_str(), sqlStmnt.length(), &statement, 0); if (req == SQLITE_ERROR) { throw SQLError("Can't select data of the given table"); return false; } sqlite3_column_count(statement); char * str_time = NULL; int i = 0; do { req = sqlite3_step(statement); Note n = Note(); if (req == SQLITE_ROW) { n.setNoteKey((int) sqlite3_column_int(statement, 0)); str_time = (char *) sqlite3_column_text(statement, 1); if (str_time != NULL) { Date d = extractDate(str_time); n.setDate(d); } else { n.setDate(Date(0, 0, 0, 0, 0)); } char * str = (char *) sqlite3_column_text(statement, 2); if (str != NULL) n.setNoteText((char *) sqlite3_column_text(statement, 2)); str = (char *) sqlite3_column_text(statement, 3); if (str != NULL) n.setNoteTitle((char *) sqlite3_column_text(statement, 3)); n.setKatKey((int) sqlite3_column_int(statement, 4)); n.setNoteRef((int) sqlite3_column_int(statement, 5)); str_time = NULL; notes.push_back(n); } i++; } while (req == SQLITE_ROW); sqlite3_finalize(statement); sqlite3_close(db); return true; }
// ------------------------------------------------------------------------- // ADate Class // ------------------------------------------------------------------------- ADate :: ADate(const IString theDate) { extractDate(theDate); };