clan::XMLResourceDocument Class Reference - ClanLib SDK
Description: clan::XMLResourceDocument Class Reference

Public Member Functions | Friends | List of all members
clan::XMLResourceDocument Class Reference
clanXML Resources

XML Resource Document. More...

`#include <xml_resource_document.h>`

## Public Member Functions
| XMLResourceDocument ()
| Construct a XMLResourceDocument.
| XMLResourceDocument (const std::string &filename)
| Constructs a XMLResourceDocument.
| XMLResourceDocument (const std::string &filename, FileSystem fs)
| Constructs a XMLResourceDocument.
| XMLResourceDocument (const XMLResourceDocument &other)
| Constructs a XMLResourceDocument.
| XMLResourceDocument (IODevice file, const std::string &base_path, FileSystem fs)
| Constructs a XMLResourceDocument.
| ~XMLResourceDocument ()
void | add_resources (const XMLResourceDocument &additional_resources)
| Add resources from an other resource document.
XMLResourceNode | create_resource (const std::string &resource_id, const std::string &type)
| Construct a new resource object.
void | destroy_resource (const std::string &resource_id)
| Destroy resource object.
bool | get_boolean_resource (const std::string &resource_id, bool default_value) const
| Returns the value of a boolean resource. (using the value attribute)
int | get_integer_resource (const std::string &resource_id, int default_value) const
| Returns the value of an integer resource. (using the value attribute)
XMLResourceNode | get_resource (const std::string &resource_id) const
| Returns Resource representing the given resource.
std::vector< std::string > | get_resource_names () const
| Returns a list of all resources available.
std::vector< std::string > | get_resource_names (const std::string &section) const
std::vector< std::string > | get_resource_names_of_type (const std::string &type) const
| Returns a list of all resources available matching a given type.
std::vector< std::string > | get_resource_names_of_type (const std::string &type, const std::string &section) const
std::vector< std::string > | get_section_names () const
| Returns all the resource sections available.
std::string | get_string_resource (const std::string &resource_id, const std::string &default_value) const
| Returns the value of an string resource. (using the value attribute)
void | load (const std::string &filename)
| Load resource XML tree from file.
void | load (const std::string &filename, const FileSystem &file_system)
| Load.
void | load (IODevice file, const std::string &base_path=std::string(), const FileSystem &file_system=FileSystem())
| Load.
XMLResourceDocument & | operator= (const XMLResourceDocument &copy)
bool | operator== (const XMLResourceDocument &that) const
void | remove_resources (const XMLResourceDocument &additional_resources)
| Remove resources from an other resource document.
bool | resource_exists (const std::string &resource_id) const
| Returns true if a resource exists.
void | save (const std::string &filename)
| Save resource XML tree to file.
void | save (const std::string &filename, const FileSystem &file_system)
| Save.
void | save (IODevice file)
| Save.

## Friends
class | XMLResourceDocument_Impl
class | XMLResourceNode

## Detailed Description

XML Resource Document.

## Constructor & Destructor Documentation

## ◆ XMLResourceDocument() [1/5]

clan::XMLResourceDocument::XMLResourceDocument | ( |  | ) |

Construct a XMLResourceDocument.

Referenced by XMLResourceDocument(), add_resources(), operator=(), operator==(), and remove_resources().

## ◆ XMLResourceDocument() [2/5]

clan::XMLResourceDocument::XMLResourceDocument | ( | const std::string & | filename | ) |

Constructs a XMLResourceDocument.

Parameters

  filename | = String

## ◆ XMLResourceDocument() [3/5]

clan::XMLResourceDocument::XMLResourceDocument | ( | const std::string & | filename,
|  | FileSystem | fs )

Constructs a XMLResourceDocument.

Parameters

  filename | = String
  directory | = Virtual Directory

## ◆ XMLResourceDocument() [4/5]

clan::XMLResourceDocument::XMLResourceDocument | ( | IODevice | file,
|  | const std::string & | base_path,
|  | FileSystem | fs )

Constructs a XMLResourceDocument.

Parameters

  file | = IODevice
  directory | = Virtual Directory

## ◆ XMLResourceDocument() [5/5]

clan::XMLResourceDocument::XMLResourceDocument | ( | const XMLResourceDocument & | other | ) |

Constructs a XMLResourceDocument.

Parameters

  other | = XMLResourceDocument

References XMLResourceDocument().

## ◆ ~XMLResourceDocument()

clan::XMLResourceDocument::~XMLResourceDocument | ( |  | ) |

## Member Function Documentation

## ◆ add_resources()

void clan::XMLResourceDocument::add_resources | ( | const XMLResourceDocument & | additional_resources | ) |

Add resources from an other resource document.

This function only makes the resource document search other documents, it does not copy the resources into this document.

References XMLResourceDocument().

## ◆ create_resource()

XMLResourceNode clan::XMLResourceDocument::create_resource | ( | const std::string & | resource_id,
|  | const std::string & | type )

Construct a new resource object.

References XMLResourceNode.

## ◆ destroy_resource()

void clan::XMLResourceDocument::destroy_resource | ( | const std::string & | resource_id | ) |

Destroy resource object.

## ◆ get_boolean_resource()

bool clan::XMLResourceDocument::get_boolean_resource | ( | const std::string & | resource_id,
|  | bool | default_value ) const

Returns the value of a boolean resource. (using the value attribute)

## ◆ get_integer_resource()

int clan::XMLResourceDocument::get_integer_resource | ( | const std::string & | resource_id,
|  | int | default_value ) const

Returns the value of an integer resource. (using the value attribute)

## ◆ get_resource()

XMLResourceNode clan::XMLResourceDocument::get_resource | ( | const std::string & | resource_id | ) | const

Returns Resource representing the given resource.

References XMLResourceNode.

## ◆ get_resource_names() [1/2]

std::vector< std::string > clan::XMLResourceDocument::get_resource_names | ( |  | ) | const

Returns a list of all resources available.

The returned resources are in the form "section/subsection/.../resourcename".

## ◆ get_resource_names() [2/2]

std::vector< std::string > clan::XMLResourceDocument::get_resource_names | ( | const std::string & | section | ) | const

## ◆ get_resource_names_of_type() [1/2]

std::vector< std::string > clan::XMLResourceDocument::get_resource_names_of_type | ( | const std::string & | type | ) | const

Returns a list of all resources available matching a given type.

The returned resources are in the form "section/subsection/.../resourcename".

## ◆ get_resource_names_of_type() [2/2]

std::vector< std::string > clan::XMLResourceDocument::get_resource_names_of_type | ( | const std::string & | type,
|  | const std::string & | section ) const

## ◆ get_section_names()

std::vector< std::string > clan::XMLResourceDocument::get_section_names | ( |  | ) | const

Returns all the resource sections available.

## ◆ get_string_resource()

std::string clan::XMLResourceDocument::get_string_resource | ( | const std::string & | resource_id,
|  | const std::string & | default_value ) const

Returns the value of an string resource. (using the value attribute)

## ◆ load() [1/3]

void clan::XMLResourceDocument::load | ( | const std::string & | filename | ) |

Load resource XML tree from file.

## ◆ load() [2/3]

void clan::XMLResourceDocument::load | ( | const std::string & | filename,
|  | const FileSystem & | file_system )

Load.

Parameters

  filename | = the filename to save
  directory | = Virtual Directory

## ◆ load() [3/3]

void clan::XMLResourceDocument::load | ( | IODevice | file,
|  | const std::string & | base_path = std::string(),
|  | const FileSystem & | file_system = FileSystem() )

Load.

Parameters

  file | = the file to load
  directory | = Virtual Directory

## ◆ operator=()

XMLResourceDocument & clan::XMLResourceDocument::operator= | ( | const XMLResourceDocument & | copy | ) |

References XMLResourceDocument().

## ◆ operator==()

bool clan::XMLResourceDocument::operator== | ( | const XMLResourceDocument & | that | ) | const

References XMLResourceDocument().

## ◆ remove_resources()

void clan::XMLResourceDocument::remove_resources | ( | const XMLResourceDocument & | additional_resources | ) |

Remove resources from an other resource document.

References XMLResourceDocument().

## ◆ resource_exists()

bool clan::XMLResourceDocument::resource_exists | ( | const std::string & | resource_id | ) | const

Returns true if a resource exists.

## ◆ save() [1/3]

void clan::XMLResourceDocument::save | ( | const std::string & | filename | ) |

Save resource XML tree to file.

## ◆ save() [2/3]

void clan::XMLResourceDocument::save | ( | const std::string & | filename,
|  | const FileSystem & | file_system )

Save.

Parameters

  filename | = the filename to save
  directory | = Virtual Directory

## ◆ save() [3/3]

void clan::XMLResourceDocument::save | ( | IODevice | file | ) |

Save.

Parameters

  file | = IODevice

## Friends And Related Symbol Documentation

## ◆ XMLResourceDocument_Impl

friend class XMLResourceDocument_Impl
| friend

References XMLResourceDocument_Impl.

Referenced by XMLResourceDocument_Impl.

## ◆ XMLResourceNode

friend class XMLResourceNode
| friend

References XMLResourceNode.

Referenced by create_resource(), get_resource(), and XMLResourceNode.

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

- xml_resource_document.h