aboutsummaryrefslogtreecommitdiff
path: root/src/tests/fstratsptr.cpp
blob: d761c4e85b348ffa50ee8491573c26bfd463bbdb (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-2008 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/fstring.h"
#include "bu/atom.h"
#include "bu/sptr.h"

class Person
{
public:
	Person(){};
	virtual ~Person(){};

	Bu::Atom<Bu::FString> sFirstName;
	Bu::Atom<Bu::FString> 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::FString> sOne, sTwo;
	sOne = "Hello";
	sTwo = sOne;

	return 0;
}