|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "snf_xci.hpp" |
|
|
#include "snf_xci.hpp" |
|
|
|
|
|
|
|
|
|
|
|
namespace cd = codedweller; |
|
|
|
|
|
|
|
|
//// snf_xci Interpreter Object //////////////////////////////////////////////// |
|
|
//// snf_xci Interpreter Object //////////////////////////////////////////////// |
|
|
|
|
|
|
|
|
snf_xci::snf_xci() : // Construcing a blank snf_xci. |
|
|
snf_xci::snf_xci() : // Construcing a blank snf_xci. |
|
|
|
|
|
|
|
|
SNFWasParsed.setup(ReadWasGood); |
|
|
SNFWasParsed.setup(ReadWasGood); |
|
|
SetupReader(); |
|
|
SetupReader(); |
|
|
reset(); |
|
|
reset(); |
|
|
ConfigurationData Data(bfr, len); // Then build ConfigurationData from |
|
|
|
|
|
|
|
|
cd::ConfigurationData Data(bfr, len); // Then build ConfigurationData from |
|
|
Reader.interpret(Data); // the buffer and interpret it. |
|
|
Reader.interpret(Data); // the buffer and interpret it. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
snf_xci::snf_xci(string& input) : // Constructing with a string. |
|
|
|
|
|
|
|
|
snf_xci::snf_xci(std::string& input) : // Constructing with a string. |
|
|
Reader("snf"), // Start with our blank construction. |
|
|
Reader("snf"), // Start with our blank construction. |
|
|
ReadWasGood(false) { |
|
|
ReadWasGood(false) { |
|
|
SNFWasParsed.setup(ReadWasGood); |
|
|
SNFWasParsed.setup(ReadWasGood); |
|
|
SetupReader(); |
|
|
SetupReader(); |
|
|
reset(); |
|
|
reset(); |
|
|
ConfigurationData Data(input.c_str(), input.length()); // Then build ConfigurationData from |
|
|
|
|
|
|
|
|
cd::ConfigurationData Data(input.c_str(), input.length()); // Then build ConfigurationData from |
|
|
Reader.interpret(Data); // the string and interpret it. |
|
|
Reader.interpret(Data); // the string and interpret it. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
bool snf_xci::read(const char* bfr, int len) { // To read from a buffer we |
|
|
bool snf_xci::read(const char* bfr, int len) { // To read from a buffer we |
|
|
ConfigurationData Data(bfr, len); // construct ConfigurationData from |
|
|
|
|
|
|
|
|
cd::ConfigurationData Data(bfr, len); // construct ConfigurationData from |
|
|
Reader.interpret(Data); // the buffer and interpret it. |
|
|
Reader.interpret(Data); // the buffer and interpret it. |
|
|
return good(); // Return true if it looked good. |
|
|
return good(); // Return true if it looked good. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bool snf_xci::read(string& input) { // To read from a string we |
|
|
|
|
|
|
|
|
bool snf_xci::read(std::string& input) { // To read from a string we |
|
|
return read(input.c_str(), input.length()); // get the strings buffer and hand off |
|
|
return read(input.c_str(), input.length()); // get the strings buffer and hand off |
|
|
} // to our buffer read() |
|
|
} // to our buffer read() |
|
|
|
|
|
|