Class Parser::TrackedPtr

template<typename T>
class TrackedPtr

Class used to ensure ownership of string or Node objects that are dynamically allocated within the parser.

Template Parameters
  • T: - std::string or Node type

Public Functions

TrackedPtr(const TrackedPtr&)
TrackedPtr &operator=(const TrackedPtr&)
T *release()

Releases ownership of contained string or Node value and returns a pointer to contained value.

T *get()

Returns a pointer to contained string or Node value.

Public Static Functions

template<typename ...Args>
static TrackedPtr<T> *make(std::vector<std::unique_ptr<TrackedPtr<T>>> &tracked_ptrs, Args&&... args)

Creates an instance of a TrackedPtr and returns a pointer to created instance.

Return

- pointer to created TrackedPtr

Parameters
  • tracked_ptrs: - TrackedPtr unique pointer vector, which takes ownership of dynamically allocated objects.

  • args: - Arguments to be used when creating contained string or Node values.

static TrackedPtr<T> *makeEmpty()

Returns a pointer to a TrackedPtr instance that represents an empty TrackedPtr.

Private Functions

TrackedPtr()
TrackedPtr(Node *node)
TrackedPtr(const std::string &str)
TrackedPtr(const char *str, size_t len)

Private Members

std::unique_ptr<T> value_
bool is_empty_
bool is_released_