Frobby  0.9.5
FrobbyStringStream.h
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see http://www.gnu.org/licenses/.
16 */
17 #ifndef FROBBY_STRING_STREAM_GUARD
18 #define FROBBY_STRING_STREAM_GUARD
19 
20 #include <string>
21 #include <stdexcept>
22 
27  public:
28  FrobbyStringStream& operator<<(unsigned long long integer);
29  FrobbyStringStream& operator<<(unsigned long integer);
30  FrobbyStringStream& operator<<(unsigned int integer);
31  FrobbyStringStream& operator<<(const mpz_class& integer);
32  FrobbyStringStream& operator<<(const string& text);
33  FrobbyStringStream& operator<<(const char* text);
34 
38  FrobbyStringStream& operator<<(char character);
39 
40  string& str();
41  const string& str() const;
42  operator const string&() const;
43 
44  void clear() {_str.clear();}
45 
46  static void appendIntegerToString(string& str, unsigned long integer);
47  static void appendIntegerToString(string& str, const mpz_class& integer);
48 
51  static void parseInteger(mpz_class& integer, const string& str);
52  class NotAnIntegerException : public runtime_error {
53  public:
54  NotAnIntegerException(const string&);
55  };
56 
57  private:
58  string _str;
59 };
60 
61 #endif
A replacement for stringstream.
FrobbyStringStream & operator<<(unsigned long long integer)
static void parseInteger(mpz_class &integer, const string &str)
Throws NotAnIntegerException if str is not the string representation of an integer.
static void appendIntegerToString(string &str, unsigned long integer)