Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes

simple_wml::node Class Reference

#include <simple_wml.hpp>

Collaboration diagram for simple_wml::node:
Collaboration graph
[legend]

List of all members.

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 93 of file simple_wml.hpp.


Member Typedef Documentation

Definition at line 100 of file simple_wml.hpp.

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

Definition at line 168 of file simple_wml.hpp.

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

Definition at line 101 of file simple_wml.hpp.

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

Definition at line 174 of file simple_wml.hpp.

typedef std::pair<string_span, child_list> simple_wml::node::child_pair [private]

Definition at line 173 of file simple_wml.hpp.


Member Enumeration Documentation

Enumerator:
REFRESH_CACHE 
DO_NOT_MODIFY_CACHE 

Definition at line 139 of file simple_wml.hpp.


Constructor & Destructor Documentation

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

Definition at line 177 of file simple_wml.cpp.

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

Here is the caller graph for this function:

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

Definition at line 191 of file simple_wml.cpp.

References attr_, check_ordered_children(), children_, ERR_SWML, error(), get_children(), node(), ordered_children_, and output_cache_.

Here is the call graph for this function:

simple_wml::node::~node (  ) 

Definition at line 334 of file simple_wml.cpp.

References children_.

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 
)

Definition at line 417 of file simple_wml.cpp.

References check_ordered_children(), children_, doc_, get_children(), insert_ordered_child(), node(), and set_dirty().

Referenced by apply_diff().

Here is the call graph for this function:

Here is the caller graph for this function:

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 543 of file simple_wml.cpp.

References children_, and ordered_children_.

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

Here is the caller graph for this function:

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

Definition at line 590 of file simple_wml.cpp.

References children_.

const node::child_list & simple_wml::node::children ( const char *  name  )  const

Definition at line 605 of file simple_wml.cpp.

References children_.

Referenced by apply_diff(), server::delete_game(), and wesnothd::game::process_turn().

Here is the caller graph for this function:

void simple_wml::node::copy_into ( node n  )  const

Definition at line 777 of file simple_wml.cpp.

References add_child(), attr_, children_, doc_, ordered_children_, set_attr(), set_dirty(), and simple_wml::document::take_ownership_of_buffer().

Referenced by server::process_data_game(), wesnothd::game::process_turn(), and server::process_whisper().

Here is the call graph for this function:

Here is the caller graph for this function:

node::child_map::iterator simple_wml::node::find_in_map ( child_map m,
const string_span attr 
) [static, private]

Definition at line 646 of file simple_wml.cpp.

node::child_map::const_iterator simple_wml::node::find_in_map ( const child_map m,
const string_span attr 
) [static, private]

Definition at line 634 of file simple_wml.cpp.

Referenced by apply_diff(), and remove_child().

Here is the caller graph for this function:

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

Definition at line 658 of file simple_wml.cpp.

References children_.

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

Definition at line 622 of file simple_wml.cpp.

References children_.

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

Here is the caller graph for this function:

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

Definition at line 617 of file simple_wml.cpp.

References get_children().

Here is the call graph for this function:

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

Definition at line 374 of file simple_wml.cpp.

References attr_.

Referenced by server::process_data().

Here is the caller graph for this function:

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

Definition at line 475 of file simple_wml.cpp.

References ordered_children_.

Referenced by add_child_at().

Here is the caller graph for this function:

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

Definition at line 516 of file simple_wml.cpp.

References ordered_children_.

bool simple_wml::node::is_dirty (  )  const [inline]

Definition at line 137 of file simple_wml.hpp.

References simple_wml::string_span::is_null(), and output_cache_.

Referenced by simple_wml::document::output(), and simple_wml::document::output_compressed().

Here is the call graph for this function:

Here is the caller graph for this function:

int simple_wml::node::nattributes_recursive (  )  const

Definition at line 890 of file simple_wml.cpp.

References attr_, and children_.

int simple_wml::node::nchildren (  )  const

Definition at line 877 of file simple_wml.cpp.

References children_.

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

Definition at line 146 of file simple_wml.hpp.

References children_.

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

Here is the caller graph for this function:

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

Definition at line 147 of file simple_wml.hpp.

References children_.

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

Here is the caller graph for this function:

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

Definition at line 361 of file simple_wml.cpp.

References attr_.

void simple_wml::node::output ( char *&  buf,
CACHE_STATUS  status = DO_NOT_MODIFY_CACHE 
)

Definition at line 714 of file simple_wml.cpp.

References attr(), attr_, simple_wml::string_span::begin(), children_, simple_wml::string_span::empty(), ordered_children_, output_cache_, REFRESH_CACHE, shift_buffers(), and simple_wml::string_span::size().

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

Here is the call graph for this function:

Here is the caller graph for this function:

int simple_wml::node::output_size (  )  const

Definition at line 668 of file simple_wml.cpp.

References attr_, check_ordered_children(), children_, simple_wml::string_span::empty(), ordered_children_, output_cache_, and simple_wml::string_span::size().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void simple_wml::node::remove_child ( const char *  name,
size_t  index 
)

Definition at line 573 of file simple_wml.cpp.

Referenced by apply_diff(), server::delete_game(), wesnothd::game::process_turn(), and wesnothd::room_manager::unstore_player_rooms().

Here is the caller graph for this function:

void simple_wml::node::remove_child ( const string_span name,
size_t  index 
)

Definition at line 449 of file simple_wml.cpp.

References children_, find_in_map(), remove_ordered_child(), remove_ordered_child_list(), and set_dirty().

Here is the call graph for this function:

void simple_wml::node::remove_ordered_child ( int  child_map_index,
int  child_list_index 
) [private]

Definition at line 497 of file simple_wml.cpp.

References ordered_children_.

Referenced by remove_child().

Here is the caller graph for this function:

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

Definition at line 526 of file simple_wml.cpp.

References ordered_children_.

Referenced by remove_child().

Here is the caller graph for this function:

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 
)

Definition at line 403 of file simple_wml.cpp.

References doc_, simple_wml::string_span::duplicate(), set_attr(), and simple_wml::document::take_ownership_of_buffer().

Here is the call graph for this function:

node & simple_wml::node::set_attr_int ( const char *  key,
int  value 
)

Definition at line 410 of file simple_wml.cpp.

References set_attr_dup().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void simple_wml::node::set_dirty (  )  [private]

Definition at line 902 of file simple_wml.cpp.

References simple_wml::string_span::is_null(), output_cache_, and parent_.

Referenced by add_child(), add_child_at(), apply_diff(), copy_into(), remove_child(), and set_attr().

Here is the call graph for this function:

Here is the caller graph for this function:

void simple_wml::node::set_doc ( document doc  ) 

Definition at line 866 of file simple_wml.cpp.

References children_, and doc_.

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

Here is the caller graph for this function:

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

Definition at line 694 of file simple_wml.cpp.

References attr_, simple_wml::string_span::begin(), children_, simple_wml::string_span::empty(), output_cache_, and simple_wml::string_span::size().

Referenced by output().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 166 of file simple_wml.hpp.

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

Definition at line 201 of file simple_wml.hpp.

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

Definition at line 171 of file simple_wml.hpp.

Referenced by set_dirty().


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

Generated by doxygen 1.7.1 on Thu May 24 2012 01:25:54 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs