Fix all warnings -Wall spews
[lsnes.git] / fieldsplit.hpp
blobfe8feaebb090cd5d9269d68887590f8d126f0138
1 #ifndef _fieldsplit_hpp__included__
2 #define _fieldsplit_hpp__included__
4 #include <string>
5 #include <stdexcept>
7 /**
8 * \brief Class for splitting string to fields.
10 * Splits string to fields on |
12 class fieldsplitter
14 public:
15 /**
16 * \brief Create new string splitter
18 * Creates a new string splitter to split specified string.
19 * \param _line The line to split.
20 * \throws std::bad_alloc Out of memory.
22 fieldsplitter(const std::string& _line) throw(std::bad_alloc);
23 /**
24 * \brief More fields coming
26 * Checks if more fields are coming.
28 * \return True if more fields are coming, otherwise false.
30 operator bool() throw();
32 /**
33 * \brief Read next field
35 * Reads the next field and returns it. If field doesn't exist, it reads as empty string.
37 * \return The read field.
38 * \throws std::bad_alloc
40 operator std::string() throw(std::bad_alloc);
41 private:
42 std::string line;
43 size_t position;
46 /**
47 * \brief Class for splitting string to fields.
49 * Splits string to fields on ' ' and '\t', with multiple whitespace collapsed into one.
51 class tokensplitter
53 public:
54 tokensplitter(const std::string& _line) throw(std::bad_alloc);
55 operator bool() throw();
56 operator std::string() throw(std::bad_alloc);
57 std::string tail() throw(std::bad_alloc);
58 private:
59 std::string line;
60 size_t position;
63 #endif