PageRenderTime 41ms CodeModel.GetById 18ms app.highlight 18ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llmessage/tests/llcurl_stub.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 95 lines | 58 code | 12 blank | 25 comment | 4 complexity | 3e8ba1b7f69394e7b29c280542b712ea MD5 | raw file
 1/**
 2 * @file llcurl_stub.cpp
 3 * @brief stub class to allow unit testing
 4 *
 5 * $LicenseInfo:firstyear=2008&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, Linden Research, Inc.
 8 * 
 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2.1 of the License only.
13 * 
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 * 
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * 
23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
24 * $/LicenseInfo$
25 */
26
27#include "linden_common.h"
28#include "llcurl.h"
29
30LLCurl::Responder::Responder()
31	: mReferenceCount(0)
32{
33}
34
35void LLCurl::Responder::completed(U32 status, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const &reason,
36								  LLSD const& mContent)
37{
38	if (isGoodStatus(status))
39	{
40		result(mContent);
41	}
42	else
43	{
44		errorWithContent(status, reason, mContent);
45	}
46}
47
48void LLCurl::Responder::completedHeader(unsigned,
49										std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&,
50										LLSD const&)
51{
52}
53
54void LLCurl::Responder::completedRaw(unsigned,
55									 std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&,
56									 LLChannelDescriptors const&,
57									 boost::shared_ptr<LLBufferArray> const&)
58{
59}
60
61void LLCurl::Responder::errorWithContent(unsigned,
62							  std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&,
63							  LLSD const&)
64{
65}
66
67LLCurl::Responder::~Responder ()
68{
69}
70
71void LLCurl::Responder::error(unsigned,
72							  std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
73{
74}
75
76void LLCurl::Responder::result(LLSD const&)
77{
78}
79
80namespace boost
81{
82	void intrusive_ptr_add_ref(LLCurl::Responder* p)
83	{
84		++p->mReferenceCount;
85	}
86
87	void intrusive_ptr_release(LLCurl::Responder* p)
88	{
89		if(p && 0 == --p->mReferenceCount)
90		{
91			delete p;
92		}
93	}
94};
95