The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
simple_wml::node Class Reference

#include <simple_wml.hpp>

Classes

struct  node_pos
 

Public Types

enum  CACHE_STATUS { REFRESH_CACHE, DO_NOT_MODIFY_CACHE }
 
typedef std::pair< string_span,
string_span
attribute
 
typedef std::vector< node * > child_list
 

Public Member Functions

 node (document &doc, node *parent)
 
 node (document &doc, node *parent, const char **str, int depth=0)
 
 ~node ()
 
const string_spanoperator[] (const char *key) const
 
const string_spanattr (const char *key) const
 
bool has_attr (const char *key) const
 
nodeset_attr (const char *key, const char *value)
 
nodeset_attr_dup (const char *key, const char *value)
 
nodeset_attr_dup (const char *key, const string_span &value)
 
nodeset_attr_int (const char *key, int value)
 
nodeadd_child (const char *name)
 
nodeadd_child_at (const char *name, size_t index)
 
void remove_child (const char *name, size_t index)
 
void remove_child (const string_span &name, size_t index)
 
nodechild (const char *name)
 
const nodechild (const char *name) const
 
const child_listchildren (const char *name) const
 
const string_spanfirst_child () const
 
bool is_dirty () const
 
int output_size () const
 
void output (char *&buf, CACHE_STATUS status=DO_NOT_MODIFY_CACHE)
 
void copy_into (node &n) const
 
bool no_children () const
 
bool one_child () const
 
void apply_diff (const node &diff)
 
void set_doc (document *doc)
 
int nchildren () const
 
int nattributes_recursive () const
 

Private Types

typedef std::vector< attributeattribute_list
 
typedef std::pair< string_span,
child_list
child_pair
 
typedef std::vector< child_pairchild_map
 

Private Member Functions

 node (const node &)
 
void operator= (const node &)
 
int get_children (const string_span &name)
 
int get_children (const char *name)
 
void set_dirty ()
 
void shift_buffers (ptrdiff_t offset)
 
void insert_ordered_child (int child_map_index, int child_list_index)
 
void remove_ordered_child (int child_map_index, int child_list_index)
 
void insert_ordered_child_list (int child_map_index)
 
void remove_ordered_child_list (int child_map_index)
 
void check_ordered_children () const
 

Static Private Member Functions

static child_map::const_iterator find_in_map (const child_map &m, const string_span &attr)
 
static child_map::iterator find_in_map (child_map &m, const string_span &attr)
 

Private Attributes

documentdoc_
 
attribute_list attr_
 
nodeparent_
 
child_map children_
 
std::vector< node_posordered_children_
 
string_span output_cache_
 

Detailed Description

Definition at line 113 of file simple_wml.hpp.

Member Typedef Documentation

Definition at line 120 of file simple_wml.hpp.

typedef std::vector<attribute> simple_wml::node::attribute_list
private

Definition at line 188 of file simple_wml.hpp.

typedef std::vector<node*> simple_wml::node::child_list

Definition at line 121 of file simple_wml.hpp.

typedef std::vector<child_pair> simple_wml::node::child_map
private

Definition at line 194 of file simple_wml.hpp.

Definition at line 193 of file simple_wml.hpp.

Member Enumeration Documentation

Enumerator
REFRESH_CACHE 
DO_NOT_MODIFY_CACHE 

Definition at line 159 of file simple_wml.hpp.

Constructor & Destructor Documentation

simple_wml::node::node ( document doc,
node parent 
)

Definition at line 206 of file simple_wml.cpp.

Referenced by add_child(), add_child_at(), and node().

simple_wml::node::node ( document doc,
node parent,
const char **  str,
int  depth = 0 
)
simple_wml::node::~node ( )

Definition at line 363 of file simple_wml.cpp.

References children_, and i.

simple_wml::node::node ( const node )
private

Member Function Documentation

node & simple_wml::node::add_child ( const char *  name)
node & simple_wml::node::add_child_at ( const char *  name,
size_t  index 
)
void simple_wml::node::apply_diff ( const node diff)
const string_span& simple_wml::node::attr ( const char *  key) const
inline
void simple_wml::node::check_ordered_children ( ) const
private

Definition at line 572 of file simple_wml.cpp.

References children_, i, and ordered_children_.

Referenced by add_child(), add_child_at(), node(), and output_size().

node * simple_wml::node::child ( const char *  name)
const node * simple_wml::node::child ( const char *  name) const

Definition at line 619 of file simple_wml.cpp.

References children_, and i.

const node::child_list & simple_wml::node::children ( const char *  name) const
void simple_wml::node::copy_into ( node n) const
node::child_map::const_iterator simple_wml::node::find_in_map ( const child_map m,
const string_span attr 
)
staticprivate

Definition at line 663 of file simple_wml.cpp.

References i.

Referenced by apply_diff(), and remove_child().

node::child_map::iterator simple_wml::node::find_in_map ( child_map m,
const string_span attr 
)
staticprivate

Definition at line 675 of file simple_wml.cpp.

References i.

const string_span & simple_wml::node::first_child ( ) const

Definition at line 687 of file simple_wml.cpp.

References children_.

int simple_wml::node::get_children ( const string_span name)
private

Definition at line 651 of file simple_wml.cpp.

References children_, and i.

Referenced by add_child(), add_child_at(), get_children(), and node().

int simple_wml::node::get_children ( const char *  name)
private

Definition at line 646 of file simple_wml.cpp.

References get_children().

bool simple_wml::node::has_attr ( const char *  key) const

Definition at line 403 of file simple_wml.cpp.

References attr_.

Referenced by wesnothd::server::handle_player_in_game(), and wesnothd::game::is_legal_command().

void simple_wml::node::insert_ordered_child ( int  child_map_index,
int  child_list_index 
)
private

Definition at line 504 of file simple_wml.cpp.

References i, and ordered_children_.

Referenced by add_child_at().

void simple_wml::node::insert_ordered_child_list ( int  child_map_index)
private

Definition at line 545 of file simple_wml.cpp.

References i, and ordered_children_.

bool simple_wml::node::is_dirty ( ) const
inline
int simple_wml::node::nattributes_recursive ( ) const

Definition at line 919 of file simple_wml.cpp.

References attr_, children_, and i.

int simple_wml::node::nchildren ( ) const

Definition at line 906 of file simple_wml.cpp.

References children_, and i.

bool simple_wml::node::no_children ( ) const
inline

Definition at line 166 of file simple_wml.hpp.

References children_.

Referenced by wesnothd::game::process_turn().

bool simple_wml::node::one_child ( ) const
inline

Definition at line 167 of file simple_wml.hpp.

References children_.

Referenced by wesnothd::game::is_legal_command().

void simple_wml::node::operator= ( const node )
private
const string_span & simple_wml::node::operator[] ( const char *  key) const

Definition at line 390 of file simple_wml.cpp.

References attr_.

void simple_wml::node::output ( char *&  buf,
CACHE_STATUS  status = DO_NOT_MODIFY_CACHE 
)
int simple_wml::node::output_size ( ) const
void simple_wml::node::remove_child ( const char *  name,
size_t  index 
)
void simple_wml::node::remove_child ( const string_span name,
size_t  index 
)
void simple_wml::node::remove_ordered_child ( int  child_map_index,
int  child_list_index 
)
private

Definition at line 526 of file simple_wml.cpp.

References i, and ordered_children_.

Referenced by remove_child().

void simple_wml::node::remove_ordered_child_list ( int  child_map_index)
private

Definition at line 555 of file simple_wml.cpp.

References i, and ordered_children_.

Referenced by remove_child().

node & simple_wml::node::set_attr ( const char *  key,
const char *  value 
)
node & simple_wml::node::set_attr_dup ( const char *  key,
const char *  value 
)
node & simple_wml::node::set_attr_dup ( const char *  key,
const string_span value 
)
node & simple_wml::node::set_attr_int ( const char *  key,
int  value 
)
void simple_wml::node::set_dirty ( )
private
void simple_wml::node::set_doc ( document doc)

Definition at line 895 of file simple_wml.cpp.

References children_, doc_, and i.

Referenced by simple_wml::document::swap().

void simple_wml::node::shift_buffers ( ptrdiff_t  offset)
private

Member Data Documentation

attribute_list simple_wml::node::attr_
private
child_map simple_wml::node::children_
private
document* simple_wml::node::doc_
private

Definition at line 186 of file simple_wml.hpp.

Referenced by add_child(), add_child_at(), apply_diff(), copy_into(), set_attr_dup(), and set_doc().

std::vector<node_pos> simple_wml::node::ordered_children_
private
string_span simple_wml::node::output_cache_
private

Definition at line 221 of file simple_wml.hpp.

Referenced by is_dirty(), node(), output(), output_size(), set_dirty(), and shift_buffers().

node* simple_wml::node::parent_
private

Definition at line 191 of file simple_wml.hpp.


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