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