Changeset 534 in 3DVCSoftware for branches/HTM-DEV-0.3-dev2/source/Lib/TAppCommon
- Timestamp:
- 13 Jul 2013, 10:26:41 (12 years ago)
- Location:
- branches/HTM-DEV-0.3-dev2/source/Lib/TAppCommon
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.3-dev2/source/Lib/TAppCommon/program_options_lite.cpp
r324 r534 39 39 #include <map> 40 40 #include "program_options_lite.h" 41 41 #include "../TLibCommon/TypeDef.h" 42 42 using namespace std; 43 43 … … 146 146 for(Options::NamesPtrList::iterator it = opts.opt_list.begin(); it != opts.opt_list.end(); it++) 147 147 { 148 #if H_MV 149 if ( (*it)->opt->opt_duplicate ) continue; 150 #endif 148 151 ostringstream line(ios_base::out); 149 152 doHelpOpt(line, **it, pad_short); … … 161 164 for(Options::NamesPtrList::iterator it = opts.opt_list.begin(); it != opts.opt_list.end(); it++) 162 165 { 166 #if H_MV 167 if ( (*it)->opt->opt_duplicate ) continue; 168 #endif 163 169 ostringstream line(ios_base::out); 164 170 line << " "; -
branches/HTM-DEV-0.3-dev2/source/Lib/TAppCommon/program_options_lite.h
r446 r534 36 36 #include <list> 37 37 #include <map> 38 #include "../TLibCommon/TypeDef.h" 38 39 39 40 #if H_MV … … 85 86 struct OptionBase 86 87 { 88 #if H_MV 89 OptionBase(const std::string& name, const std::string& desc, bool duplicate = false) 90 : opt_string(name), opt_desc(desc), opt_duplicate(duplicate) 91 #else 87 92 OptionBase(const std::string& name, const std::string& desc) 88 93 : opt_string(name), opt_desc(desc) 94 #endif 89 95 {}; 90 96 … … 98 104 std::string opt_string; 99 105 std::string opt_desc; 106 #if H_MV 107 bool opt_duplicate; 108 #endif 100 109 }; 101 110 … … 104 113 struct Option : public OptionBase 105 114 { 115 #if H_MV 116 Option(const std::string& name, T& storage, T default_val, const std::string& desc, bool duplicate = false) 117 : OptionBase(name, desc, duplicate), opt_storage(storage), opt_default_val(default_val) 118 #else 106 119 Option(const std::string& name, T& storage, T default_val, const std::string& desc) 107 120 : OptionBase(name, desc), opt_storage(storage), opt_default_val(default_val) 121 #endif 108 122 {} 109 123 … … 362 376 { 363 377 std::string cNameBuffer; 364 std::string cDesc riptionBuffer;378 std::string cDescBuffer; 365 379 366 380 cNameBuffer .resize( name.size() + 10 ); 367 cDesc riptionBuffer.resize( desc.size() + 10 );381 cDescBuffer.resize( desc.size() + 10 ); 368 382 369 383 storage.resize(uiMaxNum); 370 384 for ( unsigned int uiK = 0; uiK < uiMaxNum; uiK++ ) 371 385 { 386 Bool duplicate = (uiK != 0); 372 387 // isn't there are sprintf function for string?? 373 388 sprintf((char*) cNameBuffer.c_str() ,name.c_str(),uiK,uiK); 374 sprintf((char*) cDescriptionBuffer.c_str(),desc.c_str(),uiK,uiK); 375 376 parent.addOption(new Option<T>( cNameBuffer, (storage[uiK]), default_val, cDescriptionBuffer )); 389 390 if ( !duplicate ) 391 { 392 sprintf((char*) cDescBuffer.c_str(),desc.c_str(),uiK,uiK); 393 } 394 395 cNameBuffer.resize( std::strlen(cNameBuffer.c_str()) ); 396 cDescBuffer.resize( std::strlen(cDescBuffer.c_str()) ); 397 398 399 parent.addOption(new Option<T>( cNameBuffer, (storage[uiK]), default_val, cDescBuffer, duplicate )); 377 400 } 378 401
Note: See TracChangeset for help on using the changeset viewer.