Add SGPath to the Nasal conversion helpers.

This commit is contained in:
James Turner 2012-12-28 14:53:31 +00:00
parent a131f44247
commit 0ea8dbea10
4 changed files with 26 additions and 0 deletions

View File

@ -19,6 +19,8 @@
#include "from_nasal_detail.hxx"
#include "NasalHash.hxx"
#include <simgear/misc/sg_path.hxx>
namespace nasal
{
//----------------------------------------------------------------------------
@ -53,6 +55,12 @@ namespace nasal
return std::string(naStr_data(na_str), naStr_len(na_str));
}
SGPath from_nasal_helper(naContext c, naRef ref, SGPath*)
{
naRef na_str = naStringValue(c, ref);
return SGPath(std::string(naStr_data(na_str), naStr_len(na_str)));
}
//----------------------------------------------------------------------------
Hash from_nasal_helper(naContext c, naRef ref, Hash*)
{

View File

@ -31,6 +31,8 @@
#include <typeinfo> // std::bad_cast
#include <vector>
class SGPath;
namespace nasal
{
class Hash;
@ -75,6 +77,11 @@ namespace nasal
*/
std::string from_nasal_helper(naContext c, naRef ref, std::string*);
/**
* Convert a Nasal string to an SGPath
*/
SGPath from_nasal_helper(naContext c, naRef ref, SGPath*);
/**
* Convert a Nasal hash to a nasal::Hash
*/

View File

@ -19,6 +19,8 @@
#include "to_nasal.hxx"
#include "NasalHash.hxx"
#include <simgear/misc/sg_path.hxx>
namespace nasal
{
//----------------------------------------------------------------------------
@ -53,4 +55,9 @@ namespace nasal
return ref;
}
//----------------------------------------------------------------------------
naRef to_nasal(naContext c, const SGPath& path)
{
return to_nasal(c, path.str());
}
} // namespace nasal

View File

@ -30,6 +30,8 @@
#include <string>
#include <vector>
class SGPath;
namespace nasal
{
class Hash;
@ -60,6 +62,8 @@ namespace nasal
*/
naRef to_nasal(naContext c, naRef ref);
naRef to_nasal(naContext c, const SGPath& path);
/**
* Convert a numeric type to Nasal number
*/