Moved around some functions for clarity
This commit is contained in:
parent
aa69b273de
commit
4365d9e3fc
7 changed files with 87 additions and 30 deletions
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
64
src/derive.h
Normal file
64
src/derive.h
Normal file
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
11
src/report.h
11
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
|
||||
|
|
|
|||
17
src/scope.cc
17
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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue