f170c7bab2
Make commands objects instead of functions calling each other. Now there is '?' command that can display command list and help about individual command. Also the command handling is more distributed into places where it belongs.
27 lines
564 B
C++
27 lines
564 B
C++
#include "lsnes.hpp"
|
|
#include "fieldsplit.hpp"
|
|
#include <iostream>
|
|
|
|
fieldsplitter::fieldsplitter(const std::string& _line) throw(std::bad_alloc)
|
|
{
|
|
line = _line;
|
|
position = 0;
|
|
}
|
|
|
|
fieldsplitter::operator bool() throw()
|
|
{
|
|
return (position < line.length());
|
|
}
|
|
|
|
fieldsplitter::operator std::string() throw(std::bad_alloc)
|
|
{
|
|
size_t nextp, oldp = position;
|
|
nextp = line.find_first_of("|", position);
|
|
if(nextp > line.length()) {
|
|
position = line.length();
|
|
return line.substr(oldp);
|
|
} else {
|
|
position = nextp + 1;
|
|
return line.substr(oldp, nextp - oldp);
|
|
}
|
|
}
|