Per discussions with justincc... split the JsonStore type

functions into one for node type and one for value type.
Define and export constants for both nodes and values.
This commit is contained in:
Mic Bowman
2013-03-05 20:33:17 -08:00
parent 30e06b0742
commit 9875e840f7
5 changed files with 143 additions and 35 deletions

View File

@@ -145,7 +145,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
///
/// </summary>
// -----------------------------------------------------------------
public JsonStoreNodeType PathType(string expr)
public JsonStoreNodeType GetNodeType(string expr)
{
Stack<string> path;
if (! ParsePathExpression(expr,out path))
@@ -168,6 +168,43 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
return JsonStoreNodeType.Undefined;
}
// -----------------------------------------------------------------
/// <summary>
///
/// </summary>
// -----------------------------------------------------------------
public JsonStoreValueType GetValueType(string expr)
{
Stack<string> path;
if (! ParsePathExpression(expr,out path))
return JsonStoreValueType.Undefined;
OSD result = ProcessPathExpression(ValueStore,path);
if (result == null)
return JsonStoreValueType.Undefined;
if (result is OSDMap)
return JsonStoreValueType.Undefined;
if (result is OSDArray)
return JsonStoreValueType.Undefined;
if (result is OSDBoolean)
return JsonStoreValueType.Boolean;
if (result is OSDInteger)
return JsonStoreValueType.Integer;
if (result is OSDReal)
return JsonStoreValueType.Float;
if (result is OSDString)
return JsonStoreValueType.String;
return JsonStoreValueType.Undefined;
}
// -----------------------------------------------------------------
/// <summary>
///