#include <entriesblk.h>
#include <iostream>
#include <stdio.h>
#include <treekeyidx.h>
#include <rawgenbook.h>
Go to the source code of this file.
Definition at line 131 of file genbookutil.cpp.
133 std::cout <<
"Enter New Child Name: ";
134 fgets(buf, 1000, stdin);
136 treeKey->appendChild();
137 treeKey->setLocalName(name.trim());
Definition at line 117 of file genbookutil.cpp.
118 if (treeKey->getOffset()) {
120 std::cout <<
"Enter New Sibbling Name: ";
121 fgets(buf, 1000, stdin);
124 treeKey->setLocalName(name.trim());
127 else std::cout <<
"Can't add sibling to root node\n";
Definition at line 79 of file genbookutil.cpp.
81 std::cout <<
"Enter Path: ";
82 fgets(buf, 1000, stdin);
84 treeKey->assureKeyPath(path.trim());
Definition at line 142 of file genbookutil.cpp.
143 std::cout <<
"Removing entry [" << treeKey->getText() <<
"]\n";
Definition at line 70 of file genbookutil.cpp.
72 std::cout <<
"Enter Path: ";
73 fgets(buf, 1000, stdin);
75 (*treeKey) = path.trim();
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 157 of file genbookutil.cpp.
160 fprintf(stderr,
"usage: %s <tree/key/data/path>\n", *argv);
164 TreeKeyIdx *treeKey =
new TreeKeyIdx(argv[1]);
166 if (treeKey->popError()) {
171 RawGenBook *book =
new RawGenBook(argv[1]);
172 TreeKeyIdx root = *((TreeKeyIdx *)((SWKey *)(*book)));
173 treeKey = (TreeKeyIdx *)(SWKey *)(*book);
179 std::cout <<
"[" << treeKey->getText() <<
"] > ";
180 fgets(line, 1000, stdin);
183 if (input.length() > 0) {
189 case 'p': root.root();
printTree(root, treeKey);
break;
193 case 'j': treeKey->nextSibling();
break;
194 case 'k': treeKey->previousSibling();
break;
195 case 'h': treeKey->parent();
break;
196 case 'l': treeKey->firstChild();
break;
197 case 'r': treeKey->root();
break;
203 std::cout <<
"\n p - print tree\n";
204 std::cout <<
" n - get local name\n";
205 std::cout <<
" s - set local name\n";
206 std::cout <<
" j - next sibbling\n";
207 std::cout <<
" k - previous sibbling\n";
208 std::cout <<
" h - parent\n";
209 std::cout <<
" l - first child\n";
210 std::cout <<
" r - root\n";
211 std::cout <<
" g - goto path\n";
212 std::cout <<
" G goto path; create if it doesn't exist\n";
213 std::cout <<
" a - append sibbling\n";
214 std::cout <<
" c - append child\n";
215 std::cout <<
" d - delete node\n";
216 std::cout <<
" v - view entry text\n";
217 std::cout <<
" t - set entry text\n";
218 std::cout <<
" q - quit\n\n";
223 while (input.compare(
"q"));
void appendSibbling(TreeKeyIdx *treeKey)
void printTree(TreeKeyIdx treeKey, TreeKeyIdx *target=0, int level=1)
void deleteNode(TreeKeyIdx *treeKey)
static char createModule(const char *ipath)
void setLocalName(TreeKeyIdx *treeKey)
void viewEntryText(RawGenBook *book)
void printLocalName(TreeKeyIdx *treeKey)
void assurePath(TreeKeyIdx *treeKey)
void gotoPath(TreeKeyIdx *treeKey)
void appendChild(TreeKeyIdx *treeKey)
void setEntryText(RawGenBook *book)
Definition at line 55 of file genbookutil.cpp.
56 std::cout <<
"locaName: " << treeKey->getLocalName() <<
"\n";
Definition at line 37 of file genbookutil.cpp.
41 unsigned long currentOffset = target->getOffset();
42 std::cout << ((currentOffset == treeKey.getOffset()) ?
"==>" :
"");
43 for (
int i = 0; i < level; i++) std::cout <<
"\t";
44 std::cout << treeKey.getLocalName() <<
"/\n";
45 if (treeKey.firstChild()) {
49 if (treeKey.nextSibling())
void printTree(TreeKeyIdx treeKey, TreeKeyIdx *target=0, int level=1)
Definition at line 148 of file genbookutil.cpp.
149 if (index < eb->getCount()) {
150 std::cout <<
"Removing entry [" << index <<
"]\n";
153 else std::cout <<
"Invalid entry number\n\n";
void removeEntry(int entryIndex)
Definition at line 95 of file genbookutil.cpp.
97 TreeKeyIdx *treeKey = (TreeKeyIdx *)(SWKey *)(*book);
98 if (treeKey->getOffset()) {
100 std::cout <<
"Enter New Entry Text ('.' on a line by itself to end): \n";
102 fgets(buf, 1000, stdin);
105 if ((text[0] ==
'.') && (text[1] == 0))
111 (*book) << body.c_str();
113 else std::cout <<
"Can't add entry text to root node\n";
Definition at line 60 of file genbookutil.cpp.
62 std::cout <<
"Enter New Node Name: ";
63 fgets(buf, 1000, stdin);
65 treeKey->setLocalName(name.trim());