#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_span & | operator[] (const char *key) const |
const string_span & | attr (const char *key) const |
bool | has_attr (const char *key) const |
node & | set_attr (const char *key, const char *value) |
node & | set_attr_dup (const char *key, const char *value) |
node & | set_attr_dup (const char *key, const string_span &value) |
node & | set_attr_int (const char *key, int value) |
node & | add_child (const char *name) |
node & | add_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) |
node * | child (const char *name) |
const node * | child (const char *name) const |
const child_list & | children (const char *name) const |
const string_span & | first_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< attribute > | attribute_list |
typedef std::pair< string_span, child_list > | child_pair |
typedef std::vector< child_pair > | child_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 | |
document * | doc_ |
attribute_list | attr_ |
node * | parent_ |
child_map | children_ |
std::vector< node_pos > | ordered_children_ |
string_span | output_cache_ |
Definition at line 113 of file simple_wml.hpp.
typedef std::pair<string_span, string_span> simple_wml::node::attribute |
Definition at line 120 of file simple_wml.hpp.
|
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.
|
private |
Definition at line 194 of file simple_wml.hpp.
|
private |
Definition at line 193 of file simple_wml.hpp.
Enumerator | |
---|---|
REFRESH_CACHE | |
DO_NOT_MODIFY_CACHE |
Definition at line 159 of file simple_wml.hpp.
Definition at line 206 of file simple_wml.cpp.
Referenced by add_child(), add_child_at(), and node().
Definition at line 220 of file simple_wml.cpp.
References attr_, check_ordered_children(), children_, ERR_SWML, error(), get_children(), node(), ordered_children_, and output_cache_.
simple_wml::node::~node | ( | ) |
Definition at line 363 of file simple_wml.cpp.
|
private |
node & simple_wml::node::add_child | ( | const char * | name | ) |
Definition at line 465 of file simple_wml.cpp.
References check_ordered_children(), children_, doc_, get_children(), node(), ordered_children_, and set_dirty().
Referenced by wesnothd::game::add_player(), wesnothd::server::adminmsg_handler(), wesnothd::async_send_error(), wesnothd::async_send_warning(), wesnothd::game::change_controller(), copy_into(), wesnothd::room_manager::fill_member_list(), wesnothd::room_manager::fill_room_list(), wesnothd::game::handle_controller_choice(), wesnothd::server::handle_login(), wesnothd::server::handle_message(), wesnothd::server::handle_player_in_game(), wesnothd::game::handle_random_choice(), wesnothd::server::handle_whisper(), wesnothd::game::load_next_scenario(), wesnothd::make_add_diff(), wesnothd::make_change_diff(), wesnothd::make_delete_diff(), wesnothd::game::notify_new_host(), wesnothd::server::pm_handler(), wesnothd::room_manager::process_room_query(), wesnothd::game::process_turn(), wesnothd::server::read_version(), wesnothd::game::send_observerjoins(), wesnothd::game::send_observerquit(), wesnothd::send_server_message(), wesnothd::room::send_server_message(), wesnothd::game::send_server_message(), wesnothd::game::send_user_list(), wesnothd::game::transfer_side_control(), and wesnothd::room_manager::unstore_player_rooms().
node & simple_wml::node::add_child_at | ( | const char * | name, |
size_t | index | ||
) |
Definition at line 446 of file simple_wml.cpp.
References check_ordered_children(), children_, doc_, get_children(), insert_ordered_child(), node(), and set_dirty().
Referenced by apply_diff().
Definition at line 827 of file simple_wml.cpp.
References add_child_at(), attr_, child(), children(), children_, doc_, simple_wml::string_span::duplicate(), find_in_map(), i, itor, remove_child(), set_attr(), set_dirty(), and simple_wml::document::take_ownership_of_buffer().
Referenced by wesnothd::server::handle_player_in_game().
|
inline |
Definition at line 124 of file simple_wml.hpp.
Referenced by wesnothd::server::handle_join_game(), output(), wesnothd::room_manager::process_message(), wesnothd::room_manager::process_room_join(), wesnothd::room_manager::process_room_part(), and wesnothd::room_manager::process_room_query().
|
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 | ) |
Definition at line 607 of file simple_wml.cpp.
Referenced by apply_diff(), simple_wml::document::child(), wesnothd::get_multiplayer(), wesnothd::game::handle_choice(), wesnothd::server::handle_nickserv(), wesnothd::server::handle_player_in_game(), wesnothd::game::is_legal_command(), wesnothd::room_manager::process_message(), wesnothd::game::process_message(), wesnothd::room_manager::process_room_join(), wesnothd::room_manager::process_room_part(), wesnothd::room_manager::process_room_query(), wesnothd::game::process_turn(), wesnothd::game::start_game(), and wesnothd::game::starting_pos().
const node * simple_wml::node::child | ( | const char * | name | ) | const |
Definition at line 619 of file simple_wml.cpp.
const node::child_list & simple_wml::node::children | ( | const char * | name | ) | const |
Definition at line 634 of file simple_wml.cpp.
Referenced by apply_diff(), simple_wml::document::children(), wesnothd::server::cleanup_game(), wesnothd::server::handle_player_in_game(), wesnothd::make_add_diff(), wesnothd::make_change_diff(), wesnothd::make_delete_diff(), wesnothd::game::process_turn(), and wesnothd::server::remove_player().
Definition at line 806 of file simple_wml.cpp.
References add_child(), attr_, children_, doc_, i, ordered_children_, set_attr(), set_dirty(), and simple_wml::document::take_ownership_of_buffer().
Referenced by wesnothd::server::create_game(), wesnothd::server::handle_message(), wesnothd::server::handle_player_in_game(), wesnothd::server::handle_whisper(), wesnothd::game::load_next_scenario(), wesnothd::make_add_diff(), wesnothd::make_change_diff(), and wesnothd::game::process_turn().
|
staticprivate |
Definition at line 663 of file simple_wml.cpp.
References i.
Referenced by apply_diff(), and remove_child().
|
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_.
|
private |
Definition at line 651 of file simple_wml.cpp.
Referenced by add_child(), add_child_at(), get_children(), and node().
|
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().
Definition at line 504 of file simple_wml.cpp.
References i, and ordered_children_.
Referenced by add_child_at().
Definition at line 545 of file simple_wml.cpp.
References i, and ordered_children_.
|
inline |
Definition at line 157 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().
int simple_wml::node::nattributes_recursive | ( | ) | const |
Definition at line 919 of file simple_wml.cpp.
int simple_wml::node::nchildren | ( | ) | const |
Definition at line 906 of file simple_wml.cpp.
|
inline |
Definition at line 166 of file simple_wml.hpp.
References children_.
Referenced by wesnothd::game::process_turn().
|
inline |
Definition at line 167 of file simple_wml.hpp.
References children_.
Referenced by wesnothd::game::is_legal_command().
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 |
||
) |
Definition at line 743 of file simple_wml.cpp.
References attr(), attr_, simple_wml::string_span::begin(), children_, simple_wml::string_span::empty(), i, ordered_children_, output_cache_, REFRESH_CACHE, shift_buffers(), and simple_wml::string_span::size().
Referenced by simple_wml::node_to_string(), and simple_wml::document::output().
int simple_wml::node::output_size | ( | ) | const |
Definition at line 697 of file simple_wml.cpp.
References attr_, check_ordered_children(), children_, simple_wml::string_span::empty(), i, ordered_children_, output_cache_, and simple_wml::string_span::size().
Referenced by simple_wml::node_to_string(), and simple_wml::document::output().
void simple_wml::node::remove_child | ( | const char * | name, |
size_t | index | ||
) |
Definition at line 602 of file simple_wml.cpp.
Referenced by apply_diff(), wesnothd::server::cleanup_game(), wesnothd::game::process_turn(), wesnothd::server::remove_player(), and wesnothd::room_manager::unstore_player_rooms().
void simple_wml::node::remove_child | ( | const string_span & | name, |
size_t | index | ||
) |
Definition at line 478 of file simple_wml.cpp.
References children_, find_in_map(), itor, remove_ordered_child(), remove_ordered_child_list(), and set_dirty().
Definition at line 526 of file simple_wml.cpp.
References i, and ordered_children_.
Referenced by remove_child().
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 | ||
) |
Definition at line 411 of file simple_wml.cpp.
References attr_, and set_dirty().
Referenced by apply_diff(), wesnothd::async_send_error(), wesnothd::async_send_warning(), wesnothd::game::change_controller(), copy_into(), wesnothd::game::handle_controller_choice(), wesnothd::server::handle_player_in_game(), wesnothd::game::handle_random_choice(), wesnothd::game::load_next_scenario(), wesnothd::player::player(), wesnothd::room_manager::process_room_query(), wesnothd::server::read_version(), wesnothd::game::remove_player(), wesnothd::game::send_observerquit(), wesnothd::server::send_password_request(), wesnothd::send_server_message(), wesnothd::room::send_server_message(), wesnothd::game::send_server_message(), wesnothd::game::send_user_list(), simple_wml::document::set_attr(), set_attr_dup(), wesnothd::game::set_description(), and wesnothd::game::update_game().
node & simple_wml::node::set_attr_dup | ( | const char * | key, |
const char * | value | ||
) |
Definition at line 427 of file simple_wml.cpp.
References doc_, simple_wml::document::dup_string(), and set_attr().
Referenced by wesnothd::game::add_player(), wesnothd::server::adminmsg_handler(), wesnothd::async_send_error(), wesnothd::async_send_warning(), wesnothd::game::describe_slots(), wesnothd::game::end_turn(), wesnothd::room_manager::fill_member_list(), wesnothd::room_manager::fill_room_list(), wesnothd::server::handle_player_in_game(), wesnothd::game::handle_random_choice(), wesnothd::player::player(), wesnothd::server::pm_handler(), wesnothd::game::process_change_turns_wml(), wesnothd::room_manager::process_message(), wesnothd::game::process_message(), wesnothd::room_manager::process_room_join(), wesnothd::room_manager::process_room_part(), wesnothd::room_manager::process_room_query(), wesnothd::game::process_turn(), wesnothd::server::read_version(), wesnothd::game::send_observerjoins(), wesnothd::server::send_password_request(), wesnothd::send_server_message(), wesnothd::room::send_server_message(), wesnothd::game::send_server_message(), wesnothd::game::send_taken_side(), simple_wml::document::set_attr_dup(), set_attr_int(), wesnothd::game::take_side(), wesnothd::game::transfer_side_control(), wesnothd::chat_message::truncate_message(), and wesnothd::room_manager::unstore_player_rooms().
node & simple_wml::node::set_attr_dup | ( | const char * | key, |
const string_span & | value | ||
) |
Definition at line 432 of file simple_wml.cpp.
References doc_, simple_wml::string_span::duplicate(), set_attr(), and simple_wml::document::take_ownership_of_buffer().
Definition at line 439 of file simple_wml.cpp.
References set_attr_dup().
Referenced by wesnothd::make_add_diff(), wesnothd::make_change_diff(), and wesnothd::make_delete_diff().
|
private |
Definition at line 931 of file simple_wml.cpp.
References simple_wml::string_span::is_null(), and output_cache_.
Referenced by add_child(), add_child_at(), apply_diff(), copy_into(), remove_child(), and set_attr().
Definition at line 895 of file simple_wml.cpp.
References children_, doc_, and i.
Referenced by simple_wml::document::swap().
|
private |
Definition at line 723 of file simple_wml.cpp.
References attr_, simple_wml::string_span::begin(), children_, simple_wml::string_span::empty(), i, output_cache_, and simple_wml::string_span::size().
Referenced by output().
|
private |
Definition at line 189 of file simple_wml.hpp.
Referenced by apply_diff(), copy_into(), has_attr(), nattributes_recursive(), node(), operator[](), output(), output_size(), set_attr(), and shift_buffers().
|
private |
Definition at line 198 of file simple_wml.hpp.
Referenced by add_child(), add_child_at(), apply_diff(), check_ordered_children(), child(), children(), copy_into(), first_child(), get_children(), nattributes_recursive(), nchildren(), no_children(), node(), one_child(), output(), output_size(), remove_child(), set_doc(), shift_buffers(), and ~node().
|
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().
|
private |
Definition at line 212 of file simple_wml.hpp.
Referenced by add_child(), check_ordered_children(), copy_into(), insert_ordered_child(), insert_ordered_child_list(), node(), output(), output_size(), remove_ordered_child(), and remove_ordered_child_list().
|
private |
Definition at line 221 of file simple_wml.hpp.
Referenced by is_dirty(), node(), output(), output_size(), set_dirty(), and shift_buffers().
|
private |
Definition at line 191 of file simple_wml.hpp.