Changeset 650


Ignore:
Timestamp:
1999-10-10T21:20:37+13:00 (25 years ago)
Author:
sjboddie
Message:
  • metadata now returns map rather than array
  • redesigned browsing support (although it's not finished so

won't currently work ;-)

Location:
trunk/gsdl/src/colservr
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/colservr/collectserver.cpp

    r534 r650  
    2929/*
    3030   $Log$
     31   Revision 1.16  1999/10/10 08:20:35  sjboddie
     32   - metadata now returns map rather than array
     33   - redesigned browsing support (although it's not finished so
     34   won't currently work ;-)
     35
    3136   Revision 1.15  1999/09/07 04:57:20  sjboddie
    3237   added gpl notice
  • trunk/gsdl/src/colservr/mggdbmsource.cpp

    r534 r650  
    2828/*
    2929   $Log$
     30   Revision 1.16  1999/10/10 08:20:36  sjboddie
     31   - metadata now returns map rather than array
     32   - redesigned browsing support (although it's not finished so
     33   won't currently work ;-)
     34
    3035   Revision 1.15  1999/09/07 04:57:22  sjboddie
    3136   added gpl notice
     
    182187
    183188bool mggdbmsourceclass::get_metadata (const text_t &/*requestParams*/, const text_t &/*refParams*/,
    184                       bool getParents, const text_tarray &fields, const text_t &OID,
    185                       MetadataInfo_tarray &metadata, comerror_t &err, ostream &logout) {
     189                      bool getParents, const text_tset &fields,
     190                      const text_t &OID, MetadataInfo_tmap &metadata,
     191                      comerror_t &err, ostream &logout) {
    186192  outconvertclass text_t2ascii;
    187193
     
    233239  }
    234240
    235   // if fields array is empty we want to get all available metadata
    236   text_tarray tfields = fields;
     241  // if fields set is empty we want to get all available metadata
     242  text_tset tfields = fields;
    237243  if (tfields.empty() && !info_array.empty()) {
    238244    infodbclass::iterator t_info = info_array[0].begin();
     
    240246    while (t_info != e_info) {
    241247      if ((*t_info).first != "contains")
    242     tfields.push_back ((*t_info).first);
     248    tfields.insert ((*t_info).first);
    243249      t_info ++;
    244250    }
    245     tfields.push_back ("hasnext");
    246     tfields.push_back ("hasprevious");
     251    tfields.insert ("hasnext");
     252    tfields.insert ("hasprevious");
    247253  }
    248254   
     
    251257  bool hasnext=false, hasprevious=false;
    252258  MetadataInfo_t this_metadata;
    253   text_t *pos_metadata;
    254   text_tarray::const_iterator fields_here = tfields.begin();
    255   text_tarray::const_iterator fields_end = tfields.end();
     259  text_tarray *pos_metadata;
     260  text_tset::const_iterator fields_here = tfields.begin();
     261  text_tset::const_iterator fields_end = tfields.end();
    256262  while (fields_here != fields_end) {
    257263    this_metadata.clear();
    258264    this_metadata.isRef = false;
    259265
    260     vector<infodbclass>::iterator this_info = info_array.begin();
    261     vector<infodbclass>::iterator end_info = info_array.end();
    262 
     266    vector<infodbclass>::reverse_iterator this_info = info_array.rbegin();
     267    vector<infodbclass>::reverse_iterator end_info = info_array.rend();
     268    MetadataInfo_t *tmetaptr = &this_metadata;
    263269    while (this_info != end_info) {
    264270
    265       pos_metadata = (*this_info).getinfo(*fields_here);
     271      pos_metadata = (*this_info).getmultinfo(*fields_here);
    266272   
    267273      if ((*fields_here == "hasnext" || *fields_here == "hasprevious")) {
     
    279285          text_t &parentinfocontains = parentinfo["contains"];
    280286          if (!parentinfocontains.empty())
    281         splitchar (parentinfocontains.begin(), parentinfocontains.end(), ';', parentcontents);
     287        splitchar (parentinfocontains.begin(), parentinfocontains.end(),
     288               ';', parentcontents);
    282289        }
    283290      }
     
    306313   
    307314    // fill in metadata
    308     this_metadata.name = *fields_here;
    309315    if ((*fields_here == "hasnext" && hasnext) ||
    310316        (*fields_here == "hasprevious" && hasprevious))
    311       this_metadata.values.push_back("1");
     317      tmetaptr->values.push_back("1");
    312318    else
    313       this_metadata.values.push_back("0");
     319      tmetaptr->values.push_back("0");
    314320   
    315321      }
    316       else if (pos_metadata != NULL && *fields_here != "contains") {
    317     this_metadata.name = *fields_here;
    318     this_metadata.values.push_back(*pos_metadata);
    319       } else {
    320     this_metadata.name = *fields_here;
    321     this_metadata.values.push_back("");
     322      else if (pos_metadata != NULL && *fields_here != "contains")
     323    tmetaptr->values = *pos_metadata;
     324      else
     325    tmetaptr->values.push_back("");
     326
     327      this_info ++;
     328      if (this_info != end_info) {
     329    tmetaptr->parent = new MetadataInfo_t();
     330    tmetaptr = tmetaptr->parent;
    322331      }
    323 
    324       this_info++;
    325332    }
    326     metadata.push_back(this_metadata);
     333    metadata[*fields_here] = this_metadata;
    327334   
    328335    fields_here++;
  • trunk/gsdl/src/colservr/mggdbmsource.h

    r534 r650  
    7878              comerror_t &err, ostream &logout);
    7979  bool get_metadata (const text_t &requestParams, const text_t &refParams,
    80              bool getParents, const text_tarray &fields, const text_t &OID,
    81              MetadataInfo_tarray &metadata, comerror_t &err, ostream &logout);
     80             bool getParents, const text_tset &fields,
     81             const text_t &OID, MetadataInfo_tmap &metadata,
     82             comerror_t &err, ostream &logout);
    8283  bool get_document (const text_t &OID, text_t &doc,
    8384             comerror_t &err, ostream &logout);
  • trunk/gsdl/src/colservr/source.cpp

    r534 r650  
    2828/*
    2929   $Log$
     30   Revision 1.8  1999/10/10 08:20:36  sjboddie
     31   - metadata now returns map rather than array
     32   - redesigned browsing support (although it's not finished so
     33   won't currently work ;-)
     34
    3035   Revision 1.7  1999/09/07 04:57:25  sjboddie
    3136   added gpl notice
     
    9095// for the given OID then it will return false.
    9196bool sourceclass::get_metadata (const text_t &/*requestParams*/, const text_t &/*refParams*/,
    92                 bool /*getParents*/, const text_tarray &/*fields*/, const text_t &/*OID*/,
    93                 MetadataInfo_tarray &metadata, comerror_t &err, ostream &/*logout*/) {
     97                bool /*getParents*/, const text_tset &/*fields*/,
     98                const text_t &/*OID*/, MetadataInfo_tmap &metadata,
     99                comerror_t &err, ostream &/*logout*/) {
    94100  metadata.erase(metadata.begin(), metadata.end());
    95101  err = noError;
  • trunk/gsdl/src/colservr/source.h

    r534 r650  
    5454  // for the given OID then it will return false.
    5555  virtual bool get_metadata (const text_t &requestParams, const text_t &refParams,
    56                  bool getParents, const text_tarray &fields, const text_t &OID,
    57                  MetadataInfo_tarray &metadata, comerror_t &err, ostream &logout);
     56                 bool getParents, const text_tset &fields,
     57                 const text_t &OID, MetadataInfo_tmap &metadata,
     58                 comerror_t &err, ostream &logout);
    5859
    5960  virtual bool get_document (const text_t &OID, text_t &doc,
Note: See TracChangeset for help on using the changeset viewer.