JsonCpp project page | Classes | Namespace | JsonCpp home page

Public Member Functions | List of all members
Json::Path Class Reference

Experimental and untested: represents a "path" to access a node. More...

`#include <json/value.h>`

Collaboration diagram for Json::Path:

## Public Member Functions
| Path (const String &path, const PathArgument &a1=PathArgument(), const PathArgument &a2=PathArgument(), const PathArgument &a3=PathArgument(), const PathArgument &a4=PathArgument(), const PathArgument &a5=PathArgument())
const Value & | resolve (const Value &root) const
Value | resolve (const Value &root, const Value &defaultValue) const
Value & | make (Value &root) const
| Creates the "path" to access the specified node and returns a reference on the node.

## Detailed Description

Experimental and untested: represents a "path" to access a node.

Syntax:

- "." => root node
- ".[n]" => elements at index 'n' of root node (an array value)
- ".name" => member named 'name' of root node (an object value)
- ".name1.name2.name3"
- ".[0][1][2].name1[3]"
- ".%" => member name is provided as parameter
- ".[%]" => index is provided as parameter

Definition at line 741 of file value.h.

## Constructor & Destructor Documentation

## ◆ Path()

Json::Path::Path | ( | const String & | path,
|  | const PathArgument & | a1 = PathArgument(),
|  | const PathArgument & | a2 = PathArgument(),
|  | const PathArgument & | a3 = PathArgument(),
|  | const PathArgument & | a4 = PathArgument(),
|  | const PathArgument & | a5 = PathArgument() )

Definition at line 1515 of file json_value.cpp.

## Member Function Documentation

## ◆ make()

Value & Json::Path::make | ( | Value & | root | ) | const

Creates the "path" to access the specified node and returns a reference on the node.

Definition at line 1618 of file json_value.cpp.

References Json::Value::isArray(), and Json::Value::isObject().

## ◆ resolve() [1/2]

const Value & Json::Path::resolve | ( | const Value & | root | ) | const

Definition at line 1575 of file json_value.cpp.

References Json::Value::isArray(), Json::Value::isObject(), Json::Value::isValidIndex(), and Json::Value::nullSingleton().

## ◆ resolve() [2/2]

Value Json::Path::resolve | ( | const Value & | root,
|  | const Value & | defaultValue ) const

Definition at line 1600 of file json_value.cpp.

References Json::Value::isArray(), Json::Value::isObject(), Json::Value::isValidIndex(), and Json::Value::nullSingleton().

The documentation for this class was generated from the following files:

- include/json/value.h
- src/lib_json/json_value.cpp