OpenDDLParser: latest greatest.
parent
072a9e77ad
commit
19ba6448f0
|
@ -154,10 +154,17 @@ DataArrayList::~DataArrayList() {
|
||||||
|
|
||||||
size_t DataArrayList::size() {
|
size_t DataArrayList::size() {
|
||||||
size_t result( 0 );
|
size_t result( 0 );
|
||||||
DataArrayList *n=m_next;
|
if ( ddl_nullptr == m_next ) {
|
||||||
while( n!=ddl_nullptr ) {
|
if ( m_dataList != ddl_nullptr ) {
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataArrayList *n( m_next );
|
||||||
|
while( ddl_nullptr != n ) {
|
||||||
result++;
|
result++;
|
||||||
n=n->m_next;
|
n = n->m_next;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -334,7 +334,7 @@ bool OpenDDLExport::writeValue( Value *val, std::string &statement ) {
|
||||||
const int i = static_cast< int >( val->getInt64() );
|
const int i = static_cast< int >( val->getInt64() );
|
||||||
stream << i;
|
stream << i;
|
||||||
statement += stream.str();
|
statement += stream.str();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Value::ddl_unsigned_int8:
|
case Value::ddl_unsigned_int8:
|
||||||
{
|
{
|
||||||
|
@ -378,6 +378,11 @@ bool OpenDDLExport::writeValue( Value *val, std::string &statement ) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Value::ddl_double:
|
case Value::ddl_double:
|
||||||
|
{
|
||||||
|
std::stringstream stream;
|
||||||
|
stream << val->getDouble();
|
||||||
|
statement += stream.str();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Value::ddl_string:
|
case Value::ddl_string:
|
||||||
{
|
{
|
||||||
|
|
|
@ -948,15 +948,23 @@ char *OpenDDLParser::parseDataList( char *in, char *end, Value::ValueType type,
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DataArrayList *createDataArrayList( Value *currentValue, size_t numValues ) {
|
static DataArrayList *createDataArrayList( Value *currentValue, size_t numValues,
|
||||||
DataArrayList *dataList = new DataArrayList;
|
Reference *refs, size_t numRefs ) {
|
||||||
|
DataArrayList *dataList( new DataArrayList );
|
||||||
dataList->m_dataList = currentValue;
|
dataList->m_dataList = currentValue;
|
||||||
dataList->m_numItems = numValues;
|
dataList->m_numItems = numValues;
|
||||||
|
dataList->m_refs = refs;
|
||||||
|
dataList->m_numRefs = numRefs;
|
||||||
|
|
||||||
return dataList;
|
return dataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *OpenDDLParser::parseDataArrayList( char *in, char *end,Value::ValueType type, DataArrayList **dataArrayList ) {
|
char *OpenDDLParser::parseDataArrayList( char *in, char *end,Value::ValueType type,
|
||||||
|
DataArrayList **dataArrayList ) {
|
||||||
|
if ( ddl_nullptr == dataArrayList ) {
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
*dataArrayList = ddl_nullptr;
|
*dataArrayList = ddl_nullptr;
|
||||||
if( ddl_nullptr == in || in == end ) {
|
if( ddl_nullptr == in || in == end ) {
|
||||||
return in;
|
return in;
|
||||||
|
@ -975,10 +983,10 @@ char *OpenDDLParser::parseDataArrayList( char *in, char *end,Value::ValueType ty
|
||||||
in = parseDataList( in, end, type, ¤tValue, numValues, &refs, numRefs );
|
in = parseDataList( in, end, type, ¤tValue, numValues, &refs, numRefs );
|
||||||
if( ddl_nullptr != currentValue || 0 != numRefs ) {
|
if( ddl_nullptr != currentValue || 0 != numRefs ) {
|
||||||
if( ddl_nullptr == prev ) {
|
if( ddl_nullptr == prev ) {
|
||||||
*dataArrayList = createDataArrayList( currentValue, numValues );
|
*dataArrayList = createDataArrayList( currentValue, numValues, refs, numRefs );
|
||||||
prev = *dataArrayList;
|
prev = *dataArrayList;
|
||||||
} else {
|
} else {
|
||||||
currentDataList = createDataArrayList( currentValue, numValues );
|
currentDataList = createDataArrayList( currentValue, numValues, refs, numRefs );
|
||||||
if( ddl_nullptr != prev ) {
|
if( ddl_nullptr != prev ) {
|
||||||
prev->m_next = currentDataList;
|
prev->m_next = currentDataList;
|
||||||
prev = currentDataList;
|
prev = currentDataList;
|
||||||
|
|
|
@ -209,6 +209,8 @@ struct DLL_ODDLPARSER_EXPORT DataArrayList {
|
||||||
size_t m_numItems; ///< The number of items in the list.
|
size_t m_numItems; ///< The number of items in the list.
|
||||||
Value *m_dataList; ///< The data list ( a Value ).
|
Value *m_dataList; ///< The data list ( a Value ).
|
||||||
DataArrayList *m_next; ///< The next data array list ( ddl_nullptr if last ).
|
DataArrayList *m_next; ///< The next data array list ( ddl_nullptr if last ).
|
||||||
|
Reference *m_refs;
|
||||||
|
size_t m_numRefs;
|
||||||
|
|
||||||
/// @brief The default constructor for initialization.
|
/// @brief The default constructor for initialization.
|
||||||
DataArrayList();
|
DataArrayList();
|
||||||
|
|
Loading…
Reference in New Issue