// NVtest.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include using boost::tokenizer; #include "namevalueiter.h" typedef boost::tokenizer TokNV; int main(int argc, char* argv[]) { // first input string test all conditions in middle of string. Next two test them at the end of string. // string input("name1=value1\nname2=value=2=with equals=sign and=spaces\nname3=\nname4\nname5=plain\nname6="); // string input("name1=value1\nname6"); // string input("name1=value1\nname5=plain"); string input("=value without name\nname5=plain"); name_value_pair nv('=', '\n'); // == to nv() TokNV tok(input, nv); TokNV::iterator iter = tok.begin(); while (iter != tok.end()) { cout << '[' << *iter << ']' << "/"; ++iter; cout << '[' << *iter << ']' << endl; ++iter; } return 0; }