cleaned up some includes and added ifdefs for sstream

This commit is contained in:
mes5k 2004-10-21 03:04:13 +00:00
parent 54d1326da9
commit cf64287c40
9 changed files with 63 additions and 13 deletions

View File

@ -36,8 +36,6 @@
#include <vector> #include <vector>
#include <list> #include <list>
#include <iostream> #include <iostream>
#include <ostream>
#include <iomanip>
#include <algorithm> #include <algorithm>
namespace TCLAP { namespace TCLAP {

View File

@ -28,10 +28,6 @@
#include <vector> #include <vector>
#include <list> #include <list>
#include <iostream> #include <iostream>
#include <ostream>
#include <cstdio>
#include <cstdarg>
#include <iomanip>
#include <algorithm> #include <algorithm>
namespace TCLAP { namespace TCLAP {

View File

@ -25,7 +25,13 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <config.h>
#ifdef HAVE_SSTREAM
#include <sstream> #include <sstream>
#elif HAVE_SSTREAM
#include <strstream>
#endif
#include <tclap/Arg.h> #include <tclap/Arg.h>
@ -73,7 +79,19 @@ class ValueExtractor
int extractValue( const std::string& val ) int extractValue( const std::string& val )
{ {
T temp; T temp;
#ifdef HAVE_SSTREAM
std::istringstream is(val); std::istringstream is(val);
#elif HAVE_STRSTREAM
std::istrstream is(val.c_str());
#else
throw(SpecificationException(
string("Missing sstream or strstream lib, ") +
"without which, nothing will work. " +
"Not even sure how you got this far!",
toString()));
#endif
int valuesRead = 0; int valuesRead = 0;
while ( is.good() ) while ( is.good() )
@ -326,7 +344,19 @@ void MultiArg<T>::allowedInit()
{ {
for ( unsigned int i = 0; i < _allowed.size(); i++ ) for ( unsigned int i = 0; i < _allowed.size(); i++ )
{ {
#ifdef HAVE_SSTREAM
std::ostringstream os; std::ostringstream os;
#elif HAVE_STRSTREAM
std::ostrstream os;
#else
throw(SpecificationException(
string("Missing sstream or strstream lib, ") +
"without which, nothing will work. " +
"Not even sure how you got this far!",
toString()));
#endif
os << _allowed[i]; os << _allowed[i];
std::string temp( os.str() ); std::string temp( os.str() );

View File

@ -23,7 +23,7 @@
#ifndef TCLAP_PRINTSENSIBLY_H #ifndef TCLAP_PRINTSENSIBLY_H
#define TCLAP_PRINTSENSIBLY_H #define TCLAP_PRINTSENSIBLY_H
#include <ostream> #include <iostream>
#include <algorithm> #include <algorithm>
#include <string> #include <string>

View File

@ -26,7 +26,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <sstream>
#include <tclap/Arg.h> #include <tclap/Arg.h>

View File

@ -25,7 +25,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <sstream>
#include <tclap/MultiArg.h> #include <tclap/MultiArg.h>

View File

@ -26,7 +26,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <sstream>
#include <tclap/ValueArg.h> #include <tclap/ValueArg.h>

View File

@ -25,7 +25,13 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <config.h>
#if defined(HAVE_SSTREAM)
#include <sstream> #include <sstream>
#elif defined(HAVE_STRSTREAM)
#include <strstream>
#endif
#include <tclap/Arg.h> #include <tclap/Arg.h>
@ -74,7 +80,18 @@ template<class T> class ValueExtractor
*/ */
int extractValue( const std::string& val ) int extractValue( const std::string& val )
{ {
#ifdef HAVE_SSTREAM
std::istringstream is(val); std::istringstream is(val);
#elif HAVE_STRSTREAM
std::istrstream is(val.c_str());
#else
throw(SpecificationException(
string("Missing sstream or strstream lib, ") +
"without which, nothing will work. " +
"Not even sure how you got this far!",
toString()));
#endif
int valuesRead = 0; int valuesRead = 0;
while ( is.good() ) while ( is.good() )
@ -358,7 +375,19 @@ void ValueArg<T>::allowedInit()
{ {
for ( unsigned int i = 0; i < _allowed.size(); i++ ) for ( unsigned int i = 0; i < _allowed.size(); i++ )
{ {
#ifdef HAVE_SSTREAM
std::ostringstream os; std::ostringstream os;
#elif defined(HAVE_STRSTREAM)
std::ostrstream os;
#else
throw(SpecificationException(
string("Missing sstream or strstream lib, ") +
"without which, nothing will work. " +
"Not even sure how you got this far!",
toString()));
#endif
os << _allowed[i]; os << _allowed[i];
std::string temp( os.str() ); std::string temp( os.str() );

View File

@ -28,7 +28,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <ostream> #include <iostream>
namespace TCLAP { namespace TCLAP {