Changeset 54 in SHVCSoftware for branches/HM-10.0-dev-SHM/source/Lib/TAppCommon/program_options_lite.h
- Timestamp:
- 2 Mar 2013, 09:25:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HM-10.0-dev-SHM/source/Lib/TAppCommon/program_options_lite.h
r51 r54 209 209 return *this; 210 210 } 211 211 #if 1 //SVC_EXTENSION 212 template<typename T> 213 OptionSpecific& 214 operator()(const std::string& name, T* storage, T default_val, unsigned uiMaxNum, const std::string& desc = "" ) 215 { 216 std::string cNameBuffer; 217 std::string cDescriptionBuffer; 218 219 cNameBuffer .resize( name.size() + 10 ); 220 cDescriptionBuffer.resize( desc.size() + 10 ); 221 222 for ( unsigned int uiK = 0; uiK < uiMaxNum; uiK++ ) 223 { 224 // isn't there are sprintf function for string?? 225 sprintf((char*) cNameBuffer.c_str() ,name.c_str(),uiK,uiK); 226 sprintf((char*) cDescriptionBuffer.c_str(),desc.c_str(),uiK,uiK); 227 228 size_t pos = cNameBuffer.find_first_of('\0'); 229 if(pos != std::string::npos) 230 cNameBuffer.resize(pos); 231 232 parent.addOption(new Option<T>( cNameBuffer, (storage[uiK]), default_val, cDescriptionBuffer )); 233 } 234 235 return *this; 236 } 237 238 template<typename T> 239 OptionSpecific& 240 operator()(const std::string& name, T** storage, T default_val, unsigned uiMaxNum, const std::string& desc = "" ) 241 { 242 std::string cNameBuffer; 243 std::string cDescriptionBuffer; 244 245 cNameBuffer .resize( name.size() + 10 ); 246 cDescriptionBuffer.resize( desc.size() + 10 ); 247 248 for ( unsigned int uiK = 0; uiK < uiMaxNum; uiK++ ) 249 { 250 // isn't there are sprintf function for string?? 251 sprintf((char*) cNameBuffer.c_str() ,name.c_str(),uiK,uiK); 252 sprintf((char*) cDescriptionBuffer.c_str(),desc.c_str(),uiK,uiK); 253 254 size_t pos = cNameBuffer.find_first_of('\0'); 255 if(pos != std::string::npos) 256 cNameBuffer.resize(pos); 257 258 parent.addOption(new Option<T>( cNameBuffer, *(storage[uiK]), default_val, cDescriptionBuffer )); 259 } 260 261 return *this; 262 } 263 #endif 212 264 /** 213 265 * Add option described by name to the parent Options list,
Note: See TracChangeset for help on using the changeset viewer.