Merge branch 'master' into coverity_scan
commit
be2b008eb8
|
@ -10,12 +10,14 @@ branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
platform: x64
|
platform:
|
||||||
|
- x86
|
||||||
|
- x64
|
||||||
configuration: Release
|
configuration: Release
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- cd c:\projects\assimp
|
- cd c:\projects\assimp
|
||||||
- cmake CMakeLists.txt -G "Visual Studio 11"
|
- cmake CMakeLists.txt -G "Visual Studio 11"
|
||||||
- msbuild /m /p:Configuration=Release /p:Platform="Win32" Assimp.sln
|
- msbuild /m /p:Configuration=Release /p:Platform="Win32" Assimp.sln
|
||||||
|
|
|
@ -85,7 +85,7 @@ macro(get_debug_names PREFIX)
|
||||||
endforeach(i)
|
endforeach(i)
|
||||||
endmacro(get_debug_names)
|
endmacro(get_debug_names)
|
||||||
|
|
||||||
# Add the parent dir from DIR to VAR
|
# Add the parent dir from DIR to VAR
|
||||||
macro(add_parent_dir VAR DIR)
|
macro(add_parent_dir VAR DIR)
|
||||||
get_filename_component(${DIR}_TEMP "${${DIR}}/.." ABSOLUTE)
|
get_filename_component(${DIR}_TEMP "${${DIR}}/.." ABSOLUTE)
|
||||||
set(${VAR} ${${VAR}} ${${DIR}_TEMP})
|
set(${VAR} ${${VAR}} ${${DIR}_TEMP})
|
||||||
|
@ -127,6 +127,7 @@ MACRO(findpkg_framework fwk)
|
||||||
/System/Library/Frameworks
|
/System/Library/Frameworks
|
||||||
/Network/Library/Frameworks
|
/Network/Library/Frameworks
|
||||||
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/
|
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/
|
||||||
|
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/
|
||||||
)
|
)
|
||||||
FOREACH(dir ${${fwk}_FRAMEWORK_PATH})
|
FOREACH(dir ${${fwk}_FRAMEWORK_PATH})
|
||||||
SET(fwkpath ${dir}/${fwk}.framework)
|
SET(fwkpath ${dir}/${fwk}.framework)
|
||||||
|
|
|
@ -825,7 +825,7 @@ bool Parser::ParseString(std::string& out,const char* szName)
|
||||||
if (!SkipSpaces(&filePtr))
|
if (!SkipSpaces(&filePtr))
|
||||||
{
|
{
|
||||||
|
|
||||||
ai_snprintf(szBuffer, 1023, "Unable to parse %s block: Unexpected EOL",szName);
|
ai_snprintf(szBuffer, 1024, "Unable to parse %s block: Unexpected EOL",szName);
|
||||||
LogWarning(szBuffer);
|
LogWarning(szBuffer);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -833,7 +833,7 @@ bool Parser::ParseString(std::string& out,const char* szName)
|
||||||
if ('\"' != *filePtr)
|
if ('\"' != *filePtr)
|
||||||
{
|
{
|
||||||
|
|
||||||
ai_snprintf(szBuffer, 1023, "Unable to parse %s block: Strings are expected "
|
ai_snprintf(szBuffer, 1024, "Unable to parse %s block: Strings are expected "
|
||||||
"to be enclosed in double quotation marks",szName);
|
"to be enclosed in double quotation marks",szName);
|
||||||
LogWarning(szBuffer);
|
LogWarning(szBuffer);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -55,6 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "Defines.h"
|
#include "Defines.h"
|
||||||
|
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
|
#include "math.h"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include "../include/assimp/Importer.hpp"
|
#include "../include/assimp/Importer.hpp"
|
||||||
|
@ -77,13 +78,21 @@ static const aiImporterDesc desc = {
|
||||||
"dae"
|
"dae"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
ColladaLoader::ColladaLoader()
|
ColladaLoader::ColladaLoader()
|
||||||
: noSkeletonMesh()
|
: mFileName()
|
||||||
|
, mMeshIndexByID()
|
||||||
|
, mMaterialIndexByName()
|
||||||
|
, mMeshes()
|
||||||
|
, newMats()
|
||||||
|
, mCameras()
|
||||||
|
, mLights()
|
||||||
|
, mTextures()
|
||||||
|
, mAnims()
|
||||||
|
, noSkeletonMesh( false )
|
||||||
, ignoreUpDirection(false)
|
, ignoreUpDirection(false)
|
||||||
, mNodeNameCounter()
|
, mNodeNameCounter( 0 )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -1161,6 +1170,25 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
||||||
}
|
}
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/assimp/assimp/issues/458
|
||||||
|
// Sub-sample axis-angle channels if the delta between two consecutive
|
||||||
|
// key-frame angles is >= 180 degrees.
|
||||||
|
if (transforms[e.mTransformIndex].mType == Collada::TF_ROTATE && e.mSubElement == 3 && pos > 0 && pos < e.mTimeAccessor->mCount) {
|
||||||
|
float cur_key_angle = ReadFloat(*e.mValueAccessor, *e.mValueData, pos, 0);
|
||||||
|
float last_key_angle = ReadFloat(*e.mValueAccessor, *e.mValueData, pos - 1, 0);
|
||||||
|
float cur_key_time = ReadFloat(*e.mTimeAccessor, *e.mTimeData, pos, 0);
|
||||||
|
float last_key_time = ReadFloat(*e.mTimeAccessor, *e.mTimeData, pos - 1, 0);
|
||||||
|
float last_eval_angle = last_key_angle + (cur_key_angle - last_key_angle) * (time - last_key_time) / (cur_key_time - last_key_time);
|
||||||
|
float delta = std::fabs(cur_key_angle - last_eval_angle);
|
||||||
|
if (delta >= 180.0f) {
|
||||||
|
int subSampleCount = static_cast<int>(floorf(delta / 90.0f));
|
||||||
|
if (cur_key_time != time) {
|
||||||
|
float nextSampleTime = time + (cur_key_time - time) / subSampleCount;
|
||||||
|
nextTime = std::min(nextTime, nextSampleTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// no more keys on any channel after the current time -> we're done
|
// no more keys on any channel after the current time -> we're done
|
||||||
|
@ -1357,7 +1385,7 @@ void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pSce
|
||||||
effect.mTransparency *= (
|
effect.mTransparency *= (
|
||||||
0.212671f * effect.mTransparent.r +
|
0.212671f * effect.mTransparent.r +
|
||||||
0.715160f * effect.mTransparent.g +
|
0.715160f * effect.mTransparent.g +
|
||||||
0.072169 * effect.mTransparent.b
|
0.072169f * effect.mTransparent.b
|
||||||
);
|
);
|
||||||
|
|
||||||
effect.mTransparent.a = 1.f;
|
effect.mTransparent.a = 1.f;
|
||||||
|
|
|
@ -131,7 +131,7 @@ Cluster::~Cluster()
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Skin::Skin(uint64_t id, const Element& element, const Document& doc, const std::string& name)
|
Skin::Skin(uint64_t id, const Element& element, const Document& doc, const std::string& name)
|
||||||
: Deformer(id,element,doc,name)
|
: Deformer(id,element,doc,name)
|
||||||
{
|
, accuracy( 0.0f ) {
|
||||||
const Scope& sc = GetRequiredScope(element);
|
const Scope& sc = GetRequiredScope(element);
|
||||||
|
|
||||||
const Element* const Link_DeformAcuracy = sc["Link_DeformAcuracy"];
|
const Element* const Link_DeformAcuracy = sc["Link_DeformAcuracy"];
|
||||||
|
|
|
@ -56,14 +56,13 @@ using namespace Assimp;
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
GenVertexNormalsProcess::GenVertexNormalsProcess()
|
GenVertexNormalsProcess::GenVertexNormalsProcess()
|
||||||
{
|
: configMaxAngle( AI_DEG_TO_RAD( 175.f ) ) {
|
||||||
this->configMaxAngle = AI_DEG_TO_RAD(175.f);
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Destructor, private as well
|
// Destructor, private as well
|
||||||
GenVertexNormalsProcess::~GenVertexNormalsProcess()
|
GenVertexNormalsProcess::~GenVertexNormalsProcess() {
|
||||||
{
|
|
||||||
// nothing to do here
|
// nothing to do here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ void AllocateFromAssimpHeap::operator delete[] ( void* data) {
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Importer constructor.
|
// Importer constructor.
|
||||||
Importer::Importer()
|
Importer::Importer()
|
||||||
{
|
: pimpl( NULL ) {
|
||||||
// allocate the pimpl first
|
// allocate the pimpl first
|
||||||
pimpl = new ImporterPimpl();
|
pimpl = new ImporterPimpl();
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ Importer::~Importer()
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Copy constructor - copies the config of another Importer, not the scene
|
// Copy constructor - copies the config of another Importer, not the scene
|
||||||
Importer::Importer(const Importer &other)
|
Importer::Importer(const Importer &other)
|
||||||
{
|
: pimpl(NULL) {
|
||||||
new(this) Importer();
|
new(this) Importer();
|
||||||
|
|
||||||
pimpl->mIntProperties = other.pimpl->mIntProperties;
|
pimpl->mIntProperties = other.pimpl->mIntProperties;
|
||||||
|
|
|
@ -174,7 +174,8 @@ bool MakeVerboseFormatProcess::MakeVerboseFormat(aiMesh* pcMesh)
|
||||||
delete pcMesh->mBones[i]->mWeights;
|
delete pcMesh->mBones[i]->mWeights;
|
||||||
if (!newWeights[i].empty()) {
|
if (!newWeights[i].empty()) {
|
||||||
pcMesh->mBones[i]->mWeights = new aiVertexWeight[newWeights[i].size()];
|
pcMesh->mBones[i]->mWeights = new aiVertexWeight[newWeights[i].size()];
|
||||||
memcpy(pcMesh->mBones[i]->mWeights, &newWeights[i][0],
|
aiVertexWeight *weightToCopy = &( newWeights[i][0] );
|
||||||
|
memcpy(pcMesh->mBones[i]->mWeights, weightToCopy,
|
||||||
sizeof(aiVertexWeight) * newWeights[i].size());
|
sizeof(aiVertexWeight) * newWeights[i].size());
|
||||||
delete[] newWeights;
|
delete[] newWeights;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -145,6 +145,13 @@ void ObjFileImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||||
modelName = pFile;
|
modelName = pFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This next stage takes ~ 1/3th of the total readFile task
|
||||||
|
// so should amount for 1/3th of the progress
|
||||||
|
// only update every 100KB or it'll be too slow
|
||||||
|
unsigned int progress = 0;
|
||||||
|
unsigned int progressCounter = 0;
|
||||||
|
const unsigned int updateProgressEveryBytes = 100 * 1024;
|
||||||
|
const unsigned int progressTotal = (3*m_Buffer.size()/updateProgressEveryBytes);
|
||||||
// process all '\'
|
// process all '\'
|
||||||
std::vector<char> ::iterator iter = m_Buffer.begin();
|
std::vector<char> ::iterator iter = m_Buffer.begin();
|
||||||
while (iter != m_Buffer.end())
|
while (iter != m_Buffer.end())
|
||||||
|
@ -159,10 +166,19 @@ void ObjFileImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
++iter;
|
++iter;
|
||||||
|
|
||||||
|
if (++progressCounter >= updateProgressEveryBytes)
|
||||||
|
{
|
||||||
|
m_progress->UpdateFileRead(++progress, progressTotal);
|
||||||
|
progressCounter = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 1/3rd progress
|
||||||
|
m_progress->UpdateFileRead(1, 3);
|
||||||
|
|
||||||
// parse the file into a temporary representation
|
// parse the file into a temporary representation
|
||||||
ObjFileParser parser(m_Buffer, modelName, pIOHandler);
|
ObjFileParser parser(m_Buffer, modelName, pIOHandler, m_progress);
|
||||||
|
|
||||||
// And create the proper return structures out of it
|
// And create the proper return structures out of it
|
||||||
CreateDataFromImport(parser.GetModel(), pScene);
|
CreateDataFromImport(parser.GetModel(), pScene);
|
||||||
|
|
|
@ -61,12 +61,13 @@ const std::string ObjFileParser::DEFAULT_MATERIAL = AI_DEFAULT_MATERIAL_NAME;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Constructor with loaded data and directories.
|
// Constructor with loaded data and directories.
|
||||||
ObjFileParser::ObjFileParser(std::vector<char> &data,const std::string &modelName, IOSystem *io ) :
|
ObjFileParser::ObjFileParser(std::vector<char> &data,const std::string &modelName, IOSystem *io, ProgressHandler* progress ) :
|
||||||
m_DataIt(data.begin()),
|
m_DataIt(data.begin()),
|
||||||
m_DataItEnd(data.end()),
|
m_DataItEnd(data.end()),
|
||||||
m_pModel(NULL),
|
m_pModel(NULL),
|
||||||
m_uiLine(0),
|
m_uiLine(0),
|
||||||
m_pIO( io )
|
m_pIO( io ),
|
||||||
|
m_progress(progress)
|
||||||
{
|
{
|
||||||
std::fill_n(m_buffer,Buffersize,0);
|
std::fill_n(m_buffer,Buffersize,0);
|
||||||
|
|
||||||
|
@ -106,8 +107,28 @@ void ObjFileParser::parseFile()
|
||||||
if (m_DataIt == m_DataItEnd)
|
if (m_DataIt == m_DataItEnd)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// only update every 100KB or it'll be too slow
|
||||||
|
const unsigned int updateProgressEveryBytes = 100 * 1024;
|
||||||
|
unsigned int progressCounter = 0;
|
||||||
|
const unsigned int bytesToProcess = std::distance(m_DataIt, m_DataItEnd);
|
||||||
|
const unsigned int progressTotal = 3 * bytesToProcess;
|
||||||
|
const unsigned int progressOffset = bytesToProcess;
|
||||||
|
unsigned int processed = 0;
|
||||||
|
|
||||||
|
DataArrayIt lastDataIt = m_DataIt;
|
||||||
|
|
||||||
while (m_DataIt != m_DataItEnd)
|
while (m_DataIt != m_DataItEnd)
|
||||||
{
|
{
|
||||||
|
// Handle progress reporting
|
||||||
|
processed += std::distance(lastDataIt, m_DataIt);
|
||||||
|
lastDataIt = m_DataIt;
|
||||||
|
if (processed > (progressCounter * updateProgressEveryBytes))
|
||||||
|
{
|
||||||
|
progressCounter++;
|
||||||
|
m_progress->UpdateFileRead(progressOffset + processed*2, progressTotal);
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse line
|
||||||
switch (*m_DataIt)
|
switch (*m_DataIt)
|
||||||
{
|
{
|
||||||
case 'v': // Parse a vertex texture coordinate
|
case 'v': // Parse a vertex texture coordinate
|
||||||
|
|
|
@ -59,6 +59,7 @@ namespace ObjFile {
|
||||||
|
|
||||||
class ObjFileImporter;
|
class ObjFileImporter;
|
||||||
class IOSystem;
|
class IOSystem;
|
||||||
|
class ProgressHandler;
|
||||||
|
|
||||||
/// \class ObjFileParser
|
/// \class ObjFileParser
|
||||||
/// \brief Parser for a obj waveform file
|
/// \brief Parser for a obj waveform file
|
||||||
|
@ -71,7 +72,7 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \brief Constructor with data array.
|
/// \brief Constructor with data array.
|
||||||
ObjFileParser(std::vector<char> &Data,const std::string &strModelName, IOSystem* io);
|
ObjFileParser(std::vector<char> &Data,const std::string &strModelName, IOSystem* io, ProgressHandler* progress);
|
||||||
/// \brief Destructor
|
/// \brief Destructor
|
||||||
~ObjFileParser();
|
~ObjFileParser();
|
||||||
/// \brief Model getter.
|
/// \brief Model getter.
|
||||||
|
@ -139,6 +140,8 @@ private:
|
||||||
char m_buffer[Buffersize];
|
char m_buffer[Buffersize];
|
||||||
/// Pointer to IO system instance.
|
/// Pointer to IO system instance.
|
||||||
IOSystem *m_pIO;
|
IOSystem *m_pIO;
|
||||||
|
//! Pointer to progress handler
|
||||||
|
ProgressHandler* m_progress;
|
||||||
/// Path to the current model
|
/// Path to the current model
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,16 @@ DataArrayList::~DataArrayList() {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t DataArrayList::size() {
|
||||||
|
size_t result=1;
|
||||||
|
DataArrayList *n=m_next;
|
||||||
|
while( n!=ddl_nullptr ) {
|
||||||
|
result++;
|
||||||
|
n=n->m_next;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
Context::Context()
|
Context::Context()
|
||||||
: m_root( ddl_nullptr ) {
|
: m_root( ddl_nullptr ) {
|
||||||
// empty
|
// empty
|
||||||
|
|
|
@ -29,12 +29,30 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
BEGIN_ODDLPARSER_NS
|
BEGIN_ODDLPARSER_NS
|
||||||
|
|
||||||
IOStreamBase::IOStreamBase()
|
StreamFormatterBase::StreamFormatterBase() {
|
||||||
: m_file( ddl_nullptr ) {
|
|
||||||
// empty
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StreamFormatterBase::~StreamFormatterBase() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string StreamFormatterBase::format( const std::string &statement ) {
|
||||||
|
std::string tmp( statement );
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
IOStreamBase::IOStreamBase( StreamFormatterBase *formatter )
|
||||||
|
: m_formatter( formatter )
|
||||||
|
, m_file( ddl_nullptr ) {
|
||||||
|
if (ddl_nullptr == m_formatter) {
|
||||||
|
m_formatter = new StreamFormatterBase;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IOStreamBase::~IOStreamBase() {
|
IOStreamBase::~IOStreamBase() {
|
||||||
// empty
|
delete m_formatter;
|
||||||
|
m_formatter = ddl_nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IOStreamBase::open( const std::string &name ) {
|
bool IOStreamBase::open( const std::string &name ) {
|
||||||
|
@ -57,12 +75,12 @@ bool IOStreamBase::close() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IOStreamBase::write( const std::string &statement ) {
|
size_t IOStreamBase::write( const std::string &statement ) {
|
||||||
if (ddl_nullptr == m_file) {
|
if (ddl_nullptr == m_file) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
std::string formatStatement = m_formatter->format( statement );
|
||||||
::fwrite( statement.c_str(), sizeof( char ), statement.size(), m_file );
|
return ::fwrite( formatStatement.c_str(), sizeof( char ), formatStatement.size(), m_file );
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DDLNodeIterator {
|
struct DDLNodeIterator {
|
||||||
|
@ -88,6 +106,10 @@ struct DDLNodeIterator {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
DDLNodeIterator() ddl_no_copy;
|
||||||
|
DDLNodeIterator &operator = ( const DDLNodeIterator & ) ddl_no_copy;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void writeLineEnd( std::string &statement ) {
|
static void writeLineEnd( std::string &statement ) {
|
||||||
|
@ -410,3 +432,4 @@ bool OpenDDLExport::writeValueArray( DataArrayList *al, std::string &statement )
|
||||||
}
|
}
|
||||||
|
|
||||||
END_ODDLPARSER_NS
|
END_ODDLPARSER_NS
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
#define DEBUG_HEADER_NAME
|
|
||||||
|
|
||||||
BEGIN_ODDLPARSER_NS
|
BEGIN_ODDLPARSER_NS
|
||||||
|
|
||||||
|
@ -74,15 +73,26 @@ const char *getTypeToken( Value::ValueType type ) {
|
||||||
|
|
||||||
static void logInvalidTokenError( char *in, const std::string &exp, OpenDDLParser::logCallback callback ) {
|
static void logInvalidTokenError( char *in, const std::string &exp, OpenDDLParser::logCallback callback ) {
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
stream << "Invalid token " << *in << ", " << exp << " expected." << std::endl;
|
stream << "Invalid token \"" << *in << "\"" << " expected \"" << exp << "\"" << std::endl;
|
||||||
|
std::string full(in);
|
||||||
|
std::string part(full.substr(0,50));
|
||||||
|
stream << part;
|
||||||
callback( ddl_error_msg, stream.str() );
|
callback( ddl_error_msg, stream.str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isIntegerType( Value::ValueType integerType ) {
|
static bool isIntegerType( Value::ValueType integerType ) {
|
||||||
if( integerType != Value::ddl_int8 && integerType != Value::ddl_int16 &&
|
if( integerType != Value::ddl_int8 && integerType != Value::ddl_int16 &&
|
||||||
integerType != Value::ddl_int32 && integerType != Value::ddl_int64 ) {
|
integerType != Value::ddl_int32 && integerType != Value::ddl_int64 ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool isUnsignedIntegerType( Value::ValueType integerType ) {
|
||||||
|
if( integerType != Value::ddl_unsigned_int8 && integerType != Value::ddl_unsigned_int16 &&
|
||||||
|
integerType != Value::ddl_unsigned_int32 && integerType != Value::ddl_unsigned_int64 ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +203,7 @@ bool OpenDDLParser::parse() {
|
||||||
if( m_buffer.empty() ) {
|
if( m_buffer.empty() ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
normalizeBuffer( m_buffer );
|
normalizeBuffer( m_buffer );
|
||||||
|
|
||||||
m_context = new Context;
|
m_context = new Context;
|
||||||
|
@ -206,6 +216,9 @@ bool OpenDDLParser::parse() {
|
||||||
size_t pos( current - &m_buffer[ 0 ] );
|
size_t pos( current - &m_buffer[ 0 ] );
|
||||||
while( pos < m_buffer.size() ) {
|
while( pos < m_buffer.size() ) {
|
||||||
current = parseNextNode( current, end );
|
current = parseNextNode( current, end );
|
||||||
|
if(current==ddl_nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
pos = current - &m_buffer[ 0 ];
|
pos = current - &m_buffer[ 0 ];
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -215,11 +228,9 @@ bool OpenDDLParser::exportContext( Context *ctx, const std::string &filename ) {
|
||||||
if( ddl_nullptr == ctx ) {
|
if( ddl_nullptr == ctx ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenDDLExport myExporter;
|
OpenDDLExport myExporter;
|
||||||
return myExporter.exportContext( ctx, filename );
|
return myExporter.exportContext( ctx, filename );
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *OpenDDLParser::parseNextNode( char *in, char *end ) {
|
char *OpenDDLParser::parseNextNode( char *in, char *end ) {
|
||||||
|
@ -229,12 +240,15 @@ char *OpenDDLParser::parseNextNode( char *in, char *end ) {
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_HEADER_NAME
|
||||||
static void dumpId( Identifier *id ) {
|
static void dumpId( Identifier *id ) {
|
||||||
if( ddl_nullptr != id ) {
|
if( ddl_nullptr != id ) {
|
||||||
if ( ddl_nullptr != id->m_text.m_buffer ) { }
|
if ( ddl_nullptr != id->m_text.m_buffer ) {
|
||||||
std::cout << id->m_text.m_buffer << std::endl;
|
std::cout << id->m_text.m_buffer << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
char *OpenDDLParser::parseHeader( char *in, char *end ) {
|
char *OpenDDLParser::parseHeader( char *in, char *end ) {
|
||||||
if( ddl_nullptr == in || in == end ) {
|
if( ddl_nullptr == in || in == end ) {
|
||||||
|
@ -244,7 +258,7 @@ char *OpenDDLParser::parseHeader( char *in, char *end ) {
|
||||||
Identifier *id( ddl_nullptr );
|
Identifier *id( ddl_nullptr );
|
||||||
in = OpenDDLParser::parseIdentifier( in, end, &id );
|
in = OpenDDLParser::parseIdentifier( in, end, &id );
|
||||||
|
|
||||||
#ifdef DEBUG_HEADER_NAME
|
#ifdef DEBUG_HEADER_NAME
|
||||||
dumpId( id );
|
dumpId( id );
|
||||||
#endif // DEBUG_HEADER_NAME
|
#endif // DEBUG_HEADER_NAME
|
||||||
|
|
||||||
|
@ -260,9 +274,9 @@ char *OpenDDLParser::parseHeader( char *in, char *end ) {
|
||||||
|
|
||||||
if( *in != Grammar::CommaSeparator[ 0 ] && *in != Grammar::ClosePropertyToken[ 0 ] ) {
|
if( *in != Grammar::CommaSeparator[ 0 ] && *in != Grammar::ClosePropertyToken[ 0 ] ) {
|
||||||
logInvalidTokenError( in, Grammar::ClosePropertyToken, m_logCallback );
|
logInvalidTokenError( in, Grammar::ClosePropertyToken, m_logCallback );
|
||||||
return in;
|
return ddl_nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ddl_nullptr != prop && *in != Grammar::CommaSeparator[ 0 ] ) {
|
if( ddl_nullptr != prop && *in != Grammar::CommaSeparator[ 0 ] ) {
|
||||||
if( ddl_nullptr == first ) {
|
if( ddl_nullptr == first ) {
|
||||||
first = prop;
|
first = prop;
|
||||||
|
@ -285,13 +299,13 @@ char *OpenDDLParser::parseHeader( char *in, char *end ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the properties
|
// set the properties
|
||||||
if( ddl_nullptr != first ) {
|
if( ddl_nullptr != first && ddl_nullptr != node ) {
|
||||||
node->setProperties( first );
|
node->setProperties( first );
|
||||||
}
|
}
|
||||||
|
|
||||||
Name *name( ddl_nullptr );
|
Name *name( ddl_nullptr );
|
||||||
in = OpenDDLParser::parseName( in, end, &name );
|
in = OpenDDLParser::parseName( in, end, &name );
|
||||||
if( ddl_nullptr != name ) {
|
if( ddl_nullptr != name && ddl_nullptr != node ) {
|
||||||
const std::string nodeName( name->m_id->m_text.m_buffer );
|
const std::string nodeName( name->m_id->m_text.m_buffer );
|
||||||
node->setName( nodeName );
|
node->setName( nodeName );
|
||||||
}
|
}
|
||||||
|
@ -311,16 +325,19 @@ char *OpenDDLParser::parseStructure( char *in, char *end ) {
|
||||||
// loop over all children ( data and nodes )
|
// loop over all children ( data and nodes )
|
||||||
do {
|
do {
|
||||||
in = parseStructureBody( in, end, error );
|
in = parseStructureBody( in, end, error );
|
||||||
|
if(in == ddl_nullptr){
|
||||||
|
return ddl_nullptr;
|
||||||
|
}
|
||||||
} while ( *in != '}' );
|
} while ( *in != '}' );
|
||||||
in++;
|
in++;
|
||||||
} else {
|
} else {
|
||||||
in++;
|
in++;
|
||||||
logInvalidTokenError( in, std::string( Grammar::OpenBracketToken ), m_logCallback );
|
logInvalidTokenError( in, std::string( Grammar::OpenBracketToken ), m_logCallback );
|
||||||
error = true;
|
error = true;
|
||||||
return in;
|
return ddl_nullptr;
|
||||||
}
|
}
|
||||||
in = lookForNextToken( in, end );
|
in = lookForNextToken( in, end );
|
||||||
|
|
||||||
// pop node from stack after successful parsing
|
// pop node from stack after successful parsing
|
||||||
if( !error ) {
|
if( !error ) {
|
||||||
popNode();
|
popNode();
|
||||||
|
@ -375,7 +392,7 @@ char *OpenDDLParser::parseStructureBody( char *in, char *end, bool &error ) {
|
||||||
setNodeValues( top(), values );
|
setNodeValues( top(), values );
|
||||||
setNodeReferences( top(), refs );
|
setNodeReferences( top(), refs );
|
||||||
} else if( arrayLen > 1 ) {
|
} else if( arrayLen > 1 ) {
|
||||||
in = parseDataArrayList( in, end, &dtArrayList );
|
in = parseDataArrayList( in, end, type, &dtArrayList );
|
||||||
setNodeDataArrayList( top(), dtArrayList );
|
setNodeDataArrayList( top(), dtArrayList );
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "0 for array is invalid." << std::endl;
|
std::cerr << "0 for array is invalid." << std::endl;
|
||||||
|
@ -386,6 +403,7 @@ char *OpenDDLParser::parseStructureBody( char *in, char *end, bool &error ) {
|
||||||
in = lookForNextToken( in, end );
|
in = lookForNextToken( in, end );
|
||||||
if( *in != '}' ) {
|
if( *in != '}' ) {
|
||||||
logInvalidTokenError( in, std::string( Grammar::CloseBracketToken ), m_logCallback );
|
logInvalidTokenError( in, std::string( Grammar::CloseBracketToken ), m_logCallback );
|
||||||
|
return ddl_nullptr;
|
||||||
} else {
|
} else {
|
||||||
//in++;
|
//in++;
|
||||||
}
|
}
|
||||||
|
@ -420,7 +438,7 @@ DDLNode *OpenDDLParser::top() {
|
||||||
if( m_stack.empty() ) {
|
if( m_stack.empty() ) {
|
||||||
return ddl_nullptr;
|
return ddl_nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DDLNode *top( m_stack.back() );
|
DDLNode *top( m_stack.back() );
|
||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
|
@ -479,7 +497,7 @@ char *OpenDDLParser::parseName( char *in, char *end, Name **name ) {
|
||||||
if( *in == '%' ) {
|
if( *in == '%' ) {
|
||||||
ntype = LocalName;
|
ntype = LocalName;
|
||||||
}
|
}
|
||||||
|
in++;
|
||||||
Name *currentName( ddl_nullptr );
|
Name *currentName( ddl_nullptr );
|
||||||
Identifier *id( ddl_nullptr );
|
Identifier *id( ddl_nullptr );
|
||||||
in = parseIdentifier( in, end, &id );
|
in = parseIdentifier( in, end, &id );
|
||||||
|
@ -489,7 +507,7 @@ char *OpenDDLParser::parseName( char *in, char *end, Name **name ) {
|
||||||
*name = currentName;
|
*name = currentName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,7 +519,7 @@ char *OpenDDLParser::parseIdentifier( char *in, char *end, Identifier **id ) {
|
||||||
|
|
||||||
// ignore blanks
|
// ignore blanks
|
||||||
in = lookForNextToken( in, end );
|
in = lookForNextToken( in, end );
|
||||||
|
|
||||||
// staring with a number is forbidden
|
// staring with a number is forbidden
|
||||||
if( isNumeric<const char>( *in ) ) {
|
if( isNumeric<const char>( *in ) ) {
|
||||||
return in;
|
return in;
|
||||||
|
@ -510,11 +528,11 @@ char *OpenDDLParser::parseIdentifier( char *in, char *end, Identifier **id ) {
|
||||||
// get size of id
|
// get size of id
|
||||||
size_t idLen( 0 );
|
size_t idLen( 0 );
|
||||||
char *start( in );
|
char *start( in );
|
||||||
while( !isSeparator( *in ) && !isNewLine( *in ) && ( in != end ) && *in != Grammar::OpenPropertyToken[ 0 ] && *in != Grammar::ClosePropertyToken[ 0 ] ) {
|
while( !isSeparator( *in ) && !isNewLine( *in ) && ( in != end ) && *in != Grammar::OpenPropertyToken[ 0 ] && *in != Grammar::ClosePropertyToken[ 0 ] && *in != '$' ) {
|
||||||
++in;
|
++in;
|
||||||
++idLen;
|
++idLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t len( idLen );
|
const size_t len( idLen );
|
||||||
Identifier *newId = new Identifier( start, len );
|
Identifier *newId = new Identifier( start, len );
|
||||||
*id = newId;
|
*id = newId;
|
||||||
|
@ -631,7 +649,7 @@ char *OpenDDLParser::parseIntegerLiteral( char *in, char *end, Value **integer,
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !isIntegerType( integerType ) ) {
|
if( !(isIntegerType( integerType ) || isUnsignedIntegerType(integerType)) ) {
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,7 +660,13 @@ char *OpenDDLParser::parseIntegerLiteral( char *in, char *end, Value **integer,
|
||||||
}
|
}
|
||||||
|
|
||||||
if( isNumeric( *start ) ) {
|
if( isNumeric( *start ) ) {
|
||||||
const int value( atoi( start ) );
|
#ifdef OPENDDL_NO_USE_CPP11
|
||||||
|
const int64 value( atol( start ) ); // maybe not really 64bit as atoll is but exists without c++11
|
||||||
|
const uint64 uvalue( strtoul( start,ddl_nullptr,10 ) );
|
||||||
|
#else
|
||||||
|
const int64 value( atoll( start ) );
|
||||||
|
const uint64 uvalue( strtoull( start,ddl_nullptr,10 ) );
|
||||||
|
#endif
|
||||||
*integer = ValueAllocator::allocPrimData( integerType );
|
*integer = ValueAllocator::allocPrimData( integerType );
|
||||||
switch( integerType ) {
|
switch( integerType ) {
|
||||||
case Value::ddl_int8:
|
case Value::ddl_int8:
|
||||||
|
@ -657,15 +681,27 @@ char *OpenDDLParser::parseIntegerLiteral( char *in, char *end, Value **integer,
|
||||||
case Value::ddl_int64:
|
case Value::ddl_int64:
|
||||||
( *integer )->setInt64( ( int64 ) value );
|
( *integer )->setInt64( ( int64 ) value );
|
||||||
break;
|
break;
|
||||||
|
case Value::ddl_unsigned_int8:
|
||||||
|
( *integer )->setUnsignedInt8( (uint8) uvalue );
|
||||||
|
break;
|
||||||
|
case Value::ddl_unsigned_int16:
|
||||||
|
( *integer )->setUnsignedInt16( ( uint16 ) uvalue );
|
||||||
|
break;
|
||||||
|
case Value::ddl_unsigned_int32:
|
||||||
|
( *integer )->setUnsignedInt32( ( uint32 ) uvalue );
|
||||||
|
break;
|
||||||
|
case Value::ddl_unsigned_int64:
|
||||||
|
( *integer )->setUnsignedInt64( ( uint64 ) uvalue );
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *OpenDDLParser::parseFloatingLiteral( char *in, char *end, Value **floating ) {
|
char *OpenDDLParser::parseFloatingLiteral( char *in, char *end, Value **floating, Value::ValueType floatType) {
|
||||||
*floating = ddl_nullptr;
|
*floating = ddl_nullptr;
|
||||||
if( ddl_nullptr == in || in == end ) {
|
if( ddl_nullptr == in || in == end ) {
|
||||||
return in;
|
return in;
|
||||||
|
@ -690,9 +726,16 @@ char *OpenDDLParser::parseFloatingLiteral( char *in, char *end, Value **floating
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ok ) {
|
if( ok ) {
|
||||||
const float value( ( float ) atof( start ) );
|
if(floatType == Value::ddl_double)
|
||||||
*floating = ValueAllocator::allocPrimData( Value::ddl_float );
|
{
|
||||||
( *floating )->setFloat( value );
|
const double value( atof( start ) );
|
||||||
|
*floating = ValueAllocator::allocPrimData( Value::ddl_double );
|
||||||
|
( *floating )->setDouble( value );
|
||||||
|
} else {
|
||||||
|
const float value( ( float ) atof( start ) );
|
||||||
|
*floating = ValueAllocator::allocPrimData( Value::ddl_float );
|
||||||
|
( *floating )->setFloat( value );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return in;
|
return in;
|
||||||
|
@ -813,7 +856,7 @@ char *OpenDDLParser::parseProperty( char *in, char *end, Property **prop ) {
|
||||||
( *prop )->m_ref = ref;
|
( *prop )->m_ref = ref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return in;
|
return in;
|
||||||
|
@ -856,12 +899,27 @@ char *OpenDDLParser::parseDataList( char *in, char *end, Value::ValueType type,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Value::ddl_int32 == type) {
|
switch(type){
|
||||||
in = parseIntegerLiteral( in, end, ¤t );
|
case Value::ddl_int8:
|
||||||
} else if (Value::ddl_float == type) {
|
case Value::ddl_int16:
|
||||||
in = parseFloatingLiteral( in, end, ¤t );
|
case Value::ddl_int32:
|
||||||
} else if (Value::ddl_string == type) {
|
case Value::ddl_int64:
|
||||||
in = parseStringLiteral( in, end, ¤t );
|
case Value::ddl_unsigned_int8:
|
||||||
|
case Value::ddl_unsigned_int16:
|
||||||
|
case Value::ddl_unsigned_int32:
|
||||||
|
case Value::ddl_unsigned_int64:
|
||||||
|
in = parseIntegerLiteral( in, end, ¤t, type);
|
||||||
|
break;
|
||||||
|
case Value::ddl_half:
|
||||||
|
case Value::ddl_float:
|
||||||
|
case Value::ddl_double:
|
||||||
|
in = parseFloatingLiteral( in, end, ¤t, type);
|
||||||
|
break;
|
||||||
|
case Value::ddl_string:
|
||||||
|
in = parseStringLiteral( in, end, ¤t );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -895,7 +953,7 @@ static DataArrayList *createDataArrayList( Value *currentValue, size_t numValues
|
||||||
return dataList;
|
return dataList;
|
||||||
|
|
||||||
}
|
}
|
||||||
char *OpenDDLParser::parseDataArrayList( char *in, char *end, DataArrayList **dataList ) {
|
char *OpenDDLParser::parseDataArrayList( char *in, char *end,Value::ValueType type, DataArrayList **dataList ) {
|
||||||
*dataList = ddl_nullptr;
|
*dataList = ddl_nullptr;
|
||||||
if( ddl_nullptr == in || in == end ) {
|
if( ddl_nullptr == in || in == end ) {
|
||||||
return in;
|
return in;
|
||||||
|
@ -910,7 +968,7 @@ char *OpenDDLParser::parseDataArrayList( char *in, char *end, DataArrayList **da
|
||||||
do {
|
do {
|
||||||
size_t numRefs( 0 ), numValues( 0 );
|
size_t numRefs( 0 ), numValues( 0 );
|
||||||
currentValue = ddl_nullptr;
|
currentValue = ddl_nullptr;
|
||||||
Value::ValueType type( Value::ddl_none );
|
|
||||||
in = parseDataList( in, end, type, ¤tValue, numValues, &refs, numRefs );
|
in = parseDataList( in, end, type, ¤tValue, numValues, &refs, numRefs );
|
||||||
if( ddl_nullptr != currentValue ) {
|
if( ddl_nullptr != currentValue ) {
|
||||||
if( ddl_nullptr == prev ) {
|
if( ddl_nullptr == prev ) {
|
||||||
|
|
|
@ -316,6 +316,16 @@ Value *Value::getNext() const {
|
||||||
return m_next;
|
return m_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t Value::size(){
|
||||||
|
size_t result=1;
|
||||||
|
Value *n=m_next;
|
||||||
|
while( n!=ddl_nullptr) {
|
||||||
|
result++;
|
||||||
|
n=n->m_next;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
Value *ValueAllocator::allocPrimData( Value::ValueType type, size_t len ) {
|
Value *ValueAllocator::allocPrimData( Value::ValueType type, size_t len ) {
|
||||||
if( type == Value::ddl_none || Value::ddl_types_max == type ) {
|
if( type == Value::ddl_none || Value::ddl_types_max == type ) {
|
||||||
return ddl_nullptr;
|
return ddl_nullptr;
|
||||||
|
|
|
@ -30,7 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
# include <inttypes.h>
|
# include <inttypes.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# define TAG_DLL_EXPORT __declspec(dllexport)
|
# define TAG_DLL_EXPORT __declspec(dllexport)
|
||||||
|
@ -56,9 +56,15 @@ BEGIN_ODDLPARSER_NS
|
||||||
#ifndef OPENDDL_NO_USE_CPP11
|
#ifndef OPENDDL_NO_USE_CPP11
|
||||||
// All C++11 constructs
|
// All C++11 constructs
|
||||||
# define ddl_nullptr nullptr
|
# define ddl_nullptr nullptr
|
||||||
|
# define ddl_override override
|
||||||
|
# define ddl_final final
|
||||||
|
# define ddl_no_copy = delete
|
||||||
#else
|
#else
|
||||||
// Fall-back for older compilers
|
// Fall-back for older compilers
|
||||||
# define ddl_nullptr NULL
|
# define ddl_nullptr NULL
|
||||||
|
# define ddl_override
|
||||||
|
# define ddl_final
|
||||||
|
# define ddl_no_copy
|
||||||
#endif // OPENDDL_NO_USE_CPP11
|
#endif // OPENDDL_NO_USE_CPP11
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
|
@ -92,7 +98,7 @@ typedef uint64_impl uint64; ///< Unsigned integer, 8 byte
|
||||||
|
|
||||||
/// @brief Stores a text.
|
/// @brief Stores a text.
|
||||||
///
|
///
|
||||||
/// A text is stored in a simple character buffer. Texts buffer can be
|
/// A text is stored in a simple character buffer. Texts buffer can be
|
||||||
/// greater than the number of stored characters in them.
|
/// greater than the number of stored characters in them.
|
||||||
struct DLL_ODDLPARSER_EXPORT Text {
|
struct DLL_ODDLPARSER_EXPORT Text {
|
||||||
size_t m_capacity; ///< The capacity of the text.
|
size_t m_capacity; ///< The capacity of the text.
|
||||||
|
@ -122,8 +128,8 @@ struct DLL_ODDLPARSER_EXPORT Text {
|
||||||
bool operator == ( const Text &rhs ) const;
|
bool operator == ( const Text &rhs ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Text( const Text & );
|
Text( const Text & ) ddl_no_copy;
|
||||||
Text &operator = ( const Text & );
|
Text &operator = ( const Text & ) ddl_no_copy;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Stores an OpenDDL-specific identifier type.
|
/// @brief Stores an OpenDDL-specific identifier type.
|
||||||
|
@ -142,13 +148,13 @@ struct DLL_ODDLPARSER_EXPORT Identifier {
|
||||||
|
|
||||||
/// @brief The destructor.
|
/// @brief The destructor.
|
||||||
~Identifier();
|
~Identifier();
|
||||||
|
|
||||||
/// @brief The compare operator.
|
/// @brief The compare operator.
|
||||||
bool operator == ( const Identifier &rhs ) const;
|
bool operator == ( const Identifier &rhs ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Identifier( const Identifier & );
|
Identifier( const Identifier & ) ddl_no_copy;
|
||||||
Identifier &operator = ( const Identifier & );
|
Identifier &operator = ( const Identifier & ) ddl_no_copy;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Description of the type of a name.
|
/// @brief Description of the type of a name.
|
||||||
|
@ -171,8 +177,8 @@ struct DLL_ODDLPARSER_EXPORT Name {
|
||||||
~Name();
|
~Name();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Name( const Name & );
|
Name( const Name & ) ddl_no_copy;
|
||||||
Name &operator = ( const Name& );
|
Name &operator = ( const Name& ) ddl_no_copy;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Stores a bundle of references.
|
/// @brief Stores a bundle of references.
|
||||||
|
@ -182,7 +188,7 @@ struct DLL_ODDLPARSER_EXPORT Reference {
|
||||||
|
|
||||||
/// @brief The default constructor.
|
/// @brief The default constructor.
|
||||||
Reference();
|
Reference();
|
||||||
|
|
||||||
/// @brief The constructor with an array of ref names.
|
/// @brief The constructor with an array of ref names.
|
||||||
/// @param numrefs [in] The number of ref names.
|
/// @param numrefs [in] The number of ref names.
|
||||||
/// @param names [in] The ref names.
|
/// @param names [in] The ref names.
|
||||||
|
@ -192,8 +198,8 @@ struct DLL_ODDLPARSER_EXPORT Reference {
|
||||||
~Reference();
|
~Reference();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Reference( const Reference & );
|
Reference( const Reference & ) ddl_no_copy;
|
||||||
Reference &operator = ( const Reference & );
|
Reference &operator = ( const Reference & ) ddl_no_copy;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Stores a property list.
|
/// @brief Stores a property list.
|
||||||
|
@ -214,8 +220,8 @@ struct DLL_ODDLPARSER_EXPORT Property {
|
||||||
~Property();
|
~Property();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Property( const Property & );
|
Property( const Property & ) ddl_no_copy;
|
||||||
Property &operator = ( const Property & );
|
Property &operator = ( const Property & ) ddl_no_copy;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Stores a data array list.
|
/// @brief Stores a data array list.
|
||||||
|
@ -230,9 +236,12 @@ struct DLL_ODDLPARSER_EXPORT DataArrayList {
|
||||||
/// @brief The destructor.
|
/// @brief The destructor.
|
||||||
~DataArrayList();
|
~DataArrayList();
|
||||||
|
|
||||||
|
/// @brief Gets the length of the array
|
||||||
|
size_t size();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DataArrayList( const DataArrayList & );
|
DataArrayList( const DataArrayList & ) ddl_no_copy;
|
||||||
DataArrayList &operator = ( const DataArrayList & );
|
DataArrayList &operator = ( const DataArrayList & ) ddl_no_copy;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Stores the context of a parsed OpenDDL declaration.
|
/// @brief Stores the context of a parsed OpenDDL declaration.
|
||||||
|
@ -249,8 +258,8 @@ struct DLL_ODDLPARSER_EXPORT Context {
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Context( const Context & );
|
Context( const Context & ) ddl_no_copy;
|
||||||
Context &operator = ( const Context & );
|
Context &operator = ( const Context & ) ddl_no_copy;
|
||||||
};
|
};
|
||||||
|
|
||||||
END_ODDLPARSER_NS
|
END_ODDLPARSER_NS
|
||||||
|
|
|
@ -27,19 +27,31 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
BEGIN_ODDLPARSER_NS
|
BEGIN_ODDLPARSER_NS
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------
|
||||||
|
/// @ingroup IOStreamBase
|
||||||
|
/// @brief This class represents the stream to write out.
|
||||||
|
//-------------------------------------------------------------------------------------------------
|
||||||
|
class DLL_ODDLPARSER_EXPORT StreamFormatterBase {
|
||||||
|
public:
|
||||||
|
StreamFormatterBase();
|
||||||
|
virtual ~StreamFormatterBase();
|
||||||
|
virtual std::string format( const std::string &statement );
|
||||||
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
/// @ingroup IOStreamBase
|
/// @ingroup IOStreamBase
|
||||||
/// @brief This class represents the stream to write out.
|
/// @brief This class represents the stream to write out.
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
class DLL_ODDLPARSER_EXPORT IOStreamBase {
|
class DLL_ODDLPARSER_EXPORT IOStreamBase {
|
||||||
public:
|
public:
|
||||||
IOStreamBase();
|
IOStreamBase( StreamFormatterBase *formatter = ddl_nullptr );
|
||||||
virtual ~IOStreamBase();
|
virtual ~IOStreamBase();
|
||||||
virtual bool open( const std::string &anme );
|
virtual bool open( const std::string &anme );
|
||||||
virtual bool close();
|
virtual bool close();
|
||||||
virtual void write( const std::string &statement );
|
virtual size_t write( const std::string &statement );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
StreamFormatterBase *m_formatter;
|
||||||
FILE *m_file;
|
FILE *m_file;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -128,11 +128,11 @@ public:
|
||||||
/// @brief Returns the buffer pointer.
|
/// @brief Returns the buffer pointer.
|
||||||
/// @return The buffer pointer.
|
/// @return The buffer pointer.
|
||||||
const char *getBuffer() const;
|
const char *getBuffer() const;
|
||||||
|
|
||||||
/// @brief Returns the size of the buffer.
|
/// @brief Returns the size of the buffer.
|
||||||
/// @return The buffer size.
|
/// @return The buffer size.
|
||||||
size_t getBufferSize() const;
|
size_t getBufferSize() const;
|
||||||
|
|
||||||
/// @brief Clears all parser data, including buffer and active context.
|
/// @brief Clears all parser data, including buffer and active context.
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
@ -166,12 +166,12 @@ public: // parser helpers
|
||||||
static char *parseReference( char *in, char *end, std::vector<Name*> &names );
|
static char *parseReference( char *in, char *end, std::vector<Name*> &names );
|
||||||
static char *parseBooleanLiteral( char *in, char *end, Value **boolean );
|
static char *parseBooleanLiteral( char *in, char *end, Value **boolean );
|
||||||
static char *parseIntegerLiteral( char *in, char *end, Value **integer, Value::ValueType integerType = Value::ddl_int32 );
|
static char *parseIntegerLiteral( char *in, char *end, Value **integer, Value::ValueType integerType = Value::ddl_int32 );
|
||||||
static char *parseFloatingLiteral( char *in, char *end, Value **floating );
|
static char *parseFloatingLiteral( char *in, char *end, Value **floating, Value::ValueType floatType= Value::ddl_float );
|
||||||
static char *parseStringLiteral( char *in, char *end, Value **stringData );
|
static char *parseStringLiteral( char *in, char *end, Value **stringData );
|
||||||
static char *parseHexaLiteral( char *in, char *end, Value **data );
|
static char *parseHexaLiteral( char *in, char *end, Value **data );
|
||||||
static char *parseProperty( char *in, char *end, Property **prop );
|
static char *parseProperty( char *in, char *end, Property **prop );
|
||||||
static char *parseDataList( char *in, char *end, Value::ValueType type, Value **data, size_t &numValues, Reference **refs, size_t &numRefs );
|
static char *parseDataList( char *in, char *end, Value::ValueType type, Value **data, size_t &numValues, Reference **refs, size_t &numRefs );
|
||||||
static char *parseDataArrayList( char *in, char *end, DataArrayList **dataList );
|
static char *parseDataArrayList( char *in, char *end, Value::ValueType type, DataArrayList **dataList );
|
||||||
static const char *getVersion();
|
static const char *getVersion();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -26,19 +26,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
BEGIN_ODDLPARSER_NS
|
BEGIN_ODDLPARSER_NS
|
||||||
|
|
||||||
template<class T>
|
|
||||||
inline
|
|
||||||
bool isComment( T *in, T *end ) {
|
|
||||||
if( *in == '/' ) {
|
|
||||||
if( in + 1 != end ) {
|
|
||||||
if( *( in + 1 ) == '/' ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline
|
inline
|
||||||
bool isUpperCase( T in ) {
|
bool isUpperCase( T in ) {
|
||||||
|
@ -51,8 +38,8 @@ bool isLowerCase( T in ) {
|
||||||
return ( in >= 'a' && in <= 'z' );
|
return ( in >= 'a' && in <= 'z' );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline
|
inline
|
||||||
bool isSpace( const T in ) {
|
bool isSpace( const T in ) {
|
||||||
return ( ' ' == in || '\t' == in );
|
return ( ' ' == in || '\t' == in );
|
||||||
}
|
}
|
||||||
|
@ -66,7 +53,7 @@ bool isNewLine( const T in ) {
|
||||||
template<class T>
|
template<class T>
|
||||||
inline
|
inline
|
||||||
bool isSeparator( T in ) {
|
bool isSeparator( T in ) {
|
||||||
if( isSpace( in ) || ',' == in || '{' == in || '}' == in || '[' == in ) {
|
if( isSpace( in ) || ',' == in || '{' == in || '}' == in || '[' == in || '(' == in || ')' == in ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -83,7 +70,7 @@ static const unsigned char chartype_table[ 256 ] = {
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 96-111
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 96-111
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 112-127
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 112-127
|
||||||
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // > 127
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // > 127
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
@ -98,7 +85,7 @@ template<class T>
|
||||||
inline
|
inline
|
||||||
bool isNumeric( const T in ) {
|
bool isNumeric( const T in ) {
|
||||||
return ( in >= '0' && in <= '9' );
|
return ( in >= '0' && in <= '9' );
|
||||||
//return ( chartype_table[in] );
|
//return ( chartype_table[in] );
|
||||||
/*if (in >= '0' && in <= '9' )
|
/*if (in >= '0' && in <= '9' )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -108,7 +95,7 @@ bool isNumeric( const T in ) {
|
||||||
template<class T>
|
template<class T>
|
||||||
inline
|
inline
|
||||||
bool isNotEndOfToken( T *in, T *end ) {
|
bool isNotEndOfToken( T *in, T *end ) {
|
||||||
return ( '}' != *in && ',' != *in && !isSpace( *in ) && in != end );
|
return ( '}' != *in && ',' != *in && !isSpace( *in ) && ')' != *in && in != end );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
@ -238,7 +225,7 @@ int hex2Decimal( char in ) {
|
||||||
if( isNumeric( in ) ) {
|
if( isNumeric( in ) ) {
|
||||||
return ( in - 48 );
|
return ( in - 48 );
|
||||||
}
|
}
|
||||||
|
|
||||||
char hexCodeLower( 'a' ), hexCodeUpper( 'A' );
|
char hexCodeLower( 'a' ), hexCodeUpper( 'A' );
|
||||||
for( int i = 0; i<16; i++ ) {
|
for( int i = 0; i<16; i++ ) {
|
||||||
if( in == hexCodeLower + i || in == hexCodeUpper + i ) {
|
if( in == hexCodeLower + i || in == hexCodeUpper + i ) {
|
||||||
|
@ -249,4 +236,24 @@ int hex2Decimal( char in ) {
|
||||||
return ErrorHex2Decimal;
|
return ErrorHex2Decimal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline
|
||||||
|
bool isComment( T *in, T *end ) {
|
||||||
|
if ( *in=='/' ) {
|
||||||
|
if ( in+1!=end ) {
|
||||||
|
if ( *( in+1 )=='/' ) {
|
||||||
|
char *drive( ( in+2 ) );
|
||||||
|
if ( isUpperCase<T>( *drive )||isLowerCase<T>( *drive )&&*( drive+1 )=='/' ) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
END_ODDLPARSER_NS
|
END_ODDLPARSER_NS
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,8 @@ class DLL_ODDLPARSER_EXPORT Value {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// @brief This class implements an iterator through a Value list.
|
/// @brief This class implements an iterator through a Value list.
|
||||||
///
|
///
|
||||||
/// When getting a new value you need to know how to iterate through it. The Value::Iterator
|
/// When getting a new value you need to know how to iterate through it. The Value::Iterator
|
||||||
/// will help you here:
|
/// will help you here:
|
||||||
/// @code
|
/// @code
|
||||||
/// Value *val = node->getValue();
|
/// Value *val = node->getValue();
|
||||||
|
@ -73,10 +73,10 @@ public:
|
||||||
/// @brief Returns the next item and moves the iterator to it.
|
/// @brief Returns the next item and moves the iterator to it.
|
||||||
/// @return The next value, is ddl_nullptr in case of being the last item.
|
/// @return The next value, is ddl_nullptr in case of being the last item.
|
||||||
Value *getNext();
|
Value *getNext();
|
||||||
|
|
||||||
/// @brief The post-increment operator.
|
/// @brief The post-increment operator.
|
||||||
const Iterator operator++( int );
|
const Iterator operator++( int );
|
||||||
|
|
||||||
/// @brief The pre-increment operator.
|
/// @brief The pre-increment operator.
|
||||||
Iterator &operator++( );
|
Iterator &operator++( );
|
||||||
|
|
||||||
|
@ -109,44 +109,132 @@ public:
|
||||||
ddl_unsigned_int16, ///< Unsigned integer type, 16 bytes
|
ddl_unsigned_int16, ///< Unsigned integer type, 16 bytes
|
||||||
ddl_unsigned_int32, ///< Unsigned integer type, 32 bytes
|
ddl_unsigned_int32, ///< Unsigned integer type, 32 bytes
|
||||||
ddl_unsigned_int64, ///< Unsigned integer type, 64 bytes
|
ddl_unsigned_int64, ///< Unsigned integer type, 64 bytes
|
||||||
ddl_half,
|
ddl_half, ///< Half data type.
|
||||||
ddl_float,
|
ddl_float, ///< float data type
|
||||||
ddl_double,
|
ddl_double, ///< Double data type.
|
||||||
ddl_string,
|
ddl_string, ///< String data type.
|
||||||
ddl_ref,
|
ddl_ref, ///< Reference, used to define references to other data definitions.
|
||||||
ddl_types_max
|
ddl_types_max ///< Upper limit.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// @brief The class constructor.
|
||||||
|
/// @param type [in] The value type.
|
||||||
Value( ValueType type );
|
Value( ValueType type );
|
||||||
|
|
||||||
|
/// @brief The class destructor.
|
||||||
~Value();
|
~Value();
|
||||||
|
|
||||||
|
/// @brief Assigns a boolean to the value.
|
||||||
|
/// @param value [in9 The value.
|
||||||
void setBool( bool value );
|
void setBool( bool value );
|
||||||
|
|
||||||
|
/// @brief Returns the boolean value.
|
||||||
|
/// @return The boolean value.
|
||||||
bool getBool();
|
bool getBool();
|
||||||
|
|
||||||
|
/// @brief Assigns a int8 to the value.
|
||||||
|
/// @param value [in] The value.
|
||||||
void setInt8( int8 value );
|
void setInt8( int8 value );
|
||||||
|
|
||||||
|
/// @brief Returns the int8 value.
|
||||||
|
/// @return The int8 value.
|
||||||
int8 getInt8();
|
int8 getInt8();
|
||||||
|
|
||||||
|
/// @brief Assigns a int16 to the value.
|
||||||
|
/// @param value [in] The value.
|
||||||
void setInt16( int16 value );
|
void setInt16( int16 value );
|
||||||
|
|
||||||
|
/// @brief Returns the int16 value.
|
||||||
|
/// @return The int16 value.
|
||||||
int16 getInt16();
|
int16 getInt16();
|
||||||
|
|
||||||
|
/// @brief Assigns a int32 to the value.
|
||||||
|
/// @param value [in] The value.
|
||||||
void setInt32( int32 value );
|
void setInt32( int32 value );
|
||||||
|
|
||||||
|
/// @brief Returns the int16 value.
|
||||||
|
/// @return The int32 value.
|
||||||
int32 getInt32();
|
int32 getInt32();
|
||||||
|
|
||||||
|
/// @brief Assigns a int64 to the value.
|
||||||
|
/// @param value [in] The value.
|
||||||
void setInt64( int64 value );
|
void setInt64( int64 value );
|
||||||
|
|
||||||
|
/// @brief Returns the int16 value.
|
||||||
|
/// @return The int64 value.
|
||||||
int64 getInt64();
|
int64 getInt64();
|
||||||
|
|
||||||
|
/// @brief Assigns a unsigned int8 to the value.
|
||||||
|
/// @param value [in] The value.
|
||||||
void setUnsignedInt8( uint8 value );
|
void setUnsignedInt8( uint8 value );
|
||||||
|
|
||||||
|
/// @brief Returns the unsigned int8 value.
|
||||||
|
/// @return The unsigned int8 value.
|
||||||
uint8 getUnsignedInt8() const;
|
uint8 getUnsignedInt8() const;
|
||||||
|
|
||||||
|
/// @brief Assigns a unsigned int16 to the value.
|
||||||
|
/// @param value [in] The value.
|
||||||
void setUnsignedInt16( uint16 value );
|
void setUnsignedInt16( uint16 value );
|
||||||
|
|
||||||
|
/// @brief Returns the unsigned int16 value.
|
||||||
|
/// @return The unsigned int16 value.
|
||||||
uint16 getUnsignedInt16() const;
|
uint16 getUnsignedInt16() const;
|
||||||
|
|
||||||
|
/// @brief Assigns a unsigned int32 to the value.
|
||||||
|
/// @param value [in] The value.
|
||||||
void setUnsignedInt32( uint32 value );
|
void setUnsignedInt32( uint32 value );
|
||||||
|
|
||||||
|
/// @brief Returns the unsigned int8 value.
|
||||||
|
/// @return The unsigned int32 value.
|
||||||
uint32 getUnsignedInt32() const;
|
uint32 getUnsignedInt32() const;
|
||||||
|
|
||||||
|
/// @brief Assigns a unsigned int64 to the value.
|
||||||
|
/// @param value [in] The value.
|
||||||
void setUnsignedInt64( uint64 value );
|
void setUnsignedInt64( uint64 value );
|
||||||
|
|
||||||
|
/// @brief Returns the unsigned int64 value.
|
||||||
|
/// @return The unsigned int64 value.
|
||||||
uint64 getUnsignedInt64() const;
|
uint64 getUnsignedInt64() const;
|
||||||
|
|
||||||
|
/// @brief Assigns a float to the value.
|
||||||
|
/// @param value [in] The value.
|
||||||
void setFloat( float value );
|
void setFloat( float value );
|
||||||
|
|
||||||
|
/// @brief Returns the float value.
|
||||||
|
/// @return The float value.
|
||||||
float getFloat() const;
|
float getFloat() const;
|
||||||
|
|
||||||
|
/// @brief Assigns a double to the value.
|
||||||
|
/// @param value [in] The value.
|
||||||
void setDouble( double value );
|
void setDouble( double value );
|
||||||
|
|
||||||
|
/// @brief Returns the double value.
|
||||||
|
/// @return The double value.
|
||||||
double getDouble() const;
|
double getDouble() const;
|
||||||
|
|
||||||
|
/// @brief Assigns a std::string to the value.
|
||||||
|
/// @param value [in] The value.
|
||||||
void setString( const std::string &str );
|
void setString( const std::string &str );
|
||||||
|
|
||||||
|
/// @brief Returns the std::string value.
|
||||||
|
/// @return The std::string value.
|
||||||
const char *getString() const;
|
const char *getString() const;
|
||||||
|
|
||||||
|
/// @brief Dumps the value.
|
||||||
void dump();
|
void dump();
|
||||||
|
|
||||||
|
/// @brief Assigns the next value.
|
||||||
|
/// @param next [n] The next value.
|
||||||
void setNext( Value *next );
|
void setNext( Value *next );
|
||||||
|
|
||||||
|
/// @brief Returns the next value.
|
||||||
|
/// @return The next value.s
|
||||||
Value *getNext() const;
|
Value *getNext() const;
|
||||||
|
|
||||||
|
/// @brief Gets the length of the array.
|
||||||
|
/// @return The number of items in the array.
|
||||||
|
size_t size();
|
||||||
|
|
||||||
ValueType m_type;
|
ValueType m_type;
|
||||||
size_t m_size;
|
size_t m_size;
|
||||||
unsigned char *m_data;
|
unsigned char *m_data;
|
||||||
|
|
|
@ -1,5 +1,43 @@
|
||||||
/** @file ai_assert.h
|
/*
|
||||||
*/
|
---------------------------------------------------------------------------
|
||||||
|
Open Asset Import Library (assimp)
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2006-2016, assimp team
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer in the documentation and/or other
|
||||||
|
materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of the assimp team, nor the names of its
|
||||||
|
contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior
|
||||||
|
written permission of the assimp team.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
#ifndef AI_DEBUG_H_INC
|
#ifndef AI_DEBUG_H_INC
|
||||||
#define AI_DEBUG_H_INC
|
#define AI_DEBUG_H_INC
|
||||||
|
|
||||||
|
|
|
@ -249,7 +249,8 @@ struct aiBone
|
||||||
|
|
||||||
//! Default constructor
|
//! Default constructor
|
||||||
aiBone()
|
aiBone()
|
||||||
: mNumWeights( 0 )
|
: mName()
|
||||||
|
, mNumWeights( 0 )
|
||||||
, mWeights( NULL )
|
, mWeights( NULL )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue