summaryrefslogtreecommitdiff
path: root/tests/testblocks.cpp
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-03-29 10:53:49 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-03-29 10:53:49 -0400
commit8c8aa6b07e595cfac56838b5964ab3e96051f1b2 (patch)
treeda38e2c1979148dbd3b0c7b87f930746f5ba7f44 /tests/testblocks.cpp
parent8d3fc864d094eeadc721f8e93436b37a5fab173e (diff)
Imported Upstream version 1.5.7
Diffstat (limited to 'tests/testblocks.cpp')
-rw-r--r--tests/testblocks.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/tests/testblocks.cpp b/tests/testblocks.cpp
index 49a44c0..d4f5ed6 100644
--- a/tests/testblocks.cpp
+++ b/tests/testblocks.cpp
@@ -1,49 +1,52 @@
#include <entriesblk.h>
-#include <iostream.h>
+#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
+#ifndef NO_SWORD_NAMESPACE
+using namespace sword;
+#endif
void addEntry(EntriesBlock *eb) {
string input;
string body;
char line[1024];
- cout << "\nEnter new Entry's text. '.' on an empty line to finish:\n";
+ std::cout << "\nEnter new Entry's text. '.' on an empty line to finish:\n";
do {
- cout << "> ";
+ std::cout << "> ";
gets(line);
input = line;
if (input.compare("."))
body.append(input);
}
while (input.compare("."));
- cout << "Adding new entry. Index is: " << eb->addEntry(body.c_str()) << "\n\n";
+ std::cout << "Adding new entry. Index is: " << eb->addEntry(body.c_str()) << "\n\n";
}
void printEntry(EntriesBlock *eb, int index) {
if (index < eb->getCount()) {
- cout << "Contents of entry [" << index << "]:\n";
- cout << eb->getEntry(index) << "\n";
+ std::cout << "Contents of entry [" << index << "]:\n";
+ std::cout << eb->getEntry(index) << "\n";
}
- else cout << "Invalid entry number\n\n";
+ else std::cout << "Invalid entry number\n\n";
}
void printSize(EntriesBlock *eb) {
unsigned long size;
eb->getRawData(&size);
- cout << "Size of raw data: " << size << "\n\n";
+ std::cout << "Size of raw data: " << size << "\n\n";
}
void removeEntry(EntriesBlock *eb, int index) {
if (index < eb->getCount()) {
- cout << "Removing entry [" << index << "]\n";
+ std::cout << "Removing entry [" << index << "]\n";
eb->removeEntry(index);
}
- else cout << "Invalid entry number\n\n";
+ else std::cout << "Invalid entry number\n\n";
}
@@ -53,10 +56,10 @@ int main(int argc, char **argv) {
string input;
char line[1024];
- cout << "Initial entry count should be 0: " << eb->getCount() << "\n";
+ std::cout << "Initial entry count should be 0: " << eb->getCount() << "\n";
do {
- cout << "[" << eb->getCount() << "] > ";
+ std::cout << "[" << eb->getCount() << "] > ";
gets(line);
input = line;
if (input.length() > 0) {
@@ -68,11 +71,11 @@ int main(int argc, char **argv) {
case 'q': break;
case '?':
default:
- cout << "\n a - add a new entry\n";
- cout << " p <entry_index> - print entry\n";
- cout << " r <entry_index> - remove entry\n";
- cout << " s - print size of raw data\n";
- cout << " q - quit\n\n";
+ std::cout << "\n a - add a new entry\n";
+ std::cout << " p <entry_index> - print entry\n";
+ std::cout << " r <entry_index> - remove entry\n";
+ std::cout << " s - print size of raw data\n";
+ std::cout << " q - quit\n\n";
break;
}
}