#include #include #include #include #include #define PREFIX "..." #define MAX_LENGTH 1 int max; void flush(std::vector< std::string> & tags, std::vector< std::string>::iterator & tag_level, std::string flush_prefix) { int step = rand() % 3 - 1; //zanoreni, stejna uroven, vynoreni */ if(max > MAX_LENGTH) step = -1; //vynorime, kdyz je to moc dlouhy max++; std::cout << flush_prefix << "<" << *tag_level << ">" << std::endl; //oteviraci tag urovne if(step == -1) { std::cout << flush_prefix << "" << std::endl; //uzavren if(tag_level != tags.begin()) --tag_level; //vyskocime return; } else if (step == 0) { std::cout << flush_prefix << "" << //uzavrem std::endl << "<" << *tag_level << ">" << std::endl; //zacnem novy flush(tags, tag_level, flush_prefix); return; } else /* step == 1 */ { ++tag_level; if(tag_level == tags.end()) return; flush(tags, tag_level, flush_prefix + PREFIX); std::cout << "" << std::endl; //zacnem novy return; } } int main() { srand( time( NULL)); std::vector< std::string> tagy; tagy.push_back("tag1"); tagy.push_back("tag2"); tagy.push_back("tag3"); tagy.push_back("tag4"); tagy.push_back("tag5"); tagy.push_back("tag6"); tagy.push_back("tag7"); tagy.push_back("tag8"); std::vector< std::string> xml_includy; xml_includy.push_back("/tmp/gen/file1.xml"); xml_includy.push_back("/tmp/gen/xmldir"); std::vector< std::string> txt_includy; txt_includy.push_back("/tmp/gen/file2.txt"); txt_includy.push_back("/tmp/gen/xmldir"); }