Changeset 2999 in Sophya for trunk/SophyaPI/PIext/nobjmgr.cc
- Timestamp:
- Jul 2, 2006, 7:20:56 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/nobjmgr.cc
r2975 r2999 564 564 565 565 myNObj++; 566 if ((nobj.length() < 1) || (! isalpha(nobj[0]) ) ) { 567 cout << "NamedObjMgr::AddObj() bad object name " << nobj ; 566 if ( !CheckName(nobj) ) { 568 567 sprintf(buff,"O%d", myNObj); 569 nobj = buff;570 cout << " changed to " << nobj << endl;571 568 cout << "NamedObjMgr::AddObj() Name changed: " << nom << " -> " << buff << endl; 569 nom = buff; 570 } 572 571 573 572 nom = '/' + nrep + '/' + nobj; … … 663 662 return(false); 664 663 } 665 if ((n2.length() < 1) || (! isalpha(n2[0])) ) { 664 665 if ( !CheckName(n2) ) { 666 666 cout << "NamedObjMgr::RenameObj() Error - bad new object name" << n2 << endl; 667 667 return(false); … … 671 671 cout << "NamedObjMgr::RenameObj() Error - Object " << nomnew << " exist !" << endl; 672 672 return(false); 673 674 673 } 674 675 675 if ( (*itr1).second.lock || (*itr2).second.lock ) { 676 676 cout << "NamedObjMgr::RenameObj() Error - Source or destination directory locked !" … … 1734 1734 } 1735 1735 1736 /* Nouvelle-Fonction */ 1737 bool NamedObjMgr::CheckName(string const & nom) 1738 { 1739 if (nom.length() < 1) return false; 1740 if (! isalpha(nom[0]) ) return false; 1741 for(int k=0; k<nom.length(); k++) 1742 if ((!isalnum(nom[k])) && (nom[k] != '_')) return false; 1743 return true; 1744 }
Note:
See TracChangeset
for help on using the changeset viewer.