Changeset 8337


Ignore:
Timestamp:
2004-10-14T22:36:44+13:00 (20 years ago)
Author:
cs025
Message:

Fixed problem with a '.' in a collection name; now '.' and ':' are
switched to cope with OAI mapping without inconsistencies and poor
mappings...

Location:
trunk/gsdl/src/oaiservr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/oaiservr/oaitools.cpp

    r8219 r8337  
    44
    55#include "OIDtools.h"
     6
     7void oaiclassifier::swapColonsAndPeriods(text_t &classifier)
     8{
     9  for (int i = 1; i <= classifier.size(); i ++) {
     10    if (classifier[i] == '.') {
     11      classifier[i] = ':';
     12    }
     13    else if (classifier[i] == ':') {
     14      classifier[i] = '.';
     15    }
     16  }
     17
     18}
    619
    720text_t oaiclassifier::getGSDL_OID(const text_t &collection, const text_t& oai_id,
     
    3548void oaiclassifier::toOAI(const text_t &collection, text_t &classifier)
    3649{
    37   for (int i = 1; i <= classifier.size(); i ++) {
    38     if (classifier[i] == '.') {
    39       classifier[i] = ':';
    40     }
    41   }
     50  oaiclassifier::swapColonsAndPeriods(classifier);
    4251
    4352  // prepend the collection identifier to the beginning of the
     
    5766void oaiclassifier::toGSDL(text_t &collection, text_t &classifier)
    5867{
    59   for (int i = 1; i <= classifier.size(); i ++) {
    60     if (classifier[i] == ':') {
    61       classifier[i] = '.';
    62     }
    63   }
     68  oaiclassifier::swapColonsAndPeriods(classifier);
    6469
    6570  // separate out the collection identifier that should be
  • trunk/gsdl/src/oaiservr/oaitools.h

    r8182 r8337  
     1
    12#ifndef _OAITOOLS_H_
    23#define _OAITOOLS_H_
     
    1213  static void   toOAI(const text_t &collection, text_t &classifier);
    1314  static void   toGSDL(text_t &collection, text_t &classifier);
     15 private:
     16  static void   swapColonsAndPeriods(text_t &classifier);
    1417};
    1518#endif
Note: See TracChangeset for help on using the changeset viewer.