From 0db98a30b99bcfc6135a4608d7bb34f61af375d1 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Tue, 12 Jun 2012 18:14:09 +0200 Subject: [PATCH] msvcp90: Added basic_istream::getline(basic_string) implementation. --- dlls/msvcp90/ios.c | 33 +++++++++++++++++++++++++++++++++ dlls/msvcp90/msvcp90.h | 2 ++ dlls/msvcp90/msvcp90.spec | 8 ++++---- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index 8f4c216ef14..97edacf925c 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -4630,6 +4630,39 @@ basic_istream_char* __thiscall basic_istream_char_read_bool(basic_istream_char * return NULL; } +/* ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@D@Z */ +/* ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@D@Z */ +basic_istream_char* __cdecl basic_istream_char_getline_str_delim( + basic_istream_char *istream, basic_string_char *str, char delim) +{ + IOSB_iostate state = IOSTATE_failbit; + int c; + + TRACE("(%p %p %c)\n", istream, str, delim); + + if(basic_istream_char_sentry_create(istream, TRUE)) { + MSVCP_basic_string_char_clear(str); + + for(c = basic_istream_char_get(istream); c!=delim && c!=EOF; + c = basic_istream_char_get(istream)) { + state = IOSTATE_goodbit; + MSVCP_basic_string_char_append_ch(str, c); + } + } + basic_istream_char_sentry_destroy(istream); + + basic_ios_char_setstate(basic_istream_char_get_basic_ios(istream), state); + return istream; +} + +/* ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */ +/* ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */ +basic_istream_char* __cdecl basic_istream_char_getline_str( + basic_istream_char *istream, basic_string_char *str) +{ + return basic_istream_char_getline_str_delim(istream, str, '\n'); +} + /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@XZ */ /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@XZ */ DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor, 8) diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h index ba5b0a76638..5ca938c4362 100644 --- a/dlls/msvcp90/msvcp90.h +++ b/dlls/msvcp90/msvcp90.h @@ -247,6 +247,8 @@ basic_string_char* __stdcall MSVCP_basic_string_char_ctor_cstr(basic_string_char basic_string_char* __stdcall MSVCP_basic_string_char_copy_ctor(basic_string_char*, const basic_string_char*); void __stdcall MSVCP_basic_string_char_dtor(basic_string_char*); const char* __stdcall MSVCP_basic_string_char_c_str(const basic_string_char*); +void __thiscall MSVCP_basic_string_char_clear(basic_string_char*); +basic_string_char* __thiscall MSVCP_basic_string_char_append_ch(basic_string_char*, char); #define BUF_SIZE_WCHAR 8 typedef struct _basic_string_wchar diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec index 03e6c1a5dd6..0a6b24a5941 100644 --- a/dlls/msvcp90/msvcp90.spec +++ b/dlls/msvcp90/msvcp90.spec @@ -386,10 +386,10 @@ @ stub -arch=win64 ??$exp@N@std@@YA?AV?$complex@N@0@AEBV10@@Z @ stub -arch=win32 ??$exp@O@std@@YA?AV?$complex@O@0@ABV10@@Z @ stub -arch=win64 ??$exp@O@std@@YA?AV?$complex@O@0@AEBV10@@Z -@ stub -arch=win32 ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z -@ stub -arch=win64 ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z -@ stub -arch=win32 ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@D@Z -@ stub -arch=win64 ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@D@Z +@ cdecl -arch=win32 ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z(ptr ptr) basic_istream_char_getline_str +@ cdecl -arch=win64 ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z(ptr ptr) basic_istream_char_getline_str +@ cdecl -arch=win32 ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@D@Z(ptr ptr long) basic_istream_char_getline_str_delim +@ cdecl -arch=win64 ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@D@Z(ptr ptr long) basic_istream_char_getline_str_delim @ stub -arch=win32 ??$getline@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z @ stub -arch=win64 ??$getline@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z @ stub -arch=win32 ??$getline@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@G@Z