blob: fa38459c389a6d592e719b59464ee7c4ea344ca3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/*
* Copyright (C) 2007-2010 Xagasoft, All rights reserved.
*
* This file is part of the libbu++ library and is released under the
* terms of the license contained in the file LICENSE.
*/
#include "bu/string.h"
#include "bu/atom.h"
#include "bu/sptr.h"
class Person
{
public:
Person(){};
virtual ~Person(){};
Bu::Atom<Bu::String> sFirstName;
Bu::Atom<Bu::String> sLastName;
};
typedef Bu::SPtr<Person> PersonPtr;
void Swap(PersonPtr one, PersonPtr two)
{
PersonPtr three(new Person);
three->sFirstName = one->sFirstName;
three->sLastName = two->sLastName;
printf(
"%s %s\n",
three->sFirstName->getStr(),
three->sLastName->getStr() );
}
int main()
{
/* PersonPtr one(new Person);
PersonPtr two(new Person);
one->sFirstName = "Bob";
one->sLastName = "Smith";
two->sFirstName = "Fred";
two->sLastName = "Carpenter";
Swap(one, two);
*/
Bu::Atom<Bu::String> sOne, sTwo;
sOne = "Hello";
sTwo = sOne;
return 0;
}
|