[DEV] update to the etk normalisation
This commit is contained in:
parent
bf82bb3bbd
commit
39dfd1793b
@ -10,14 +10,12 @@
|
||||
#define __ETK_JSON_ARRAY_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/types.h>
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <ejson/Value.h>
|
||||
|
||||
namespace ejson
|
||||
{
|
||||
class Array : public ejson::Value
|
||||
{
|
||||
namespace ejson {
|
||||
class Array : public ejson::Value {
|
||||
public:
|
||||
/**
|
||||
* @brief basic element of a xml structure
|
||||
|
@ -10,14 +10,12 @@
|
||||
#define __ETK_JSON_BOOLEAN_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/types.h>
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <ejson/Value.h>
|
||||
|
||||
namespace ejson
|
||||
{
|
||||
class Boolean : public ejson::Value
|
||||
{
|
||||
namespace ejson {
|
||||
class Boolean : public ejson::Value {
|
||||
public:
|
||||
/**
|
||||
* @brief basic element of a xml structure
|
||||
|
@ -10,14 +10,12 @@
|
||||
#define __ETK_JSON_NULL_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/types.h>
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <ejson/Value.h>
|
||||
|
||||
namespace ejson
|
||||
{
|
||||
class Null : public ejson::Value
|
||||
{
|
||||
namespace ejson {
|
||||
class Null : public ejson::Value {
|
||||
public:
|
||||
/**
|
||||
* @brief basic element of a xml structure
|
||||
|
@ -10,14 +10,12 @@
|
||||
#define __ETK_JSON_NUMBER_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/types.h>
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <ejson/Value.h>
|
||||
|
||||
namespace ejson
|
||||
{
|
||||
class Number : public ejson::Value
|
||||
{
|
||||
namespace ejson {
|
||||
class Number : public ejson::Value {
|
||||
public:
|
||||
/**
|
||||
* @brief basic element of a xml structure
|
||||
|
@ -10,7 +10,7 @@
|
||||
#define __ETK_JSON_OBJECT_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/types.h>
|
||||
#include <etk/Hash.h>
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <ejson/Value.h>
|
||||
|
@ -10,14 +10,12 @@
|
||||
#define __ETK_JSON_STRING_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/types.h>
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <ejson/Value.h>
|
||||
|
||||
namespace ejson
|
||||
{
|
||||
class String : public ejson::Value
|
||||
{
|
||||
namespace ejson {
|
||||
class String : public ejson::Value {
|
||||
public:
|
||||
/**
|
||||
* @brief basic element of a xml structure
|
||||
|
@ -14,6 +14,7 @@
|
||||
#define __class__ "Value"
|
||||
|
||||
|
||||
|
||||
ejson::Value::~Value(void) {
|
||||
clear();
|
||||
}
|
||||
@ -28,6 +29,17 @@ etk::CCout& ejson::operator <<(etk::CCout& _os, const ejson::filePos& _obj) {
|
||||
}
|
||||
|
||||
|
||||
bool ejson::Value::isWhiteChar(char32_t _val) {
|
||||
if( _val == ' '
|
||||
|| _val == '\t'
|
||||
|| _val == '\n'
|
||||
|| _val == '\r') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void ejson::Value::addIndent(std::string& _data, size_t _indent) const {
|
||||
for (size_t iii=0; iii<_indent; iii++) {
|
||||
_data+="\t";
|
||||
@ -49,7 +61,7 @@ int32_t ejson::Value::countWhiteChar(const std::string& _data, size_t _pos, ejso
|
||||
size_t white=0;
|
||||
for (size_t iii=_pos; iii<_data.size(); iii++) {
|
||||
_filePos.check(_data[iii]);
|
||||
if(true == etk::isWhiteChar(_data[iii])) {
|
||||
if(true == isWhiteChar(_data[iii])) {
|
||||
white++;
|
||||
} else {
|
||||
break;
|
||||
|
@ -10,7 +10,7 @@
|
||||
#define __ETK_JSON_VALUE_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/types.h>
|
||||
#include <etk/math/Vector2D.h>
|
||||
|
||||
namespace ejson {
|
||||
@ -336,6 +336,12 @@ namespace ejson {
|
||||
virtual ejson::Value* duplicate(void) const {
|
||||
return NULL;
|
||||
};
|
||||
protected:
|
||||
/**
|
||||
* @brief check if the current element is white or not : '\t' '\n' '\r' ' '
|
||||
* @return tue if it is white char
|
||||
*/
|
||||
static bool isWhiteChar(char32_t _val);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -10,9 +10,8 @@
|
||||
#define __ETK_JSON_H__
|
||||
|
||||
#include <ejson/Value.h>
|
||||
#include <etk/unicode.h>
|
||||
#include <vector>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/types.h>
|
||||
#include <ejson/String.h>
|
||||
#include <ejson/Array.h>
|
||||
#include <ejson/Object.h>
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/types.h>
|
||||
#include <ejson/debug.h>
|
||||
#include <ejson/ejson.h>
|
||||
|
||||
@ -518,8 +518,8 @@ int main(int argc, const char *argv[]) {
|
||||
JSON_INFO("[TEST] " << sectionID << ":" << jjj << " { OK } Result in error (normal case)");
|
||||
} else {
|
||||
JSON_ERROR("[TEST] " << sectionID << ":" << jjj << " {ERROR } different output");
|
||||
std::vector<std::string> tmpout = string_split(out, '\n');
|
||||
std::vector<std::string> tmpref = string_split(l_list[iii].m_ref, '\n');
|
||||
std::vector<std::string> tmpout = std::split(out, '\n');
|
||||
std::vector<std::string> tmpref = std::split(l_list[iii].m_ref, '\n');
|
||||
//JSON_ERROR("generate : \n" << out);
|
||||
//JSON_ERROR("reference : \n" << l_list[iii].m_ref);
|
||||
for (int32_t jjj=0; jjj<tmpout.size() || jjj<tmpref.size(); ++jjj) {
|
||||
@ -538,8 +538,8 @@ int main(int argc, const char *argv[]) {
|
||||
}
|
||||
if (l_list[iii].m_errorPos == 3) {
|
||||
JSON_ERROR("[TEST] " << sectionID << ":" << jjj << " {ERROR} checking result might be in error...");
|
||||
std::vector<std::string> tmpout = string_split(out, '\n');
|
||||
std::vector<std::string> tmpref = string_split(l_list[iii].m_ref, '\n');
|
||||
std::vector<std::string> tmpout = std::split(out, '\n');
|
||||
std::vector<std::string> tmpref = std::split(l_list[iii].m_ref, '\n');
|
||||
//JSON_ERROR("generate : \n" << out);
|
||||
//JSON_ERROR("reference : \n" << l_list[iii].m_ref);
|
||||
for (int32_t jjj=0; jjj<tmpout.size() || jjj<tmpref.size(); ++jjj) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user