/* -*- mode: c++; indent-tabs-mode: nil -*- */
/*
    Pseudo_QC_Nothing.qpp

    Qore Programming Language

    Copyright (C) 2003 - 2023 Qore Technologies, s.r.o.

    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this software and associated documentation files (the "Software"),
    to deal in the Software without restriction, including without limitation
    the rights to use, copy, modify, merge, publish, distribute, sublicense,
    and/or sell copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    DEALINGS IN THE SOFTWARE.

    Note that the Qore library is released under a choice of three open-source
    licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
    information.
*/

#include <qore/Qore.h>

//! Methods in this pseudo-class can be executed on @ref nothing
/**
 */
qclass <nothing> [arg=;vparent=<value>];

//! Returns Qore::NT_NOTHING
/**
    @return Qore::NT_NOTHING

    @par Example:
    @code{.py}
switch (n.typeCode()) {
    case NT_NOTHING:
        printf("%y: no value\n", n);
        break;
}
    @endcode
*/
int <nothing>::typeCode() [flags=CONSTANT] {
   return NT_NOTHING;
}

//! Returns 0
/**
    @return 0

    @par Example:
    @code{.py}
printf("iterating %d element%s\n", val.lsize(), val.lsize() == 1 ? "" : "s");
foreach any element in (val) {
    do_something(element);
}
    @endcode
*/
int <nothing>::lsize() [flags=CONSTANT] {
   return 0;
}

//! Returns an empty @ref Qore::SingleValueIterator "SingleValueIterator" object
/** @return an empty @ref Qore::SingleValueIterator "SingleValueIterator" object

    @par Example:
    @code{.py}
map printf("+ %y\n", $1), get_hash_or_nothing().pairIterator();
    @endcode

    @since %Qore 0.8.6.2
 */
SingleValueIterator <nothing>::pairIterator() [flags=CONSTANT] {
   return new QoreObject(QC_SINGLEVALUEITERATOR, 0, new SingleValueIterator(QoreValue()));
}

//! Returns an empty @ref Qore::SingleValueIterator "SingleValueIterator" object
/** @return an empty @ref Qore::SingleValueIterator "SingleValueIterator" object

    @par Example:
    @code{.py}
map printf("+ %y\n", $1), get_hash_or_nothing().keyIterator();
    @endcode

    @see <hash>::keyIterator()

    @since %Qore 0.8.6.2
 */
SingleValueIterator <nothing>::keyIterator() [flags=CONSTANT] {
   return new QoreObject(QC_SINGLEVALUEITERATOR, 0, new SingleValueIterator(QoreValue()));
}

//! Returns an empty @ref Qore::SingleValueIterator "SingleValueIterator" object
/** @return an empty @ref Qore::SingleValueIterator "SingleValueIterator" object

    @par Example:
    @code{.py}
map printf("+ %y\n", $1), get_hash_or_nothing().contextIterator();
    @endcode

    @see <hash>::contextIterator()

    @since %Qore 0.8.6.2
 */
SingleValueIterator <nothing>::contextIterator() [flags=CONSTANT] {
   return new QoreObject(QC_SINGLEVALUEITERATOR, 0, new SingleValueIterator(QoreValue()));
}

//! Returns an empty list
/**
    @return an empty list

    @par Example:
    @code{.py}
*hash h = hash_or_nothing();
list<string> l = h.keys();
    @endcode

    @see <hash>::keys()

    @since %Qore 0.8.7
 */
list<string> <nothing>::keys() [flags=CONSTANT] {
   return new QoreListNode(stringTypeInfo);
}

//! Returns an empty list
/**
    @return an empty list

    @par Example:
    @code{.py}
*hash h = hash_or_nothing();
list<auto> l = h.values();
    @endcode

    @see <hash>::values()

    @since %Qore 0.8.7
 */
list<auto> <nothing>::values() [flags=CONSTANT] {
   return new QoreListNode(autoTypeInfo);
}

//! Returns @ref nothing
/**
    @return @ref nothing

    @par Example:
    @code{.py}
*hash h = hash_or_nothing();
*string n = h.firstKey();
    @endcode

    @see <hash>::firstKey()

    @since %Qore 0.8.7
 */
nothing <nothing>::firstKey() [flags=CONSTANT] {
}

//! Returns @ref nothing
/**
    @return @ref nothing

    @par Example:
    @code{.py}
*hash h = hash_or_nothing();
auto n = h.firstValue();
    @endcode

    @see <hash>::firstValue()

    @since %Qore 0.8.7
 */
nothing <nothing>::firstValue() [flags=CONSTANT] {
}

//! Returns @ref nothing
/**
    @return @ref nothing

    @par Example:
    @code{.py}
*hash h = hash_or_nothing();
*string n = h.firstKey();
    @endcode

    @see <hash>::firstKey()

    @since %Qore 0.8.7
 */
nothing <nothing>::lastKey() [flags=CONSTANT] {
}

//! Returns @ref nothing
/**
    @return @ref nothing

    @par Example:
    @code{.py}
*hash h = hash_or_nothing();
auto n = h.firstValue();
    @endcode

    @see <hash>::lastValue()

    @since %Qore 0.8.7
 */
nothing <nothing>::lastValue() [flags=CONSTANT] {
}

//! Returns @ref True if the key exists in the hash (may or may not be assigned a value), @ref False if not
/**
    @param key the key name to check

    @return @ref True if the key exists in the hash (may or may not be assigned a value), @ref False if not

    @par Example:
    @code{.py}
*hash h = hash_or_nothing();
bool b = h.hasKey(key);
    @endcode

    @see <hash>::hasKey(softstring)

    @since %Qore 0.8.7
 */
bool <nothing>::hasKey(softstring[doc] key) [flags=CONSTANT] {
   return false;
}

//! Returns @ref True if the key exists and is assigned to a value, @ref False if not
/**
    @param key the key name to check

    @return @ref True if the key exists and is assigned to a value, @ref False if not

    @par Example:
    @code{.py}
*hash h = hash_or_nothing();
bool b = h.hasKeyValue(key);
    @endcode

    @see <hash>::hasKeyValue(softstring)

    @since %Qore 0.8.7
 */
bool <nothing>::hasKeyValue(softstring[doc] key) [flags=CONSTANT] {
   return false;
}

//! Returns an empty @ref Qore::SingleValueIterator "SingleValueIterator" object
/** @return an empty @ref Qore::SingleValueIterator "SingleValueIterator" object

    @par Example:
    @code{.py}
map printf("+ %y\n", $1), get_list_or_nothing().rangeIterator();
    @endcode

    @see <list>::rangeIterator()

    @since %Qore 0.8.8
 */
SingleValueIterator <nothing>::rangeIterator() [flags=CONSTANT] {
   return new QoreObject(QC_SINGLEVALUEITERATOR, 0, new SingleValueIterator(QoreValue()));
}
