📝 updated documentation
This commit is contained in:
		
							parent
							
								
									710f26f95c
								
							
						
					
					
						commit
						e07e8e7912
					
				
					 9 changed files with 126 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -8620,7 +8620,7 @@ class json_pointer
 | 
			
		|||
    @return parent of this JSON pointer; in case this JSON pointer is the root,
 | 
			
		||||
            the root itself is returned
 | 
			
		||||
 | 
			
		||||
    @complexity Constant.
 | 
			
		||||
    @complexity Linear in the length of the JSON pointer.
 | 
			
		||||
 | 
			
		||||
    @liveexample{The example shows the result of `parent_pointer` for different
 | 
			
		||||
    JSON Pointers.,json_pointer__parent_pointer}
 | 
			
		||||
| 
						 | 
				
			
			@ -8640,19 +8640,50 @@ class json_pointer
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
    @brief remove and return last reference token
 | 
			
		||||
    @brief remove last reference token
 | 
			
		||||
 | 
			
		||||
    @pre not `empty()`
 | 
			
		||||
 | 
			
		||||
    @liveexample{The example shows the usage of `pop_back`.,json_pointer__pop_back}
 | 
			
		||||
 | 
			
		||||
    @complexity Constant.
 | 
			
		||||
 | 
			
		||||
    @throw out_of_range.405 if JSON pointer has no parent
 | 
			
		||||
 | 
			
		||||
    @since version 3.6.0
 | 
			
		||||
    */
 | 
			
		||||
    std::string pop_back()
 | 
			
		||||
    void pop_back()
 | 
			
		||||
    {
 | 
			
		||||
        if (JSON_UNLIKELY(empty()))
 | 
			
		||||
        {
 | 
			
		||||
            JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        auto last = reference_tokens.back();
 | 
			
		||||
        reference_tokens.pop_back();
 | 
			
		||||
        return last;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
    @brief return last reference token
 | 
			
		||||
 | 
			
		||||
    @pre not `empty()`
 | 
			
		||||
    @return last reference token
 | 
			
		||||
 | 
			
		||||
    @liveexample{The example shows the usage of `back`.,json_pointer__back}
 | 
			
		||||
 | 
			
		||||
    @complexity Constant.
 | 
			
		||||
 | 
			
		||||
    @throw out_of_range.405 if JSON pointer has no parent
 | 
			
		||||
 | 
			
		||||
    @since version 3.6.0
 | 
			
		||||
    */
 | 
			
		||||
    const std::string& back()
 | 
			
		||||
    {
 | 
			
		||||
        if (JSON_UNLIKELY(empty()))
 | 
			
		||||
        {
 | 
			
		||||
            JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return reference_tokens.back();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
| 
						 | 
				
			
			@ -8665,7 +8696,7 @@ class json_pointer
 | 
			
		|||
    @liveexample{The example shows the result of `push_back` for different
 | 
			
		||||
    JSON Pointers.,json_pointer__push_back}
 | 
			
		||||
 | 
			
		||||
    @since version 0.6.0
 | 
			
		||||
    @since version 3.6.0
 | 
			
		||||
    */
 | 
			
		||||
    void push_back(const std::string& token)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -20241,7 +20272,8 @@ class basic_json
 | 
			
		|||
            }
 | 
			
		||||
 | 
			
		||||
            // get reference to parent of JSON pointer ptr
 | 
			
		||||
            const auto last_path = ptr.pop_back();
 | 
			
		||||
            const auto last_path = ptr.back();
 | 
			
		||||
            ptr.pop_back();
 | 
			
		||||
            basic_json& parent = result[ptr];
 | 
			
		||||
 | 
			
		||||
            switch (parent.m_type)
 | 
			
		||||
| 
						 | 
				
			
			@ -20286,7 +20318,8 @@ class basic_json
 | 
			
		|||
        const auto operation_remove = [&result](json_pointer & ptr)
 | 
			
		||||
        {
 | 
			
		||||
            // get reference to parent of JSON pointer ptr
 | 
			
		||||
            const auto last_path = ptr.pop_back();
 | 
			
		||||
            const auto last_path = ptr.back();
 | 
			
		||||
            ptr.pop_back();
 | 
			
		||||
            basic_json& parent = result.at(ptr);
 | 
			
		||||
 | 
			
		||||
            // remove child
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue