From 9875e840f7e71f0b253c0b2aa90d47edc9c77b64 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 5 Mar 2013 20:33:17 -0800 Subject: 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. --- .../Scripting/JsonStore/JsonStore.cs | 39 +++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs') diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs index 40adba1..e498c6a 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs @@ -145,7 +145,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore /// /// // ----------------------------------------------------------------- - public JsonStoreNodeType PathType(string expr) + public JsonStoreNodeType GetNodeType(string expr) { Stack path; if (! ParsePathExpression(expr,out path)) @@ -173,6 +173,43 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore /// /// // ----------------------------------------------------------------- + public JsonStoreValueType GetValueType(string expr) + { + Stack 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; + } + + // ----------------------------------------------------------------- + /// + /// + /// + // ----------------------------------------------------------------- public int ArrayLength(string expr) { Stack path; -- cgit v1.1