diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-16 04:10:22 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-16 04:10:22 -0400 |
commit | 4365d9e3fcbe2546c15f188833a69cf8416f44fe (patch) | |
tree | 2f3da7ba36669752670a119983ef53f3eee02d40 | |
parent | aa69b273deda6cc29701fe9a4adf66abe8773cda (diff) | |
download | fork-ledger-4365d9e3fcbe2546c15f188833a69cf8416f44fe.tar.gz fork-ledger-4365d9e3fcbe2546c15f188833a69cf8416f44fe.tar.bz2 fork-ledger-4365d9e3fcbe2546c15f188833a69cf8416f44fe.zip |
Moved around some functions for clarity
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | src/derive.cc | 2 | ||||
-rw-r--r-- | src/derive.h | 64 | ||||
-rw-r--r-- | src/report.cc | 20 | ||||
-rw-r--r-- | src/report.h | 11 | ||||
-rw-r--r-- | src/scope.cc | 17 | ||||
-rw-r--r-- | src/scope.h | 2 |
7 files changed, 87 insertions, 30 deletions
diff --git a/Makefile.am b/Makefile.am index 22110b57..e41d8d3c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -114,6 +114,7 @@ pkginclude_HEADERS = \ src/filters.h \ src/chain.h \ src/precmd.h \ + src/derive.h \ src/output.h \ src/emacs.h \ src/help.h \ diff --git a/src/derive.cc b/src/derive.cc index c8da6326..ea9e7483 100644 --- a/src/derive.cc +++ b/src/derive.cc @@ -29,7 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "report.h" +#include "derive.h" #include "output.h" namespace ledger { diff --git a/src/derive.h b/src/derive.h new file mode 100644 index 00000000..2cefc3bf --- /dev/null +++ b/src/derive.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2003-2009, John Wiegley. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of New Artisans LLC nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @addtogroup derive + */ + +/** + * @file derive.h + * @author John Wiegley + * + * @ingroup report + * + * @brief Brief + * + * Long. + */ +#ifndef _DERIVE_H +#define _DERIVE_H + +#include "scope.h" + +namespace ledger { + +value_t entry_command(call_scope_t& args); +value_t template_command(call_scope_t& args); + +class entry_t; +class report_t; +entry_t * derive_new_entry(report_t& report, + value_t::sequence_t::const_iterator i, + value_t::sequence_t::const_iterator end); + +} // namespace ledger + +#endif // _DERIVE_H diff --git a/src/report.cc b/src/report.cc index b0281c3e..98b90272 100644 --- a/src/report.cc +++ b/src/report.cc @@ -34,8 +34,9 @@ #include "filters.h" #include "chain.h" #include "output.h" -#include "emacs.h" #include "precmd.h" +#include "emacs.h" +#include "derive.h" namespace ledger { @@ -671,21 +672,4 @@ expr_t::ptr_op_t report_t::lookup(const string& name) return NULL; } -string join_args(call_scope_t& args) -{ - std::ostringstream buf; - bool first = true; - - for (std::size_t i = 0; i < args.size(); i++) { - if (first) { - buf << args[i]; - first = false; - } else { - buf << ' ' << args[i]; - } - } - - return buf.str(); -} - } // namespace ledger diff --git a/src/report.h b/src/report.h index 2007d29c..e77ba1a4 100644 --- a/src/report.h +++ b/src/report.h @@ -512,17 +512,6 @@ public: }); }; -// jww (2009-02-10): These should perhaps live elsewhere -value_t entry_command(call_scope_t& args); -value_t template_command(call_scope_t& args); - -entry_t * derive_new_entry(report_t& report, - value_t::sequence_t::const_iterator i, - value_t::sequence_t::const_iterator end); - -string join_args(call_scope_t& args); - - } // namespace ledger #endif // _REPORT_H diff --git a/src/scope.cc b/src/scope.cc index f4b2dfab..660f1af2 100644 --- a/src/scope.cc +++ b/src/scope.cc @@ -60,4 +60,21 @@ expr_t::ptr_op_t symbol_scope_t::lookup(const string& name) return child_scope_t::lookup(name); } +string join_args(call_scope_t& args) +{ + std::ostringstream buf; + bool first = true; + + for (std::size_t i = 0; i < args.size(); i++) { + if (first) { + buf << args[i]; + first = false; + } else { + buf << ' ' << args[i]; + } + } + + return buf.str(); +} + } // namespace ledger diff --git a/src/scope.h b/src/scope.h index 42825606..32fbed4a 100644 --- a/src/scope.h +++ b/src/scope.h @@ -371,6 +371,8 @@ inline datetime_t var_t<datetime_t>::operator *() const { return value->to_datetime(); } +string join_args(call_scope_t& args); + } // namespace ledger #endif // _SCOPE_H |