Samchon Framework for CPP
1.0.0
|
A wrapper can contain products. More...
#include <Wrapper.hpp>
Public Member Functions | |
Wrapper () | |
Default Constructor. More... | |
Wrapper (const string &name, int price, int volume, int weight) | |
Construct from argument of a wrapper. More... | |
Wrapper (const Wrapper &wrapper) | |
Copy Constructor. More... | |
auto | tryInsert (shared_ptr< Product > product) -> bool |
Try to insert a product into the wrapper. More... | |
virtual auto | TAG () const -> string override |
A tag name when represented by XML. More... | |
virtual auto | toXML () const -> shared_ptr< XML > override |
Get an XML object represents the Entity. More... | |
virtual auto | toString () const -> string override |
Return a string represent the wrapper. More... | |
![]() | |
virtual auto | CHILD_TAG () const -> string override |
A tag name of children. More... | |
![]() | |
EntityGroup () | |
Default Constructor. More... | |
virtual void | construct (std::shared_ptr< library::XML > xml) |
Construct data of the Entity from an XML object. More... | |
auto | has (const std::string &key) const -> bool |
Indicates whether a container has an object having the specified identifier. More... | |
auto | get (const std::string &key) -> value_type & |
Access the element by specified identifier(key). More... | |
auto | get (const std::string &key) const -> const value_type & |
Access the const element by specified identifier(key). More... | |
![]() | |
Entity () | |
Default Constructor. More... | |
virtual auto | key () const -> std::string |
Get a key that can identify the Entity uniquely. More... | |
![]() | |
IEntityGroup () | |
Default Constructor. More... | |
![]() | |
Instance () | |
Default Constructor. More... | |
Instance (const string &name, int price, int volume, int weight) | |
Construct from instance. More... | |
auto | getName () const -> string |
Get name. More... | |
auto | getPrice () const -> int |
Get price. More... | |
auto | getVolume () const -> int |
Get volume. More... | |
auto | getWeight () const -> int |
Get weight. More... | |
Additional Inherited Members | |
![]() | |
virtual auto | createChild (std::shared_ptr< library::XML >) -> entity_type *=0 |
Factory method of a child Entity. More... | |
![]() | |
string | name |
Name represent the Instance. More... | |
int | price |
Price of an instance -> 1,000 won. More... | |
int | volume |
Volume of an instance -> 130 cm^3. More... | |
int | weight |
Weight of an instance -> 1,200 g. More... | |
A wrapper can contain products.
A wrapper containing products with its limitation of weight and volume.
Definition at line 27 of file Wrapper.hpp.
|
inline |
Default Constructor.
Definition at line 41 of file Wrapper.hpp.
|
inline |
Construct from argument of a wrapper.
name | Category name of a wrapper, can be identified |
price | Price of a wrapper |
volume | Limited volume of a wrapper can put in. |
weight | Limited weight of a wrapper can put in. |
Definition at line 55 of file Wrapper.hpp.
|
inline |
Copy Constructor.
Copy constructor of wrapper does not copy children items. Only copies arguments of Instance's.
Definition at line 66 of file Wrapper.hpp.
|
inline |
Try to insert a product into the wrapper.
If the Wrapper has enough volume and limit of weight, inserts the Product into the Wrapper and returns true. If not enough, does not insert and just return false.
product | A product try to insert in. |
Definition at line 91 of file Wrapper.hpp.
Referenced by samchon::example::packer::WrapperArray::optimize().
|
inlineoverridevirtual |
A tag name when represented by XML.
Reimplemented from samchon::example::packer::ProductArray.
Definition at line 115 of file Wrapper.hpp.
|
inlineoverridevirtual |
Get an XML object represents the Entity.
Returns an XML object that can represents the Entity containing member variables into properties.
A member variable (not object, but atomic value like number, string or date) is categorized as a property within the framework of entity side. Thus, when overriding a toXML() method and archiving member variables to an XML object to return, puts each variable to be a property belongs to only an XML object.
Don't archive the member variable of atomic value to XML::value causing enormouse creation of XML objects to number of member variables. An Entity must be represented by only an XML instance (tag).
Standard Usage | Non-standard usage abusing value |
---|---|
<memberList> <member id='jhnam88' name='Jeongho+Nam' birthdate='1988-03-11' /> <member id='master' name='Administartor' birthdate='2011-07-28' /> </memberList> | <member> <id>jhnam88</id> <name>Jeongho+Nam</name> <birthdate>1988-03-11</birthdate> </member> |
Reimplemented from samchon::example::packer::Instance.
Definition at line 120 of file Wrapper.hpp.
References samchon::example::packer::Instance::toXML().
|
inlineoverridevirtual |
Return a string represent the wrapper.
Returns a string of the Wrapper and Product(s) packaged in.
Reimplemented from samchon::example::packer::Instance.
Definition at line 134 of file Wrapper.hpp.
References samchon::example::packer::Instance::toString().