Skip to content

Commit 801f169

Browse files
authored
Merge pull request #2209 from opensim-org/expose_object_get_document
Expose Object::getDocument() as a const public method.
2 parents 2fc6dc1 + ac6815f commit 801f169

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

OpenSim/Common/Object.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,13 +1241,18 @@ updateDefaultObjectsXMLNode(SimTK::Xml::Element& aParent)
12411241
*
12421242
* @return Document's filename for this object.
12431243
*/
1244-
string Object::
1245-
getDocumentFileName() const
1244+
string Object::getDocumentFileName() const
12461245
{
12471246
return _document ? _document->getFileName() : "";
12481247
}
12491248

12501249

1250+
int Object::getDocumentFileVersion() const
1251+
{
1252+
return _document ? _document->getDocumentVersion() : -1;
1253+
}
1254+
1255+
12511256
//-----------------------------------------------------------------------------
12521257
// GENERATE XML DOCUMENT
12531258
//-----------------------------------------------------------------------------

OpenSim/Common/Object.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,13 @@ class OSIMCOMMON_API Object
573573
/** If there is a document associated with this object then return the
574574
file name maintained by the document. Otherwise return an empty string. **/
575575
std::string getDocumentFileName() const;
576+
577+
/** If there is a document associated with this object then return its
578+
version number. For example this is 30000 for OpenSim 3.x documents
579+
and is 305xx for OpenSim 4.0 beta and above. If there is no document
580+
associated with the object, the method returns -1.*/
581+
int getDocumentFileVersion() const;
582+
576583
void setAllPropertiesUseDefault(bool aUseDefault);
577584

578585
/** Write this %Object into an XML file of the given name; conventionally

0 commit comments

Comments
 (0)