diff options
author | randomdan <randomdan@localhost> | 2010-12-17 23:01:10 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2010-12-17 23:01:10 +0000 |
commit | 8e965240abf25b9d33231d35d23c3c98c50f5616 (patch) | |
tree | a674036788ea48c5485f0382ae02e6e778c6a92d | |
parent | Return HTTP 500 on error (diff) | |
download | project2-8e965240abf25b9d33231d35d23c3c98c50f5616.tar.bz2 project2-8e965240abf25b9d33231d35d23c3c98c50f5616.tar.xz project2-8e965240abf25b9d33231d35d23c3c98c50f5616.zip |
Remove the stupid _ naming convention
49 files changed, 361 insertions, 397 deletions
diff --git a/project2/dataSource.cpp b/project2/dataSource.cpp index 6da997e..e40ad64 100644 --- a/project2/dataSource.cpp +++ b/project2/dataSource.cpp @@ -1,11 +1,11 @@ #include "dataSource.h" -_DataSource::_DataSource(const xmlpp::Element * p) : - _SourceObject(p) +DataSource::DataSource(const xmlpp::Element * p) : + SourceObject(p) { } -_DataSource::~_DataSource() +DataSource::~DataSource() { } diff --git a/project2/dataSource.h b/project2/dataSource.h index 297f048..b1147da 100644 --- a/project2/dataSource.h +++ b/project2/dataSource.h @@ -7,14 +7,14 @@ #include "sourceObject.h" #include "xmlObjectLoader.h" -class _DataSource; -typedef boost::intrusive_ptr<_DataSource> DataSource; -typedef std::map<std::string, DataSource> DataSources; +class DataSource; +typedef boost::intrusive_ptr<DataSource> DataSourcePtr; +typedef std::map<std::string, DataSourcePtr> DataSources; -class _DataSource : public virtual _SourceObject { +class DataSource : public virtual SourceObject { public: - _DataSource(const xmlpp::Element * p); - virtual ~_DataSource(); + DataSource(const xmlpp::Element * p); + virtual ~DataSource(); virtual void commit() { }; virtual void rollback() { }; diff --git a/project2/dumpTask.cpp b/project2/dumpTask.cpp index 3db29f6..cc13f0b 100644 --- a/project2/dumpTask.cpp +++ b/project2/dumpTask.cpp @@ -1,27 +1,28 @@ #include "dumpTask.h" #include "perRowValues.h" +#include "xmlObjectLoader.h" #include <boost/foreach.hpp> #include <stdio.h> -ElementLoaderImpl<_DumpTask> dumptaskLoader("dumptask"); +ElementLoaderImpl<DumpTask> dumptaskLoader("dumptask"); -_DumpTask::_DumpTask(const xmlpp::Element * p) : - _SourceObject(p), - _Task(p) +DumpTask::DumpTask(const xmlpp::Element * p) : + SourceObject(p), + Task(p) { } -_DumpTask::~_DumpTask() +DumpTask::~DumpTask() { } void -_DumpTask::loadComplete(const CommonObjects *) +DumpTask::loadComplete(const CommonObjects *) { } void -_DumpTask::execute() const +DumpTask::execute() const { const PerRowValues::RowValuesStack::value_type & r = PerRowValues::Stack().back(); unsigned int cols = r->columnCount(); diff --git a/project2/dumpTask.h b/project2/dumpTask.h index bc6f69c..b3dc906 100644 --- a/project2/dumpTask.h +++ b/project2/dumpTask.h @@ -3,16 +3,14 @@ #include "task.h" -class _DumpTask : public _Task { +class DumpTask : public Task { public: - _DumpTask(const xmlpp::Element * p); - virtual ~_DumpTask(); + DumpTask(const xmlpp::Element * p); + virtual ~DumpTask(); virtual void loadComplete(const CommonObjects *); virtual void execute() const; }; -typedef boost::intrusive_ptr<_DumpTask> DumpTask; -typedef std::map<std::string, DumpTask> DumpTasks; #endif diff --git a/project2/fileRows.cpp b/project2/fileRows.cpp index 3a16ed6..f9bdebf 100644 --- a/project2/fileRows.cpp +++ b/project2/fileRows.cpp @@ -2,10 +2,10 @@ #include "xmlObjectLoader.h" #include "exceptions.h" -ElementLoaderImpl<_FileRows> filerowsLoader("filerows"); +ElementLoaderImpl<FileRows> filerowsLoader("filerows"); -_FileRows::_FileRows(const xmlpp::Element * p) : - _SourceObject(p), +FileRows::FileRows(const xmlpp::Element * p) : + SourceObject(p), PerRowValues(p), path(p->get_attribute_value("path")), fieldSep(p->get_attribute_value("fieldSep")[0]), @@ -21,35 +21,35 @@ _FileRows::_FileRows(const xmlpp::Element * p) : } } -_FileRows::~_FileRows() +FileRows::~FileRows() { } void -_FileRows::loadComplete(const CommonObjects *) +FileRows::loadComplete(const CommonObjects *) { } void -_FileRows::setFilter(const Glib::ustring &) +FileRows::setFilter(const Glib::ustring &) { throw NotSupported(__PRETTY_FUNCTION__); } unsigned int -_FileRows::columnCount() const +FileRows::columnCount() const { return columns.size(); } const Glib::ustring & -_FileRows::getColumnName(unsigned int col) const +FileRows::getColumnName(unsigned int col) const { return columns[col]; } void -_FileRows::execute(const RowProcessor * rp) const +FileRows::execute(const RowProcessor * rp) const { rowNum = 0; FileStarChannel c(doOpen()); @@ -113,25 +113,25 @@ _FileRows::execute(const RowProcessor * rp) const } const Glib::ustring & -_FileRows::getCurrentValue(unsigned int col) const +FileRows::getCurrentValue(unsigned int col) const { return *values[col]; } bool -_FileRows::isNull(unsigned int col) const +FileRows::isNull(unsigned int col) const { return false; } bool -_FileRows::isNull(const Glib::ustring & col) const +FileRows::isNull(const Glib::ustring & col) const { return false; } const Glib::ustring & -_FileRows::getCurrentValue(const Glib::ustring & id) const +FileRows::getCurrentValue(const Glib::ustring & id) const { Values::const_iterator v = values.begin(); for (Columns::const_iterator i = columns.begin(); i != columns.end(); i++, v++) { @@ -143,7 +143,7 @@ _FileRows::getCurrentValue(const Glib::ustring & id) const } void -_FileRows::addColumn(const Glib::ustring & rawtok) const +FileRows::addColumn(const Glib::ustring & rawtok) const { columns.push_back(rawtok); Glib::ustring & tok(columns.back()); @@ -158,7 +158,7 @@ _FileRows::addColumn(const Glib::ustring & rawtok) const } FileStarChannel -_FileRows::doOpen() const +FileRows::doOpen() const { FILE * f = fopen(path->c_str(), "r"); if (!f) { diff --git a/project2/fileRows.h b/project2/fileRows.h index 899205c..ec937ad 100644 --- a/project2/fileRows.h +++ b/project2/fileRows.h @@ -11,10 +11,10 @@ class CommonObjects; -class _FileRows : public PerRowValues { +class FileRows : public PerRowValues { public: - _FileRows(const xmlpp::Element * p); - ~_FileRows(); + FileRows(const xmlpp::Element * p); + ~FileRows(); void execute(const RowProcessor *) const; virtual void loadComplete(const CommonObjects *); @@ -44,7 +44,6 @@ class _FileRows : public PerRowValues { typedef std::vector<Glib::ustring> Columns; mutable Columns columns; }; -typedef boost::intrusive_ptr<_FileRows> FileRows; #endif diff --git a/project2/iHaveParameters.cpp b/project2/iHaveParameters.cpp index abab80c..bce857f 100644 --- a/project2/iHaveParameters.cpp +++ b/project2/iHaveParameters.cpp @@ -9,7 +9,7 @@ IHaveParameters::IHaveParameters(const xmlpp::Element * p) BOOST_FOREACH(xmlpp::Node * node, p->find("parameters/param")) { const xmlpp::Element * elem = dynamic_cast<const xmlpp::Element *>(node); if (elem) { - Parameter p = new _Parameter(elem); + ParameterPtr p = new Parameter(elem); parameters[p->name] = p; } } @@ -19,7 +19,7 @@ IHaveParameters::~IHaveParameters() { } -IHaveParameters::_Parameter::_Parameter(const xmlpp::Element * p) : +IHaveParameters::Parameter::Parameter(const xmlpp::Element * p) : name(p->get_attribute_value("name")), value(p->get_attribute("value")) { diff --git a/project2/iHaveParameters.h b/project2/iHaveParameters.h index 83a77b4..8cfe8cd 100644 --- a/project2/iHaveParameters.h +++ b/project2/iHaveParameters.h @@ -9,9 +9,9 @@ class IHaveParameters : public virtual IntrusivePtrBase { public: - class _Parameter : public virtual IntrusivePtrBase { + class Parameter : public virtual IntrusivePtrBase { public: - _Parameter(const xmlpp::Element * p); + Parameter(const xmlpp::Element * p); const Glib::ustring name; const Variable value; }; @@ -20,8 +20,8 @@ class IHaveParameters : public virtual IntrusivePtrBase { const Glib::ustring & getParameter(const Glib::ustring &) const; - typedef boost::intrusive_ptr<_Parameter> Parameter; - typedef std::map<Glib::ustring, Parameter> Parameters; + typedef boost::intrusive_ptr<Parameter> ParameterPtr; + typedef std::map<Glib::ustring, ParameterPtr> Parameters; protected: Parameters parameters; }; diff --git a/project2/iterate.cpp b/project2/iterate.cpp index 7e86c4b..91d5c75 100644 --- a/project2/iterate.cpp +++ b/project2/iterate.cpp @@ -3,11 +3,11 @@ #include <syslog.h> #include "xmlObjectLoader.h" -ElementLoaderImpl<_Iterate> iterateLoader("iterate"); +ElementLoaderImpl<Iterate> iterateLoader("iterate"); -_Iterate::_Iterate(const xmlpp::Element * p) : - _SourceObject(p), - _NoOutputExecute(p), +Iterate::Iterate(const xmlpp::Element * p) : + SourceObject(p), + NoOutputExecute(p), RowProcessor(p) { LoaderBase loader("http://project2.randomdan.homeip.net", true); @@ -15,25 +15,25 @@ _Iterate::_Iterate(const xmlpp::Element * p) : loader.collectAll(p, true); } -_Iterate::~_Iterate() +Iterate::~Iterate() { } void -_Iterate::loadComplete(const CommonObjects * co) +Iterate::loadComplete(const CommonObjects * co) { RowProcessor::loadComplete(co); } void -_Iterate::rowReady() const +Iterate::rowReady() const { executeChildren(); source->rowChanged(); } void -_Iterate::execute() const +Iterate::execute() const { PerRowValues::beginRow(source.get()); try { @@ -47,7 +47,7 @@ _Iterate::execute() const } void -_Iterate::executeChildren() const +Iterate::executeChildren() const { BOOST_FOREACH(NoOutputExecutes::value_type sq, subNOEs) { if (dynamic_cast<const RowProcessor *>(sq.second.get())) { diff --git a/project2/iterate.h b/project2/iterate.h index 852310b..a95aeaf 100644 --- a/project2/iterate.h +++ b/project2/iterate.h @@ -9,14 +9,14 @@ #include "perRowValues.h" #include "noOutputExecute.h" -class _Iterate; -typedef boost::intrusive_ptr<_Iterate> Iterate; -typedef std::map<std::string, Iterate> Iterates; +class Iterate; +typedef boost::intrusive_ptr<Iterate> IteratePtr; +typedef std::map<std::string, IteratePtr> Iterates; -class _Iterate : public _NoOutputExecute, public RowProcessor { +class Iterate : public NoOutputExecute, public RowProcessor { public: - _Iterate(const xmlpp::Element * p); - virtual ~_Iterate(); + Iterate(const xmlpp::Element * p); + virtual ~Iterate(); void loadComplete(const CommonObjects *); void rowReady() const; diff --git a/project2/noOutputExecute.h b/project2/noOutputExecute.h index 3e92aba..9c476eb 100644 --- a/project2/noOutputExecute.h +++ b/project2/noOutputExecute.h @@ -6,15 +6,15 @@ class ApplicationEngine; class PerRowValues; -class _NoOutputExecute; -typedef boost::intrusive_ptr<_NoOutputExecute> NoOutputExecute; -typedef std::map<unsigned int, NoOutputExecute> NoOutputExecutes; +class NoOutputExecute; +typedef boost::intrusive_ptr<NoOutputExecute> NoOutputExecutePtr; +typedef std::map<unsigned int, NoOutputExecutePtr> NoOutputExecutes; -class _NoOutputExecute : public virtual _SourceObject { +class NoOutputExecute : public virtual SourceObject { public: - _NoOutputExecute(const xmlpp::Element * p) : _SourceObject(p) { }; - _NoOutputExecute(const std::string & n) : _SourceObject(n) { }; - virtual ~_NoOutputExecute() { } + NoOutputExecute(const xmlpp::Element * p) : SourceObject(p) { }; + NoOutputExecute(const std::string & n) : SourceObject(n) { }; + virtual ~NoOutputExecute() { } virtual void execute() const = 0; }; diff --git a/project2/paramChecker.cpp b/project2/paramChecker.cpp index 7d2f68a..71b5a74 100644 --- a/project2/paramChecker.cpp +++ b/project2/paramChecker.cpp @@ -1,13 +1,13 @@ #include "paramChecker.h" -_ParamChecker::_ParamChecker(const xmlpp::Element * p) : - _SourceObject(p), +ParamChecker::ParamChecker(const xmlpp::Element * p) : + SourceObject(p), message(xmlChildText(p, "message")), present(p->get_attribute_value("present")) { } -_ParamChecker::~_ParamChecker() +ParamChecker::~ParamChecker() { } diff --git a/project2/paramChecker.h b/project2/paramChecker.h index d2ccbfc..7d14346 100644 --- a/project2/paramChecker.h +++ b/project2/paramChecker.h @@ -9,15 +9,15 @@ #include "variables.h" class ApplicationEngine; -class _ParamChecker; -typedef boost::intrusive_ptr<_ParamChecker> ParamChecker; -typedef std::map<std::string, ParamChecker> ParamCheckers; -typedef std::map<unsigned int, ParamChecker> OrderedParamCheckers; +class ParamChecker; +typedef boost::intrusive_ptr<ParamChecker> ParamCheckerPtr; +typedef std::map<std::string, ParamCheckerPtr> ParamCheckers; +typedef std::map<unsigned int, ParamCheckerPtr> OrderedParamCheckers; -class _ParamChecker : public virtual _SourceObject { +class ParamChecker : public virtual SourceObject { public: - _ParamChecker(const xmlpp::Element * p); - virtual ~_ParamChecker(); + ParamChecker(const xmlpp::Element * p); + virtual ~ParamChecker(); virtual bool performCheck() const = 0; diff --git a/project2/perRowValues.cpp b/project2/perRowValues.cpp index 4666735..d4aa945 100644 --- a/project2/perRowValues.cpp +++ b/project2/perRowValues.cpp @@ -7,7 +7,7 @@ PerRowValues::RowValuesStack PerRowValues::stack; PerRowValues::PerRowValues(const xmlpp::Element * p) : - _SourceObject(p), + SourceObject(p), rowNum(-1) { } @@ -67,7 +67,7 @@ RowUser::~RowUser() } RowProcessor::RowProcessor(const xmlpp::Element * p) : - _SourceObject(p), + SourceObject(p), IHaveParameters(p), recordSource(p->get_attribute_value("source")), filter(p->get_attribute_value("filter")) diff --git a/project2/perRowValues.h b/project2/perRowValues.h index 52b6024..5b8db9b 100644 --- a/project2/perRowValues.h +++ b/project2/perRowValues.h @@ -21,7 +21,7 @@ class PerRowValues; typedef boost::intrusive_ptr<PerRowValues> PerRowValuesPtr; typedef std::map<std::string, PerRowValuesPtr> RowSets; -class RowProcessor : public IHaveParameters, public virtual _SourceObject { +class RowProcessor : public IHaveParameters, public virtual SourceObject { public: RowProcessor(const xmlpp::Element *); virtual void rowReady() const = 0; @@ -34,7 +34,7 @@ class RowProcessor : public IHaveParameters, public virtual _SourceObject { PerRowValuesPtr source; }; -class PerRowValues : public virtual _SourceObject { +class PerRowValues : public virtual SourceObject { public: class ParentOutOfRange : public std::exception { }; class FieldDoesNotExist : public std::exception { }; diff --git a/project2/procRows.cpp b/project2/procRows.cpp index f4a34a1..25730d3 100644 --- a/project2/procRows.cpp +++ b/project2/procRows.cpp @@ -2,28 +2,28 @@ #include "xmlObjectLoader.h" #include <stdexcept> -ElementLoaderImpl<_ProcRows> procrowsLoader("procrows"); +ElementLoaderImpl<ProcRows> procrowsLoader("procrows"); class SubProcessFailedToStart : public std::exception { }; class SubProcessFailed : public std::exception { }; -_ProcRows::_ProcRows(const xmlpp::Element * p) : - _SourceObject(p), - _FileRows(p) +ProcRows::ProcRows(const xmlpp::Element * p) : + SourceObject(p), + FileRows(p) { } -_ProcRows::~_ProcRows() +ProcRows::~ProcRows() { } void -_ProcRows::loadComplete(const CommonObjects *) +ProcRows::loadComplete(const CommonObjects *) { } FileStarChannel -_ProcRows::doOpen() const +ProcRows::doOpen() const { FILE * f = popen(path->c_str(), "re"); if (!f) { @@ -33,7 +33,7 @@ _ProcRows::doOpen() const } int -_ProcRows::doClose(FILE * f) +ProcRows::doClose(FILE * f) { int pclo = pclose(f); if (pclo != 0) { diff --git a/project2/procRows.h b/project2/procRows.h index bada523..c35a2c1 100644 --- a/project2/procRows.h +++ b/project2/procRows.h @@ -3,10 +3,10 @@ #include "fileRows.h" -class _ProcRows : public _FileRows { +class ProcRows : public FileRows { public: - _ProcRows(const xmlpp::Element * p); - ~_ProcRows(); + ProcRows(const xmlpp::Element * p); + ~ProcRows(); virtual void loadComplete(const CommonObjects *); virtual FileStarChannel doOpen() const; diff --git a/project2/rawView.cpp b/project2/rawView.cpp index 3a97cd3..595890b 100644 --- a/project2/rawView.cpp +++ b/project2/rawView.cpp @@ -5,22 +5,22 @@ #include "environment.h" #include "appEngine.h" -ElementLoaderImpl<_RawView> rawviewLoader("rawview"); +ElementLoaderImpl<RawView> rawviewLoader("rawview"); -_RawView::_RawView(const xmlpp::Element * p) : - _SourceObject(p), - _View(p), +RawView::RawView(const xmlpp::Element * p) : + SourceObject(p), + View(p), copyRoot(p) { } void -_RawView::loadComplete(const CommonObjects *) +RawView::loadComplete(const CommonObjects *) { } void -_RawView::execute(const Presenter * p) const +RawView::execute(const Presenter * p) const { BOOST_FOREACH(xmlpp::Node * node, copyRoot->get_children()) { const xmlpp::Element * e = dynamic_cast<const xmlpp::Element *>(node); @@ -31,7 +31,7 @@ _RawView::execute(const Presenter * p) const } void -_RawView::copyNode(const Presenter * p, const xmlpp::Element * n) const +RawView::copyNode(const Presenter * p, const xmlpp::Element * n) const { p->pushSub(n->get_name()); xmlpp::Element::AttributeList al = n->get_attributes(); diff --git a/project2/rawView.h b/project2/rawView.h index 3f0de83..5ccd02c 100644 --- a/project2/rawView.h +++ b/project2/rawView.h @@ -6,17 +6,15 @@ #include <map> #include "view.h" -class _RawView : public _View { +class RawView : public View { public: - _RawView(const xmlpp::Element * p); + RawView(const xmlpp::Element * p); void execute(const Presenter *) const; virtual void loadComplete(const CommonObjects *); private: void copyNode(const Presenter *, const xmlpp::Element *) const; const xmlpp::Element * copyRoot; }; -typedef boost::intrusive_ptr<_RawView> RawView; -typedef std::map<std::string, RawView> RawViews; #endif diff --git a/project2/rdbmsDataSource.cpp b/project2/rdbmsDataSource.cpp index 4dccc08..e79b841 100644 --- a/project2/rdbmsDataSource.cpp +++ b/project2/rdbmsDataSource.cpp @@ -6,41 +6,41 @@ #include <errno.h> #include <sqlext.h> -class RdbmsDataSourceLoader : public ElementLoaderImpl<_RdbmsDataSource> { +class RdbmsDataSourceLoader : public ElementLoaderImpl<RdbmsDataSource> { public: - RdbmsDataSourceLoader() : ElementLoaderImpl<_RdbmsDataSource>("rdbmsdatasource") + RdbmsDataSourceLoader() : ElementLoaderImpl<RdbmsDataSource>("rdbmsdatasource") { } void onIdle() { // Disconnect all cached database connections - _RdbmsDataSource::dbhosts.clear(); + RdbmsDataSource::dbhosts.clear(); } - static bool isConnectionExpired(const _RdbmsDataSource::DBHosts::value_type & con) + static bool isConnectionExpired(const RdbmsDataSource::DBHosts::value_type & con) { return con.second->isExpired(); } void onPeriodic() { // Disconnect expired database connections - _RdbmsDataSource::DBHosts::iterator i; - while ((i = std::find_if(_RdbmsDataSource::dbhosts.begin(), _RdbmsDataSource::dbhosts.end(), isConnectionExpired)) != _RdbmsDataSource::dbhosts.end()) { - _RdbmsDataSource::dbhosts.erase(i); + RdbmsDataSource::DBHosts::iterator i; + while ((i = std::find_if(RdbmsDataSource::dbhosts.begin(), RdbmsDataSource::dbhosts.end(), isConnectionExpired)) != RdbmsDataSource::dbhosts.end()) { + RdbmsDataSource::dbhosts.erase(i); } } void onIteration() { - _RdbmsDataSource::changedDSNs.clear(); + RdbmsDataSource::changedDSNs.clear(); } } rdbmsLoader; -_RdbmsDataSource::DBHosts _RdbmsDataSource::dbhosts; -_RdbmsDataSource::FailedHosts _RdbmsDataSource::failedhosts; -_RdbmsDataSource::DSNSet _RdbmsDataSource::changedDSNs; +RdbmsDataSource::DBHosts RdbmsDataSource::dbhosts; +RdbmsDataSource::FailedHosts RdbmsDataSource::failedhosts; +RdbmsDataSource::DSNSet RdbmsDataSource::changedDSNs; -_RdbmsDataSource::_RdbmsDataSource(const xmlpp::Element * p) : - _SourceObject(p), - _DataSource(p), +RdbmsDataSource::RdbmsDataSource(const xmlpp::Element * p) : + SourceObject(p), + DataSource(p), masterDsn(xmlChildText(p, "masterdsn")), preferLocal(p->get_attribute_value("preferlocal") != "false") { @@ -52,17 +52,17 @@ _RdbmsDataSource::_RdbmsDataSource(const xmlpp::Element * p) : } } -_RdbmsDataSource::~_RdbmsDataSource() +RdbmsDataSource::~RdbmsDataSource() { } void -_RdbmsDataSource::loadComplete(const CommonObjects *) +RdbmsDataSource::loadComplete(const CommonObjects *) { } ODBC::Connection & -_RdbmsDataSource::getWritable() const +RdbmsDataSource::getWritable() const { ConnectionPtr master = connectTo(masterDsn); if (!master->inTx()) { @@ -73,7 +73,7 @@ _RdbmsDataSource::getWritable() const } ODBC::Connection & -_RdbmsDataSource::getReadonly() const +RdbmsDataSource::getReadonly() const { if (changedDSNs.find(name) != changedDSNs.end()) { return *connectTo(masterDsn); @@ -114,7 +114,7 @@ _RdbmsDataSource::getReadonly() const } void -_RdbmsDataSource::commit() +RdbmsDataSource::commit() { DBHosts::const_iterator m = dbhosts.find(masterDsn); if (m != dbhosts.end() && m->second->inTx()) { @@ -123,7 +123,7 @@ _RdbmsDataSource::commit() } void -_RdbmsDataSource::rollback() +RdbmsDataSource::rollback() { DBHosts::const_iterator m = dbhosts.find(masterDsn); if (m != dbhosts.end() && m->second->inTx()) { @@ -132,8 +132,8 @@ _RdbmsDataSource::rollback() changedDSNs.erase(name); } -_RdbmsDataSource::ConnectionPtr -_RdbmsDataSource::connectTo(const std::string & dsn) +RdbmsDataSource::ConnectionPtr +RdbmsDataSource::connectTo(const std::string & dsn) { FailedHosts::iterator dbf = failedhosts.find(dsn); if (dbf != failedhosts.end()) { @@ -171,7 +171,7 @@ _RdbmsDataSource::connectTo(const std::string & dsn) } } -_RdbmsDataSource::RdbmsConnection::RdbmsConnection(const std::string & dsn, time_t kat) : +RdbmsDataSource::RdbmsConnection::RdbmsConnection(const std::string & dsn, time_t kat) : ODBC::Connection(dsn), lastUsedTime(0), keepAliveTime(kat) @@ -179,13 +179,13 @@ _RdbmsDataSource::RdbmsConnection::RdbmsConnection(const std::string & dsn, time } void -_RdbmsDataSource::RdbmsConnection::touch() const +RdbmsDataSource::RdbmsConnection::touch() const { time(&lastUsedTime); } bool -_RdbmsDataSource::RdbmsConnection::isExpired() const +RdbmsDataSource::RdbmsConnection::isExpired() const { return (time(NULL) > lastUsedTime + keepAliveTime); } diff --git a/project2/rdbmsDataSource.h b/project2/rdbmsDataSource.h index 5421b3f..ad97624 100644 --- a/project2/rdbmsDataSource.h +++ b/project2/rdbmsDataSource.h @@ -7,7 +7,7 @@ #include "dataSource.h" #include "connection.h" -class _RdbmsDataSource : public _DataSource { +class RdbmsDataSource : public DataSource { public: class RdbmsConnection : public ODBC::Connection { public: @@ -22,8 +22,8 @@ class _RdbmsDataSource : public _DataSource { typedef std::map<std::string, std::string> ReadonlyDSNs; // Map hostname to DSN string typedef std::map<std::string, ConnectionPtr> DBHosts; // Map DSN strings to connections typedef std::map<std::string, const ODBC::ConnectionError> FailedHosts; // Map DSN strings to failures - _RdbmsDataSource(const xmlpp::Element * p); - ~_RdbmsDataSource(); + RdbmsDataSource(const xmlpp::Element * p); + ~RdbmsDataSource(); ODBC::Connection & getReadonly() const; ODBC::Connection & getWritable() const; virtual void loadComplete(const CommonObjects *); @@ -45,8 +45,6 @@ class _RdbmsDataSource : public _DataSource { friend class RdbmsDataSourceLoader; }; -typedef boost::shared_ptr<_RdbmsDataSource> RdbmsDataSource; -typedef std::map<std::string, RdbmsDataSource> RdbmsDataSources; #endif diff --git a/project2/regexCheck.cpp b/project2/regexCheck.cpp index 92b7563..1af5fa1 100644 --- a/project2/regexCheck.cpp +++ b/project2/regexCheck.cpp @@ -3,27 +3,27 @@ #include "commonObjects.h" #include <boost/regex.hpp> -ElementLoaderImpl<_RegexCheck> regexCheckLoader("regexcheck"); +ElementLoaderImpl<RegexCheck> regexCheckLoader("regexcheck"); -_RegexCheck::_RegexCheck(const xmlpp::Element * p) : - _SourceObject(p), - _ParamChecker(p), +RegexCheck::RegexCheck(const xmlpp::Element * p) : + SourceObject(p), + ParamChecker(p), applyTo(p->get_attribute("apply-to")), regex(xmlChildText(p, "regex").raw()) { } -_RegexCheck::~_RegexCheck() +RegexCheck::~RegexCheck() { } void -_RegexCheck::loadComplete(const CommonObjects *) +RegexCheck::loadComplete(const CommonObjects *) { } bool -_RegexCheck::performCheck() const +RegexCheck::performCheck() const { const Glib::ustring & param(applyTo); return boost::regex_match(param.begin(), param.end(), regex); diff --git a/project2/regexCheck.h b/project2/regexCheck.h index 868f97e..818b11e 100644 --- a/project2/regexCheck.h +++ b/project2/regexCheck.h @@ -4,10 +4,10 @@ #include "paramChecker.h" #include <boost/regex.hpp> -class _RegexCheck : public _ParamChecker { +class RegexCheck : public ParamChecker { public: - _RegexCheck(const xmlpp::Element * p); - virtual ~_RegexCheck(); + RegexCheck(const xmlpp::Element * p); + virtual ~RegexCheck(); virtual void loadComplete(const CommonObjects *); bool performCheck() const; @@ -15,7 +15,5 @@ class _RegexCheck : public _ParamChecker { const Variable applyTo; const boost::regex regex; }; -typedef boost::intrusive_ptr<_RegexCheck> RegexCheck; -typedef std::map<std::string, RegexCheck> RegexChecks; #endif diff --git a/project2/sendmailTask.cpp b/project2/sendmailTask.cpp index 97c7b4f..a95945f 100644 --- a/project2/sendmailTask.cpp +++ b/project2/sendmailTask.cpp @@ -11,7 +11,7 @@ #include <libxml/HTMLtree.h> #include <sys/wait.h> -ElementLoaderImpl<_SendMailTask> sendmailLoader("sendmail"); +ElementLoaderImpl<SendMailTask> sendmailLoader("sendmail"); class SendEmailFailed : public std::runtime_error { public: @@ -20,9 +20,9 @@ class SendEmailFailed : public std::runtime_error { typedef boost::shared_ptr<xmlDoc> XmlDocumentPtr; -_SendMailTask::_SendMailTask(const xmlpp::Element * p) : - _SourceObject(p), - _Task(p), +SendMailTask::SendMailTask(const xmlpp::Element * p) : + SourceObject(p), + Task(p), to(p->get_attribute("to")), subject(p->get_attribute("subject")), from(p->get_attribute("from")), @@ -31,22 +31,22 @@ _SendMailTask::_SendMailTask(const xmlpp::Element * p) : { } -_SendMailTask::~_SendMailTask() +SendMailTask::~SendMailTask() { } void -_SendMailTask::loadComplete(const CommonObjects *) +SendMailTask::loadComplete(const CommonObjects *) { } const char * -_SendMailTask::writeMailWrapper(void ** buf, int * len, void * arg) +SendMailTask::writeMailWrapper(void ** buf, int * len, void * arg) { - return static_cast<const _SendMailTask*>(arg)->writeMail(buf, len); + return static_cast<const SendMailTask*>(arg)->writeMail(buf, len); } -class BoundaryBegin : public _SendMailTask::MailPart { +class BoundaryBegin : public SendMailTask::MailPart { public: BoundaryBegin(const std::string & ct) : contentType(ct) { } @@ -57,14 +57,14 @@ class BoundaryBegin : public _SendMailTask::MailPart { private: const std::string contentType; }; -class BoundaryEnd : public _SendMailTask::MailPart { +class BoundaryEnd : public SendMailTask::MailPart { public: const char * write(char ** buf, int * len) { *len = 19; return "\r\n--<<divider>>--\r\n"; } }; -class Header : public _SendMailTask::MailPart { +class Header : public SendMailTask::MailPart { public: Header(const std::string & h, const Glib::ustring & v) : header(h), value(v) { @@ -77,7 +77,7 @@ class Header : public _SendMailTask::MailPart { const std::string header; const Glib::ustring value; }; -class HtmlContent : public _SendMailTask::MailPart { +class HtmlContent : public SendMailTask::MailPart { public: HtmlContent(XmlDocumentPtr d) : doc(d) { } @@ -88,7 +88,7 @@ class HtmlContent : public _SendMailTask::MailPart { private: const XmlDocumentPtr doc; }; -class TextContent : public _SendMailTask::MailPart { +class TextContent : public SendMailTask::MailPart { public: TextContent(XmlDocumentPtr d) : doc(d) { } @@ -128,7 +128,7 @@ class TextContent : public _SendMailTask::MailPart { }; void -_SendMailTask::execute() const +SendMailTask::execute() const { XmlPresenterPtr p = new XmlPresenter("emails", present); p->execute(); @@ -168,7 +168,7 @@ _SendMailTask::execute() const smtp_set_server(session, server().c_str()); smtp_set_header(message, "To", NULL, NULL); smtp_add_recipient(message, to().c_str()); - smtp_set_messagecb(message, writeMailWrapper, (_SendMailTask*)this); + smtp_set_messagecb(message, writeMailWrapper, (SendMailTask*)this); if (!smtp_start_session(session)) { char buf[BUFSIZ]; smtp_strerror(smtp_errno(), buf, sizeof buf); @@ -177,7 +177,7 @@ _SendMailTask::execute() const } const char * -_SendMailTask::writeMail(void ** buf, int * len) const +SendMailTask::writeMail(void ** buf, int * len) const { if (len == NULL || part == parts.end()) { return NULL; diff --git a/project2/sendmailTask.h b/project2/sendmailTask.h index f9ab6bd..1f7f193 100644 --- a/project2/sendmailTask.h +++ b/project2/sendmailTask.h @@ -7,19 +7,15 @@ #include "task.h" #include "variables.h" -class ApplicationEngine; -class _View; -typedef unsigned char xmlChar; - -class _SendMailTask : public _Task { +class SendMailTask : public Task { public: class MailPart : public IntrusivePtrBase { public: virtual const char * write(char ** buf, int * len) = 0; }; - _SendMailTask(const xmlpp::Element * p); - virtual ~_SendMailTask(); + SendMailTask(const xmlpp::Element * p); + virtual ~SendMailTask(); virtual void loadComplete(const CommonObjects *); virtual void execute() const; @@ -39,7 +35,5 @@ class _SendMailTask : public _Task { mutable Parts parts; mutable Parts::iterator part; }; -typedef boost::intrusive_ptr<_SendMailTask> SendMailTask; -typedef std::map<std::string, SendMailTask> SendMailTasks; #endif diff --git a/project2/sessionClearTask.cpp b/project2/sessionClearTask.cpp index 8af2b4a..57a4512 100644 --- a/project2/sessionClearTask.cpp +++ b/project2/sessionClearTask.cpp @@ -4,26 +4,26 @@ #include "appEngine.h" #include "session.h" -ElementLoaderImpl<_SessionClearTask> sessionclearLoader("sessionclear"); +ElementLoaderImpl<SessionClearTask> sessionclearLoader("sessionclear"); -_SessionClearTask::_SessionClearTask(const xmlpp::Element * p) : - _SourceObject(p), - _Task(p), +SessionClearTask::SessionClearTask(const xmlpp::Element * p) : + SourceObject(p), + Task(p), key(p->get_attribute_value("key")) { } -_SessionClearTask::~_SessionClearTask() +SessionClearTask::~SessionClearTask() { } void -_SessionClearTask::loadComplete(const CommonObjects *) +SessionClearTask::loadComplete(const CommonObjects *) { } void -_SessionClearTask::execute() const +SessionClearTask::execute() const { ApplicationEngine::getCurrent()->session()->ClearValue(key); } diff --git a/project2/sessionClearTask.h b/project2/sessionClearTask.h index 94bca1d..9b93ed5 100644 --- a/project2/sessionClearTask.h +++ b/project2/sessionClearTask.h @@ -9,13 +9,11 @@ #include "task.h" class CommonObjects; -class _SessionClearTask; -typedef boost::intrusive_ptr<_SessionClearTask> SessionClearTask; -class _SessionClearTask : public virtual _Task { +class SessionClearTask : public virtual Task { public: - _SessionClearTask(const xmlpp::Element * p); - virtual ~_SessionClearTask(); + SessionClearTask(const xmlpp::Element * p); + virtual ~SessionClearTask(); virtual void loadComplete(const CommonObjects *); void execute() const; diff --git a/project2/sessionSetTask.cpp b/project2/sessionSetTask.cpp index a8ac749..df96c66 100644 --- a/project2/sessionSetTask.cpp +++ b/project2/sessionSetTask.cpp @@ -5,27 +5,27 @@ #include "appEngine.h" #include "session.h" -ElementLoaderImpl<_SessionSetTask> sessionsetLoader("sessionset"); +ElementLoaderImpl<SessionSetTask> sessionsetLoader("sessionset"); -_SessionSetTask::_SessionSetTask(const xmlpp::Element * p) : - _SourceObject(p), - _Task(p), +SessionSetTask::SessionSetTask(const xmlpp::Element * p) : + SourceObject(p), + Task(p), key(p->get_attribute_value("key")), value(p->get_attribute("value")) { } -_SessionSetTask::~_SessionSetTask() +SessionSetTask::~SessionSetTask() { } void -_SessionSetTask::loadComplete(const CommonObjects *) +SessionSetTask::loadComplete(const CommonObjects *) { } void -_SessionSetTask::execute() const +SessionSetTask::execute() const { ApplicationEngine::getCurrent()->session()->SetValue(key, value); } diff --git a/project2/sessionSetTask.h b/project2/sessionSetTask.h index f85e8f1..5cf139e 100644 --- a/project2/sessionSetTask.h +++ b/project2/sessionSetTask.h @@ -10,13 +10,11 @@ #include "variables.h" class CommonObjects; -class _SessionSetTask; -typedef boost::intrusive_ptr<_SessionSetTask> SessionSetTask; -class _SessionSetTask : public virtual _Task { +class SessionSetTask : public virtual Task { public: - _SessionSetTask(const xmlpp::Element * p); - virtual ~_SessionSetTask(); + SessionSetTask(const xmlpp::Element * p); + virtual ~SessionSetTask(); virtual void loadComplete(const CommonObjects *); void execute() const; diff --git a/project2/sourceObject.cpp b/project2/sourceObject.cpp index 533ab5b..b2bcf12 100644 --- a/project2/sourceObject.cpp +++ b/project2/sourceObject.cpp @@ -1,20 +1,20 @@ #include "sourceObject.h" -unsigned int _SourceObject::loadOrder = 1; +unsigned int SourceObject::loadOrder = 1; -_SourceObject::_SourceObject(const xmlpp::Element * p) : +SourceObject::SourceObject(const xmlpp::Element * p) : name(p->get_attribute_value("name")), order(loadOrder++) { } -_SourceObject::_SourceObject(const std::string & n) : +SourceObject::SourceObject(const std::string & n) : name(n), order(loadOrder++) { } -_SourceObject::~_SourceObject() +SourceObject::~SourceObject() { } diff --git a/project2/sourceObject.h b/project2/sourceObject.h index 1ccc4af..fe6b4cc 100644 --- a/project2/sourceObject.h +++ b/project2/sourceObject.h @@ -6,13 +6,13 @@ #include "intrusivePtrBase.h" class CommonObjects; -class _SourceObject; -typedef boost::intrusive_ptr<_SourceObject> Project2SourceObject; -class _SourceObject : public virtual IntrusivePtrBase { +class SourceObject; +typedef boost::intrusive_ptr<SourceObject> SourceObjectPtr; +class SourceObject : public virtual IntrusivePtrBase { public: - _SourceObject(const xmlpp::Element * p); - _SourceObject(const std::string & name); - virtual ~_SourceObject() = 0; + SourceObject(const xmlpp::Element * p); + SourceObject(const std::string & name); + virtual ~SourceObject() = 0; virtual void loadComplete(const CommonObjects *) = 0; diff --git a/project2/sqlCheck.cpp b/project2/sqlCheck.cpp index f348689..a65b379 100644 --- a/project2/sqlCheck.cpp +++ b/project2/sqlCheck.cpp @@ -6,12 +6,12 @@ #include <boost/regex.hpp> #include "commonObjects.h" -ElementLoaderImpl<_SqlCheck> sqlCheckLoader("sqlcheck"); +ElementLoaderImpl<SqlCheck> sqlCheckLoader("sqlcheck"); -_SqlCheck::_SqlCheck(const xmlpp::Element * p) : - _SourceObject(p), +SqlCheck::SqlCheck(const xmlpp::Element * p) : + SourceObject(p), IHaveParameters(p), - _ParamChecker(p), + ParamChecker(p), dataSource(p->get_attribute_value("datasource")), sql(xmlChildText(p, "sql")), testOp(p->get_attribute_value("testOp")), @@ -20,19 +20,19 @@ _SqlCheck::_SqlCheck(const xmlpp::Element * p) : { } -_SqlCheck::~_SqlCheck() +SqlCheck::~SqlCheck() { delete query; } void -_SqlCheck::loadComplete(const CommonObjects * co) +SqlCheck::loadComplete(const CommonObjects * co) { - query = new ODBC::SelectCommand(co->dataSource<_RdbmsDataSource>(dataSource)->getReadonly(), sql); + query = new ODBC::SelectCommand(co->dataSource<RdbmsDataSource>(dataSource)->getReadonly(), sql); } bool -_SqlCheck::performCheck() const +SqlCheck::performCheck() const { BOOST_FOREACH(Parameters::value_type p, parameters) { query->bindParamS(atoi(p.second->name.c_str()), p.second->value); diff --git a/project2/sqlCheck.h b/project2/sqlCheck.h index 40c6e9a..e4f79ee 100644 --- a/project2/sqlCheck.h +++ b/project2/sqlCheck.h @@ -6,10 +6,10 @@ namespace ODBC { class SelectCommand; } -class _SqlCheck : public IHaveParameters, public _ParamChecker { +class SqlCheck : public IHaveParameters, public ParamChecker { public: - _SqlCheck(const xmlpp::Element * p); - virtual ~_SqlCheck(); + SqlCheck(const xmlpp::Element * p); + virtual ~SqlCheck(); virtual void loadComplete(const CommonObjects *); bool performCheck() const; @@ -21,7 +21,5 @@ class _SqlCheck : public IHaveParameters, public _ParamChecker { private: ODBC::SelectCommand * query; }; -typedef boost::intrusive_ptr<_SqlCheck> SqlCheck; -typedef std::map<std::string, SqlCheck> SqlChecks; #endif diff --git a/project2/sqlMergeTask.cpp b/project2/sqlMergeTask.cpp index 360c98b..09e18ca 100644 --- a/project2/sqlMergeTask.cpp +++ b/project2/sqlMergeTask.cpp @@ -7,17 +7,17 @@ #include <stdexcept> #include <boost/algorithm/string/join.hpp> -bool _SqlMergeTask::defaultUseTempTable = true; -static void attach(Iterate i, ModifyCommand * insert); +bool SqlMergeTask::defaultUseTempTable = true; +static void attach(IteratePtr i, ModifyCommand * insert); -class _SqlMergeInsert; -typedef boost::intrusive_ptr<_SqlMergeInsert> SqlMergeInsert; -class _SqlMergeInsert : public IHaveParameters, public virtual _SourceObject, public _Task { +class SqlMergeInsert; +typedef boost::intrusive_ptr<SqlMergeInsert> SqlMergeInsertPtr; +class SqlMergeInsert : public IHaveParameters, public virtual SourceObject, public Task { public: - _SqlMergeInsert(const xmlpp::Element * p) : - _SourceObject(p), + SqlMergeInsert(const xmlpp::Element * p) : + SourceObject(p), IHaveParameters(p), - _Task(p) { + Task(p) { } void loadComplete(const CommonObjects*) { } @@ -28,17 +28,17 @@ class _SqlMergeInsert : public IHaveParameters, public virtual _SourceObject, pu } } private: - friend void attach(SqlMergeInsert i, ModifyCommand * insert); + friend void attach(SqlMergeInsertPtr i, ModifyCommand * insert); ModifyCommand * insert; }; -ElementLoaderImpl<_SqlMergeTask> sqlmergeLoader("sqlmerge"); -ElementLoaderImpl<_SqlMergeInsert> sqlmergeinsertLoader("sqlmergeinsert"); +ElementLoaderImpl<SqlMergeTask> sqlmergeLoader("sqlmerge"); +ElementLoaderImpl<SqlMergeInsert> sqlmergeinsertLoader("sqlmergeinsert"); // Conversion logic -_SqlMergeTask::_SqlMergeTask(const xmlpp::Element * p) : - _SourceObject(p), - _Task(p), +SqlMergeTask::SqlMergeTask(const xmlpp::Element * p) : + SourceObject(p), + Task(p), updateWhere(p->get_attribute_value("updatewhere")), patchOrder(p->get_attribute_value("patchorder")), earlyKeys(p->get_attribute_value("earlykeys") == "yes"), @@ -78,35 +78,35 @@ _SqlMergeTask::_SqlMergeTask(const xmlpp::Element * p) : } } -_SqlMergeTask::~_SqlMergeTask() +SqlMergeTask::~SqlMergeTask() { delete insCmd; } void -_SqlMergeTask::loadComplete(const CommonObjects * co) +SqlMergeTask::loadComplete(const CommonObjects * co) { - destdb = &co->dataSource<_RdbmsDataSource>(dataSource)->getWritable(); + destdb = &co->dataSource<RdbmsDataSource>(dataSource)->getWritable(); insCmd = insertCommand(); BOOST_FOREACH(const Iterates::value_type & i, sources) { attach(i.second, insCmd); } } -_SqlMergeTask::TargetColumn::TargetColumn(const Column & c) : +SqlMergeTask::TargetColumn::TargetColumn(const Column & c) : column(c), mapcolumn(c) { } bool -_SqlMergeTask::TargetColumn::Sort::operator()(const TargetColumnPtr & a, const TargetColumnPtr & b) const +SqlMergeTask::TargetColumn::Sort::operator()(const TargetColumnPtr & a, const TargetColumnPtr & b) const { return a->column < b->column; } void -_SqlMergeTask::execute() const +SqlMergeTask::execute() const { createTempTable(); if (earlyKeys) { @@ -131,7 +131,7 @@ _SqlMergeTask::execute() const } void -_SqlMergeTask::createTempTable() const +SqlMergeTask::createTempTable() const { if (useView) { ModifyCommand(*destdb, stringf( @@ -156,7 +156,7 @@ _SqlMergeTask::createTempTable() const tempTableCreated = true; } void -_SqlMergeTask::dropTempTable() const +SqlMergeTask::dropTempTable() const { if (tempTableCreated) { if (useView) { @@ -168,7 +168,7 @@ _SqlMergeTask::dropTempTable() const } } void -_SqlMergeTask::createTempKey() const +SqlMergeTask::createTempKey() const { if (useView) return; /* Primary key */ @@ -187,7 +187,7 @@ _SqlMergeTask::createTempKey() const } } ModifyCommand * -_SqlMergeTask::insertCommand() const +SqlMergeTask::insertCommand() const { Buffer ins; ins.appendf("INSERT INTO %s(", dtablet.c_str()); @@ -210,11 +210,11 @@ _SqlMergeTask::insertCommand() const return new ModifyCommand(*destdb, ins); } -class _Populate : public _NoOutputExecute { +class Populate : public NoOutputExecute { public: - _Populate(ModifyCommand * c) : - _SourceObject(__FUNCTION__), - _NoOutputExecute(__FUNCTION__), + Populate(ModifyCommand * c) : + SourceObject(__FUNCTION__), + NoOutputExecute(__FUNCTION__), cmd(c) { } @@ -253,10 +253,10 @@ class _Populate : public _NoOutputExecute { mutable std::vector<unsigned int> idxs; ModifyCommand * cmd; }; -typedef boost::intrusive_ptr<_Populate> Populate; +typedef boost::intrusive_ptr<Populate> PopulatePtr; void -attach(SqlMergeInsert i, ModifyCommand * insert) +attach(SqlMergeInsertPtr i, ModifyCommand * insert) { if (i) { i->insert = insert; @@ -264,24 +264,24 @@ attach(SqlMergeInsert i, ModifyCommand * insert) } static void -attach(Iterate i, ModifyCommand * insert) +attach(IteratePtr i, ModifyCommand * insert) { if (!i) { return; } if (i->subNOEs.empty()) { - i->subNOEs.insert(NoOutputExecutes::value_type(0, new _Populate(insert))); + i->subNOEs.insert(NoOutputExecutes::value_type(0, new Populate(insert))); } else { BOOST_FOREACH(const NoOutputExecutes::value_type & n, i->subNOEs) { - attach(boost::dynamic_pointer_cast<_Iterate>(n.second), insert); - attach(boost::dynamic_pointer_cast<_SqlMergeInsert>(n.second), insert); + attach(boost::dynamic_pointer_cast<Iterate>(n.second), insert); + attach(boost::dynamic_pointer_cast<SqlMergeInsert>(n.second), insert); } } } void -_SqlMergeTask::copyToTempTable() const +SqlMergeTask::copyToTempTable() const { if (useView) return; BOOST_FOREACH(const Iterates::value_type & i, sources) { diff --git a/project2/sqlMergeTask.h b/project2/sqlMergeTask.h index 532367e..ede8424 100644 --- a/project2/sqlMergeTask.h +++ b/project2/sqlMergeTask.h @@ -14,7 +14,7 @@ #include <map> #include <list> -class _SqlMergeTask : public _Task { +class SqlMergeTask : public Task { public: typedef std::string Table; typedef std::string Column; @@ -37,8 +37,8 @@ class _SqlMergeTask : public _Task { typedef std::set<Column> Keys; - _SqlMergeTask(const xmlpp::Element * p); - virtual ~_SqlMergeTask(); + SqlMergeTask(const xmlpp::Element * p); + virtual ~SqlMergeTask(); virtual void loadComplete(const CommonObjects *); void execute() const; diff --git a/project2/sqlRows.cpp b/project2/sqlRows.cpp index 1924207..9d7950f 100644 --- a/project2/sqlRows.cpp +++ b/project2/sqlRows.cpp @@ -8,10 +8,10 @@ #include "xmlObjectLoader.h" #include "commonObjects.h" -ElementLoaderImpl<_SqlRows> sqlviewLoader("sqlrows"); +ElementLoaderImpl<SqlRows> sqlviewLoader("sqlrows"); -_SqlRows::_SqlRows(const xmlpp::Element * p) : - _SourceObject(p), +SqlRows::SqlRows(const xmlpp::Element * p) : + SourceObject(p), PerRowValues(p), dataSource(p->get_attribute_value("datasource")), sqlCommand(dynamic_cast<xmlpp::Element *>(p->get_children("sql").front())), @@ -20,18 +20,18 @@ _SqlRows::_SqlRows(const xmlpp::Element * p) : { } -_SqlRows::~_SqlRows() +SqlRows::~SqlRows() { } void -_SqlRows::loadComplete(const CommonObjects * co) +SqlRows::loadComplete(const CommonObjects * co) { - db = co->dataSource<_RdbmsDataSource>(dataSource); + db = co->dataSource<RdbmsDataSource>(dataSource); } void -_SqlRows::setFilter(const Glib::ustring & name) +SqlRows::setFilter(const Glib::ustring & name) { SqlCommand::FiltersRangeType r = sqlCommand.filters.equal_range(name); for (SqlCommand::Filters::const_iterator i = r.first; i != r.second; i++) { @@ -40,43 +40,43 @@ _SqlRows::setFilter(const Glib::ustring & name) } const Glib::ustring & -_SqlRows::getCurrentValue(const Glib::ustring & id) const +SqlRows::getCurrentValue(const Glib::ustring & id) const { return (*query)[id].compose(); } const Glib::ustring & -_SqlRows::getCurrentValue(unsigned int col) const +SqlRows::getCurrentValue(unsigned int col) const { return (*query)[col].compose(); } bool -_SqlRows::isNull(unsigned int col) const +SqlRows::isNull(unsigned int col) const { return (*query)[col].isNull(); } bool -_SqlRows::isNull(const Glib::ustring & col) const +SqlRows::isNull(const Glib::ustring & col) const { return (*query)[col].isNull(); } unsigned int -_SqlRows::columnCount() const +SqlRows::columnCount() const { return query->columnCount(); } const Glib::ustring & -_SqlRows::getColumnName(unsigned int col) const +SqlRows::getColumnName(unsigned int col) const { return (*query)[col].name; } void -_SqlRows::execute(const RowProcessor * rp) const +SqlRows::execute(const RowProcessor * rp) const { rowNum = 0; unsigned int offset = 0; @@ -91,15 +91,15 @@ _SqlRows::execute(const RowProcessor * rp) const delete query; } -_SqlRows::SqlWriter::SqlWriter() +SqlRows::SqlWriter::SqlWriter() { } -_SqlRows::SqlWriter::~SqlWriter() +SqlRows::SqlWriter::~SqlWriter() { } -_SqlRows::SqlCommand::SqlCommand(const xmlpp::Element * N) +SqlRows::SqlCommand::SqlCommand(const xmlpp::Element * N) { BOOST_FOREACH(xmlpp::Node * n, N->get_children()) { const xmlpp::TextNode * t = dynamic_cast<const xmlpp::TextNode *>(n); @@ -121,7 +121,7 @@ _SqlRows::SqlCommand::SqlCommand(const xmlpp::Element * N) } void -_SqlRows::SqlCommand::writeSql(Glib::ustring & sql) const +SqlRows::SqlCommand::writeSql(Glib::ustring & sql) const { BOOST_FOREACH(const SqlWriterPtr & w, writers) { w->writeSql(sql); @@ -129,14 +129,14 @@ _SqlRows::SqlCommand::writeSql(Glib::ustring & sql) const } void -_SqlRows::SqlCommand::bindParams(const RowProcessor * rp, ODBC::SelectCommand * cmd, unsigned int & offset) const +SqlRows::SqlCommand::bindParams(const RowProcessor * rp, ODBC::SelectCommand * cmd, unsigned int & offset) const { BOOST_FOREACH(const SqlWriterPtr & w, writers) { w->bindParams(rp, cmd, offset); } } -_SqlRows::SqlFilter::SqlFilter(const xmlpp::Element * N) : +SqlRows::SqlFilter::SqlFilter(const xmlpp::Element * N) : name(N->get_attribute_value("name")), active(false) { @@ -155,7 +155,7 @@ _SqlRows::SqlFilter::SqlFilter(const xmlpp::Element * N) : } void -_SqlRows::SqlFilter::writeSql(Glib::ustring & sql) const +SqlRows::SqlFilter::writeSql(Glib::ustring & sql) const { if (active) { BOOST_FOREACH(const SqlWriterPtr & w, writers) { @@ -165,7 +165,7 @@ _SqlRows::SqlFilter::writeSql(Glib::ustring & sql) const } void -_SqlRows::SqlFilter::bindParams(const RowProcessor * rp, ODBC::SelectCommand * cmd, unsigned int & offset) const +SqlRows::SqlFilter::bindParams(const RowProcessor * rp, ODBC::SelectCommand * cmd, unsigned int & offset) const { if (active) { BOOST_FOREACH(const SqlWriterPtr & w, writers) { @@ -174,36 +174,36 @@ _SqlRows::SqlFilter::bindParams(const RowProcessor * rp, ODBC::SelectCommand * c } } -_SqlRows::SqlParameter::SqlParameter(const xmlpp::Element * n) : +SqlRows::SqlParameter::SqlParameter(const xmlpp::Element * n) : name(n->get_attribute_value("name")) { } void -_SqlRows::SqlParameter::writeSql(Glib::ustring & sql) const +SqlRows::SqlParameter::writeSql(Glib::ustring & sql) const { sql.append("?"); } void -_SqlRows::SqlParameter::bindParams(const RowProcessor * rp, ODBC::SelectCommand * cmd, unsigned int & offset) const +SqlRows::SqlParameter::bindParams(const RowProcessor * rp, ODBC::SelectCommand * cmd, unsigned int & offset) const { cmd->bindParamS(offset++, rp->getParameter(name)); } -_SqlRows::SqlText::SqlText(const xmlpp::TextNode * n) : +SqlRows::SqlText::SqlText(const xmlpp::TextNode * n) : text(n->get_content()) { } void -_SqlRows::SqlText::writeSql(Glib::ustring & sql) const +SqlRows::SqlText::writeSql(Glib::ustring & sql) const { sql.append(text); } void -_SqlRows::SqlText::bindParams(const RowProcessor * rp, ODBC::SelectCommand * cmd, unsigned int & offset) const +SqlRows::SqlText::bindParams(const RowProcessor * rp, ODBC::SelectCommand * cmd, unsigned int & offset) const { } diff --git a/project2/sqlRows.h b/project2/sqlRows.h index a00c8ce..f3e5605 100644 --- a/project2/sqlRows.h +++ b/project2/sqlRows.h @@ -8,12 +8,12 @@ #include "iHaveParameters.h" #include "perRowValues.h" -class _RdbmsDataSource; +class RdbmsDataSource; -class _SqlRows : public PerRowValues { +class SqlRows : public PerRowValues { public: - _SqlRows(const xmlpp::Element * p); - ~_SqlRows(); + SqlRows(const xmlpp::Element * p); + ~SqlRows(); void execute(const RowProcessor *) const; virtual void loadComplete(const CommonObjects *); @@ -79,9 +79,8 @@ class _SqlRows : public PerRowValues { }; SqlCommand sqlCommand; mutable ODBC::SelectCommand * query; - const _RdbmsDataSource * db; + const RdbmsDataSource * db; }; -typedef boost::intrusive_ptr<_SqlRows> SqlRows; #endif diff --git a/project2/sqlTask.cpp b/project2/sqlTask.cpp index 2775a74..61bec1d 100644 --- a/project2/sqlTask.cpp +++ b/project2/sqlTask.cpp @@ -5,11 +5,11 @@ #include "rdbmsDataSource.h" #include "commonObjects.h" -ElementLoaderImpl<_SqlTask> sqltaskLoader("sqltask"); +ElementLoaderImpl<SqlTask> sqltaskLoader("sqltask"); -_SqlTask::_SqlTask(const xmlpp::Element * p) : - _SourceObject(p), - _Task(p), +SqlTask::SqlTask(const xmlpp::Element * p) : + SourceObject(p), + Task(p), IHaveParameters(p), dataSource(p->get_attribute_value("datasource")), sql(xmlChildText(p, "sql")), @@ -17,19 +17,19 @@ _SqlTask::_SqlTask(const xmlpp::Element * p) : { } -_SqlTask::~_SqlTask() +SqlTask::~SqlTask() { delete modify; } void -_SqlTask::loadComplete(const CommonObjects * co) +SqlTask::loadComplete(const CommonObjects * co) { - modify = new ODBC::ModifyCommand(co->dataSource<_RdbmsDataSource>(dataSource)->getWritable(), sql); + modify = new ODBC::ModifyCommand(co->dataSource<RdbmsDataSource>(dataSource)->getWritable(), sql); } void -_SqlTask::execute() const +SqlTask::execute() const { BOOST_FOREACH(Parameters::value_type p, parameters) { modify->bindParamS(atoi(p.second->name.c_str()), p.second->value); diff --git a/project2/sqlTask.h b/project2/sqlTask.h index 5984c6f..3cd93c6 100644 --- a/project2/sqlTask.h +++ b/project2/sqlTask.h @@ -7,15 +7,12 @@ #include "task.h" #include "iHaveParameters.h" -class ApplicationEngine; -class _View; - namespace ODBC { class ModifyCommand; } -class _SqlTask : public _Task, public IHaveParameters { +class SqlTask : public Task, public IHaveParameters { public: - _SqlTask(const xmlpp::Element * p); - virtual ~_SqlTask(); + SqlTask(const xmlpp::Element * p); + virtual ~SqlTask(); virtual void loadComplete(const CommonObjects *); virtual void execute() const; @@ -24,8 +21,6 @@ class _SqlTask : public _Task, public IHaveParameters { protected: mutable ODBC::ModifyCommand * modify; }; -typedef boost::intrusive_ptr<_SqlTask> SqlTask; -typedef std::map<std::string, SqlTask> SqlTasks; #endif diff --git a/project2/task.cpp b/project2/task.cpp index 70cf03b..5f828ef 100644 --- a/project2/task.cpp +++ b/project2/task.cpp @@ -1,13 +1,13 @@ #include "task.h" #include <boost/foreach.hpp> -_Task::_Task(const xmlpp::Element * p) : - _SourceObject(p), - _NoOutputExecute(p) +Task::Task(const xmlpp::Element * p) : + SourceObject(p), + NoOutputExecute(p) { } -_Task::~_Task() +Task::~Task() { } diff --git a/project2/task.h b/project2/task.h index 563a623..dc47b07 100644 --- a/project2/task.h +++ b/project2/task.h @@ -2,21 +2,13 @@ #define TASK_H #include <libxml++/nodes/element.h> -#include <boost/intrusive_ptr.hpp> -#include <map> #include "sourceObject.h" -#include "xmlObjectLoader.h" #include "noOutputExecute.h" -class _Task; -typedef boost::intrusive_ptr<_Task> Task; -typedef std::map<std::string, Task> Tasks; -typedef std::map<unsigned int, Task> OrderedTasks; - -class _Task : public virtual _SourceObject, public _NoOutputExecute { +class Task : public virtual SourceObject, public NoOutputExecute { public: - _Task(const xmlpp::Element * p); - virtual ~_Task(); + Task(const xmlpp::Element * p); + virtual ~Task(); virtual void execute() const = 0; }; diff --git a/project2/urlRows.cpp b/project2/urlRows.cpp index 94ee05e..68d81e4 100644 --- a/project2/urlRows.cpp +++ b/project2/urlRows.cpp @@ -5,10 +5,10 @@ #include <stdexcept> #include <queue> -ElementLoaderImpl<_UrlRows> urlrowsLoader("urlrows"); +ElementLoaderImpl<UrlRows> urlrowsLoader("urlrows"); -_UrlRows::_UrlRows(const xmlpp::Element * p) : - _SourceObject(p), +UrlRows::UrlRows(const xmlpp::Element * p) : + SourceObject(p), PerRowValues(p), url(p->get_attribute_value("url")), fieldSep(p->get_attribute_value("fieldSep")[0]), @@ -28,53 +28,53 @@ _UrlRows::_UrlRows(const xmlpp::Element * p) : mkCols = columns.empty(); } -_UrlRows::~_UrlRows() +UrlRows::~UrlRows() { } void -_UrlRows::loadComplete(const CommonObjects *) +UrlRows::loadComplete(const CommonObjects *) { } void -_UrlRows::setFilter(const Glib::ustring &) +UrlRows::setFilter(const Glib::ustring &) { throw NotSupported(__PRETTY_FUNCTION__); } unsigned int -_UrlRows::columnCount() const +UrlRows::columnCount() const { return columns.size(); } const Glib::ustring & -_UrlRows::getColumnName(unsigned int col) const +UrlRows::getColumnName(unsigned int col) const { return columns[col]; } const Glib::ustring & -_UrlRows::getCurrentValue(unsigned int col) const +UrlRows::getCurrentValue(unsigned int col) const { return *values[col]; } bool -_UrlRows::isNull(unsigned int col) const +UrlRows::isNull(unsigned int col) const { return false; } bool -_UrlRows::isNull(const Glib::ustring & col) const +UrlRows::isNull(const Glib::ustring & col) const { return false; } const Glib::ustring & -_UrlRows::getCurrentValue(const Glib::ustring & id) const +UrlRows::getCurrentValue(const Glib::ustring & id) const { Values::const_iterator v = values.begin(); for (Columns::const_iterator i = columns.begin(); i != columns.end(); i++, v++) { @@ -86,7 +86,7 @@ _UrlRows::getCurrentValue(const Glib::ustring & id) const } size_t -_UrlRows::_handleData(const char * ptr, size_t size, size_t nmemb, void *stream) +UrlRows::handleDataHelper(const char * ptr, size_t size, size_t nmemb, void *stream) { const callback * cb = static_cast<const callback *>(stream); size_t used = cb->urlRows->handleData(cb->rp, ptr, size * nmemb); @@ -94,7 +94,7 @@ _UrlRows::_handleData(const char * ptr, size_t size, size_t nmemb, void *stream) } size_t -_UrlRows::handleData(const RowProcessor * rp, const char * bytes, size_t bytesLen) const +UrlRows::handleData(const RowProcessor * rp, const char * bytes, size_t bytesLen) const { size_t used = 0, len = 0; char * utf8 = g_convert(bytes, bytesLen, "utf-8", encoding.c_str(), &used, &len, NULL); @@ -157,7 +157,7 @@ _UrlRows::handleData(const RowProcessor * rp, const char * bytes, size_t bytesLe } void -_UrlRows::addColumn(const Glib::ustring & rawtok) const +UrlRows::addColumn(const Glib::ustring & rawtok) const { columns.push_back(rawtok); Glib::ustring & tok(columns.back()); @@ -172,7 +172,7 @@ _UrlRows::addColumn(const Glib::ustring & rawtok) const } void -_UrlRows::execute(const RowProcessor * rp) const +UrlRows::execute(const RowProcessor * rp) const { rowNum = 0; CurlHandle::Ptr c = new CurlHandle(); @@ -185,7 +185,7 @@ _UrlRows::execute(const RowProcessor * rp) const c->setopt(CURLOPT_USERAGENT, "project2/0.3"); callback cb(this, rp); c->setopt(CURLOPT_WRITEDATA, &cb); - c->setopt(CURLOPT_WRITEFUNCTION, &_handleData); + c->setopt(CURLOPT_WRITEFUNCTION, &handleDataHelper); c->perform(); if (!tok.empty()) { if (skipheader == 0) { @@ -208,7 +208,7 @@ _UrlRows::execute(const RowProcessor * rp) const values.clear(); } -_UrlRows::callback::callback(const _UrlRows * u, const RowProcessor * r) : +UrlRows::callback::callback(const UrlRows * u, const RowProcessor * r) : urlRows(u), rp(r) { diff --git a/project2/urlRows.h b/project2/urlRows.h index 83c11ce..3333fca 100644 --- a/project2/urlRows.h +++ b/project2/urlRows.h @@ -7,10 +7,10 @@ #include <map> #include "perRowValues.h" -class _UrlRows : public PerRowValues { +class UrlRows : public PerRowValues { public: - _UrlRows(const xmlpp::Element * p); - ~_UrlRows(); + UrlRows(const xmlpp::Element * p); + ~UrlRows(); virtual void loadComplete(const CommonObjects *); void execute(const RowProcessor *) const; @@ -33,11 +33,11 @@ class _UrlRows : public PerRowValues { private: struct callback { - callback(const _UrlRows * urlRows, const RowProcessor * rp); - const _UrlRows * urlRows; + callback(const UrlRows * urlRows, const RowProcessor * rp); + const UrlRows * urlRows; const RowProcessor * rp; }; - static size_t _handleData(const char * ptr, size_t size, size_t nmemb, void * stream); + static size_t handleDataHelper(const char * ptr, size_t size, size_t nmemb, void * stream); size_t handleData(const RowProcessor * rp, const char * bytes, size_t bytesLen) const; gunichar fieldSep; gunichar quoteChar; @@ -53,7 +53,6 @@ class _UrlRows : public PerRowValues { mutable bool prevWasQuote; mutable Glib::ustring tok; }; -typedef boost::intrusive_ptr<_UrlRows> UrlRows; #endif diff --git a/project2/view.cpp b/project2/view.cpp index d32b275..53eff61 100644 --- a/project2/view.cpp +++ b/project2/view.cpp @@ -3,20 +3,20 @@ #include <boost/foreach.hpp> #include <stdexcept> -ElementLoaderImpl<_RowView> viewLoader("view"); +ElementLoaderImpl<RowView> viewLoader("view"); -_View::_View(const xmlpp::Element * p) : - _SourceObject(p) +View::View(const xmlpp::Element * p) : + SourceObject(p) { } -_View::~_View() +View::~View() { } -_RowView::_RowView(const xmlpp::Element * p) : - _SourceObject(p), - _View(p), +RowView::RowView(const xmlpp::Element * p) : + SourceObject(p), + View(p), RowProcessor(p), rootName(p->get_attribute_value("rootname")), recordName(p->get_attribute_value("recordname")) @@ -32,18 +32,18 @@ _RowView::_RowView(const xmlpp::Element * p) : loader.collectAll(p, true); } -_RowView::~_RowView() +RowView::~RowView() { } void -_RowView::loadComplete(const CommonObjects * co) +RowView::loadComplete(const CommonObjects * co) { RowProcessor::loadComplete(co); } void -_RowView::rowReady() const +RowView::rowReady() const { presenter->pushSub(recordName); if (viewColumns.empty()) { @@ -67,7 +67,7 @@ _RowView::rowReady() const } void -_RowView::execute(const Presenter * p) const +RowView::execute(const Presenter * p) const { presenter = p; presenter->pushSub(rootName); @@ -85,7 +85,7 @@ _RowView::execute(const Presenter * p) const } void -_RowView::executeChildren() const +RowView::executeChildren() const { BOOST_FOREACH(Views::value_type sq, subViews) { sq.second->execute(presenter); diff --git a/project2/view.h b/project2/view.h index 081cf13..9f77cb6 100644 --- a/project2/view.h +++ b/project2/view.h @@ -10,22 +10,22 @@ #include "variables.h" class Presenter; -class _View; -typedef boost::intrusive_ptr<_View> View; -typedef std::map<std::string, View> Views; +class View; +typedef boost::intrusive_ptr<View> ViewPtr; +typedef std::map<std::string, ViewPtr> Views; -class _View : public virtual _SourceObject { +class View : public virtual SourceObject { public: - _View(const xmlpp::Element *); - virtual ~_View(); + View(const xmlpp::Element *); + virtual ~View(); virtual void execute(const Presenter *) const = 0; }; -class _RowView : public _View, public RowProcessor { +class RowView : public View, public RowProcessor { public: - _RowView(const xmlpp::Element *); - virtual ~_RowView(); + RowView(const xmlpp::Element *); + virtual ~RowView(); void loadComplete(const CommonObjects *); void execute(const Presenter *) const; diff --git a/project2/xmlObjectLoader.cpp b/project2/xmlObjectLoader.cpp index cfbf1a4..aa1873b 100644 --- a/project2/xmlObjectLoader.cpp +++ b/project2/xmlObjectLoader.cpp @@ -3,7 +3,7 @@ #include <stdio.h> unsigned int LoaderBase::depth = 0; -std::set<Project2SourceObject> LoaderBase::loadedObjects; +std::set<SourceObjectPtr> LoaderBase::loadedObjects; LoaderBase::ElementLoaderMap & LoaderBase::getMap() @@ -34,7 +34,7 @@ LoaderBase::collectAll(const xmlpp::Element * node, bool childrenOnly) const Glib::ustring name = node->get_name(); unsigned int stored = 0; for(ElementLoaderMap::const_iterator i = getMap().lower_bound(name); i != getMap().upper_bound(name); i++) { - Project2SourceObject o = i->second->go(node); + SourceObjectPtr o = i->second->go(node); created += 1; loadedObjects.insert(o); BOOST_FOREACH(std::set<boost::intrusive_ptr<Storer> >::value_type s, supportedStorers) { @@ -65,7 +65,7 @@ LoaderBase::collectAll(const CommonObjects * co, const xmlpp::Element * node, bo throw std::logic_error("Cannot set CommonObjects in subloader"); } collectAll(node, childrenOnly); - BOOST_FOREACH(Project2SourceObject o, loadedObjects) { + BOOST_FOREACH(SourceObjectPtr o, loadedObjects) { o->loadComplete(co); } loadedObjects.clear(); diff --git a/project2/xmlObjectLoader.h b/project2/xmlObjectLoader.h index 5f79122..1ebc154 100644 --- a/project2/xmlObjectLoader.h +++ b/project2/xmlObjectLoader.h @@ -22,7 +22,7 @@ class Storer : public virtual IntrusivePtrBase { template <class X, class Key> static boost::intrusive_ptr<Storer> into(std::map<Key, boost::intrusive_ptr<X> > * map); - virtual bool save(Project2SourceObject o) const = 0; + virtual bool save(SourceObjectPtr o) const = 0; }; template <class X, class K> @@ -45,7 +45,7 @@ class StorerImpl<X, unsigned int> : public StorerImplBase<X, unsigned int> { StorerImpl(std::map<Key, Ptr> * m) : StorerImplBase<X, Key>(m) { } - bool save(Project2SourceObject obj) const + bool save(SourceObjectPtr obj) const { Ptr O = boost::dynamic_pointer_cast<X>(obj); if (O) { @@ -64,7 +64,7 @@ class StorerImpl<X, std::string> : public StorerImplBase<X, std::string> { StorerImpl(std::map<Key, Ptr> * m) : StorerImplBase<X, Key>(m) { } - bool save(Project2SourceObject obj) const + bool save(SourceObjectPtr obj) const { Ptr O = boost::dynamic_pointer_cast<X>(obj); if (O) { @@ -104,7 +104,7 @@ class LoaderBase { private: static unsigned int depth; - static std::set<Project2SourceObject> loadedObjects; + static std::set<SourceObjectPtr> loadedObjects; const bool recursive; public: @@ -113,7 +113,7 @@ class LoaderBase { class ElementLoader { public: - virtual Project2SourceObject go(const xmlpp::Element * xml) const = 0; + virtual SourceObjectPtr go(const xmlpp::Element * xml) const = 0; virtual void onIdle(); // When the app engine goes idle virtual void onIteration(); // When the app engine has completed an iteration virtual void onPeriodic(); // When the app engine feels like it @@ -131,7 +131,7 @@ class ElementLoaderImpl : ElementLoader { { LoaderBase::getMap().erase(xmlName); } - Project2SourceObject go(const xmlpp::Element * xml) const + SourceObjectPtr go(const xmlpp::Element * xml) const { return new X(xml); } diff --git a/project2/xmlRows.cpp b/project2/xmlRows.cpp index bfccca1..ba5697a 100644 --- a/project2/xmlRows.cpp +++ b/project2/xmlRows.cpp @@ -9,10 +9,10 @@ #include <boost/algorithm/string/join.hpp> #include <boost/algorithm/string/predicate.hpp> -ElementLoaderImpl<_XmlRows> xmlrowLoader("xmlrows"); +ElementLoaderImpl<XmlRows> xmlrowLoader("xmlrows"); -_XmlRows::_XmlRows(const xmlpp::Element * p) : - _SourceObject(p), +XmlRows::XmlRows(const xmlpp::Element * p) : + SourceObject(p), PerRowValues(p), recordRoot(p->get_attribute_value("recordroot")), recordTrigger(p->get_attribute_value("recordtrigger")), @@ -45,23 +45,23 @@ _XmlRows::_XmlRows(const xmlpp::Element * p) : } } -_XmlRows::~_XmlRows() +XmlRows::~XmlRows() { } void -_XmlRows::loadComplete(const CommonObjects *) +XmlRows::loadComplete(const CommonObjects *) { } void -_XmlRows::setFilter(const Glib::ustring &) +XmlRows::setFilter(const Glib::ustring &) { throw NotSupported(__PRETTY_FUNCTION__); } const Glib::ustring & -_XmlRows::getCurrentValue(const Glib::ustring & id) const +XmlRows::getCurrentValue(const Glib::ustring & id) const { Values::const_iterator i = values.find(id); if (i == values.end()) { @@ -71,7 +71,7 @@ _XmlRows::getCurrentValue(const Glib::ustring & id) const } const Glib::ustring & -_XmlRows::getCurrentValue(unsigned int col) const +XmlRows::getCurrentValue(unsigned int col) const { Values::const_iterator i = values.find(fieldNames[col]); if (i == values.end()) { @@ -81,40 +81,40 @@ _XmlRows::getCurrentValue(unsigned int col) const } bool -_XmlRows::isNull(unsigned int col) const +XmlRows::isNull(unsigned int col) const { return (values.find(fieldNames[col]) == values.end()); } bool -_XmlRows::isNull(const Glib::ustring & col) const +XmlRows::isNull(const Glib::ustring & col) const { return (values.find(col) == values.end()); } unsigned int -_XmlRows::columnCount() const +XmlRows::columnCount() const { return fields.size(); } const Glib::ustring & -_XmlRows::getColumnName(unsigned int col) const +XmlRows::getColumnName(unsigned int col) const { return fieldNames[col]; } void -store(const _XmlRows::Path & position, _XmlRows::Values & values, const _XmlRows::Interests & fields, const xmlChar * val) +store(const XmlRows::Path & position, XmlRows::Values & values, const XmlRows::Interests & fields, const xmlChar * val) { - _XmlRows::Interests::const_iterator i = fields.find(position); + XmlRows::Interests::const_iterator i = fields.find(position); if (i != fields.end()) { values[i->second] = (const char *)val; } } void -_XmlRows::execute(const RowProcessor * rp) const +XmlRows::execute(const RowProcessor * rp) const { rowNum = 0; xmlTextReaderPtr reader = xmlReaderForFile(filename.c_str(), NULL, 0); diff --git a/project2/xmlRows.h b/project2/xmlRows.h index 6e671de..9d7bade 100644 --- a/project2/xmlRows.h +++ b/project2/xmlRows.h @@ -1,19 +1,19 @@ -#ifndef XMLITERATE_H -#define XMLITERATE_H +#ifndef XMLROWS_H +#define XMLROWS_H #include <libxml++/nodes/element.h> #include <boost/intrusive_ptr.hpp> #include <map> #include "perRowValues.h" -class _XmlRows : public PerRowValues { +class XmlRows : public PerRowValues { public: typedef std::map<Glib::ustring, Glib::ustring> Values; typedef std::vector<std::string> Path; typedef std::map<Path, Glib::ustring> Interests; - _XmlRows(const xmlpp::Element * p); - ~_XmlRows(); + XmlRows(const xmlpp::Element * p); + ~XmlRows(); void execute(const RowProcessor *) const; virtual void loadComplete(const CommonObjects *); @@ -38,7 +38,6 @@ class _XmlRows : public PerRowValues { bool anyInterestingAttributes; std::vector<Glib::ustring> fieldNames; }; -typedef boost::intrusive_ptr<_XmlRows> XmlRows; #endif |