Add iostream to CTL

This commit is contained in:
Justine Tunney 2024-06-29 15:45:09 -07:00
parent 617ddfee93
commit 98e684622b
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
20 changed files with 1531 additions and 7 deletions

41
ctl/istringstream.h Normal file
View file

@ -0,0 +1,41 @@
// -*-mode:c++;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8-*-
// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :vi
#ifndef CTL_ISTRINGSTREAM_H_
#define CTL_ISTRINGSTREAM_H_
#include "ios_base.h"
#include "string.h"
namespace ctl {
class istringstream : public ios_base
{
public:
istringstream();
explicit istringstream(const string_view&);
string str() const;
void str(const string&);
istringstream& operator>>(char&);
istringstream& operator>>(char*);
istringstream& operator>>(string&);
istringstream& operator>>(short&);
istringstream& operator>>(unsigned short&);
istringstream& operator>>(int&);
istringstream& operator>>(unsigned int&);
istringstream& operator>>(long&);
istringstream& operator>>(unsigned long&);
istringstream& operator>>(float&);
istringstream& operator>>(double&);
private:
string buffer_;
size_t read_pos_;
template<typename T>
istringstream& read_numeric(T&);
};
} // namespace ctl
#endif // CTL_ISTRINGSTREAM_H_