libcrn
3.9.5
A document image processing library
|
XML Alto file wrapper. More...
#include <CRNAlto.h>
Public Member Functions | |
Alto (const Path &fname, bool char_conversion_throws=true) | |
Constructor from a file. More... | |
Alto (const Path &imagename, const StringUTF8 &ns, const StringUTF8 &encoding="UTF-8", const StringUTF8 &version="1.0", bool char_conversion_throws=true) | |
Constructor from image. More... | |
Alto (const Alto &)=delete | |
Alto (Alto &&)=default | |
virtual | ~Alto () override |
Alto & | operator= (const Alto &)=delete |
Alto & | operator= (Alto &&)=default |
Description & | GetDescription () |
Gets the global description part of the Alto (may be null) More... | |
const Description & | GetDescription () const |
Styles & | GetStyles () |
Gets the styles description part of the Alto (may be null) More... | |
const Styles & | GetStyles () const |
Layout & | GetLayout () |
Gets the layout description part of the Alto. More... | |
const Layout & | GetLayout () const |
Layout::Page & | GetPage (const Id &id) |
const Layout::Page & | GetPage (const Id &id) const |
Layout::Page::Space & | GetSpace (const Id &id) |
const Layout::Page::Space & | GetSpace (const Id &id) const |
Layout::Page::Space::Block & | GetBlock (const Id &id) |
const Layout::Page::Space::Block & | GetBlock (const Id &id) const |
Layout::Page::Space::TextBlock & | GetTextBlock (const Id &id) |
const Layout::Page::Space::TextBlock & | GetTextBlock (const Id &id) const |
Layout::Page::Space::TextBlock::TextLine & | GetTextLine (const Id &id) |
const Layout::Page::Space::TextBlock::TextLine & | GetTextLine (const Id &id) const |
Layout::Page::Space::TextBlock::TextLine::Word & | GetWord (const Id &id) |
const Layout::Page::Space::TextBlock::TextLine::Word & | GetWord (const Id &id) const |
Element & | GetElement (const Id &id) |
const Element & | GetElement (const Id &id) const |
Id | CreateId () |
Creates a new id for the document. More... | |
bool | CheckId (const Id &id) const |
Checks if an id already exists in the document. More... | |
Id | AddId (Element &el) |
Adds an id to an element. More... | |
![]() | |
Document (const StringUTF8 &encoding="UTF-8", const StringUTF8 &version="1.0", bool char_conversion_throws=true) | |
Constructor. More... | |
Document (const Path &fname, bool char_conversion_throws=true) | |
Constructor from file. More... | |
Document (const char *content, bool char_conversion_throws=true) | |
Constructor from buffer. More... | |
Document (const Document &)=delete | |
Document (Document &&) | |
Document & | operator= (const Document &)=delete |
Document & | operator= (Document &&) |
virtual | ~Document () |
Destructor. More... | |
operator bool () const noexcept | |
Checks if the document is open. More... | |
bool | operator! () const noexcept |
Checks if the document is not open. More... | |
void | Save (const Path &fname) |
Saves to file. More... | |
void | Save () |
Saves to file. More... | |
const Path & | GetFilename () const noexcept |
Gets the filename if the document exists on the disk. More... | |
const StringUTF8 & | GetEncoding () const noexcept |
Gets the character encoding of the file. More... | |
const StringUTF8 & | GetVersion () const noexcept |
Gets the XML version of the file. More... | |
Element | GetRoot () |
Gets the first element. More... | |
Node | GetFirstNode () |
Gets the first child node. More... | |
Node | GetLastNode () |
Gets the last child node. More... | |
Node | BeginNode () |
Gets the first child node. More... | |
Node | EndNode () |
Gets a null node. More... | |
Element | GetFirstElement (const StringUTF8 &name="") |
Gets the first child element. More... | |
Element | GetLastElement (const StringUTF8 &name="") |
Gets the last child element. More... | |
Element | BeginElement () |
Gets the first child element. More... | |
Element | EndElement () |
Gets a null node. More... | |
Element | PushBackElement (const StringUTF8 &name) |
Adds an element at the end of the children list. More... | |
Element | InsertElement (Node &n, const StringUTF8 &name) |
Inserts an element after a node. More... | |
Comment | PushBackComment (const StringUTF8 &text) |
Adds a comment at the end of the children list. More... | |
Comment | InsertComment (Node &n, const StringUTF8 &text) |
Inserts a comment after a node. More... | |
Node | PushBackClone (Node &n, bool recursive=false) |
Adds a copy of a node at the end of the children list. More... | |
StringUTF8 | AsString () |
Exports the document to a string. More... | |
Constructor from a file.
Constructor from a file
crn::ExceptionIO | cannot read file |
ExceptionInvalidArgument | null node |
ExceptionNotFound | an mandatory element or attribute was not found |
[in] | fname | the path to the file to read |
[in] | char_conversion_throws | shall an exception be thrown on character conversion error? |
Definition at line 36 of file CRNAlto.cpp.
Alto::Alto | ( | const Path & | imagename, |
const StringUTF8 & | ns, | ||
const StringUTF8 & | encoding = "UTF-8" , |
||
const StringUTF8 & | version = "1.0" , |
||
bool | char_conversion_throws = true |
||
) |
Constructor from image.
Constructor from image
crn::ExceptionInvalidArgument | null filename or namespace |
[in] | imagename | the path the image |
[in] | ns | the namespace |
[in] | charset | the character encoding |
[in] | throw_exceptions | shall an exception be thrown on character conversion error? |
Definition at line 50 of file CRNAlto.cpp.
|
delete |
|
default |
Adds an id to an element.
Adds an Id to an element and registers it
crn::ExceptionInvalidArgument | the element already has an id |
[in] | el | the element to register |
Definition at line 622 of file CRNAlto.cpp.
bool Alto::CheckId | ( | const Id & | id | ) | const |
Checks if an id already exists in the document.
Checks if an id already exists in the document
[in] | id | the id to check |
Definition at line 611 of file CRNAlto.cpp.
Id Alto::CreateId | ( | ) |
Creates a new id for the document.
Creates a new id for the document
Definition at line 591 of file CRNAlto.cpp.
Alto::Layout::Page::Space::Block & Alto::GetBlock | ( | const Id & | id | ) |
Returns a block
ExceptionNotFound | block not found |
[in] | id | the id of the block to get |
Definition at line 145 of file CRNAlto.cpp.
const Alto::Layout::Page::Space::Block & Alto::GetBlock | ( | const Id & | id | ) | const |
Returns a block
ExceptionNotFound | block not found |
[in] | id | the id of the block to get |
Definition at line 171 of file CRNAlto.cpp.
|
inline |
|
inline |
Returns an element
ExceptionNotFound | element not found |
[in] | id | the id of the element to get |
Definition at line 407 of file CRNAlto.cpp.
Returns an element
ExceptionNotFound | element not found |
[in] | id | the id of the element to get |
Definition at line 472 of file CRNAlto.cpp.
|
inline |
Alto::Layout::Page & Alto::GetPage | ( | const Id & | id | ) |
Returns a page
ExceptionNotFound | page not found |
[in] | id | the id of the page to get |
Definition at line 63 of file CRNAlto.cpp.
const Alto::Layout::Page & Alto::GetPage | ( | const Id & | id | ) | const |
Returns a page
ExceptionNotFound | page not found |
[in] | id | the id of the page to get |
Definition at line 81 of file CRNAlto.cpp.
Alto::Layout::Page::Space & Alto::GetSpace | ( | const Id & | id | ) |
Returns a space
ExceptionNotFound | space not found |
[in] | id | the id of the space to get |
Definition at line 99 of file CRNAlto.cpp.
const Alto::Layout::Page::Space & Alto::GetSpace | ( | const Id & | id | ) | const |
Returns a space
ExceptionNotFound | space not found |
[in] | id | the id of the space to get |
Definition at line 122 of file CRNAlto.cpp.
|
inline |
Alto::Layout::Page::Space::TextBlock & Alto::GetTextBlock | ( | const Id & | id | ) |
Returns a textblock
ExceptionNotFound | textblock not found |
[in] | id | the id of the textblock to get |
Definition at line 197 of file CRNAlto.cpp.
const Alto::Layout::Page::Space::TextBlock & Alto::GetTextBlock | ( | const Id & | id | ) | const |
Returns a textblock
ExceptionNotFound | textblock not found |
[in] | id | the id of the textblock to get |
Definition at line 226 of file CRNAlto.cpp.
Alto::Layout::Page::Space::TextBlock::TextLine & Alto::GetTextLine | ( | const Id & | id | ) |
Returns a line
ExceptionNotFound | line not found |
[in] | id | the id of the line to get |
Definition at line 255 of file CRNAlto.cpp.
const Alto::Layout::Page::Space::TextBlock::TextLine & Alto::GetTextLine | ( | const Id & | id | ) | const |
Returns a line
ExceptionNotFound | line not found |
[in] | id | the id of the line to get |
Definition at line 289 of file CRNAlto.cpp.
Alto::Layout::Page::Space::TextBlock::TextLine::Word & Alto::GetWord | ( | const Id & | id | ) |
Returns a word
ExceptionNotFound | word not found |
[in] | id | the id of the word to get |
Definition at line 323 of file CRNAlto.cpp.
const Alto::Layout::Page::Space::TextBlock::TextLine::Word & Alto::GetWord | ( | const Id & | id | ) | const |
Returns a word
ExceptionNotFound | word not found |
[in] | id | the id of the word to get |
Definition at line 365 of file CRNAlto.cpp.