From 7f49ba72b46a5c6faf613c812d2de45f23e04b68 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 31 Oct 2002 04:57:32 +0000 Subject: [PATCH] add a getline wrapper for mfc --- stepmania/src/StdAfx.h | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/stepmania/src/StdAfx.h b/stepmania/src/StdAfx.h index aa4deb18a0..c70c788b95 100644 --- a/stepmania/src/StdAfx.h +++ b/stepmania/src/StdAfx.h @@ -34,8 +34,15 @@ #define NOMINMAX /* make sure Windows doesn't try to define this */ #include // MFC core and standard components +/* Make sure everyone has min and max: */ #include +/* Everything will need string for one reason or another: */ +#include + +/* And vector: */ +#include + using namespace std; // Don't include these everywhere. They're big. -Chris @@ -52,9 +59,19 @@ using namespace std; /* Use CStdString: */ #define CString CStdString -#define CStringArray StdCArray #else +/* Wrapper to use getline() on MFC strings. */ +template inline +basic_istream<_E, _Tr>& getline(basic_istream<_E, _Tr> &I, + CString &X) { + string str; + + basic_istream<_E, _Tr> &ret = getline(I, str); + X = str.c_str(); + return ret; +} + /* Arg. VC7's CString has GetString(), an equivalent of c_str(). * VC6 doesn't have that. We need it to transition to std::string * sanely. So, sneakily add it. This goes away when we finish @@ -88,8 +105,10 @@ inline const T& min(const T &a, const T &b, P Pr) #endif -#include "STDCarray.h" -#define CStringArray StdCArray +template +class StdCArray: public std::vector {}; +#define CArray StdCArray +#define CStringArray vector /* Include this here to make sure our assertion handler is always * used. (This file is a dependency of most everything anyway,