Sciter: F:/hsmile5/sdk/include/value.h Source File

Sciter  3.3.2.5
Sciter API
value.h
Go to the documentation of this file.
1 #ifndef __value_h__
2 #define __value_h__
3 
4 #include "sciter-x-types.h"
5 
6  enum VALUE_RESULT
7 {
8   HV_OK_TRUE = -1,
9   HV_OK = 0,
10   HV_BAD_PARAMETER = 1,
11   HV_INCOMPATIBLE_TYPE = 2
12 };
13 
14  typedef struct
15 {
16   UINT t;
17   UINT u;
18   UINT64 d;
19 } VALUE;
20 
21  #define FLOAT_VALUE double
22 
23  enum VALUE_TYPE
24 {
25   T_UNDEFINED = 0,
26   T_NULL = 1,
27   T_BOOL,
28   T_INT,
29   T_FLOAT,
30   T_STRING,
31   T_DATE, // INT64 - contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC), a.k.a. FILETIME on Windows
32   T_CURRENCY, // INT64 - 14.4 fixed number. E.g. dollars = int64 / 10000;
33   T_LENGTH, // length units, value is int or float, units are VALUE_UNIT_TYPE
34   T_ARRAY,
35   T_MAP,
36   T_FUNCTION,
37   T_BYTES, // sequence of bytes - e.g. image data
38   T_OBJECT, // scripting object proxy (TISCRIPT/SCITER)
39   T_DOM_OBJECT // DOM object (CSSS!), use get_object_data to get HELEMENT
40 };
41 
42  enum VALUE_UNIT_TYPE
43 {
44   UT_EM = 1, //height of the element's font.
45   UT_EX = 2, //height of letter 'x'
46   UT_PR = 3, //%
47   UT_SP = 4, //%% "springs", a.k.a. flex units
48   reserved1 = 5,
49   reserved2 = 6,
50   UT_PX = 7, //pixels
51   UT_IN = 8, //inches (1 inch = 2.54 centimeters).
52   UT_CM = 9, //centimeters.
53   UT_MM = 10, //millimeters.
54   UT_PT = 11, //points (1 point = 1/72 inches).
55   UT_PC = 12, //picas (1 pica = 12 points).
56   UT_DIP = 13,
57   reserved3 = 14,
58   UT_COLOR = 15, // color in int
59   UT_URL = 16, // url in string
60 };
61 
62  enum VALUE_UNIT_TYPE_DATE
63 {
64   DT_HAS_DATE = 0x01, // date contains date portion
65   DT_HAS_TIME = 0x02, // date contains time portion HH:MM
66   DT_HAS_SECONDS = 0x04, // date contains time and seconds HH:MM:SS
67   DT_UTC = 0x10, // T_DATE is known to be UTC. Otherwise it is local date/time
68 };
69 
70 // Sciter or TIScript specific
71  enum VALUE_UNIT_TYPE_OBJECT
72 {
73   UT_OBJECT_ARRAY = 0, // type T_OBJECT of type Array
74   UT_OBJECT_OBJECT = 1, // type T_OBJECT of type Object
75   UT_OBJECT_CLASS = 2, // type T_OBJECT of type Type (class or namespace)
76   UT_OBJECT_NATIVE = 3, // type T_OBJECT of native Type with data slot (LPVOID)
77   UT_OBJECT_FUNCTION = 4, // type T_OBJECT of type Function
78   UT_OBJECT_ERROR = 5, // type T_OBJECT of type Error
79 };
80 
81 // Sciter or TIScript specific
82  enum VALUE_UNIT_TYPE_STRING
83 {
84   UT_STRING_STRING = 0, // string
85   UT_STRING_ERROR = 1, // is an error string
86   UT_STRING_SECURE = 2, // secure string ("wiped" on destroy)
87   UT_STRING_SYMBOL = 0xffff, // symbol in tiscript sense
88 };
89 
90 // Native functor
91  typedef VOID NATIVE_FUNCTOR_INVOKE( VOID* tag, UINT argc, const VALUE* argv, VALUE* retval); // retval may contain error definition
92  typedef VOID NATIVE_FUNCTOR_RELEASE( VOID* tag );
93 
94 
99 UINT SCAPI ValueInit( VALUE* pval );
100 
104 UINT SCAPI ValueClear( VALUE* pval );
105 
109 UINT SCAPI ValueCompare( const VALUE* pval1, const VALUE* pval2 );
110 
114 UINT SCAPI ValueCopy( VALUE* pdst, const VALUE* psrc );
115 
121 UINT SCAPI ValueIsolate( VALUE* pdst );
122 
126 UINT SCAPI ValueType( const VALUE* pval, UINT* pType, UINT* pUnits );
127 
132 UINT SCAPI ValueStringData( const VALUE* pval, LPCWSTR* pChars, UINT* pNumChars );
133 
138 UINT SCAPI ValueStringDataSet( VALUE* pval, LPCWSTR chars, UINT numChars, UINT units );
139 
143 UINT SCAPI ValueIntData( const VALUE* pval, INT* pData );
144 
149 UINT SCAPI ValueIntDataSet( VALUE* pval, INT data, UINT type, UINT units );
150 
154 UINT SCAPI ValueInt64Data( const VALUE* pval, INT64* pData );
155 
159 UINT SCAPI ValueInt64DataSet( VALUE* pval, INT64 data, UINT type, UINT units );
160 
164 UINT SCAPI ValueFloatData( const VALUE* pval, FLOAT_VALUE* pData );
165 
169 UINT SCAPI ValueFloatDataSet( VALUE* pval, FLOAT_VALUE data, UINT type, UINT units );
170 
174 UINT SCAPI ValueBinaryData( const VALUE* pval, LPCBYTE* pBytes, UINT* pnBytes );
175 
181 UINT SCAPI ValueBinaryDataSet( VALUE* pval, LPCBYTE pBytes, UINT nBytes, UINT type, UINT units );
182 
189 UINT SCAPI ValueElementsCount( const VALUE* pval, INT* pn);
190 
197 UINT SCAPI ValueNthElementValue( const VALUE* pval, INT n, VALUE* pretval);
198 
207 UINT SCAPI ValueNthElementValueSet( VALUE* pval, INT n, const VALUE* pval_to_set);
208 
212  typedef BOOL SC_CALLBACK KeyValueCallback( LPVOID param, const VALUE* pkey, const VALUE* pval );
213 
219 UINT SCAPI ValueNthElementKey( const VALUE* pval, INT n, VALUE* pretval);
220 
221 UINT SCAPI ValueEnumElements( const VALUE* pval, KeyValueCallback* penum, LPVOID param);
222 
234 UINT SCAPI ValueSetValueToKey( VALUE* pval, const VALUE* pkey, const VALUE* pval_to_set);
235 
243 UINT SCAPI ValueGetValueOfKey( const VALUE* pval, const VALUE* pkey, VALUE* pretval);
244 
245  enum VALUE_STRING_CVT_TYPE
246 {
247   CVT_SIMPLE,
248   CVT_JSON_LITERAL,
249   CVT_JSON_MAP,
250   CVT_XJSON_LITERAL,
251 
252 };
253 
260 UINT SCAPI ValueToString( VALUE* pval, /*VALUE_STRING_CVT_TYPE*/ UINT how );
261 
270 UINT SCAPI ValueFromString( VALUE* pval, LPCWSTR str, UINT strLength, /*VALUE_STRING_CVT_TYPE*/ UINT how );
271 
282 UINT SCAPI ValueInvoke( const VALUE* pval, VALUE* pthis, UINT argc, const VALUE* argv, VALUE* pretval, LPCWSTR url);
283 
293 UINT SCAPI ValueNativeFunctorSet( VALUE* pval,
294  NATIVE_FUNCTOR_INVOKE* pinvoke,
295  NATIVE_FUNCTOR_RELEASE* prelease = NULL,
296  VOID* tag = NULL );
297 
298 BOOL SCAPI ValueIsNativeFunctor( const VALUE* pval);
299 
300 
301 #if defined(__cplusplus) && !defined(__value_hpp__)
302 
303  #include "value.hpp"
304 
305  #pragma warning( push )
306  #pragma warning(disable:4786) //identifier was truncated...
307 
308  namespace json
309  {
310  using sciter::value;
311  using sciter::string;
312  using sciter::astring;
313  }
314 
315 #endif //defined(__cplusplus)
316 
317 #endif
BOOL SCAPI ValueIsNativeFunctor(const VALUE *pval)
Definition: sciter-x-api.h:600
Definition: value.h:31
UINT SCAPI ValueToString(VALUE *pval, UINT how)
Definition: sciter-x-api.h:596
UINT64 d
Definition: value.h:18
Definition: value.h:38
Definition: value.h:50
Definition: value.h:45
UINT SCAPI ValueType(const VALUE *pval, UINT *pType, UINT *pUnits)
Definition: sciter-x-api.h:578
UINT SCAPI ValueClear(VALUE *pval)
Definition: sciter-x-api.h:574
Definition: value.h:8
Definition: value.h:54
VALUE_UNIT_TYPE_DATE
Definition: value.h:62
Definition: value.h:48
UINT SCAPI ValueInt64DataSet(VALUE *pval, INT64 data, UINT type, UINT units)
Definition: sciter-x-api.h:584
UINT SCAPI ValueBinaryDataSet(VALUE *pval, LPCBYTE pBytes, UINT nBytes, UINT type, UINT units)
Definition: sciter-x-api.h:588
UINT SCAPI ValueStringDataSet(VALUE *pval, LPCWSTR chars, UINT numChars, UINT units)
Definition: sciter-x-api.h:580
Definition: value.h:32
Definition: value.h:52
Definition: value.h:58
UINT SCAPI ValueNthElementKey(const VALUE *pval, INT n, VALUE *pretval)
Definition: sciter-x-api.h:592
std::basic_string< char > astring
Definition: value.hpp:44
Definition: value.h:9
UINT SCAPI ValueFromString(VALUE *pval, LPCWSTR str, UINT strLength, UINT how)
Definition: sciter-x-api.h:597
UINT SCAPI ValueEnumElements(const VALUE *pval, KeyValueCallback *penum, LPVOID param)
Definition: sciter-x-api.h:593
const BYTE * LPCBYTE
UINT SCAPI ValueIsolate(VALUE *pdst)
Definition: sciter-x-api.h:577
Definition: value.h:46
Definition: value.h:67
VALUE_UNIT_TYPE_OBJECT
Definition: value.h:71
Definition: value.h:47
UINT SCAPI ValueNthElementValue(const VALUE *pval, INT n, VALUE *pretval)
Definition: sciter-x-api.h:590
UINT SCAPI ValueIntData(const VALUE *pval, INT *pData)
Definition: sciter-x-api.h:581
Definition: value.h:51
Definition: value.h:14
VOID NATIVE_FUNCTOR_RELEASE(VOID *tag)
Definition: value.h:92
Definition: value.h:53
Definition: value.h:34
VOID NATIVE_FUNCTOR_INVOKE(VOID *tag, UINT argc, const VALUE *argv, VALUE *retval)
Definition: value.h:91
Definition: value.h:65
Definition: value.h:56
UINT SCAPI ValueStringData(const VALUE *pval, LPCWSTR *pChars, UINT *pNumChars)
Definition: sciter-x-api.h:579
Definition: value.h:36
Definition: value.h:37
UINT SCAPI ValueFloatData(const VALUE *pval, FLOAT_VALUE *pData)
Definition: sciter-x-api.h:585
Definition: value.h:64
UINT SCAPI ValueNativeFunctorSet(VALUE *pval, NATIVE_FUNCTOR_INVOKE *pinvoke, NATIVE_FUNCTOR_RELEASE *prelease=NULL, VOID *tag=NULL)
Definition: sciter-x-api.h:599
Definition: value.h:29
UINT SCAPI ValueNthElementValueSet(VALUE *pval, INT n, const VALUE *pval_to_set)
Definition: sciter-x-api.h:591
UINT SCAPI ValueGetValueOfKey(const VALUE *pval, const VALUE *pkey, VALUE *pretval)
Definition: sciter-x-api.h:595
BOOL SC_CALLBACK KeyValueCallback(LPVOID param, const VALUE *pkey, const VALUE *pval)
Definition: value.h:212
UINT SCAPI ValueElementsCount(const VALUE *pval, INT *pn)
Definition: sciter-x-api.h:589
Definition: value.h:30
VALUE_UNIT_TYPE_STRING
Definition: value.h:82
const std::vector< sciter::string > & argv()
json parsing/emission, it parses as if token &#39;{&#39; already recognized
Definition: value.h:249
UINT u
Definition: value.h:17
Definition: value.h:26
UINT t
Definition: value.h:16
Definition: value.h:55
VALUE_TYPE
Definition: value.h:23
Definition: value.h:27
Definition: value.h:33
Definition: value.h:59
Definition: value.h:44
UINT SCAPI ValueCompare(const VALUE *pval1, const VALUE *pval2)
Definition: sciter-x-api.h:575
UINT SCAPI ValueSetValueToKey(VALUE *pval, const VALUE *pkey, const VALUE *pval_to_set)
Definition: sciter-x-api.h:594
UINT SCAPI ValueFloatDataSet(VALUE *pval, FLOAT_VALUE data, UINT type, UINT units)
Definition: sciter-x-api.h:586
Definition: value.h:49
json literal parsing/emission
Definition: value.h:248
Definition: value.h:35
UINT SCAPI ValueInt64Data(const VALUE *pval, INT64 *pData)
Definition: sciter-x-api.h:583
Definition: value.h:57
#define FLOAT_VALUE
Definition: value.h:21
UINT SCAPI ValueCopy(VALUE *pdst, const VALUE *psrc)
Definition: sciter-x-api.h:576
x-json parsing/emission, date is emitted as ISO8601 date literal, currency is emitted in the form DDD...
Definition: value.h:250
VALUE_RESULT
Definition: value.h:6
VALUE_UNIT_TYPE
Definition: value.h:42
std::basic_string< WCHAR > string
Definition: value.hpp:42
UINT SCAPI ValueInvoke(const VALUE *pval, VALUE *pthis, UINT argc, const VALUE *argv, VALUE *pretval, LPCWSTR url)
Definition: sciter-x-api.h:598
Definition: value.h:25
UINT SCAPI ValueIntDataSet(VALUE *pval, INT data, UINT type, UINT units)
Definition: sciter-x-api.h:582
simple conversion of terminal values
Definition: value.h:247
UINT SCAPI ValueInit(VALUE *pval)
Definition: sciter-x-api.h:573
value.hpp VALUE C++ wrapper
Definition: value.h:28
VALUE_STRING_CVT_TYPE
Definition: value.h:245
UINT SCAPI ValueBinaryData(const VALUE *pval, LPCBYTE *pBytes, UINT *pnBytes)
Definition: sciter-x-api.h:587

AltStyle によって変換されたページ (->オリジナル) /