freemind-mindgen/mindgen.cpp

57 lines
1.0 KiB
C++

#include <fstream>
#include <iostream>
#include "mindgen_funcs.h"
#include "MindNode.h"
using namespace std;
void printTree(MindNode* root)
{
if (root != NULL)
{
cout << "ID: " << root->getID() << endl;
cout << "TEXT: " << root->getText() << endl;
cout << "LINK: " << root->getLink() << endl;
vector<string> vec = root->getIcons();
for (vector<string>::iterator it = vec.begin(); it != vec.end(); ++it)
{
cout << "ICON: " << *it << endl;
}
cout << "DOWN" << endl;
printTree(root->getFirstChild());
cout << "RIGHT" << endl;
printTree(root->getNextNode());
}
cout << "UP" << endl;
}
int main(int argc, char** argv)
{
ifstream input_file;
ofstream output_file;
MindNode* root;
if (argc < 3)
{
cout << "Usage: " << argv[0] << " [mindmap] [output]" << endl;
return -1;
}
input_file.open(argv[1]);
output_file.open(argv[2]);
if (0 != parse_mindmap(input_file, &root))
{
cout << "ERR" << endl;
return -1;
}
// printTree(root);
write_html(output_file, root);
delete root;
return 0;
}