////////////////////////////////////////////////////////////////////////// // Actions ////////////////////////////////////////////////////////////////////////// /** * Invoke a remote action using the "invokeAction" REST operation. */ public HGrid invokeAction(HRef id, string action, HDict args) { return(invokeAction(id, action, args, null)); }
private HGrid parseGrid() { bool nested = m_tokCur == HaystackToken.lt2; if (nested) { consume(HaystackToken.lt2); if (m_tokCur == HaystackToken.nl) { consume(HaystackToken.nl); } } bool bValisVer = false; if (m_curVal is string) { if (((string)m_curVal).CompareTo("ver") == 0) { bValisVer = true; } } // ver:"3.0" if (m_tokCur != HaystackToken.id || !bValisVer) { err("Expecting grid 'ver' identifier, not " + curToStr()); } consume(); consume(HaystackToken.colon); m_iversion = checkVersion(consumeStr()); // grid meta HGridBuilder gb = new HGridBuilder(); if (m_tokCur == HaystackToken.id) { gb.Meta.add(parseDict()); } consume(HaystackToken.nl); // column definitions int numCols = 0; while (m_tokCur == HaystackToken.id) { ++numCols; string name = consumeTagName(); HDict colMeta = HDict.Empty; if (m_tokCur == HaystackToken.id) { colMeta = parseDict(); } gb.addCol(name).add(colMeta); if (m_tokCur != HaystackToken.comma) { break; } consume(HaystackToken.comma); } if (numCols == 0) { err("No columns defined"); } consume(HaystackToken.nl); // grid rows while (true) { if (m_tokCur == HaystackToken.nl) { break; } if (m_tokCur == HaystackToken.eof) { break; } if (nested && m_tokCur == HaystackToken.gt2) { break; } // read cells HVal[] cells = new HVal[numCols]; for (int i = 0; i < numCols; ++i) { if (m_tokCur == HaystackToken.comma || m_tokCur == HaystackToken.nl || m_tokCur == HaystackToken.eof) { cells[i] = null; } else { cells[i] = parseVal(); } if (i + 1 < numCols) { consume(HaystackToken.comma); } } gb.addRow(cells); // newline or end if (nested && m_tokCur == HaystackToken.gt2) { break; } if (m_tokCur == HaystackToken.eof) { break; } consume(HaystackToken.nl); } if (m_tokCur == HaystackToken.nl) { consume(HaystackToken.nl); } if (nested) { consume(HaystackToken.gt2); } return(gb.toGrid()); }
public string ToJsonString <E, ER>(Apply <ListType, E> obj, HDict <ER> dict) where ER : R, Relation <Type <E>, JsonWrite0 <E, ER> >, new() { return("[" + String.Join(", ", ListType.From <E>(obj).Select(x => x.ToJsonString(dict))) + "]"); }
public string ToJsonString(int obj, HDict <R> dict) { return(obj.ToString()); }
public string ToJsonString(int obj, HDict <R> dict) { return("{" + obj.ToString() + "}"); }