public ParsedJsonIterator(ParsedJson parsedJson)
        {
            pj           = parsedJson;
            depth        = 0;
            location     = 0;
            tape_length  = 0;
            depthindex   = allocate <scopeindex_t>(pj.depthcapacity);
            current_type = 0;
            current_val  = 0;

            depthindex[0].start_of_scope = location;
            current_val              = pj.tape[location++];
            current_type             = (uint8_t)(current_val >> 56);
            depthindex[0].scope_type = current_type;
            if (current_type == 'r')
            {
                tape_length = current_val & JSONVALUEMASK;
                if (location < tape_length)
                {
                    current_val  = pj.tape[location];
                    current_type = (uint8_t)(current_val >> 56);
                    depth++;
                    depthindex[depth].start_of_scope = location;
                    depthindex[depth].scope_type     = current_type;
                }
            }
            else
            {
                throw new InvalidOperationException("Json is invalid");
            }
        }
Esempio n. 2
0
 public void Dispose()
 {
     if (depthindex != null)
     {
         Utils.delete(depthindex);
         depthindex = null;
     }
 }
        private void Dispose(bool disposing)
        {
            if (disposing)
            {
                GC.SuppressFinalize(this);
            }

            delete(depthindex);
            depthindex = null;
        }
Esempio n. 4
0
        public void Dispose()
        {
            if (depthindex != null)
            {
                delete(depthindex);
                depthindex = null;
            }

            if (pj != null)
            {
                pj.Dispose();
                pj = null;
            }
        }
Esempio n. 5
0
        public iterator(ParsedJson *pj)
        {
            this.pj      = pj;
            depth        = 0;
            location     = 0;
            tape_length  = 0;
            depthindex   = null;
            current_type = 0;
            current_val  = 0;

            if (pj->isValid())
            {
                depthindex = allocate <scopeindex_t>(pj->depthcapacity);
                if (depthindex == null)
                {
                    return;
                }

                depthindex[0].start_of_scope = location;
                current_val              = pj->tape[location++];
                current_type             = (uint8_t)(current_val >> 56);
                depthindex[0].scope_type = current_type;
                if (current_type == 'r')
                {
                    tape_length = current_val & JSONVALUEMASK;
                    if (location < tape_length)
                    {
                        current_val  = pj->tape[location];
                        current_type = (uint8_t)(current_val >> 56);
                        depth++;
                        depthindex[depth].start_of_scope = location;
                        depthindex[depth].scope_type     = current_type;
                    }
                }
            }
            else
            {
                throw new InvalidOperationException("Json is invalid");
            }
        }