update openddl-parser.
Signed-off-by: Kim Kulling <kim.kulling@googlemail.com>pull/502/head
parent
bd1168af30
commit
f5f0c9f7cf
|
@ -21,6 +21,7 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
-----------------------------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------------------------*/
|
||||||
#include <openddlparser/Value.h>
|
#include <openddlparser/Value.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
@ -109,6 +110,15 @@ double Value::getDouble() const {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Value::setString( const std::string &str ) {
|
||||||
|
assert( ddl_string == m_type );
|
||||||
|
::memcpy( m_data, str.c_str(), str.size() );
|
||||||
|
m_data[ str.size() ] = '\0';
|
||||||
|
}
|
||||||
|
const char *Value::getString() const {
|
||||||
|
return (const char*) m_data;
|
||||||
|
}
|
||||||
|
|
||||||
void Value::dump() {
|
void Value::dump() {
|
||||||
switch( m_type ) {
|
switch( m_type ) {
|
||||||
case ddl_none:
|
case ddl_none:
|
||||||
|
@ -223,7 +233,11 @@ Value *ValueAllocator::allocPrimData( Value::ValueType type, size_t len ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if( data->m_size ) {
|
if( data->m_size ) {
|
||||||
data->m_size *= len;
|
size_t len1( len );
|
||||||
|
if( Value::ddl_string == type ) {
|
||||||
|
len1++;
|
||||||
|
}
|
||||||
|
data->m_size *= len1;
|
||||||
data->m_data = new unsigned char[ data->m_size ];
|
data->m_data = new unsigned char[ data->m_size ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include <openddlparser/OpenDDLCommon.h>
|
#include <openddlparser/OpenDDLCommon.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
BEGIN_ODDLPARSER_NS
|
BEGIN_ODDLPARSER_NS
|
||||||
|
|
||||||
///------------------------------------------------------------------------------------------------
|
///------------------------------------------------------------------------------------------------
|
||||||
|
@ -73,6 +75,8 @@ public:
|
||||||
float getFloat() const;
|
float getFloat() const;
|
||||||
void setDouble( double value );
|
void setDouble( double value );
|
||||||
double getDouble() const;
|
double getDouble() const;
|
||||||
|
void setString( const std::string &str );
|
||||||
|
const char *getString() const;
|
||||||
void dump();
|
void dump();
|
||||||
void setNext( Value *next );
|
void setNext( Value *next );
|
||||||
Value *getNext() const;
|
Value *getNext() const;
|
||||||
|
|
Loading…
Reference in New Issue