Changeset 2218 in Sophya for trunk/SophyaPI/PIext/nobjmgr.cc


Ignore:
Timestamp:
Oct 21, 2002, 5:38:02 PM (23 years ago)
Author:
ansari
Message:

Suite amelioration interpreteur PIACmd , variables de type $#varname
et $varname[indexvar] - Reza 21/10/2002

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/nobjmgr.cc

    r2180 r2218  
    218218bool NamedObjMgr::SetVar(string const & key, string const & val)
    219219{
     220  if ((key.length() < 1) || (! isalpha(key[0])) )   {
     221    cout << "NamedObjMgr::SetVar( " << key << " ...) Bad VarName " << endl;
     222    return(false);
     223  }
    220224#ifdef SANS_EVOLPLANCK
    221225  bool fg = true;
     
    231235bool NamedObjMgr::HasVar(string const & key)
    232236{
     237  if ((key.length() < 1) || (! isalpha(key[0])) )   {
     238    cout << "NamedObjMgr::HasVar( " << key << ") Bad VarName " << endl;
     239    return(false);
     240  }
    233241#ifdef SANS_EVOLPLANCK
    234242  DVList::ValList::const_iterator it;
     
    244252bool NamedObjMgr::DeleteVar(string const & key)
    245253{
     254  if ((key.length() < 1) || (! isalpha(key[0])) )   {
     255    cout << "NamedObjMgr::DeleteVar( " << key << ") Bad VarName " << endl;
     256    return(false);
     257  }
    246258#ifdef SANS_EVOLPLANCK
    247259  return(false);
     
    254266string NamedObjMgr::GetVar(string const & key)
    255267{
     268  if ((key.length() < 1) || (! isalpha(key[0])) )   {
     269    cout << "NamedObjMgr::GetVar( " << key << ") Bad VarName " << endl;
     270    return("");
     271  }
    256272  //  cout << " DEBUG::GetVar " << *myVars << endl;
    257273  return(myVars->GetS(key));
     
    503519
    504520myNObj++;
    505 if (nobj.length() < 1) {
     521if ((nobj.length() < 1) || (! isalpha(nobj[0]) ) ) {
     522  cout << "NamedObjMgr::AddObj() bad object name " << nobj ;
    506523  sprintf(buff,"O%d", myNObj);
    507524  nobj = buff;
     525  cout << " changed to " << nobj << endl;
    508526  }
    509527
     
    580598  cout << "NamedObjMgr::RenameObj() Error - No " << r2 << " directory !" << endl;
    581599  return(false);
    582   }
     600}
    583601nom = '/' + r1 + '/' + n1;
    584602nomnew = '/' + r2 + '/' + n2;
     
    587605  cout << "NamedObjMgr::RenameObj() Error -  No " << nom << " object !" << endl;
    588606  return(false);
    589   }
     607}
     608if ((n2.length() < 1) || (! isalpha(n2[0])) ) {
     609  cout << "NamedObjMgr::RenameObj() Error -  bad new object name" << n2 << endl;
     610  return(false);
     611}
    590612NObjList::iterator it2 = myObjs->find(nomnew);
    591613if (it2 != myObjs->end()) {
     
    15011523size_t p = nom.find('/');
    15021524if (p < nom.length()) nom = nom.substr(0,p);
    1503 if (nom.length() < 1)  return(false);
     1525if ((nom.length() < 1) || (! isalpha(nom[0]) ) )  return(false);
    15041526return(true);
    15051527}
Note: See TracChangeset for help on using the changeset viewer.