Property map container for use in Picture
.
More...
#include <libnebular.hpp>
Inherited by libnebular::PictureProps.
Classes | |
class | DefaultImpl_ |
class | Impl_ |
class | PropKeyIterator |
C++ iterator, ForwardIterator , iterating through PicturePropContainer key names. More... | |
class | SubtreeProxyImpl_ |
Public Member Functions | |
PropKeyIterator | propKeyBegin () |
Iterator value for first property key. | |
PropKeyIterator | propKeyEnd () |
Iterator value for after-the-last property key. | |
template<typename R > | |
void | set (const String &key, const R &value) |
Main property "set"-ter. | |
template<typename R > | |
const R | get (const String &key) const |
Main property "get"-ter. | |
template<typename R > | |
void | get (const String &key, R &value) const |
Analog of get<R>(const String&) const differing by return of result in argument value . | |
void | unSet (const String &key) |
Main property "unset"-ter. | |
bool | isSet (const String &key) const |
bool | isDefault (const String &key) const |
Whether property have "default" attribute set. | |
PicturePropContainer () | |
virtual | ~PicturePropContainer () |
template<> | |
String | castToPropString (const bool &arg) |
Explicit specialization of castToPropString<Src>(const Src&) for bool . | |
template<> | |
void | set (const String &key, const String &value) |
Explicit specialization of set<R>(const String&, const R&) that's used by general implementation. | |
template<> | |
void | set (const String &key, const Blob &value) |
Explicit specialization of set<R>(const String&, const R&) for Blob . | |
helpers | |
void | move (const String &srcKey, const String &destKey) |
Moves value. | |
void | acceptOpt (const String &acceptedKey) |
If string ("opt/")+key value is set, it to key . | |
bool | isSetAndTrue (const String &key) const |
Whether key is set and can be read as bool value true . | |
template<typename Value > | |
void | swap (const String &keyA, const String &keyB) |
Swaps values even when any, both of properties aren't set. | |
template<typename Value > | |
void | copyFromIfSet (const String &key, const PicturePropContainer &src) |
Copies value for key from PicturePropContainer src here if that's set. | |
void | setDefaultIfNotSet (const String &key, const String &defaultValue) |
Sets key to defaultValue and to be having "default" attribute. | |
Static Public Member Functions | |
template<typename Src > | |
static String | castToPropString (const Src &value) |
Casts value of arbitrary type to String to be used in property map of PicturePropContainer . | |
static String | castToPropString (const char *value) |
Overload of castToPropString<Src>(const Src&) . | |
template<typename Dest > | |
static Dest | castFromPropString (const String &value) |
Casts to arbitrary type from value of String been used in property map of PicturePropContainer . | |
Friends | |
template<class PicturePropContainerBased > | |
boost::shared_ptr < PicturePropContainerBased > | createSubtreeProxy (PicturePropContainer &realSubject, const String &subTreePrefix) |
Allows to work with property subtree given by subTreePrefix as with arbitrary object based on PicturePropContainer . | |
void | setDefault (PicturePropContainer &p, const String &key, const String &value) |
Sets value to property key of PicturePropContainer p as default. |
Property map container for use in Picture
.
All property values will internally be stored in 2 types:
Strings of dynamic length.
BLOBs, for data which can have "\0", thus cannot be stored in std::string
.
Now only bitmap data needs to be stored in Blob
.
libnebular::String
data (i.e. not for libnebular::Blob
).createSubtreeProxy()
.PictureHandler
.PicturePropContainer
and PictureProps
? No, because their interface is a part of Picture
interface, so i should reveal it.CopyConstructible
and Assignable
to ease Picture
manipulations in containers? So, PicturePropContainer
is too heavy to be deep-copied when treated as value class; shallow copy could be an application, but such technique can be achieved by boost::shared_ptr
. So, give up CopyConstructible
. And deep copy can be called through PictureProps::reproduce
. Then, let's strike out Assignable
."[a-z]\|[1-9]\|0\|-\|/"
with "/"
and some other sequences having predefined meaningBlob
to String
, there's lossy one-way conversion and resulting value is value of "some" hash function (boost::hash_range()
) applied to Blob
data. This is for property listing purposes.PicturePropContainer
template
-d "get"-ters and "set"-ters with built-in conversions are specialized only for these types that they're explicitly instantiated in realization. So, at the time of writing: String
is alrealy specialized for: String
, Integer
, Real
, bool
, HexInteger<Integer>
. String
is alrealy specialized for: String
, Integer
, Real
, bool
, int16_t
, int32_t
, uint16_t
, uint32_t
.castToPropString
, castFromPropString
by theirself? Hmm, but there is dependency on templated implementation details (such as boost::lexical_cast
). Anyway, that's done in libnebular-extra.templates.hpp
By default, "set"-ters that only set value and not "default" attribute also have effect of resetting "default attribute to its unset state.
Definition at line 379 of file libnebular.hpp.
libnebular::PicturePropContainer::PicturePropContainer | ( | ) |
Definition at line 499 of file picture-prop-container.cpp.
libnebular::PicturePropContainer::~PicturePropContainer | ( | ) | [virtual] |
Definition at line 503 of file picture-prop-container.cpp.
void libnebular::PicturePropContainer::acceptOpt | ( | const String & | acceptedKey | ) |
If string
("opt/")+key value is set,
it to move()
-skey
.
Definition at line 487 of file picture-prop-container.cpp.
template uint32_t libnebular::PicturePropContainer::castFromPropString | ( | const String & | value | ) | [inline, static] |
Casts to arbitrary type from value
of String
been used in property map of PicturePropContainer
.
Patch for documentation generator malfunction.
Explicitly specialization for bool
.
Definition at line 520 of file picture-prop-container.cpp.
String libnebular::PicturePropContainer::castToPropString | ( | const bool & | arg | ) | [inline] |
Explicit specialization of castToPropString<Src>(const Src&)
for bool
.
Definition at line 512 of file picture-prop-container.cpp.
String libnebular::PicturePropContainer::castToPropString | ( | const char * | value | ) | [static] |
Overload of castToPropString<Src>(const Src&)
.
Definition at line 505 of file picture-prop-container.cpp.
static String libnebular::PicturePropContainer::castToPropString | ( | const Src & | value | ) | [inline, static] |
Casts value
of arbitrary type to String
to be used in property map of PicturePropContainer
.
void libnebular::PicturePropContainer::copyFromIfSet | ( | const String & | key, | |
const PicturePropContainer & | src | |||
) | [inline] |
Copies value for key
from PicturePropContainer
src
here if that's set.
Definition at line 75 of file libnebular.templates.hpp.
void libnebular::PicturePropContainer::get | ( | const String & | key, | |
R & | value | |||
) | const [inline] |
Analog of get<R>(const String&) const
differing by return of result in argument value
.
Definition at line 32 of file libnebular.templates.hpp.
Main property "get"-ter.
With built-in type conversion.
Also specialized for String
(general implementation always uses that); Blob
.
Definition at line 43 of file libnebular.templates.hpp.
bool libnebular::PicturePropContainer::isDefault | ( | const String & | key | ) | const |
Whether property have "default" attribute set.
Definition at line 479 of file picture-prop-container.cpp.
bool libnebular::PicturePropContainer::isSet | ( | const String & | key | ) | const |
Definition at line 476 of file picture-prop-container.cpp.
bool libnebular::PicturePropContainer::isSetAndTrue | ( | const String & | key | ) | const |
Whether key
is set and can be read as bool
value true
.
Definition at line 483 of file picture-prop-container.cpp.
Moves value.
Unsets srcKey
.
Definition at line 464 of file picture-prop-container.cpp.
PicturePropContainer::PropKeyIterator libnebular::PicturePropContainer::propKeyBegin | ( | ) |
Iterator value for first property key.
Definition at line 621 of file picture-prop-container.cpp.
PicturePropContainer::PropKeyIterator libnebular::PicturePropContainer::propKeyEnd | ( | ) |
Iterator value for after-the-last property key.
Definition at line 624 of file picture-prop-container.cpp.
Explicit specialization of set<R>(const String&, const R&)
for Blob
.
Definition at line 543 of file picture-prop-container.cpp.
Explicit specialization of set<R>(const String&, const R&)
that's used by general implementation.
Definition at line 533 of file picture-prop-container.cpp.
void libnebular::PicturePropContainer::set | ( | const String & | key, | |
const R & | value | |||
) | [inline] |
Main property "set"-ter.
With built-in type conversion
Definition at line 37 of file libnebular.templates.hpp.
void libnebular::PicturePropContainer::setDefaultIfNotSet | ( | const String & | key, | |
const String & | defaultValue | |||
) |
Sets key
to defaultValue
and to be having "default" attribute.
Definition at line 493 of file picture-prop-container.cpp.
void libnebular::PicturePropContainer::swap | ( | const String & | keyA, | |
const String & | keyB | |||
) | [inline] |
Swaps values even when any, both of properties aren't set.
Definition at line 50 of file libnebular.templates.hpp.
void libnebular::PicturePropContainer::unSet | ( | const String & | key | ) |
Main property "unset"-ter.
Erases corresponding value and key
from PicturePropContainer
.
Definition at line 460 of file picture-prop-container.cpp.
boost::shared_ptr<PicturePropContainerBased> createSubtreeProxy | ( | PicturePropContainer & | realSubject, | |
const String & | subTreePrefix | |||
) | [friend] |
Allows to work with property subtree given by subTreePrefix
as with arbitrary object based on PicturePropContainer
.
Specialized for PicturePropContainer
, PictureProps
, Picture
.
If extracted subtree "can be seen" as "real" Picture
(as in "bm/palette"), that's recommended to extract it as Picture
or PictureProps
. Otherwise (case when subtree is "arbitrary", doesn't have enough properties that every Picture
"should" have), extract that as PicturePropContainer
.
Definition at line 709 of file picture-prop-container.cpp.
void setDefault | ( | PicturePropContainer & | p, | |
const String & | key, | |||
const String & | value | |||
) | [friend] |
Sets value
to property key
of PicturePropContainer
p
as default.
Not in PicturePropContainer
because public interface of that class is almost entirely should be in User API.
Definition at line 452 of file picture-prop-container.cpp.