Beispiel #1
0
bool 
JsonParse::AddValue(JsonValue *obj)
{
    bool ret = false;

    JsonNode *current;
    JsonType type;

    current = m_ctx.Current();
    if (current) {
        type = static_cast<JsonValue *>(current)->GetType();
    }
    if (current && type != JsonType_Object && type != JsonType_Tuple) {
        current->AddChild(obj);
        ret = true;
    } 
    return ret;
}
Beispiel #2
0
bool
JsonParse::AddTuple(void *name, void *val)
{
    bool ret = false;

    JsonNode *current;
    JsonTuple *tuple;

    current = m_ctx.Current();
    if (current) {
        tuple = new JsonTuple(
            static_cast<JsonValue *>(name),
            static_cast<JsonValue *>(val));
        current->AddChild(tuple);
        ret = true;
    } else {
        delete static_cast<JsonValue *>(name);
        delete static_cast<JsonValue *>(val);
    } 
    return ret;
}