1 /*
2  * String8.cpp
3  *
4  * Copyright (C) 2009-2012  Belledonne Communications, Grenoble, France
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  */
20 
21 #include "String8.h"
22 
23 namespace fake_android{
24 
String8Impl(Library * lib)25 String8Impl::String8Impl(Library *lib) :
26 	mCtor(lib,"_ZN7android7String8C1EPKc"),
27 	mDtor(lib,"_ZN7android7String8D1Ev"),
28 	mInitialize(lib,"_ZN7android18initialize_string8Ev"){
29 }
30 
init(Library * lib)31 bool String8Impl::init(Library *lib){
32 	String8Impl *impl=new String8Impl(lib);
33 	if (!impl->mCtor.isFound()) goto end;
34 	if (!impl->mDtor.isFound()) goto end;
35 	if (!impl->mInitialize.isFound()) goto end;
36 
37 	impl->mInitialize.invoke();
38 	sImpl=impl;
39 	return true;
40 
41 	end:
42 	delete impl;
43 	return false;
44 }
45 
46 String8Impl * String8Impl::sImpl=0;
47 
String8(const char * cstr)48 String8::String8(const char* cstr){
49 	mImpl=String8Impl::get();
50 	mImpl->mCtor.invoke(mThis,cstr);
51 }
52 
~String8()53 String8::~String8(){
54 	mImpl->mDtor.invoke(mThis);
55 }
56 
57 
58 }//end of namespace
59 
60