From f04303157dd3dab51b7d214d9caa152d7ffed9b4 Mon Sep 17 00:00:00 2001 From: Ralph Marschall Date: Mon, 12 Nov 2018 09:56:30 +0100 Subject: [PATCH] Refactor AmdSec struct name to AmdSecMix --- common_files/struct.h | 4 ++-- project/Project.vcproj | 2 +- project/metsparser.cpp | 16 ++++++++-------- project/metsparser.h | 6 +++--- project/sql.cpp | 4 ++-- project/verifycutouts.cpp | 4 ++-- project/verifyidentifierinmix.cpp | 6 +++--- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/common_files/struct.h b/common_files/struct.h index 7d13aa2..edf49c8 100644 --- a/common_files/struct.h +++ b/common_files/struct.h @@ -50,7 +50,7 @@ struct File_Group : public dataitem }; //! structure of an amdsec -struct AmdSec : public dataitem +struct AmdSecMix : public dataitem { static const size_t DATAITEM_ID =7; std::string amdSecId; @@ -58,7 +58,7 @@ struct AmdSec : public dataitem int dpi; }; -// TODO: Refactor AmdSec to AmdSecMix and add AmdSecOdrl. Break the code and compile. +// TODO: [Refactor AmdSec to AmdSecMix] (OK) and add AmdSecOdrl. Break the code and compile. //! structure of a block type struct typeBlock diff --git a/project/Project.vcproj b/project/Project.vcproj index 2c32012..4485f4b 100644 --- a/project/Project.vcproj +++ b/project/Project.vcproj @@ -1,7 +1,7 @@ set(CTX.amdsec.amdSecId,CTX.amdsec); // TODO: Should this be moved to RootGeneralAmdSecState.endElement ?? + //CTX.dfMets->set(CTX.amdSecMix.amdSecId,CTX.amdSecMix); // TODO: Should this be moved to RootGeneralAmdSecState.endElement ?? if ( CTX.flagMix ) { if ( CTX.mandatoryField.size() != 0 ) { @@ -249,14 +249,14 @@ class StateParserGeneralAmdSecState : public StateParserRootGeneralAmdSecState { virtual void startElement (const char* const name, const xercesc::Attributes &atts ) { const char *attribute_id = getAttributeValue("ID", atts); if (attribute_id != 0) { - CTX.amdsec.amdSecId = attribute_id; + CTX.amdSecMix.amdSecId = attribute_id; } //std::cout << "StateParserGeneralAmdSecState: START ELEMENT : " << attribute_id << std::endl; }; virtual void endElement (const char* const name) { - CTX.dfMets->set(CTX.amdsec.amdSecId,CTX.amdsec); + CTX.dfMets->set(CTX.amdSecMix.amdSecId,CTX.amdSecMix); //std::cout << "StateParserGeneralAmdSecState: END ELEMENT" << std::endl; diff --git a/project/metsparser.h b/project/metsparser.h index 768008b..936eaca 100644 --- a/project/metsparser.h +++ b/project/metsparser.h @@ -34,13 +34,13 @@ public : Type_File f; File_Group file_group; - // dmd + // dmdSec std::string idItem; std::string addStringData; dmdsec dmdSecStruct; - // amdsec - AmdSec amdsec; + // amdSec + AmdSecMix amdSecMix; // TODO: Use kind of Enum // Possible values: MIX, ODRL diff --git a/project/sql.cpp b/project/sql.cpp index 415071e..6551516 100644 --- a/project/sql.cpp +++ b/project/sql.cpp @@ -392,7 +392,7 @@ void database::insertLinkedFiles(int id_mets,datafactory *df) sqlite3_stmt *pStmt = 0; datafactory_set dftypefile = df->get_set(); - datafactory_set dfamdsec = df->get_set(); + datafactory_set dfamdsec = df->get_set(); const char *sql = "INSERT INTO LINKEDFILES ('ID_METS', 'TYPE', 'GROUPID', 'CHECKSUM','SIZE','FILENAME','FILEID','DPI') VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; if (sqlite3_prepare_v2(db, sql, -1, &pStmt, &zErrMsg) == SQLITE_OK) { @@ -404,7 +404,7 @@ void database::insertLinkedFiles(int id_mets,datafactory *df) int dpi =0; if (it.key() == "IMGGRP") { - AmdSec *s = df->get(tf.admid); // get the dpi of image + AmdSecMix *s = df->get(tf.admid); // get the dpi of image if ( s!= NULL) { dpi = s->dpi; }else{ diff --git a/project/verifycutouts.cpp b/project/verifycutouts.cpp index 291a485..38961d3 100644 --- a/project/verifycutouts.cpp +++ b/project/verifycutouts.cpp @@ -4,9 +4,9 @@ void verifycutouts(datafactory *df, errorHandler *h, std::string &fileName) { bool foundOne = false; h->begin("Verify: cut-out references in mix"); - datafactory_set dfAmdSec = df->get_set(); + datafactory_set dfAmdSec = df->get_set(); datafactory_set dfFileGrp = df->get_set(); - for (datafactory_set::iterator it = dfAmdSec.begin(); it != dfAmdSec.end(); ++it) { + for (datafactory_set::iterator it = dfAmdSec.begin(); it != dfAmdSec.end(); ++it) { if (it->sourceData.length()) { // Look for the identifier in the fileGrp foundOne = false; diff --git a/project/verifyidentifierinmix.cpp b/project/verifyidentifierinmix.cpp index 0f9aab8..1efc4b6 100644 --- a/project/verifyidentifierinmix.cpp +++ b/project/verifyidentifierinmix.cpp @@ -10,10 +10,10 @@ verifyidentifierinmix::verifyidentifierinmix(datafactory *dfverifiers,errorHandl fg = dfverifiers->get("IMGGRP"); for(size_t j=0;j< fg->vect.size();j++) { - AmdSec *amdsec = dfverifiers->get(fg->vect[j].admid); - if (amdsec ==0) + AmdSecMix *amdSecMix = dfverifiers->get(fg->vect[j].admid); + if (amdSecMix ==0) { - hError->getError(cat_amdsecID,"METS","MIX",fg->vect[j].admid,fileName,"getError(cat_amdsecID,"METS","MIX",fg->vect[j].admid,fileName,"