public static long PopLong(RopLib rop, long val, int err) { if (err != ROPE.RNP_SUCCESS) { throw new RopError(err); } return(val); }
public static bool PopBool(RopLib rop, bool val, int err) { if (err != ROPE.RNP_SUCCESS) { throw new RopError(err); } return(val); }
public static RopHandle PopHandle(RopLib rop, RopHandle val, int err) { if (err != ROPE.RNP_SUCCESS) { throw new RopError(err); } return(val); }
public static int PopInt(RopLib rop, int val, int err) { if (err != ROPE.RNP_SUCCESS) { throw new RopError(err); } return(val); }
/** * Terminates the instance */ public void Close() { clear(); if (lib != null) { lib.CleanUp(); } lib = null; }
private SortedDictionary <int, SortedDictionary <RopObject, int> > t2objs; //tag->set private void IniRopBind(bool checkLibVer) { this.cnt = 1; this.lib = new RopLib(); this.tags = new List <int>(); this.tags.Add(this.cnt); this.t2objs = new SortedDictionary <int, SortedDictionary <RopObject, int> >(); if (checkLibVer && !(this.lib.rnp_version() >= this.lib.rnp_version_for(0, 9, 0)) && !((long)lib.rnp_version_commit_timestamp() >= ropid())) { throw new RopError(ROP_ERROR_LIBVERSION); } }
public static string GetRopString(RopLib rop, int ret, RopHandle ropStr, bool freeBuf = true) { string sval = RopHandle.Str(ropStr); if (freeBuf) { rop.rnp_buffer_destroy(ropStr); } if (ret != ROPE.RNP_SUCCESS) { throw new RopError(ret); } return(sval); }
public static string[] GetRopStrings(RopLib rop, int ret, RopHandle[] ropStrs, bool freeBuf = true) { string[] svals = new string[ropStrs.Length]; for (int idx = 0; idx < ropStrs.Length; idx++) { svals[idx] = RopHandle.Str(ropStrs[idx]); if (freeBuf) { rop.rnp_buffer_destroy(ropStrs[idx]); } } if (ret != ROPE.RNP_SUCCESS) { throw new RopError(ret); } return(svals); }
public int WriteString(object buf, int maxLen) { int len = 0; var enc = RopLib.Encode(buf); if (!enc.P.Equals(IntPtr.Zero)) { unsafe { byte *src = (byte *)enc.P.ToPointer(); byte *dst = (byte *)ptr.ToPointer(); while (*src != 0 && len < maxLen - 1) { dst[len++] = *src++; } dst[len] = 0; } } RopLib.FreeEncoded(enc); return(len); }