Changeset 1058
- Timestamp:
- Apr 24, 2010, 6:36:59 PM (13 years ago)
- Location:
- trunk/lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/OptionVersion.cc
r1021 r1058 37 37 #endif 38 38 39 #include <cstdlib> 39 40 #include <iostream> 40 41 #include <sstream> … … 91 92 #endif 92 93 } 93 exit( 0);94 exit(EXIT_SUCCESS); 94 95 } 95 96 -
trunk/lib/OptionVersion.h
r847 r1058 5 5 6 6 /* 7 Copyright (C) 2008, 2009 Peter Johansson7 Copyright (C) 2008, 2009, 2010 Peter Johansson 8 8 9 9 This file is part of svndigest, http://trac.thep.lu.se/svndigest … … 57 57 OptionSwitch* const verbose=NULL); 58 58 59 /** 60 \brief set version string 61 */ 62 void version(const std::string&); 63 59 64 private: 60 65 OptionSwitch* const verbose_; -
trunk/lib/yat/CommandLine.h
r1039 r1058 2 2 #define _theplu_yat_utility_commandline_ 3 3 4 //$Id: CommandLine.h 22 02 2010-02-21 18:39:13Z peter $4 //$Id: CommandLine.h 2247 2010-04-22 00:54:34Z peter $ 5 5 6 6 /* … … 164 164 private: 165 165 friend std::ostream& operator<<(std::ostream& os, const CommandLine& cl); 166 void add_private(std::string, Option&);167 166 bool is_long_option(std::string str) const; 168 167 bool is_short_option(std::string str) const; -
trunk/lib/yat/OptionHelp.cc
r1027 r1058 1 // $Id: OptionHelp.cc 2 121 2009-12-13 16:17:07Z peter $1 // $Id: OptionHelp.cc 2246 2010-04-22 00:53:23Z peter $ 2 2 3 3 /* … … 50 50 std::cout << cmd() << "\n"; 51 51 std::cout << post_cmd_; 52 exit( 0);52 exit(EXIT_SUCCESS); 53 53 } 54 54 -
trunk/lib/yat/utility.h
r1039 r1058 2 2 #define _theplu_yat_utility_utility_ 3 3 4 // $Id: utility.h 22 10 2010-03-05 22:59:01Z peter $4 // $Id: utility.h 2248 2010-04-22 00:57:13Z peter $ 5 5 6 6 /* … … 149 149 150 150 \note Requirement on T: utility::convert<T> must be supported 151 (from yat 0.7 T=string is also supported) 151 152 152 153 \since New in yat 0.6 … … 173 174 174 175 \note Requirement on T: utility::convert<T> must be supported 176 (from yat 0.7 T=string is also supported) 175 177 176 178 \since New in yat 0.6 … … 179 181 void load(std::istream& is, std::vector<T>& vec, char sep='\0'); 180 182 183 // private namespace 184 namespace detail { 185 /** 186 Functor used in load function 187 */ 188 template<typename T> 189 struct VectorPusher 190 { 191 /** 192 convert element to T and push on vec's back 193 194 \internal 195 */ 196 void operator()(const std::string& element, std::vector<T>& vec) 197 { 198 if (!element.size()) 199 vec.push_back(std::numeric_limits<T>::quiet_NaN()); 200 else { 201 vec.push_back(theplu::yat::utility::convert<T>(element)); 202 } 203 } 204 }; 205 206 /** 207 specialization for string 208 209 \internal 210 */ 211 template<> 212 struct VectorPusher<std::string> 213 { 214 /** 215 push element on vec's back 216 */ 217 void operator()(const std::string& element, std::vector<std::string>& vec) 218 { 219 vec.push_back(element); 220 } 221 }; 222 223 } // end of namespace detail 224 225 181 226 // template implementations 182 227 … … 287 332 void load(std::istream& is, std::vector<T>& vec, char sep='\0') 288 333 { 334 detail::VectorPusher<T> pusher; 289 335 std::string element; 290 336 bool ok=true; 291 while( ok) {337 while(true) { 292 338 if(sep=='\0') 293 339 ok=(is>>element); … … 297 343 break; 298 344 299 if (!element.size()) 300 vec.push_back(std::numeric_limits<T>::quiet_NaN()); 301 else { 302 vec.push_back(convert<T>(element)); 303 } 345 pusher(element, vec); 304 346 } 305 347 }
Note: See TracChangeset
for help on using the changeset viewer.