From Mathias Froehlich, build fixes for legacy unix systems

This commit is contained in:
Robert Osfield
2011-06-07 14:26:13 +00:00
parent 7f9a6aa49d
commit 4f7903f732
4 changed files with 77 additions and 76 deletions

View File

@@ -192,7 +192,7 @@ int main(int argc, char** argv)
std::string testString("All seems fine");
node->setUserValue("Status",testString);
node->setUserValue<float>("Height",1.4);
node->setUserValue("Height",float(1.4));
osg::ref_ptr<osg::Drawable> drawable = new osg::Geometry;
drawable->setName("myDrawable");
@@ -201,7 +201,7 @@ int main(int argc, char** argv)
node->setUserValue("fred",12);
node->setUserValue("john",1.1);
node->setUserValue("david",1.9f);
node->setUserValue<char>("char",65);
node->setUserValue("char",char(65));
node->setUserValue("matrixd",osg::Matrixd::translate(1.0,2.0,3.0));
node->setUserValue("flag-on",true);
node->setUserValue("flag-off",false);

View File

@@ -41,74 +41,6 @@ class State;
virtual const char* libraryName() const { return #library; }\
virtual const char* className() const { return #name; }
template<typename T>
T* clone(const T* t, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY)
{
if (t)
{
osg::ref_ptr<osg::Object> obj = t->clone(copyop);
T* ptr = dynamic_cast<T*>(obj.get());
if (ptr)
{
obj.release();
return ptr;
}
else
{
OSG_WARN<<"Warning: osg::clone(const T*, osg::CopyOp&) cloned object not of type T, returning NULL."<<std::endl;
return 0;
}
}
else
{
OSG_WARN<<"Warning: osg::clone(const T*, osg::CopyOp&) passed null object to clone, returning NULL."<<std::endl;
return 0;
}
}
template<typename T>
T* clone(const T* t, const std::string& name, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY)
{
T* newObject = osg::clone(t, copyop);
if (newObject)
{
newObject->setName(name);
return newObject;
}
else
{
OSG_WARN<<"Warning: osg::clone(const T*, const std::string&, const osg::CopyOp) passed null object to clone, returning NULL."<<std::endl;
return 0;
}
}
template<typename T>
T* cloneType(const T* t)
{
if (t)
{
osg::ref_ptr<osg::Object> obj = t->cloneType();
T* ptr = dynamic_cast<T*>(obj.get());
if (ptr)
{
obj.release();
return ptr;
}
else
{
OSG_WARN<<"Warning: osg::cloneType(const T*) cloned object not of type T, returning NULL."<<std::endl;
return 0;
}
}
else
{
OSG_WARN<<"Warning: osg::cloneType(const T*) passed null object to clone, returning NULL."<<std::endl;
return 0;
}
}
/** Base class/standard interface for objects which require IO support,
cloning and reference counting.
Based on GOF Composite, Prototype and Template Method patterns.
@@ -319,6 +251,73 @@ class OSG_EXPORT Object : public Referenced
Object& operator = (const Object&) { return *this; }
};
template<typename T>
T* clone(const T* t, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY)
{
if (t)
{
osg::ref_ptr<osg::Object> obj = t->clone(copyop);
T* ptr = dynamic_cast<T*>(obj.get());
if (ptr)
{
obj.release();
return ptr;
}
else
{
OSG_WARN<<"Warning: osg::clone(const T*, osg::CopyOp&) cloned object not of type T, returning NULL."<<std::endl;
return 0;
}
}
else
{
OSG_WARN<<"Warning: osg::clone(const T*, osg::CopyOp&) passed null object to clone, returning NULL."<<std::endl;
return 0;
}
}
template<typename T>
T* clone(const T* t, const std::string& name, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY)
{
T* newObject = osg::clone(t, copyop);
if (newObject)
{
newObject->setName(name);
return newObject;
}
else
{
OSG_WARN<<"Warning: osg::clone(const T*, const std::string&, const osg::CopyOp) passed null object to clone, returning NULL."<<std::endl;
return 0;
}
}
template<typename T>
T* cloneType(const T* t)
{
if (t)
{
osg::ref_ptr<osg::Object> obj = t->cloneType();
T* ptr = dynamic_cast<T*>(obj.get());
if (ptr)
{
obj.release();
return ptr;
}
else
{
OSG_WARN<<"Warning: osg::cloneType(const T*) cloned object not of type T, returning NULL."<<std::endl;
return 0;
}
}
else
{
OSG_WARN<<"Warning: osg::cloneType(const T*) passed null object to clone, returning NULL."<<std::endl;
return 0;
}
}
}

View File

@@ -473,19 +473,17 @@ osgDB::DirectoryContents ZipArchive::getDirectoryContents(const std::string& dir
for(; iter != iterEnd; ++iter)
{
const ZipEntryMapping& ze = *iter;
std::string searchPath = dirName;
CleanupFileString(searchPath);
if(ze.first.size() > searchPath.size())
if(iter->first.size() > searchPath.size())
{
size_t endSubElement = ze.first.find(searchPath);
size_t endSubElement = iter->first.find(searchPath);
//we match the whole string in the beginning of the path
if(endSubElement == 0)
{
std::string remainingFile = ze.first.substr(searchPath.size() + 1, std::string::npos);
std::string remainingFile = iter->first.substr(searchPath.size() + 1, std::string::npos);
size_t endFileToken = remainingFile.find_first_of('/');
if(endFileToken == std::string::npos)

View File

@@ -342,7 +342,11 @@ bool GraphicsWindowQt::init( QWidget* parent, const QGLWidget* shareWidget, Qt::
// WindowFlags
Qt::WindowFlags flags = f | Qt::Window | Qt::CustomizeWindowHint;
if ( _traits->windowDecoration )
flags |= Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
flags |= Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowSystemMenuHint
#if (QT_VERSION_CHECK(4, 5, 0) <= QT_VERSION)
| Qt::WindowCloseButtonHint
#endif
;
// create widget
_widget = new GLWidget( traits2qglFormat( _traits.get() ), parent, shareWidget, flags );