mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-21 23:56:54 +02:00
code cleanups
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/JSON/Array.h"
|
||||
#include "Poco/JSON/Object.h"
|
||||
#include "Poco/JSON/Stringifier.h"
|
||||
@@ -47,19 +48,16 @@ namespace JSON {
|
||||
|
||||
Array::Array()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
Array::Array(const Array& copy) : _values(copy._values)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
Array::~Array()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -153,4 +151,4 @@ void Array::stringify(std::ostream& out, unsigned int indent) const
|
||||
}
|
||||
|
||||
|
||||
}} // Namespace Poco::JSON
|
||||
} } // namespace Poco::JSON
|
||||
|
@@ -33,6 +33,7 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/JSON/DefaultHandler.h"
|
||||
#include "Poco/JSON/Object.h"
|
||||
|
||||
@@ -151,4 +152,4 @@ void DefaultHandler::setValue(const Var& value)
|
||||
}
|
||||
|
||||
|
||||
}} // Namespace Poco::JSON
|
||||
} } // namespace Poco::JSON
|
||||
|
@@ -33,16 +33,18 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/JSON/Handler.h"
|
||||
#include "Poco/JSON/Object.h"
|
||||
|
||||
namespace Poco
|
||||
{
|
||||
namespace JSON
|
||||
{
|
||||
|
||||
namespace Poco {
|
||||
namespace JSON {
|
||||
|
||||
|
||||
Handler::~Handler()
|
||||
{
|
||||
}
|
||||
|
||||
}} // Namespace Poco::JSON
|
||||
|
||||
} } // namespace Poco::JSON
|
||||
|
@@ -33,12 +33,16 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/JSON/JSONException.h"
|
||||
#include <typeinfo>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace JSON {
|
||||
|
||||
|
||||
POCO_IMPLEMENT_EXCEPTION(JSONException, Exception, "JSON Exception")
|
||||
|
||||
}} // Namespace Poco::JSON
|
||||
|
||||
} } // Namespace Poco::JSON
|
||||
|
@@ -33,10 +33,10 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/JSON/Object.h"
|
||||
#include "Poco/JSON/Array.h"
|
||||
#include "Poco/JSON/Stringifier.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
@@ -153,7 +153,7 @@ void Object::stringify(std::ostream& out, unsigned int indent) const
|
||||
}
|
||||
|
||||
out << '}';
|
||||
|
||||
}
|
||||
|
||||
}} // Namespace Poco::JSON
|
||||
|
||||
} } // namespace Poco::JSON
|
||||
|
@@ -33,19 +33,18 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include "Poco/Ascii.h"
|
||||
#include "Poco/Token.h"
|
||||
|
||||
#include "Poco/JSON/Parser.h"
|
||||
#include "Poco/JSON/JSONException.h"
|
||||
#include "Poco/Ascii.h"
|
||||
#include "Poco/Token.h"
|
||||
#undef min
|
||||
#undef max
|
||||
#include <limits>
|
||||
|
||||
|
||||
namespace Poco
|
||||
{
|
||||
namespace JSON
|
||||
{
|
||||
namespace Poco {
|
||||
namespace JSON {
|
||||
|
||||
|
||||
class SeparatorToken: public Token
|
||||
@@ -90,6 +89,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class StringToken: public Token
|
||||
{
|
||||
public:
|
||||
@@ -243,6 +243,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class KeywordToken : public Token
|
||||
{
|
||||
public:
|
||||
@@ -281,6 +282,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class NumberToken: public Token
|
||||
{
|
||||
public:
|
||||
@@ -418,9 +420,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Class _activeClass;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -697,4 +697,4 @@ bool Parser::readElements(bool firstCall)
|
||||
throw JSONException(format("Invalid token '%s' found.", token->asString()));
|
||||
}
|
||||
|
||||
}}
|
||||
} } // namespace Poco::JSON
|
||||
|
@@ -33,13 +33,12 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "Poco/JSON/Query.h"
|
||||
#include "Poco/StringTokenizer.h"
|
||||
#include "Poco/RegularExpression.h"
|
||||
#include "Poco/NumberParser.h"
|
||||
|
||||
#include "Poco/JSON/Query.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Poco::Dynamic::Var;
|
||||
@@ -49,7 +48,7 @@ namespace Poco {
|
||||
namespace JSON {
|
||||
|
||||
|
||||
Query::Query(const Var& source) : _source(source)
|
||||
Query::Query(const Var& source): _source(source)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -145,4 +144,4 @@ Var Query::find(const std::string& path) const
|
||||
}
|
||||
|
||||
|
||||
}} // Namespace Poco::JSON
|
||||
} } // Namespace Poco::JSON
|
||||
|
@@ -33,11 +33,11 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
#include "Poco/JSON/Stringifier.h"
|
||||
#include "Poco/JSON/Array.h"
|
||||
#include "Poco/JSON/Object.h"
|
||||
#include <iomanip>
|
||||
|
||||
|
||||
using Poco::Dynamic::Var;
|
||||
@@ -115,4 +115,4 @@ void Stringifier::stringify(const Var& any, std::ostream& out, unsigned int inde
|
||||
}
|
||||
|
||||
|
||||
}} // Namespace Poco::JSON
|
||||
} } // Namespace Poco::JSON
|
||||
|
@@ -32,11 +32,13 @@
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
#include "Poco/File.h"
|
||||
#include "Poco/FileStream.h"
|
||||
|
||||
|
||||
#include "Poco/JSON/Template.h"
|
||||
#include "Poco/JSON/TemplateCache.h"
|
||||
#include "Poco/JSON/Query.h"
|
||||
#include "Poco/File.h"
|
||||
#include "Poco/FileStream.h"
|
||||
|
||||
|
||||
using Poco::Dynamic::Var;
|
||||
@@ -52,12 +54,10 @@ POCO_IMPLEMENT_EXCEPTION(JSONTemplateException, Exception, "Template Exception")
|
||||
class Part
|
||||
{
|
||||
public:
|
||||
|
||||
Part()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual ~Part()
|
||||
{
|
||||
}
|
||||
@@ -68,10 +68,9 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class StringPart : public Part
|
||||
class StringPart: public Part
|
||||
{
|
||||
public:
|
||||
|
||||
StringPart() : Part()
|
||||
{
|
||||
}
|
||||
@@ -80,57 +79,46 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual ~StringPart()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void render(const Var& data, std::ostream& out) const
|
||||
{
|
||||
out << _content;
|
||||
}
|
||||
|
||||
|
||||
void setContent(const std::string& content)
|
||||
{
|
||||
_content = content;
|
||||
}
|
||||
|
||||
|
||||
inline std::string getContent() const
|
||||
{
|
||||
return _content;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::string _content;
|
||||
};
|
||||
|
||||
|
||||
class MultiPart : public Part
|
||||
class MultiPart: public Part
|
||||
{
|
||||
public:
|
||||
|
||||
MultiPart()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
virtual ~MultiPart()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
virtual void addPart(Part* part)
|
||||
{
|
||||
_parts.push_back(part);
|
||||
}
|
||||
|
||||
|
||||
void render(const Var& data, std::ostream& out) const
|
||||
{
|
||||
for(VectorParts::const_iterator it = _parts.begin(); it != _parts.end(); ++it)
|
||||
@@ -140,15 +128,13 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
VectorParts _parts;
|
||||
};
|
||||
|
||||
|
||||
class EchoPart : public Part
|
||||
class EchoPart: public Part
|
||||
{
|
||||
public:
|
||||
|
||||
EchoPart(const std::string& query) : Part(), _query(query)
|
||||
{
|
||||
}
|
||||
@@ -157,7 +143,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void render(const Var& data, std::ostream& out) const
|
||||
{
|
||||
Query query(data);
|
||||
@@ -170,7 +155,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::string _query;
|
||||
};
|
||||
|
||||
@@ -261,7 +245,6 @@ public:
|
||||
class LogicPart : public MultiPart
|
||||
{
|
||||
public:
|
||||
|
||||
LogicPart() : MultiPart()
|
||||
{
|
||||
}
|
||||
@@ -296,22 +279,19 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::vector<SharedPtr<LogicQuery> > _queries;
|
||||
};
|
||||
|
||||
|
||||
class LoopPart : public MultiPart
|
||||
class LoopPart: public MultiPart
|
||||
{
|
||||
public:
|
||||
|
||||
LoopPart(const std::string& name, const std::string& query) : MultiPart(), _name(name), _query(query)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~LoopPart()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void render(const Var& data, std::ostream& out) const
|
||||
@@ -336,14 +316,12 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::string _name;
|
||||
|
||||
std::string _query;
|
||||
};
|
||||
|
||||
|
||||
class IncludePart : public Part
|
||||
class IncludePart: public Part
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -370,7 +348,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void render(const Var& data, std::ostream& out) const
|
||||
{
|
||||
TemplateCache* cache = TemplateCache::instance();
|
||||
@@ -388,9 +365,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Path _path;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -748,4 +723,4 @@ void Template::render(const Var& data, std::ostream& out) const
|
||||
}
|
||||
|
||||
|
||||
}} // Namespace Poco::JSON
|
||||
} } // Namespace Poco::JSON
|
||||
|
@@ -33,16 +33,18 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/File.h"
|
||||
#include "Poco/JSON/TemplateCache.h"
|
||||
|
||||
namespace Poco
|
||||
{
|
||||
namespace JSON
|
||||
{
|
||||
|
||||
namespace Poco {
|
||||
namespace JSON {
|
||||
|
||||
|
||||
TemplateCache* TemplateCache::_instance = NULL;
|
||||
|
||||
|
||||
TemplateCache::TemplateCache() : _logger(NULL)
|
||||
{
|
||||
setup();
|
||||
@@ -169,4 +171,5 @@ Path TemplateCache::resolvePath(const Path& path) const
|
||||
throw FileNotFoundException(path.toString());
|
||||
}
|
||||
|
||||
}} // Poco::JSON
|
||||
|
||||
} } // Poco::JSON
|
||||
|
Reference in New Issue
Block a user