Poco::FastInfoset

class DocumentVocabulary

File Information

Library: FastInfoset
Package: FastInfoset
Header: Poco/FastInfoset/DocumentVocabulary.h

Description

DocumentVocabulary groups together all vocabularies used when de-/encoding a FISDocument.

DocumentVocabulary can use different internal table implementations, e.g. a hash table, a map or a simple vector. If the vocabulary is used for parsing only, the simple vector-based implementation is the best choice, as it will deliver the fastest parsing speed. However, a vector-based vocabulary cannot be used for generating FastInfoset data with the FastInfosetWriter.

A hash table based vocabulary is the best choice for use with the FastInfosetWriter. Its only limitations are the sizes of the internal hash tables. which might be too small for some very huge documents.

A map based vocabulary does not has the size limitations of a hash table based vocabulary, but is slightly slower.

Member Summary

Member Functions: attributeVocabulary, decodings, elementVocabulary, encodings, exists, getURI, impl, index, init, initialize, operator -, operator =, reset, restrictedAlphabets, setURI, value, vocabularies, vocabulary

Types

VocabularyVector

typedef std::vector < XMLStringVocabulary * > VocabularyVector;

XMLStringVocabulary

typedef Vocabulary < std::string > XMLStringVocabulary;

Enumerations

CharacterStringEncoding

UTF8 = 0

UTF16 = 1

RESTRICTEDALPHABET = 2

ENCODINGALGORITHM = 3

ID

RESTRICTED_ALPHABET = 0

ENCODING_ALGORITHM = 1

PREFIX = 2

NAMESPACE_NAME = 3

LOCAL_NAME = 4

OTHER_NCNAME = 5

OTHER_URI = 6

ATTRIBUTE_VALUE = 7

OTHER_STRING = 8

CHARACTER_CONTENT_CHUNK = 9

ELEMENT_NAME = 10

ATTRIBUTE_NAME = 11

INVALID = 0xffffffff

VocabularyImpl

Implementation of vocabulary.

VOC_HASH

using hash table — fast, but limited size

VOC_MAP

using map — a bit slower than hash, but no size limit

VOC_VECTOR

using vector — fastest, but can only be used for parsing

Constructors

DocumentVocabulary

explicit DocumentVocabulary(
    VocabularyImpl impl = VOC_HASH
);

Creates the DocumentVocabulary, using the given implementation.

DocumentVocabulary

DocumentVocabulary(
    const DocumentVocabulary & other
);

Creates a DocumentVocabulary by copying another one.

DocumentVocabulary

DocumentVocabulary(
    const std::string & uri,
    VocabularyImpl impl = VOC_HASH
);

Creates the DocumentVocabulary, using the given URI and vocabulary implementation.

Destructor

~DocumentVocabulary

~DocumentVocabulary();

Destroys the DocumentVocabulary.

Member Functions

attributeVocabulary inline

QualifiedNameVocabulary & attributeVocabulary();

Returns the vocabulary used for QualifiedNames of attributes.

attributeVocabulary

const QualifiedNameVocabulary & attributeVocabulary() const;

Returns the vocabulary used for QualifiedNames of attributes.

decodings inline

DecodingAlgorithm & decodings();

Returns the decodings which are available per default.

elementVocabulary inline

QualifiedNameVocabulary & elementVocabulary();

Returns the vocabulary used for QualifiedNames of elements.

elementVocabulary

const QualifiedNameVocabulary & elementVocabulary() const;

Returns the vocabulary used for QualifiedNames of elements.

encodings inline

EncodingAlgorithm & encodings();

Returns the encodings which are available per default.

exists inline

Poco::UInt32 exists(
    ID vocabulary,
    const std::string & value,
    bool & valueExists
) const;

Returns the index for the given vocabulary and value if it exists. otherwise an invalid value is returned and valueExists is set to false.

getURI inline

const std::string & getURI() const;

Returns the vocabulary's URI.

impl inline

VocabularyImpl impl() const;

index inline

Poco::UInt32 index(
    ID vocabulary,
    const std::string & value,
    bool & valueExisted
);

Returns the index for the given vocabulary and value. Automatically appends the value and assigns it a new index if the value does not exist yet.

init

void init();

Sets the minimum required entries.

initialize

void initialize(
    ID vocabulary,
    XMLStringVocabulary * pVoc
);

Initializes a vocabulary with the given one. Existing cached data will be cleared! Class takes ownership of the pointer.

operator -

DocumentVocabulary operator - (
    const DocumentVocabulary & doc
);

Subtracts from this object doc. the doc vocabulary must contain for each vocabulary less elements than this vocabulary. The returned Vocabulary will only contain the difference, url will be always empty note that the - operator ignores encodingalgos currently!

operator =

DocumentVocabulary & operator = (
    const DocumentVocabulary & voc
);

Assignement operator.

reset

void reset();

Resets the vocabulary for a new parsing run.

restrictedAlphabets inline

DocumentRestrictedAlphabet & restrictedAlphabets();

Returns the restricted alphabets, per default only the builtin ones are enabled.

restrictedAlphabets

const DocumentRestrictedAlphabet & restrictedAlphabets() const;

Returns the restricted alphabets, per default only the builtin ones are enabled.

setURI inline

void setURI(
    const std::string & uri
);

Sets the vocabulary's URI (for external vocabularies).

value inline

const std::string & value(
    ID vocabulary,
    Poco::UInt32 idx
) const;

Returns the value for the given vocabulary and index. Throws an exception if vocabulary or idx are out of range.

vocabularies inline

const VocabularyVector & vocabularies() const;

vocabulary inline

XMLStringVocabulary & vocabulary(
    ID voc
);

vocabulary

const XMLStringVocabulary & vocabulary(
    ID voc
) const;

Securely control IoT edge devices from anywhere   Connect a Device