MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / ColumnSortOrderFromJS

Function ColumnSortOrderFromJS

src/openrct2-ui/scripting/CustomListView.cpp:37–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35 constexpr size_t kColumnHeaderHeight = kListRowHeight + 1;
36
37 ColumnSortOrder ColumnSortOrderFromJS(JSContext* ctx, JSValue d)
38 {
39 if (JS_IsString(d))
40 {
41 auto s = JSToStdString(ctx, d);
42 if (s == "ascending")
43 return ColumnSortOrder::Ascending;
44 if (s == "descending")
45 return ColumnSortOrder::Descending;
46 }
47 return ColumnSortOrder::None;
48 }
49
50 static JSValue ColumnSortOrderToJS(JSContext* ctx, ColumnSortOrder value)
51 {

Callers 1

ListViewColumnFromJSFunction · 0.85

Calls 1

JSToStdStringFunction · 0.85

Tested by

no test coverage detected