static unsafe void Main(string[] args) { string helloWorldJson = "{ \"answer\": 42, \"name\": \"Egor\" }"; ReadOnlySpan <byte> bytes = Encoding.UTF8.GetBytes(helloWorldJson); // SimdJson is UTF8 only using (ParsedJson doc = SimdJson.build_parsed_json(bytes)) { Console.WriteLine("Is json valid:" + doc.isValid()); // open iterator: using (iterator iterator = new iterator(&doc)) { while (iterator.move_forward()) { switch (iterator.GetTokenType()) { case JsonTokenType.Number: Console.WriteLine("integer: " + iterator.get_integer()); break; case JsonTokenType.String: Console.WriteLine("string: " + iterator.GetUtf16String()); break; } } } } }
public void printogrenci() { iterator bursluogrenciiterator = bursluogrenci.createiterator(); // Console.WriteLine("print burslu ogrenci"); printogrenci(bursluogrenciiterator); }
public static void iteratormethod() { iterator <int> iterators = new iterator <int>(); // Adding numbers to the iterator stack for (int num = 0; num <= 9; num++) { iterators.Push(num); } //TopToBottom returns IEnumerable(Of Integer). foreach (int num in iterators.TopBottom) { Console.Write("{0} ", num); } Console.WriteLine(); Console.WriteLine(); // Output: 9 8 7 6 5 4 3 2 1 0 foreach (int num in iterators.Bottomtothetop) { Console.Write("{0} ", num); } Console.WriteLine(); Console.WriteLine(); // Output: 0 1 2 3 4 5 6 7 8 9 Console.ReadKey(); }
public void erase(iterator itWhere) { if (itWhere != m_pEndItera) { CFastListNode pNode = itWhere.get_ptr(); if (pNode == m_pHeader) { m_pHeader = m_pHeader.m_pNext; m_pHeader.m_pLast = null; if (m_pHeader == m_pEnd) { m_pEnd.m_pLast = m_pEnd; } } else { if (pNode.m_pLast != null) { pNode.m_pLast.m_pNext = pNode.m_pNext; } if (pNode.m_pNext != null) { pNode.m_pNext.m_pLast = pNode.m_pLast; } } pNode.m_pLast = null; pNode.m_pNext = null; --m_nCount; } }
public CFastList() { m_pHeader = m_pEnd = new CFastListNode(); m_pEnd.m_pLast = m_pEnd; m_nCount = 0; m_pEndItera = new iterator(m_pEnd); }
public static new iterator operator --(int UnnamedParameter) { //C++ TO C# CONVERTER TODO TASK: The following line was determined to contain a copy constructor call - this should be verified and a copy constructor should be created: //ORIGINAL LINE: iterator tmp = *this; iterator tmp = new iterator(this); --base.m_index; return(tmp); }
public int FindAndDelete(KzValType vchSig) { int nFound = 0; var s = _script; var r = s; if (vchSig.Length == 0) { return(nFound); } var op = new KzOp(); var consumed = 0L; var offset = 0L; var o = vchSig.Sequence; var oLen = o.Length; do { offset += consumed; while (s.StartsWith(o)) { r = r.RemoveSlice(offset, oLen); s = s.Slice(oLen); ++nFound; } } while (op.TryReadOp(ref s, out consumed)); _script = r; return(nFound); #if false CScript result; iterator pc = begin(), pc2 = begin(); opcodetype opcode; do { result.insert(result.end(), pc2, pc); while (static_cast <size_t>(end() - pc) >= b.size() && std::equal(b.begin(), b.end(), pc)) { pc = pc + b.size(); ++nFound; } pc2 = pc; } while (GetOp(pc, opcode)); if (nFound > 0) { result.insert(result.end(), pc2, end()); *this = result; } #endif }
public void IterateOverTiles(iterator iterate) { for (int x = 0; x <= data.GetUpperBound(0); x++) // Loop through the width of the map { for (int y = 0; y <= data.GetUpperBound(1); y++) // Loop through the height of the map { iterate(x, y); } } }
public void swap(CFastList <_Ty> other) { CFastListNode temp = null; temp = m_pHeader; m_pHeader = other.m_pHeader; other.m_pHeader = temp; temp = m_pEnd; m_pEnd = other.m_pEnd; other.m_pEnd = temp; iterator pIt = null; pIt = m_pEndItera; m_pEndItera = other.m_pEndItera; other.m_pEndItera = pIt; int nTemp = 0; nTemp = m_nCount; m_nCount = other.m_nCount; other.m_nCount = nTemp; }
void printogrenci(iterator iterator) { while (iterator.hasnext()) { Ogrenciii ogrenciii = iterator.next(); // Console.Write(ogrenciii.GetName() + ""); // Console.Write(ogrenciii.GetSoyad() + ""); // Console.Write(ogrenciii.GetTel() + ""); // Console.Write(ogrenciii.GetSinif() + ""); // Console.Write(ogrenciii.GetOrtalama() + ""); } }
public void PrintMsg() { os.print("Item count:{0}", Items.Length); for (iterator <int, ItemMsg> it = Items.begin(); it; ++it) { it.value.PrintMsg(); } os.print("-------------------"); os.print("Names count:{0}", Names.Length); for (iterator <int, StringA> itName = Names.begin(); itName; ++itName) { os.print("({0},{1})", itName.key, itName.value); } }
static void Test() { Vector3 v = new Vector3(1, 2, 3); v *= 10; v /= 3; StringA str = "abc"; map <int, StringA> m = new map <int, StringA>(); m[1] = "a"; m[2] = "b"; for (iterator <int, StringA> it = m.begin(); it; ++it) { } }
public unsafe ulong SimdJsonSharpApi(byte[] data, string fileName, string fileSize) { ulong numbersCount = 0; using (ParsedJson doc = SimdJson.build_parsed_json(data)) { using (var iterator = new iterator(&doc)) { while (iterator.move_forward()) { if (iterator.is_integer() || iterator.is_double()) { numbersCount++; } } } } return(numbersCount); }
public iterator find(K key) { Stack <RBNode <pair <K, V> > > stack = new Stack <RBNode <pair <K, V> > >(); bool done = false; RBNode <pair <K, V> > node = _tree; while (!done && node != null) { int res = node.value.first.CompareTo(key); if (res == 0) { /* the iterator now points to the matching node.*/ stack.Push(node); done = true; } else if (res > 0) { stack.Push(node); node = node.link[0]; } else { stack.Push(node); node = node.link[1]; } } iterator it = null; if (!done) { /* never found it, so make an end iterator. */ it = end(); } else { it = new iterator(_tree, stack); } return(it); }
public virtual iterator find(T data) { Stack <RBNode <T> > stack = new Stack <RBNode <T> >(); bool done = false; RBNode <T> node = _tree; while (!done && node != null) { int res = node.value.CompareTo(data); if (res == 0) { /* the iterator now points to the matching node.*/ stack.Push(node); done = true; } else if (res > 0) { stack.Push(node); node = node.link[0]; } else { stack.Push(node); node = node.link[1]; } } iterator it = null; if (done) { it = new iterator(_tree, stack); } else { it = end(); } return(it); }
/** true if they are the equivilant object. * false if the object isn't an 'iterator' or if the object isn't the same iterator. */ public override bool Equals(object o) { iterator it = o as iterator; return(it != null ? (this == it) : false); }
public application(ApplyFunc pre = default, ApplyFunc post = default, Cursor cursor = default, iterator iter = default) { this.pre = pre; this.post = post; this.cursor = cursor; this.iter = iter; }
public LimitIterator(Traversable iterator, long offset = 0, long count = -1) => __construct(iterator, offset, count);
public IteratorIterator(Traversable iterator, string classname = null) => __construct(iterator, classname);
// void insert(T value) // { // root = _insert(ref root, value); // } // internal RBTree<T> _insert(ref RBTree<T> root, T value) // { // if (tree == null) { tree = new RBNode<T>(value); } // else // { // int dir = (root.value < value ? 1 : 0); // root.link[dir] = _insert(root.link[dir], data); // } // return root; // } public iterator begin() { iterator it = new iterator(_tree); it.init(); return(it); }
public void erase(iterator position) { Debug.Assert(position.List == this); RemoveAt(position.Index); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(iterator obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
public CachingIterator(Iterator iterator, int flags = CALL_TOSTRING) => __construct(iterator, flags);
bool Equals(iterator it) { return(m_pNode == it.m_pNode); }