nginxconfig
C++libraryforparsingandprintingnginx.conf
nginxconfig::ast_entry Class Reference

#include <nginxconfig/ast.hpp>

List of all members.

Public Member Functions

 ast_entry (const ast_entry &) = default
ast_entryoperator= (const ast_entry &) = default
 ast_entry (ast_entry &&) noexcept
ast_entryoperator= (ast_entry &&) noexcept
ast_entry_kind kind () const
const std::string & name () const
std::string & name ()
const attribute_list & attributes () const
attribute_list & attributes ()
const child_list & children () const
child_list & children ()
const std::string & comment () const
std::string & comment ()
bool operator== (const ast_entry &other) const
bool operator!= (const ast_entry &other) const

Static Public Member Functions

static ast_entry make_simple (std::string name, attribute_list attributes=attribute_list(), std::string comment_text=std::string())
static ast_entry make_complex (std::string name, attribute_list attributes=attribute_list(), child_list children=child_list())
static ast_entry make_document (child_list children=child_list())
static ast_entry make_comment (std::string comment_text)

Friends

void swap (ast_entry &a, ast_entry &b) noexcept

Detailed Description

Represents an entry in an nginx configuration file.

Definition at line 50 of file ast.hpp.


Member Function Documentation

const ast_entry::attribute_list & nginxconfig::ast_entry::attributes ( ) const

The attributes immediately follow the name of a simple or complex entry. This is used to specify additional options to an entry.

Exceptions:
kind_errorif kind is not simple or complex.

Definition at line 155 of file ast.cpp.

const ast_entry::child_list & nginxconfig::ast_entry::children ( ) const

Get the children of a complex or document entry.

Exceptions:
kind_errorif kind is not complex or document.

Definition at line 167 of file ast.cpp.

const std::string & nginxconfig::ast_entry::comment ( ) const

Get the comment of a comment, simple or complex entry. Comments are appended after the closing ; or {. For document comments, add them as a child.

Exceptions:
kind_errorif kind is not comment, simple or complex.

Definition at line 179 of file ast.cpp.

ast_entry_kind nginxconfig::ast_entry::kind ( ) const

Get the kind of entry this is.

See also:
ast_entry_kind

Definition at line 150 of file ast.cpp.

ast_entry nginxconfig::ast_entry::make_comment ( std::string  comment_text) [static]

Create a comment AST entry.

Definition at line 143 of file ast.cpp.

ast_entry nginxconfig::ast_entry::make_complex ( std::string  name,
attribute_list  attributes = attribute_list(),
child_list  children = child_list() 
) [static]

Create a complex AST entry.

Definition at line 112 of file ast.cpp.

ast_entry nginxconfig::ast_entry::make_document ( child_list  children = child_list()) [static]

Create a document.

Definition at line 124 of file ast.cpp.

ast_entry nginxconfig::ast_entry::make_simple ( std::string  name,
attribute_list  attributes = attribute_list(),
std::string  comment_text = std::string() 
) [static]

Create a simple AST entry.

Definition at line 131 of file ast.cpp.

const std::string & nginxconfig::ast_entry::name ( ) const

The name of the entry is the first part of a simple or complex entry. This is typically something like "http", "location" or "root". The only allowed characters according to nginx are alphanumeric and underscores, but your input is not validated.

Exceptions:
kind_errorif kind is not simple or complex.

Definition at line 191 of file ast.cpp.

bool nginxconfig::ast_entry::operator== ( const ast_entry other) const

Compare the AST for equality.

Definition at line 206 of file ast.cpp.


Friends And Related Function Documentation

void swap ( ast_entry a,
ast_entry b 
) [friend]

Swap the contents of a with b. This will never throw.

Definition at line 102 of file ast.cpp.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Friends Defines