summaryrefslogtreecommitdiff
path: root/src/generate.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-11 16:03:50 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-11 17:02:25 -0400
commitdea2aed0b509734ec4e1cd163ac2a4f013000da2 (patch)
tree7908da76c67ae5172882306a319bf26df81b73b4 /src/generate.cc
parentd580079df892c30d023b3211d6c4611c17b11f8f (diff)
downloadfork-ledger-dea2aed0b509734ec4e1cd163ac2a4f013000da2.tar.gz
fork-ledger-dea2aed0b509734ec4e1cd163ac2a4f013000da2.tar.bz2
fork-ledger-dea2aed0b509734ec4e1cd163ac2a4f013000da2.zip
Untabified all source files
Diffstat (limited to 'src/generate.cc')
-rw-r--r--src/generate.cc80
1 files changed, 40 insertions, 40 deletions
diff --git a/src/generate.cc b/src/generate.cc
index 3f540b22..fbfca342 100644
--- a/src/generate.cc
+++ b/src/generate.cc
@@ -76,10 +76,10 @@ generate_posts_iterator::generate_posts_iterator
}
void generate_posts_iterator::generate_string(std::ostream& out, int len,
- bool only_alpha)
+ bool only_alpha)
{
DEBUG("generate.post.string",
- "Generating string of length " << len << ", only alpha " << only_alpha);
+ "Generating string of length " << len << ", only alpha " << only_alpha);
int last = -1;
bool first = true;
@@ -87,38 +87,38 @@ void generate_posts_iterator::generate_string(std::ostream& out, int len,
int next = only_alpha ? 3 : three_gen();
bool output = true;
switch (next) {
- case 1: // colon
+ case 1: // colon
if (! first && last == 3 && strlen_gen() % 10 == 0 && i + 1 != len)
- out << ':';
+ out << ':';
else {
- i--;
- output = false;
+ i--;
+ output = false;
}
break;
- case 2: // space
+ case 2: // space
if (! first && last == 3 && strlen_gen() % 20 == 0 && i + 1 != len)
- out << ' ';
+ out << ' ';
else {
- i--;
- output = false;
+ i--;
+ output = false;
}
break;
- case 3: // character
+ case 3: // character
switch (three_gen()) {
- case 1: // uppercase
- out << char(upchar_gen());
- break;
- case 2: // lowercase
- out << char(downchar_gen());
- break;
- case 3: // number
- if (! only_alpha && ! first)
- out << char(numchar_gen());
- else {
- i--;
- output = false;
- }
- break;
+ case 1: // uppercase
+ out << char(upchar_gen());
+ break;
+ case 2: // lowercase
+ out << char(downchar_gen());
+ break;
+ case 3: // number
+ if (! only_alpha && ! first)
+ out << char(numchar_gen());
+ else {
+ i--;
+ output = false;
+ }
+ break;
}
break;
}
@@ -130,7 +130,7 @@ void generate_posts_iterator::generate_string(std::ostream& out, int len,
}
bool generate_posts_iterator::generate_account(std::ostream& out,
- bool no_virtual)
+ bool no_virtual)
{
bool must_balance = true;
bool is_virtual = false;
@@ -164,7 +164,7 @@ bool generate_posts_iterator::generate_account(std::ostream& out,
}
void generate_posts_iterator::generate_commodity(std::ostream& out,
- const string& exclude)
+ const string& exclude)
{
string comm;
do {
@@ -173,21 +173,21 @@ void generate_posts_iterator::generate_commodity(std::ostream& out,
comm = buf.str();
}
while (comm == exclude || comm == "h" || comm == "m" || comm == "s" ||
- comm == "and" || comm == "any" || comm == "all" || comm == "div" ||
- comm == "false" || comm == "or" || comm == "not" ||
- comm == "true" || comm == "if" || comm == "else");
+ comm == "and" || comm == "any" || comm == "all" || comm == "div" ||
+ comm == "false" || comm == "or" || comm == "not" ||
+ comm == "true" || comm == "if" || comm == "else");
out << comm;
}
string generate_posts_iterator::generate_amount(std::ostream& out,
- value_t not_this_amount,
- bool no_negative,
- const string& exclude)
+ value_t not_this_amount,
+ bool no_negative,
+ const string& exclude)
{
std::ostringstream buf;
- if (truth_gen()) { // commodity goes in front
+ if (truth_gen()) { // commodity goes in front
generate_commodity(buf, exclude);
if (truth_gen())
buf << ' ';
@@ -262,7 +262,7 @@ void generate_posts_iterator::generate_cost(std::ostream& out, value_t amount)
buf << " @@ ";
if (! generate_amount(buf, amount, true,
- amount.as_amount().commodity().symbol()).empty())
+ amount.as_amount().commodity().symbol()).empty())
out << buf.str();
}
@@ -362,20 +362,20 @@ post_t * generate_posts_iterator::operator()()
std::istringstream in(buf.str());
try {
if (session.journal->parse(in, session) != 0) {
- VERIFY(session.journal->xacts.back()->valid());
- posts.reset(*session.journal->xacts.back());
- post = posts();
+ VERIFY(session.journal->xacts.back()->valid());
+ posts.reset(*session.journal->xacts.back());
+ post = posts();
}
}
catch (std::exception& err) {
add_error_context(_("While parsing generated transaction (seed %1):")
- << seed);
+ << seed);
add_error_context(buf.str());
throw;
}
catch (int status) {
add_error_context(_("While parsing generated transaction (seed %1):")
- << seed);
+ << seed);
add_error_context(buf.str());
throw;
}