Changeset 2962 in Sophya for trunk/SophyaLib/HiStats
- Timestamp:
- Jun 2, 2006, 1:23:46 PM (19 years ago)
- Location:
- trunk/SophyaLib/HiStats
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/HiStats/basedtable.cc
r2891 r2962 179 179 } 180 180 181 //! Check the validity of column name \b cnom - throw exception. 181 182 bool BaseDataTable::CheckColName(string const & cnom) 182 183 { … … 194 195 throw ParmError("BaseDataTable::CheckColName() already existing name"); 195 196 return true; 197 } 198 199 /*! 200 \brief Check the validity of column name \b cnom and correct it if necessary 201 return true if \b cnom has been changed 202 */ 203 bool BaseDataTable::CheckCorrectColName(string& cnom) 204 { 205 size_t l,k; 206 l = cnom.length(); 207 string ssn; 208 MuTyV mvv = (NCols()+1); 209 mvv.Convert(ssn); 210 bool fgrc = false; 211 if (l < 1) { cnom = "C"+ssn; fgrc = true; } 212 if (!isalpha(cnom[0])) { cnom = "C"+cnom; fgrc = true; } 213 for(k=1; k<l; k++) 214 if ((!isalnum(cnom[k])) && (cnom[k] != '_')) { 215 cnom[k] = '_'; fgrc = true; 216 } 217 bool fgdouble = true; 218 while (fgdouble) { 219 fgdouble = false; 220 for(k=0; k<mNames.size(); k++) 221 if (cnom == mNames[k].nom) { 222 fgdouble = true; break; 223 } 224 if (fgdouble) { cnom = cnom+ssn; fgrc = true; } 225 } 226 return fgrc; 196 227 } 197 228 -
trunk/SophyaLib/HiStats/basedtable.h
r2851 r2962 144 144 // si nom en double ou non valide 145 145 virtual bool CheckColName(string const & cnom); 146 // Verifie et corrige si besoin un nom de colonne 147 virtual bool CheckCorrectColName(string & cnom); 146 148 147 149 // Acces to various counts and parameters
Note:
See TracChangeset
for help on using the changeset viewer.