Beispiel #1
0
/*
 *  iterator native function get(): Iterator
 */
static EjsVar *getVoidIterator(Ejs *ejs, EjsVar *np, int argc, EjsVar **argv)
{
    return (EjsVar*) ejsCreateIterator(ejs, np, NULL, 0, NULL);
}
Beispiel #2
0
/*
    iterator native function get(): Iterator
 */
static EjsIterator *getNullIterator(Ejs *ejs, EjsObj *np, int argc, EjsObj **argv)
{
    return ejsCreateIterator(ejs, np, -1, NULL, 0, NULL);
}
Beispiel #3
0
/*
    Return the default iterator. This returns the array index names.

    iterator native function get(): Iterator
 */
static EjsObj *getXmlIterator(Ejs *ejs, EjsObj *xml, int argc, EjsObj **argv)
{
    return (EjsObj*) ejsCreateIterator(ejs, xml, -1, nextXmlKey, 0, NULL);
}
Beispiel #4
0
/*
    Return an iterator to return the next array element value.

    iterator native function getValues(): Iterator
 */
static EjsObj *getXmlValues(Ejs *ejs, EjsObj *ap, int argc, EjsObj **argv)
{
    return (EjsObj*) ejsCreateIterator(ejs, ap, -1, nextXmlValue, 0, NULL);
}
Beispiel #5
0
/*  
    Return an iterator to enumerate the bytes in the file. For use with "for each ..."
    iterator native function getValues(): Iterator
 */
static EjsObj *getFileValues(Ejs *ejs, EjsFile *fp, int argc, EjsObj **argv)
{
    mprGetPathInfo(fp->path, &fp->info);

    return (EjsObj*) ejsCreateIterator(ejs, fp, -1, nextValue, 0, NULL);
}
Beispiel #6
0
/*  
    Return the default iterator for use with "for ... in". This returns byte offsets in the file.
    iterator native function get(): Iterator
 */
static EjsIterator *getFileIterator(Ejs *ejs, EjsFile *fp, int argc, EjsObj **argv)
{
    mprGetPathInfo(fp->path, &fp->info);
    return ejsCreateIterator(ejs, fp, -1, nextKey, 0, NULL);
}
Beispiel #7
0
/*
 *  Return an iterator to return the next array element value.
 *
 *  iterator native function getValues(): Iterator
 */
static EjsVar *getArrayValues(Ejs *ejs, EjsVar *ap, int argc, EjsVar **argv)
{
    return (EjsVar*) ejsCreateIterator(ejs, ap, (EjsNativeFunction) nextArrayValue, 0, NULL);
}
Beispiel #8
0
/*
    Return an iterator to return the next array element value.

    iterator native function getValues(): Iterator
 */
static EjsAny *getArrayValues(Ejs *ejs, EjsArray *ap, int argc, EjsObj **argv)
{
    return ejsCreateIterator(ejs, ap, ap->length, nextArrayValue, 0, NULL);
}
Beispiel #9
0
/*
    Return the default iterator. This returns the array index names.

    iterator native function get(): Iterator
 */
static EjsIterator *getArrayIterator(Ejs *ejs, EjsArray *ap, int argc, EjsObj **argv)
{
    return ejsCreateIterator(ejs, ap, ap->length, nextArrayKey, 0, NULL);
}