ultimatepp/uppdev/CoreTopics/src.tpp/One$en-us.tpp

122 lines
No EOL
5.4 KiB
C++

topic "One";
[2 $$0,0#00000000000000000000000000000000:Default]
[i448;a25;kKO9;*@(64)2 $$1,0#37138531426314131252341829483380:class]
[l288;2 $$2,0#27521748481378242620020725143825:desc]
[a83;*R6 $$3,0#31310162474203024125188417583966:caption]
[l288;i1121;b17;O9;~~~.1408;2 $$4,0#10431211400427159095818037425705:param]
[i448;a25;kKO9;*@(64)2 $$5,0#37138531426314131252341829483370:item]
[*+117 $$6,6#14700283458701402223321329925657:header]
[l288;a17;*1 $$7,7#70004532496200323422659154056402:requirement]
[{_}%EN-US
[s3;%- One&]
[s5;K%- template_<[@(0.0.255) class]_[@4 T]>__[@(0.0.255) class]_[@0 One]_:_[@(0.0.255) private]_
[^`:`:MoveableAndDeepCopyOption^ MoveableAndDeepCopyOption]<_[@0 One]<[@4 T]>_>_&]
[s2; &]
[s0; [%-*C@4 T]-|Type or base class of element stored in One.&]
[s0; One is a container capable of containing none or single element
of type specified as template argument or derived from it.&]
[s0; One is [*/^topic`:`/`/Core`/srcdoc`/Moveable`$en`-us^ moveable][*/
]type with [*/^topic`:`/`/Core`/srcdoc`/pick`_`$en`-us^ pick and
optional deep copy] transfer semantics. Calling methods of picked
One is logic error with exception of&]
[s0; [C+75 void ][*C+75 operator`=][C+75 (pick`_ One`& ][*C@3+75 v][C+75 )]&]
[s0; [C+75 void ][*C+75 operator<<`=][C+75 (const One`& ][*C@3+75 v][C+75 )][+75
][/+75 (defined using DeepCopyOption template base class)]&]
[s0; [C+75 void ][*C+75 Clear][C+75 ()]&]
[s0; [C+75 bool ][*C+75 IsPicked][C+75 () const]&]
[s0; Members&]
[s0;3 &]
[s0;:`:`:One`:`:One`(`):%- [* One]()&]
[s2; Constructor. Constructs empty One.&]
[s0;3 &]
[s0;:`:`:One`:`:One`(T`*`):%- [* One](T_`*[*@3 newt])&]
[s2; Constructs One with content. Content is specified by pointer
to object created using operator new. One takes over ownership
of this this object. &]
[s4; [*C@3 newt]-|Object to be added.&]
[s0;3 &]
[s0;:`:`:One`:`:One`(pick`_`:`:One`<T`>`&`):%- [* One](pick`__[* One]<T>`&_[*@3 p])&]
[s2; Pick constructor. Transfers source One in low constant time,
but destroys it by picking. &]
[s4; [*C@3 p]-|Source One.&]
[s0;3 &]
[s0;:`:`:One`:`:One`(const`:`:One`<T`>`&`,int`):%- [* One](const_[* One]<T>`&_[*@3 p],
int)&]
[s2; Optional deep copy constructor.&]
[s7; Requires T to have deep copy constructor or optional deep copy
constructor.&]
[s4; [*C@3 p]-|Source One.&]
[s0;3 &]
[s0;:`:`:One`:`:`~One`(`):%- `~[* One]()&]
[s2; Destructor.&]
[s0;3 &]
[s5;K:`:`:One`:`:Attach`(T`*`):%- [@(0.0.255) void]_[@0 Attach](T_`*[@3 data])&]
[s2; Assigns element to One. (Note: if there is content in One while
calling this function, it is destroyed).&]
[s4; [%-*C@3 data]-|Pointer to the new element created using operator
new.&]
[s0;3 &]
[s5;K%- T_`*[@0 Detach]()_pick`_&]
[s2; Removes content giving up ownership. Client is responsible for
deletion of content.&]
[s4; [*/ Return value]-|Pointer to the content allocated on the heap.&]
[s0;3 &]
[s5;K%- T_`*[@0 operator`-]()_pick`_&]
[s2; Same as Detach() (operator version).&]
[s4; [*/ Return value]-|Pointer to the content allocated on the heap.&]
[s0;3 &]
[s5;K%- [@(0.0.255) void]_[@0 Clear]()&]
[s2; Removes and destroys content.&]
[s0;3 &]
[s5;K%- [@(0.0.255) void]_[@0 operator`=](T_`*[@3 data])&]
[s2; Same as Attach(data) (operator version).&]
[s4; [%-*C@3 data]-|Pointer to the new element created using operator
new.&]
[s0;3 &]
[s5;K%- [@(0.0.255) void]_[@0 operator`=](pick`__[^`:`:One^ One]<[^T^ T]>`&_[@3 d])&]
[s2; Pick operator. Transfers source One in low constant time, but
destroys it by picking.&]
[s4; [%-*C@3 d]-|Source One.&]
[s0;3 &]
[s5;K%- [@(0.0.255) const]_T_`*[@0 operator`->]()_[@(0.0.255) const]&]
[s2; Constant content access operator. Illegal if there is no content.&]
[s4; [*/ Return value]-|Returns constant pointer to content.&]
[s0;3 &]
[s5;K%- T_`*[@0 operator`->]()&]
[s2; Content access operator. Illegal if there is no content.&]
[s4; [*/ Return value]-|Returns pointer to content.&]
[s0;3 &]
[s5;K%- [@(0.0.255) const]_T_`*[@0 operator`~]()_[@(0.0.255) const]&]
[s2; Constant content pointer access.&]
[s4; [*/ Return value]-|Returns constant pointer to content or NULL
when there is no content.&]
[s0;3 &]
[s5;K%- T_`*[@0 operator`~]()&]
[s2; Content pointer access.&]
[s4; [*/ Return value]-|Returns pointer to content or NULL when there
is no content.&]
[s0;3 &]
[s5;K%- [@(0.0.255) const]_T`&_[@0 operator`*]()_[@(0.0.255) const]&]
[s2; Content constant reference access. Illegal if there is no content.&]
[s4; [*/ Return value]-|Constant reference to content.&]
[s0;3 &]
[s5;K%- T`&_[@0 operator`*]()&]
[s2; Content reference access. Illegal if there is no content.&]
[s4; [*/ Return value]-|Reference to content.&]
[s0; &]
[s0;%- [* template <class ][*@4 TT][* >][*@4 TT]`&_[* Create]()&]
[s2; Creates content in One. (Note: if there is content in One while
calling this function, it is destroyed).&]
[s4; [*C@4 TT]-|Type of content. Must be equal to T or derived from
it.&]
[s4; [*/ Return value]-|Reference to actual content (of type TT).&]
[s0;3 &]
[s5;K%- [@(0.0.255) bool]_[@0 IsPicked]()_[@(0.0.255) const]&]
[s4; [*/ Return value]-|true if One is picked.&]
[s0;3 &]
[s5;K%- [@(0.0.255) bool]_[@0 IsEmpty]()_[@(0.0.255) const]&]
[s4; [*/ Return value]-|true if there is no content.&]
[s0;3 &]
[s5;K%- operator_[@(0.0.255) bool]()_[@(0.0.255) const]&]
[s4; [*/ Return value]-|true if there is content.&]
[s0; ]