Changeset 3693 in Sophya


Ignore:
Timestamp:
Nov 30, 2009, 5:18:57 PM (16 years ago)
Author:
cmv
Message:

add GetKeyValue pour lire le contenu des clefs FITS, cmv 30/11/2009

Location:
trunk/AddOn/TAcq
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/AddOn/TAcq/minifits.cc

    r3691 r3693  
    332332    }
    333333  }
     334  return rs;
     335}
     336
     337/* --Methode-- */
     338string MiniFITSFile::GetKeyValue(const char* key)
     339{
     340  string line = GetKey(key);
     341  if(line.size()==0) return "";
     342  char rs[84], sep = '?';
     343  bool foundeq = false;
     344  unsigned int ip = 0;
     345  for(unsigned int i=0;i<line.size();i++) {
     346    if(!foundeq) {if(line[i] == '=') foundeq = true; continue;}
     347    if(sep=='?') {  // recherche du separateur de debut
     348      if(line[i]==' ') continue;
     349      if(line[i]=='\'' || line[i]=='\"') {sep = line[i]; continue;}
     350      else sep = ' ';
     351    }
     352    if(line[i]==sep) break;
     353    rs[ip] = line[i];
     354    ip++;
     355  }
     356  rs[ip] = '\0';
    334357  return rs;
    335358}
  • trunk/AddOn/TAcq/minifits.h

    r3688 r3693  
    9696  string GetKey(string& key) { return GetKey(key.c_str()) ; }
    9797  string GetKey(const char* key);
     98  string GetKeyValue(const char* key);
    9899
    99100protected:
Note: See TracChangeset for help on using the changeset viewer.